AnsweredAssumed Answered

Link Error: Illegal 16-bit small data area relative reference to symbol

Question asked by jimfell on Oct 26, 2012
Latest reply on Oct 29, 2012 by jimfell

Does anyone know what this linker error means and/or how to resolve it?


'Building target: USB_CDC_Test_App.elf'

'Executing target #4 USB_CDC_Test_App.elf'

'Invoking: ColdFire Linker'

"C:/Program Files/Freescale/CW MCU v10.2/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf" @@"USB_CDC_Test_App.args" -o "USB_CDC_Test_App.elf"   -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/Queue_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/USB_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/Debug_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/SArray_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/Serial_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/Text_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/Timer_MCF51JM.lib" -l"C:/Users/jim.fell/Source/Embedded/Libs/Target/Debug/valloc_MCF51JM.lib"

C:/Program Files/Freescale/CW MCU v10.2/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf|Linker|Error

>Illegal 16-bit small data area relative reference to symbol '_g_Mem'                                                                                          

>from address 0x000030BA in section '.text' of file 'USB_MCF51JM.lib

>usb_dci_c.o    '.

>This type of reference has a range from 4294934528 to 32767 bytes.

>from address 0x00003202 in section '.text' of file 'USB_MCF51JM.lib

>usb_dci_c.o    '.



I am using CodeWarrior for MCU v10 with the ColdFire V1 architecture.  My application project is a simple bareboard project, which references multiple compiled libraries.  All of the libraries build without issue.  One of the libraries references a CDC library built using the Freescale USB stack v4.0.2.  Changes I made to the stack were very minimal:


  1. Linker output was changed to generate a library, rather than an application:
    • Project menu > Properties > C/C++ Build > Settings > Tool Settings tab > ColdFire Linker > Output > Output Type > Static Library
    • Project menu > Properties > C/C++ Build > Settings > Build Artifact tab > Artifact Extension > lib
  2. These files were excluded from the build:
    • user_config.h
    • virtual_com.h
    • main.c
    • RealTimerCounter.c
    • virtual_com.c


Functionality found in virtual_com.c was moved to one of the new libraries for abstraction purposes.  I know where g_Mem is declared, but I'm confused as to why it's giving me this link error when I try to build my application with the USB driver in referenced libraries.  Any help or insight into the linker error would be appreciated.  Thanks.