_S_romp structure created by automatic project creation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_S_romp structure created by automatic project creation

1,337 Views
SVC1
Contributor I

When a project is created in CW (version 7), the IDE generates automatically a structure RomInfo (__S_romp in linker file) and during startup (startcf.c), the structure is used to copy a block from rom to ram.

 

Can anyone explain what this piece of code does?

 

I am checking the addresses (destination, source) of the block being copied and have no idea what is the purpose of the code? Needless to say, when I delete it, nothing works…

 

Code:
static void __copy_rom_sections_to_ram(void)============================================        Value    Location      data_end            0x2000A52C         0x2000C4FC      data_ram            0x2000A500         0x2000C510      data_rom            0x200030DC         0x2000C514      heap_end            0x2000B52C         0x2000C4F4      heap_start          0x2000A52C         0x2000C4F8      info                0x200030F0         0x2000C518          Source          0x200030DC         0x200030F0          Target          0x2000A500         0x200030F4          Size            20                 0x200030F8      sbs_end             0x00000000         0x2000C500      sbs_start           0x00000000         0x2000C504      sbss_end            0x00000000         0x2000C508      sbss_start          0x00000000         0x2000C50C      sp_end              0x2000B52C         0x2000C4F0      sp_init             0x2000C52C         0x2000C51Cstatic void __copy_rom_section(char* dst, const char* src, unsigned long size)=============================================================================          Value       Location      dst                 ""                 0x2000C4D0          *dst            '\x00'             0x2000A500      size                20                 0x2000C4D8      src                 ""                 0x2000C4D4          *src            '\x00'             0x200030DC

 

So it is copies the content of address (0x2000_C4D4 to 0x2000_C4D0). The code is in SRAM (5282)?

Simon


 

Labels (1)
0 Kudos
1 Reply

319 Views
Arev
Contributor III
Hello,
 
_S_romp structure is defined in the link file (*.lcf) and is used for ROM to RAM copy at Startup.
 
_S_romp structure contains sequence of three word values per entry, the last entry must be 3 NULL words.
{
 ROM Start Address 
 RAM Start Address
 BLOCK Size
 
For software in Flash running from Flash, At Startup the BSP uses _S_romp to copy initilized data from Flash to their Ram location.
 
For software in Flash running from Ram, At Startup the BSP  uses _S_romp to copy the Code from Flash to Ram and initilized data from Flash to RAM.

I Hope this helps..

Bye
 
<< Freescale MCF5234/35 with CodeWarrior 6.2 >>
0 Kudos