Other Parts Discussed in Thread: HALCOGEN
Hello,
I've developed a functioning Ethernet bootloader, and have had some success loading small, basic applications into memory.
My next goal is to load an application that uses interrupts (specifically a simple UDP app using lwip to blink an LED, which has been tested an runs successfully as a standalone application w/o a bootloader).
After reading through some forums and this CAN bootloader manual I've noticed that if I plan on using interrupts in my application that will be loaded into memory by the bootloader, then I have to change the exception vector table.
My bootloader is run out of Bank1 at 0x180000, with the vector table being at it's default 0x0 position
My UDP application starts at 0x160000 in Bank0, so the bootloader's sys_intvecs.asm is as follows:
.sect ".intvecs" .arm ;------------------------------------------------------------------------------- ; import reference for interrupt routines .ref _c_int00 .ref _dabort ;.ref phantomInterrupt .def resetEntry ;------------------------------------------------------------------------------- ; interrupt vectors resetEntry b _c_int00 ; 0x00 Bootloader b #0x15FFF8 ; 0x04 b #0x15FFF8 ; 0x08, SW interrupt b #0x15FFF8 ; 0x0C, Abort (prefetch) b #0x15FFF8 ; 0x10, Abort (data) reservedEntry b reservedEntry ldr pc,[pc,#-0x1b0] ldr pc,[pc,#-0x1b0]
I believe the addresses are setup correctly, as the PC points two address ahead, so APP_START_ADDR - 0x8 = 0x15FFF8
After doing so, my bootloader does not work, and seems to receive a ESM error upon start up.
HOWEVER, when I leave the exception vector table in it's default state, the bootloader does boot up successfully, and I can load and run the UDP app over Ethernet successfully. This result is what is strange to me: I receive network packets in my newly loaded app, even though I didn't change the exception vector table in the bootloader, and I disable interrupts before I run my UDP app (which tells me the UDP app is successfully enabling interrupts).
Here is the bootloader sys_intvecs.asm file that allows me to run everything successfully:
.sect ".intvecs" .arm ;------------------------------------------------------------------------------- ; import reference for interrupt routines .ref _c_int00 .ref _dabort ;.ref phantomInterrupt .def resetEntry ;------------------------------------------------------------------------------- ; interrupt vectors resetEntry b _c_int00 undefEntry b undefEntry svcEntry b svcEntry prefetchEntry b prefetchEntry b _dabort reservedEntry b reservedEntry ldr pc,[pc,#-0x1b0] ldr pc,[pc,#-0x1b0]
My questions:
1. Am I doing something incorrectly with respect to the exception vector table for the bootloader?
2. More importantly: Why does my loaded UDP app work when the bootloader's 'sys_intvecs.asm' file is left alone? If both apps are using the same interrupts for EMAC, is that why I'm able to receive packets in my UDP even though I didn't setup the sys_intvecs.asm file to jump to my new address?
Any advice or tips are appreciated!
Also, let me know if you need more info
Thank you,
-Nate J