Hello,
I'm using uVision 4.20 and an LPC1788 development board.
The development board has external NOR flash at CS0 (0x80000000). I am able to download code to the external NOR flash using and INI setup file but I can't seem to write the VTOR register with 0x80000000.
The exact code and setup modified to run from iRAM works without issue (@ 0x10000000).
Does anyone have any ideas why I cant write VTOR with 0x80000000?
(Note the code runs until there is any interrupt and than crashes)
Thanks.
Mac
Vector Table can be used only for Code & SRAM region in Cortex-M cores (addresses 0x00000000 .. 0x3FFFFFFF).
Bits 31..30 in VTOR register are not used and writing 0x80000000 will NOT set VTOR to 0x80000000.
So you can't put the vector table in External memory.
Thanks for you reply.
That's what I was afraid of.
What is the general strategy then when the user code is larger than the devices (LPC1788) internal flash.
Do I need to split my user application binary into two (using scatter file) so that I can load one into iRAM and the other into SDRAM?
Basically I have a setup on an LPC2478 where I copy the entire user application into SDRAM and remap the ARM7 vectors using the MEMMAP register of that device.
I guess there is no way of doing this same strategy on the LPC1788 so I'm wondering what do people do normally?
M
I fail to see the problem. Why not have the vector table in the internal flash or the internal RAM?
Do you really want to _physically_ separate the vector table from the rest of the program? what if the NOR flash needs to be replaced (assuming it does not carry code)?
what if the NOR flash is somehow deleted (assuming it does not carry code)? You're 100% toast, as is your program...
I guess that is what I'm asking.
What is the best strategy. I have a bootloader that lives in internal flash. The bootloader (if not updating firmware) loads the user application from external flash into SDRAM.
It loads the user application into SDRAM because it is too big to load into iRAM.
I guess I have to split my user application into 2 binaries one with the vector table that loads into iRAM and the other that loads into SDRAM. Do this sound right?
Why do you copy the application into RAM in the first place? It might surprise you, but as far as I can recall, on a LPC1788 that might actually slow your program (because of architectural considerations - the chip cannot take advantage of its Harvard architecture if not executing from internal flash). Why not run from internal flash? It is too small?
I believe you are correct execution is fastest out or internal flash, than iRAM, than SDRAM than external flash.
I can not use the internal flash because 1) it is too small and 2) I have a bootloader that already lives there.
I have a similar situation with a LPC2478. The program for that product is organized in the following way: 1. bootloader(s) zone at the first 16[KB] of internal flash. 2. program components until the end of internal flash. 3. The rest of the program inside a NOR flash.
Note that you would need to: 1. Configure uv4 to program the NOR flash so you can debug. 2. Make sure your bootloader can program the application parts that reside in NOR flash. 3. Adjust your scatter loading files to house a separate load region for the NOR flash. 4. Create a small PC application that stitches the load regions binaries generated by the linker together so that the bootloader can program it seamlessly.
View all questions in Keil forum