Inclusione libreria esterna

Forum relativo alle schede FLEX, ERIKA Enterprise, RT-Druid, ScicosLab, ...

Moderator: paolo.gai

Locked
Daniel_C
Newbie
Posts: 4
Joined: Sun Mar 16, 2014 7:53 pm

Inclusione libreria esterna

Post by Daniel_C » Mon Mar 17, 2014 10:24 am

Salve a tutti, ho un problema nell'inclusione di una libreria esterna in un progetto che utilizza Erika.
Ho inserito i file .h nel progetto eclipse ed incluso la libreria nel file oil, credo in maniera corretta, ma le funzioni specificate non vengono trovate (come se mancasse l'implementazione, quindi credo che ci sia qualche problema nell'inclusione del file .a tramite il file oil).
Allego alcuni degli errori che ricevo:

LD
obj/GUIConf_stm32f4_discovery.o: In function `GUI_X_Config':
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin2/GUIConf_stm32f4_discovery.c:115: undefined reference to `GUI_ALLOC_AssignMemory'
obj/LCDConf_stm32f4_discovery.o: In function `LCD_X_Config':
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin2/LCDConf_stm32f4_discovery.c:200: undefined reference to `GUIDRV_FlexColor_API'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin2/LCDConf_stm32f4_discovery.c:200: undefined reference to `GUIDRV_FlexColor_API'

Le righe che ho aggiunto nel file oil per l'inclusione della libreria sono:

LDFLAGS = "-LC:/Users/Daniel/Desktop/STemWin_Library_V1.1.2/Libraries/STemWinLibrary522/Lib";
LIBS = "-lSTemWin522_CM4_GCC.a";

Per l'inclusione della libreria tramite il file oil mi sono basato su quanto scritto a questo link (che dovrebbe essere inerente allo stesso problema) : http://erika.tuxfamily.org/forum/viewtopic.php?t=261

Grazie in anticipo,
Daniel

paolo.gai
Administrator
Posts: 864
Joined: Thu Dec 07, 2006 12:11 pm

Re: Inclusione libreria esterna

Post by paolo.gai » Mon Mar 17, 2014 10:28 am

Probabilmente non trova la libreria.

Prova a compilare con l'opzione VERBOSE in modo tale da stampare la riga di comando con cui viene invocato il linker. Cosi' vedi se la riga di comando è corretta (verificala con quella usata dall'ambiente di sviluppo standrd fornito con l'architettura.

Ciao,

PJ

Daniel_C
Newbie
Posts: 4
Joined: Sun Mar 16, 2014 7:53 pm

Re: Inclusione libreria esterna

Post by Daniel_C » Mon Mar 17, 2014 10:40 pm

Compilando con l'opzione verbose ottengo:

Code: Select all

LD
/cygdrive/c/PROGRA~2/GNUTOO~1/43F2B~1.720/bin/arm-none-eabi-gcc.exe -static -mcpu=cortex-m4 -mthumb -mthumb-interwork -ggdb -L/cygdrive/c/PROGRA~2/GNUTOO~1/43F2B~1.720/arm-none-eabi/lib/thumb -L"C:\\PROGRA~2\\GNUTOO~1\\43F2B~1.720\\arm-none-eabi\\lib\\thumb" -L. --verbose -LC:/STemWin -Wl,-e,EE_cortex_mx_default_reset_ISR -o c_mX.elf obj/GUIConf_stm32f4_discovery.o obj/LCDConf_stm32f4_discovery.o obj/STMPE811QTR.o obj/code.o obj/eecfg.o obj/pictures.o obj/pkg/mcu/st_stm32_stm32f4xx/src/startup_stm32f4xx_gnu.o obj/pkg/mcu/st_stm32_stm32f4xx/src/system_stm32f4xx.o libee.a libstm32f4discovery.a libstm32f4xxspd.a libstgui.a \
Using built-in specs.
	-Wl,-T"D:\\ee\\pkg\\mcu\\st_stm32_stm32f4xx\\src\\stm32f40x_gnu.ld"  -Wl,-Map,c_mX.map
COLLECT_GCC=C:\PROGRA~2\GNUTOO~1\43F2B~1.720\bin\arm-none-eabi-gcc.exe
COLLECT_LTO_WRAPPER=c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-7-build/src/gcc/configure --build=i686-linux-gnu --host=i586-mingw32 --target=arm-none-eabi --prefix=/home/build/work/GCC-4-7-build/install-mingw --libexecdir=/home/build/work/GCC-4-7-build/install-mingw/lib --infodir=/home/build/work/GCC-4-7-build/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-4-7-build/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-4-7-build/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-4-7-build/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-4-7-build/install-mingw/arm-none-eabi --with-libiconv-prefix=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-gmp=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-mpfr=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-mpc=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-ppl=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-cloog=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-libelf=/home/build/work/GCC-4-7-build/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r
Thread model: single
gcc version 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601] (GNU Tools for ARM Embedded Processors) 
COMPILER_PATH=c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/
LIBRARY_PATH=c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7e-m/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../arm-none-eabi/lib/armv7e-m/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/;c:/progra~2/gnutoo~1/43f2b~1.720/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-static' '-mcpu=cortex-m4' '-mthumb' '-mthumb-interwork' '-ggdb' '-L/cygdrive/c/PROGRA~2/GNUTOO~1/43F2B~1.720/arm-none-eabi/lib/thumb' '-LC:\PROGRA~2\GNUTOO~1\43F2B~1.720\arm-none-eabi\lib\thumb' '-L.' '-v' '-LC:/STemWin' '-o' 'c_mX.elf'
 c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/collect2.exe --sysroot=c:\progra~2\gnutoo~1\43f2b~1.720\bin\../arm-none-eabi -Bstatic -X -o c_mX.elf c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m/crti.o c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m/crtbegin.o c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7e-m/crt0.o -L/cygdrive/c/PROGRA~2/GNUTOO~1/43F2B~1.720/arm-none-eabi/lib/thumb -LC:\PROGRA~2\GNUTOO~1\43F2B~1.720\arm-none-eabi\lib\thumb -L. -LC:/STemWin -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7e-m -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../arm-none-eabi/lib/armv7e-m -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4 -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib -Lc:/progra~2/gnutoo~1/43f2b~1.720/bin/../arm-none-eabi/lib -e EE_cortex_mx_default_reset_ISR obj/GUIConf_stm32f4_discovery.o obj/LCDConf_stm32f4_discovery.o obj/STMPE811QTR.o obj/code.o obj/eecfg.o obj/pictures.o obj/pkg/mcu/st_stm32_stm32f4xx/src/startup_stm32f4xx_gnu.o obj/pkg/mcu/st_stm32_stm32f4xx/src/system_stm32f4xx.o libee.a libstm32f4discovery.a libstm32f4xxspd.a libstgui.a -TD:\ee\pkg\mcu\st_stm32_stm32f4xx\src\stm32f40x_gnu.ld -Map c_mX.map --start-group -lgcc -lg -lc --end-group c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m/crtend.o c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/armv7e-m/crtn.o
obj/GUIConf_stm32f4_discovery.o: In function `GUI_X_Config':
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/GUIConf_stm32f4_discovery.c:115: undefined reference to `GUI_ALLOC_AssignMemory'
obj/LCDConf_stm32f4_discovery.o: In function `LCD_X_Config':
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:200: undefined reference to `GUIDRV_FlexColor_API'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:200: undefined reference to `GUIDRV_FlexColor_API'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:200: undefined reference to `LCD_API_ColorConv_565'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:200: undefined reference to `LCD_API_ColorConv_565'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:200: undefined reference to `GUI_DEVICE_CreateAndLink'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:204: undefined reference to `LCD_SetSizeEx'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:205: undefined reference to `LCD_SetVSizeEx'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:212: undefined reference to `GUIDRV_FlexColor_Config'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:220: undefined reference to `GUIDRV_FlexColor_SetFunc66714'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:220: undefined reference to `GUIDRV_FlexColor_SetFunc66714'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:220: undefined reference to `GUIDRV_FlexColor_SetMode16bppC0B16'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:220: undefined reference to `GUIDRV_FlexColor_SetMode16bppC0B16'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/LCDConf_stm32f4_discovery.c:220: undefined reference to `GUIDRV_FlexColor_SetFunc'
obj/code.o: In function `main':
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/code.c:116: undefined reference to `GUI_Init'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/code.c:117: undefined reference to `GUI_GotoXY'
C:\Users\Daniel\workspaceLabEsd\Watch_STemWin/code.c:118: undefined reference to `GUI_DispString'
collect2.exe: error: ld returned 1 exit status
make: *** [c_mX.elf] Error 1
dove sembra che l'opzione del path della libreria, incluso come detto con il post precedente con ldflags, sia incluso correttamente (comando presente nella prima riga dopo LD, dopo COLLECT_GCC_OPTIONS e nella riga sotto di essa), mentre sembra che la libreria stessa (libSTemWin.a) non venga mai inclusa. Da cosa potrebbe dipendere?
Avendo cambiando i nomi ed i path rispetto al post precedente, allego anche le righe del file oil.

Code: Select all

LDFLAGS = "-LC:/STemWin";
LIBS = "-llibSTemWin.a'";
Grazie in anticipo,
Daniel

EDIT:
Inserendo direttamente

Code: Select all

LDFLAGS = "-lC:\\STemWin\\libSTemWin.a";
ottengo ora

Code: Select all

c:/progra~2/gnutoo~1/43f2b~1.720/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: cannot find -lC:\STemWin\libSTemWin.a
che sembra essere l'errore descritto a questo link: http://stackoverflow.com/questions/1323 ... ng-eclipse , ma anche aggiungendo

Code: Select all

LDFLAGS =" --specs=rdimon.specs -lrdimon";
non ci sono cambiamenti

Locked