Reference bsp_section_data_start from C yields "R_PPC_EMB_SDA21 relocation is in the wrong output section"

Eric Norum wenorum at lbl.gov
Mon May 17 01:07:32 UTC 2010


I use the following trick to get at loader symbols (see the uC5282 BSP for examples).

extern char RamSize[];

Then to get the value:
	s = (uint32_t)RamSize;

On 05/16/2010 05:41 AM, Peter Dufault wrote:
> This is in the MPC55XXEVB in the head, but it's a general question.
> 
> I need to reference bsp_section_start from a routine that duplicates a program that's been running in RAM into the FLASH once it's been debugged.
> I have this expression:
> 
> extern void *bsp_section_text_end,
>     *bsp_section_data_start,
>     *bsp_section_data_end;
> 
> ...
> 
>     te = (uint32_t)&bsp_section_text_end;
>     ds = (uint32_t)0x40000180; /* XXX Should be&bsp_section_data_start; but linker error */
>     de = (uint32_t)&bsp_section_data_end;
>     end = (te + ((de - ds) + 16))&~0x7;
> 
> However, if I reference bsp_section_data_start in that instead of the hard-wired number I get this link error:
> 
> /opt/rtems-4.10/lib/gcc/powerpc-rtems4.10/4.4.4/../../../../powerpc-rtems4.10/bin/ld: /home/dufault/work/scratch/peter_6600_dev/powerpcphycore_mpc5554rtems4.10/lib/libmpc55xx_misc.a(flash.o): the target (bsp_section_data_start) of a R_PPC_EMB_SDA21 relocation is in the wrong output section (.data)
> /opt/rtems-4.10/lib/gcc/powerpc-rtems4.10/4.4.4/../../../../powerpc-rtems4.10/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
> make: *** [o-optimize/motobank.exe] Error 1
> 
> Does anyone know how to fix this?  I've done some searches and don't know enough about the issues to solve it quickly.
> 
> From the name list:
> 
> 40000180 D bsp_section_data_start
> 40004ba0 G bsp_section_data_end
> 000f5160 G bsp_section_text_end
> 
> Peter
> -----------------
> Peter Dufault
> HD Associates, Inc.      Software and System Engineering
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>   
> 

-- 
Eric Norum
wenorum at lbl.gov






More information about the users mailing list