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

Peter Dufault dufault at
Sun May 16 10:41:37 UTC 2010

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,


    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 Dufault
HD Associates, Inc.      Software and System Engineering

More information about the users mailing list