My question is how to run MQX on MPU, because MPU usually has external flash and sdram, I know the code can run in nor flash, but it's slow. linux usually use bootloader to load image from flash into sdram and then run in sdram. but MQX can do this?
for example ,if I use mcf52277, How to load image from flash into sdram ,then run it in sdram?
thanks!
Solved! Go to Solution.
Hi,
some MQX BSPs for processors with external flash and sdram/ddr do the exactly same thjng as you have described - The code is started from NOR and then copied to external ram and executed from there.
There is not special boot loader created for this purpose, BSP uses CodeWarrior startup code for this purpose - see M54455EVB platform as example - The setting is mostly done in the linker commad file "c:\Program Files\Freescale\Freescale MQX 3.6\mqx\source\bsp\m54455evb\cw\extflash0.lcf", also the MQX BSP startup code have to be placed into "init" section.
The part of boot sequence needed for setting of RAM, PLL, flash and code copy routine is placed and executed from FLASH -
.main_application :
{
*(S_BOOT)
*(IPSUM)
*(.init)
# boot
OBJECT(___boot, *)
OBJECT(___boot_exception, *)
# startup code from CodeWarrior library
OBJECT(_simple_block_copy, *)
OBJECT(___copy_rom_section, *)
OBJECT(___copy_rom_sections_to_ram, *)
OBJECT(__ExitProcess, *)
OBJECT(___block_copy_sections, *)
OBJECT(___fix_addr_references, *)
OBJECT(_clear_mem, *)
OBJECT(__start, *)
OBJECT(___initialize_hardware, *)
OBJECT(___initialize_OS, *)
Then the rest of application is placed to next section and copied to RAM using CW startup.
The sections : .main_application_code : AT(___COPY_OF_CODE) and .main_application_data : AT(___COPY_OF_DATA) are are placed in the FLASH and copied to the addresses reserved in the SDRAM (sdram_cached memory space).
This mechanism need to be configured using following table in linker command file:
# Locate the ROM copy table into ROM after the initialized data
_romp_at = ___COPY_OF_DATA + SIZEOF(.main_application_data);
.romp : AT (_romp_at)
{
__S_romp = _romp_at;
WRITEW(___COPY_OF_DATA); #ROM start address
WRITEW(ADDR(.main_application_data)); #RAM start address
WRITEW(SIZEOF(.main_application_data)); #size of application data
WRITEW(___COPY_OF_CODE); #ROM code start address
WRITEW(ADDR(.main_application_code)); #RAM code start address
WRITEW(SIZEOF(.main_application_code)); #size of code
WRITEW(0);
WRITEW(0);
WRITEW(0);
}
Hi,
some MQX BSPs for processors with external flash and sdram/ddr do the exactly same thjng as you have described - The code is started from NOR and then copied to external ram and executed from there.
There is not special boot loader created for this purpose, BSP uses CodeWarrior startup code for this purpose - see M54455EVB platform as example - The setting is mostly done in the linker commad file "c:\Program Files\Freescale\Freescale MQX 3.6\mqx\source\bsp\m54455evb\cw\extflash0.lcf", also the MQX BSP startup code have to be placed into "init" section.
The part of boot sequence needed for setting of RAM, PLL, flash and code copy routine is placed and executed from FLASH -
.main_application :
{
*(S_BOOT)
*(IPSUM)
*(.init)
# boot
OBJECT(___boot, *)
OBJECT(___boot_exception, *)
# startup code from CodeWarrior library
OBJECT(_simple_block_copy, *)
OBJECT(___copy_rom_section, *)
OBJECT(___copy_rom_sections_to_ram, *)
OBJECT(__ExitProcess, *)
OBJECT(___block_copy_sections, *)
OBJECT(___fix_addr_references, *)
OBJECT(_clear_mem, *)
OBJECT(__start, *)
OBJECT(___initialize_hardware, *)
OBJECT(___initialize_OS, *)
Then the rest of application is placed to next section and copied to RAM using CW startup.
The sections : .main_application_code : AT(___COPY_OF_CODE) and .main_application_data : AT(___COPY_OF_DATA) are are placed in the FLASH and copied to the addresses reserved in the SDRAM (sdram_cached memory space).
This mechanism need to be configured using following table in linker command file:
# Locate the ROM copy table into ROM after the initialized data
_romp_at = ___COPY_OF_DATA + SIZEOF(.main_application_data);
.romp : AT (_romp_at)
{
__S_romp = _romp_at;
WRITEW(___COPY_OF_DATA); #ROM start address
WRITEW(ADDR(.main_application_data)); #RAM start address
WRITEW(SIZEOF(.main_application_data)); #size of application data
WRITEW(___COPY_OF_CODE); #ROM code start address
WRITEW(ADDR(.main_application_code)); #RAM code start address
WRITEW(SIZEOF(.main_application_code)); #size of code
WRITEW(0);
WRITEW(0);
WRITEW(0);
}