lua.a file compile error

Discussion to talk about software related topics only.
Post Reply
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

lua.a file compile error

Post by nicobari »

Hi,
I have the following code for IRQ

Code: Select all

#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <networkdebug.h>
#include <pins.h>
#include <pin_irq.h>
#include <smarttrap.h>


extern "C"
{
   void UserMain( void *pd );
}

void EdgeportISR()
{
	J2[15]=J2[15]^J2[15];
}

void UserMain( void* pd )
{
	/////Usual Routine
	InitializeStack();
	OSChangePrio( MAIN_PRIO );
    EnableAutoUpdate();
	//EnableTaskMonitor();
	EnableSmartTraps();

	J2[15].function(0);
	int i=J2[15];
	J2[15]=0;

	 SetPinIrq( 47, -1, &EdgeportISR);
	 while(1)
	 {

	 }
}
and when I am trying to compile I am getting the following error
**** Build of configuration Release for project readppm ****

**** Internal Builder is used for build ****
m68k-elf-g++ -O2 -falign-functions=4 -IC:\nburn/include -IC:\nburn/MOD5441X/include -IC:\nburn/gcc-m68k/m68k-elf/include -IC:\Users\AvionicsIRL\Desktop\Electronics\MOD54415\NetburnerCodes\readppm -gdwarf-2 -Wall -Wno-write-strings -c -fmessage-length=0 -fno-rtti -fno-exceptions -mcpu=5206e -DMOD5441X -DMCF5441X -o readppm.o ..\readppm.cpp
..\readppm.cpp: In function 'void UserMain(void*)':
..\readppm.cpp:49: warning: unused variable 'i'
m68k-elf-g++ readppm.o -Wl,-Map=readppm.map -mcpu=5206e -Wl -Wl,-n -TC:\nburn/MOD5441X/lib/MOD5441X.ld -Wl,-RC:\nburn/MOD5441X/lib/sys.ld -Wl,--start-group,C:\nburn/lib/MOD5441X.a C:\nburn/lib/NetBurner.a C:\nburn/lib/FatFile.a C:\nburn\lib\debugLibrary.a C:\nburn\lib\lua.a -Wl,--end-group -oreadppm.elf
m68k-elf-g++: C:\nburn\lib\lua.a: No such file or directory
Build error occurred, build is stopped
Time consumed: 395 ms.
Where can I find lua.a file? Thank you

Regards,
TM
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: lua.a file compile error

Post by nicobari »

Solved the problem by renaming Lua_full.a to Lua.a . Dont know if I will face any other problem or not.

Regards,
TM
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: lua.a file compile error

Post by nicobari »

Now when I upload the code I am getting following trap error.
-------------------Trap information-----------------------------
Exception Frame/A7 =800023EC
Trap Vector =Spurious interrupt (24)
Format =04
Status register SR =2000
Fault Status =00
Faulted PC =4000063C

-------------------Register information-------------------------
A0=40000000 A1=00000046 A2=000000A2 A3=000000A3
A4=000000A4 A5=000000A5 A6=800023FC A7=800023EC
D0=00000001 D1=00000001 D2=000000D2 D3=000000D3
D4=000000D4 D5=000000D5 D6=000000D6 D7=000000D7
SR=2000 PC=4000063C
-------------------RTOS information-----------------------------
The OSTCBCur current task control block = 80000264
This looks like a valid TCB
The current running task is: Main#32
-------------------Task information-----------------------------
Task | State |Wait| Call Stack
Idle#3F|Ready | |40003264,0
Main#32|Running | |4000063C,40013030,0
TCPD#28|Semaphore |045F|400038FE,4000F132,40013030,0
IP#27|Fifo |0009|40004664,40006478,40013030,0
Enet#26|Fifo |0028|40004664,4001773C,40013030,0

-------------------End of Trap Diagnostics----------------------
Since I have only 1 interrupt routine running I don't see what else could be wrong with the code.

Regards,
TM
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: lua.a file compile error

Post by tod »

According to my docs the 5441x doesn't support SetPinIrq. In fact I don't have the pin_irq.h in my C:\nburn\MOD5441X\include folder. Do you?

While I'm here I thought I might suggest a couple of things that might help you going forward.

1. Add an OSTimeDly(TICKS_PER_SECOND) call to your forever loop. Killer loops like this just make me suspicious. It's probably OK but why wear out the poor CPU? Also I find it helpful while experimenting to increase the time delay to 5* TICKS_PER_SECOND and cout<<'.'; just so I can see the main loop is alive and well (which obviously in this case it is not since you trapped).
2. Comment out the contents of your ISR and see if it runs. If it doesn't then you've narrowed down where to look.
3. If it runs with the ISR commented out, comment back in your ISR and break it into multiple lines. You might want to take a look at Pins.h so you can see what it's actually doing but here's my take on it, your single line
J2[15]=J2[15]^J2[15]; does the following:

1. Invokes the PinIO constructor with parameters (2,15) (let's call it temp1)
2. Invokes the PInIO constructor a second time with (2,15). (let's call it temp2)
3. Then you're counting on the ^ operator to do two implicit casts via the implicit cast operator int() to perform a temp1.read() and a temp2.read()
4. Perform the xor
5. Invoke the operator = overload (the one that takes an int) to call set() and return a reference with the results.
6. Destroy the instances of PinIO that were created.

If anything is not working it's going to be hard to figure out where things went wrong as it's written.

But again for the current problem I think you have to write the interrupt handler code by hand.
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: lua.a file compile error

Post by ecasey »

Using NNDK release tag version:2.6.2, my system has a pin_irq.h in the C:\nburn\MOD5441X\include folder.
Also, I compiled your code and it linked using C:\nburn\lib\Lua_Full.a (it did not try to find Lua.a).

The code works without a trap and gives a square wave of about 216 kHz.

I did check the "Reload selected platform's properties file" box in the NetBurner Options section of the project's Properties.

I put OSTimeDly(5); in the forever loop and the frequency dropped to about 75 kHz.
.
Then I changed the ISR to:

Code: Select all

   i=J2[15];
   J2[15] = i^i;
The frequency goes up to 540 kHz with no OSTimeDly and 180 kHz with the OSTimeDly(5); but it is not a square wave anymore. Duty cycle goes to 30% high.

Not sure what you are trying to do, but it runs on my MOD5441X on the MOD-DEV-70 V 1.7 board.

Ed
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: lua.a file compile error

Post by nicobari »

I was using NNDK 2.6.0 and downloaded NNDK 2.6.2 and installed it without uninstalling NNDK 2.6.0. I am assuming lua.a error might be a result of that. As ecasey pointed out I decided to shift to 2.6.2 to be able to use the interrupt macro for IRQ.

I am also running the code on Mod-Dev-70 Rev 1.7. Currently trying to implement some of the advise and will post the results. Thanks again.

Regards,
TM
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: lua.a file compile error

Post by nicobari »

So now after using

Code: Select all

i=J2[15];
J2[15]=i^i;
also added OSTimeDly(5) in the while loop. This time the code runs a bit long before entering a trap. Trying to go through it again and see if anything else can be changed or not.

Regards,
TM
nicobari
Posts: 110
Joined: Mon Jan 30, 2012 12:15 pm

Re: lua.a file compile error

Post by nicobari »

This is what I achieved from a long night of debugging my external interrupts.To understand what exactly is happening I opened up pin_irq.cpp. According to reference manual for IRQ6 to enable a falling edge trigger on IRQ6 only, EPPAR register should be 0x2000 but in pin_irq.cpp it is configured as 0x8000. Surprisingly the IRQ6 works with 0x8000 (which should infact be for IRQ7) EPPAR register value with lots of trap but doesn't work with 0x2000. However the EPIER register value is configured for IRQ6, this all looks contradicting. So this morning to save myself additional pain I just changed to IRQ2 and to my relief everything is working as it should without any traps even without a delay in while loop. So I would avoid using IRQ6 for my application.

Thanks,
TM
Post Reply