We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm working on Cortex-M0. The goal is to execute the program in SDRAM after copying from flash. The system will boot from ROM, copy the program from flash to SDRAM, then execute from SDRAM afterwards.
I'm new to Cortex-M0 and have two questions:
1) Do I need to implement two programs? One program in ROM is to perform copying of the second program from flash to SDRAM. And the second program will execute from SDRAM.
2) Can I create a program with assembly codes only? The program in ROM has to be very small because of ROM size limitation (512 bytes only). I tried but the linker shows the following error message. I must miss something here...
armlink --cpu Cortex-M0 --entry Reset_Handler startup_rom.o -o startup_rom.axf
Warning: L6665W: Neither Lib$$Request$$armlib Lib$$Request$$cpplib defined, not searching ARM libraries.
Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_rom.o).
Thanks for any help in advance.
Hi wshen,
actually I think the simplest solution is:
use your current startup code, startup_rom. In it, you can do the following steps:
1. copy the program from flash to SDRAM
2. initialize data and clear bss sections (according to your linker script)
3. jump to the starting point of the copied program in SDRAM
For your error, I guess "__use_two_region_memory " should be a memory address and defined in linker script. Can you check if you have defined?
Best regards. Teddy
Thanks for the answers. Another dummy question:
Assume 0x0000_0000 is the address to be jumped to,
LDR R6, =0x1 ; set R6 to 0x0000_0001 due to Thumb mode
BX R6 ; jump to start address
Shall I use BX or BLX or another instruction? This is expected to be a one-time jump and address 0x0000_0000 has the new vector table.