Building library with extern data fails in GCC

HvW hermanv@process-auto.com
Fri Aug 31 19:24:00 GMT 2012


Hi,

I am trying to create a library that handles the USART TX and RX data. The
buffer used for the TX and RX data I declared as extern as this needs to be
specified by the application using the library. This works fine in Keil
ARM-MDK. Attempting to build this in the latest version of GCC shows the
following errors:

C:\yagarto_cortex_m3\bin\arm-none-eabi-gcc  libhl_usart.o -mcpu=cortex-m3
-mthumb -nostartfiles -Tstm32f103x_xl_flash.ld
-Wl,-Map=lib_usart.map,--cref,--no-warn-mismatch -L./lib/ -lm -lgcc -lc
./lib/lib_stm3210x_xl_stdperiph.a -o lib_usart.elf
libhl_usart.o: In function `Libhl_Usart_Lib_Init':
libhl_usart.c:(.text+0x1a): undefined reference to `Libhl_Usart2_Tx_Buff'
libhl_usart.c:(.text+0x1e): undefined reference to `Libhl_Usart2_Tx_Buff'
libhl_usart.c:(.text+0x2c): undefined reference to `Libhl_Usart3_Tx_Buff'
libhl_usart.c:(.text+0x30): undefined reference to `Libhl_Usart3_Tx_Buff'
libhl_usart.c:(.text+0x3e): undefined reference to `Libhl_Uart4_Tx_Buff'
libhl_usart.c:(.text+0x42): undefined reference to `Libhl_Uart4_Tx_Buff'
libhl_usart.c:(.text+0x50): undefined reference to `Libhl_Uart5_Tx_Buff'
libhl_usart.c:(.text+0x54): undefined reference to `Libhl_Uart5_Tx_Buff'
libhl_usart.c:(.text+0x62): undefined reference to `Libhl_Usart1_Rx_Buff'
libhl_usart.c:(.text+0x66): undefined reference to


I am sure that I am just missing some compiler option that will allow it to
assume that the data will be available when needed. 

I am attaching the code and makefile. 

http://gcc.1065356.n5.nabble.com/file/n865274/code_makefile.rar
code_makefile.rar 

Please help me solve this problem.

Thanks,




--
View this message in context: http://gcc.1065356.n5.nabble.com/Building-library-with-extern-data-fails-in-GCC-tp865274.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list