AnsweredAssumed Answered

MPC5123 Linker Command File LOAD directive

Question asked by Giuseppe Noto on Mar 11, 2014

Hello,

I need to put one byte in a specific address in flash. I have used the LOAD directive in the LCF file.

I need that this location is absolute and that it is independent from possible increment of code size.

Below there is my LCF file where there is the section "HwVersion". The total code reaches the location 0xFDE168B8 and when I insert the "HwVersion" section to the address 0xFDE16000 CodeWarrior displays this error:

"Link Error: Can't write binary file 'workode.bin' because gap between bin file offset segments .header_bot and .HwVersion wasn't update correctly (too much)"

 

 

MEMORY {
ram : org = 0x00003000, //length = 0x8000000  // 128 MB (DDR) (era 0x3000)
rom : org = 0xfc000000, length = 0x03FFFFFF // start of code in ROM
immrbar : origin = 0xF0000000, length = 0x0
}

/* We use FORCEFILES so that the linker will not deadstrip the file reset.s. The function
reset would be deadstripped since it is not ever called by anything */

FORCEACTIVE { gInterruptVectorTable, __reset}
FORCEFILES {header.o,HwVersion.o}
//FORCEFILES {header.o}

SECTIONS {
 
.header_top : {} > rom
.reset : {} > rom 
.init  : {} > rom     
.immrbar  : {} > immrbar
.identification : {} > rom

GROUP : {
  .myText : { __init_cpp_exceptions.o  (.text) }
  .myText2 : { ExceptionPPC.o  (.text) }
  .myText4 : { init_mmu_cache.o  (.text) }
  
} > rom


ALTIAGRAPHICS_DATA ALIGN(4): {
   
               data.o (.rodata)
              
    } > rom 


ALTIAGRAPHICS_DATA_0 ALIGN(4): {
     
               altiaImageDataBank0.o (.rodata)
    } > rom 


ALTIAGRAPHICS_DATA_1 ALIGN(4): {
   
               altiaImageDataBank1.o (.rodata)
      
    } > rom 


ALTIAGRAPHICS_DATA_2 ALIGN(4): {
   
         altiaImageDataBank2.o (.rodata)
    } > rom 

ALTIAGRAPHICS_DATA_3 ALIGN(4): {
         altiaImageDataBank3.o (.rodata)
    } > rom
   
ALTIAGRAPHICS_DATA_4 ALIGN(4): {
         altiaImageDataBank4.o (.rodata)
    } > rom
   
    ALTIAGRAPHICS_DATA_5 ALIGN(4): {
         altiaImageDataBank5.o (.rodata)
    } > rom
   
    ALTIAGRAPHICS_DATA_6 ALIGN(4): {
         altiaImageDataBank6.o (.rodata)
    } > rom

GROUP : {

  .text (TEXT): {}
  .rodata (CONST) : {
   *(.rdata)
   *(.rodata)
  }
  .ctors : {}
  .dtors : {}
  extab : {}
  extabindex : {}
} > ram  // replace 'rom' with 'ram' if you want to execute  in RAM
    // in questo modo faccio girare il codice in DDR (se faccio girare da flash è tutto molto lento)
GROUP : {
  .data : {}
  .sdata : {}
  .sbss : {}
  .sdata2 : {}
  .sbss2 : {}
  .bss : {}
  .PPC.EMB.sdata0 : {}
  .PPC.EMB.sbss0 : {} 
} > ram


PRE_MAIN : {
               
                timer.o (.text) 
                interrupt.o(.text)
                canB.o (.text)
                canC.o (.text)
                io.o (.text)
                TJA.o (.text)
                canB_par_cfg.o (.text)
                canB_par_cfg.o (.rodata) // GN 16/01/2014: BugFix UID 1254
                       // Necessary to permit correct reading of the CAN buffer
                get_B_can.o (.text)
                put_B_can.o (.text)
                drvB_par.o (.text)
                canC_par_cfg.o (.text)
                get_C_can.o (.text)
                drvC_par.o (.text)
                watchdog.o (.text)
                runtime.o (.text)
                SWmonitor.o (.text)
                DRV_LIN.o(.text)
                pre_main.o (.text)

               
        }    > ram

.header_bot : {
 
} > rom


__IMMRBAR = ADDR(.immrbar);
 

    .HwVersion LOAD(0xFDE16000): {
*(.HwVersion)
.= ALIGN(4);
}

}

 

How I can solve this problem.

 

Thanks for Help

Giuseppe Noto


Outcomes