LCF sections

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

LCF sections

2,346 Views
Kremer
Contributor I
 Hi
 
 I´m trying to split the internal flash memory into some regions using sections. I´m using CW6.4 for coldfire. But i´m having a little bit trouble when i´m trying to place data into an specific section.
 
 My LCF is like this:
 
Code:
MEMORY {    startup    (RX) : ORIGIN = 0x00000000,  LENGTH = 0x00000400    cfm_init   (RX) : ORIGIN = 0x00000400,  LENGTH = 0x00000020    program    (RX) : ORIGIN = 0x00000420,  LENGTH = 0x0003DBE0    user_rom   (RW) : ORIGIN = 0x0003E000,  LENGTH = 0x00002000    vector_ram (RW) : ORIGIN = 0x20000000,  LENGTH = 0x00000400    ram        (RW) : ORIGIN = 0x20000400,  LENGTH = 0x00007C00}SECTIONS {    ___IPSBAR           = 0x40000000;    ___SRAM             = 0x20000000;    ___SRAM_SIZE        = (32 * 1024);    ___FLASH            = 0x00000000;    ___FLASH_SIZE       = (256 * 1024);    ___VECTOR_RAM       = ___SRAM;        .startup :    {        .               = ALIGN(0x10);        mcf5223_vectors.s (.text)        .               = ALIGN(0x10);    } > startup    .cfm_conf :     {        .               = ALIGN(0x10);        cfm_flash.s (.text)        .               = ALIGN(0x10);    } > cfm_init    .text :     {        .               = ALIGN(0x10);        mcf5223_sysinit.c (.text)        *(.text)        *(.rodata)         .              = ALIGN(0x10);        ___DATA_ROM     = .;    } > program    .nv_data:    {        .               = ALIGN(0x10);        ___USER_MEM     = .;    } > user_rom    .data_bss : AT(___DATA_ROM)    {        ___DATA_RAM     = .;        *(.data)        *(.sdata)        ___DATA_END     = .;        .               = ALIGN(0x10);        ___BSS_START    = .;        *(.sbss)        *(SCOMMON)        *(.bss)        *(COMMON)        ___BSS_END      = .;               .               = ALIGN(0x04);  #Add this line               ___SP_END       = .;        .               = . + (0x1000);        ___SP_INIT      = .;        .               = . + (4);        ___HEAP_START   = .;        ___HEAP_END     = ___SRAM + ___SRAM_SIZE - 1;    } > ram ___heap_addr = ___HEAP_START; ___heap_size = (___HEAP_END - ___HEAP_START - 4) & 0x0FFFFF00; ___STACK_SIZE = ___SP_INIT - ___SP_END;}

 
 And here is what the .map file shows:
 
Code:
 (cfm_flash.s ) [whole file]#>40000000          ___IPSBAR (linker command file)#>20000000          ___SRAM (linker command file)#>00008000          ___SRAM_SIZE (linker command file)#>00000000          ___FLASH (linker command file)#>00040000          ___FLASH_SIZE (linker command file)#>20000000          ___VECTOR_RAM (linker command file)# .startup  00000000 00000014 .text   .text (mcf5223_vectors.s)  00000000 00000000 .text   VECTOR_TABLE (mcf5223_vectors.s)  00000000 00000000 .text   VECTOR_TABLE (mcf5223_vectors.s)  00000008 00000000 .text   start (mcf5223_vectors.s)  00000008 0000000C .text   @DummyFn1 (mcf5223_vectors.s)# .cfm_conf# .text  00000420 00000260 .text   mcf5223_init (mcf5223_sysinit.c)  00000680 0000000C .text   mcf5223_wtm_init (mcf5223_sysinit.c)  0000068C 00000020 .text   mcf5223_pll_init (mcf5223_sysinit.c)  000006AC 0000001C .text   mcf5223_scm_init (mcf5223_sysinit.c)  000006C8 000000BC .text   mcf5223_gpio_init (mcf5223_sysinit.c)... list of functions goes on normally...

 
The problem is in .cfm_conf section. I try to place the initialization values for the CFM module on the position specified by the LCF file but there´s no way the linker put those values on 0x00000400 to 0x00000417.
  The line (cfm_flash.s ) [whole file] on .map file says linker deadstrip the cfm_flash.s file completely.
 
 Here is the cfm_flash.s file:
 
Code:
/*  * CFM Flash Configuration Field  */   .global CFM_CONF .global _CFM_CONF .global KEY_UPPER .global KEY_LOWER .global CFMPROT .global CFMSACC .global CFMDACC .global CFMSEC    .textCFM_CONF:_CFM_CONF:KEY_UPPER:  .long   0x89ABCDEFKEY_LOWER:  .long   0x00000000CFMPROT:    .int    0x0000CFMSACC:    .int    0x0000CFMDACC:    .int    0x0000CFMSEC:     .int    0x0000      .end/********************************************************************/

 
 What can i be doing wrong?
 Any help is welcome.
 Thank you all.
Labels (1)
0 Kudos
Reply
1 Reply

501 Views
CrasyCat
Specialist III
Hello
 
I think the issue here is that the symbols defined in cfm_flash.s are not used anywhere in the source code. Per default the linker is performing dead stripping. It does not link symbols (functions, variables, constants), which are not used to the application.
 
You need to tell the linker you want to link those symbols to the application even though they are not used.
In this purpose just add the following in the EPPC Linker panel "Force Active Symbols" edit box
   _CFM_CONF
 
That should do it. I hope this helps. 
 
CrasyCat
0 Kudos
Reply