我在这里因为我无法解决我的问题;事实上,我正在Eclipse CDT C / C ++ IDE中使用arm-none-eabi-gcc编译器制作一个C项目(它是STM32嵌入式卡的),我已经实现了PolarSSL来创建一个HTTPS服务器:
我在很多论坛中都看到我需要删除printf
,malloc
,file
,path
以避免此错误(事实上,我是嵌入式项目所以禁止这些功能!)。但即使我删除了所有这些功能,这些错误也会留在这里!所以现在我不知道如何解决这些错误,所以你能帮帮我吗?
感谢您的帮助。
'Building file: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c'
'Invoking: Cross GCC Compiler'
arm-none-eabi-gcc -DARP_CACHE_SIZE=4 -D_kill -D_getpid -D_cert -DUSE_IPV4 -DUSE_IPV6 -DNDP_CACHE_SIZE=4 -DHARDWARE_ETH_TX_CRC -DHARDWARE_ETH_RX_CRC -DUSE_STDPERIPH_DRIVER -DUSE_TCP -DHSE_VALUE=25000000 -DSTM32F2XX -DUSE_MII -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Library_StackIP/Driver_phyter_f2" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/stm32f2xx" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/urts" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/ethernet" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/agilia" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Service_HttpServeur" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/Library_StackIP" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/include/polarssl" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/include" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1/test_serverweb_v0/src/library" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\CMSIS_V3P00\CMSIS\Include" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\CMSIS_V3P00\Device\ST\STM32F2xx\Include" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\inc" -I"C:\Sebastien\Sujet_1_ServeurWeb\Projet_1\test_serverweb\src\LibrarySSL" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\StdPeriph_Driver\inc" -I"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\STM32_Ethernet\inc" -I"C:\AIM\uOne\F2\inc" -I"C:\AIM\uOne\F2\StdPeriph_Driver\inc" -O2 -g3 -Wall -c -fmessage-length=0 -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -mfloat-abi=softfp -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP -MF".metadata/.plugins/org.eclipse.cdt.make.core/specs.d" -MT".metadata/.plugins/org.eclipse.cdt.make.core/specs.d" -o ".metadata/.plugins/org.eclipse.cdt.make.core/specs.o" "../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c"
'Finished building: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c'
'Building target: test_serverweb_v0'
'Invoking: Cross GCC Linker'
arm-none-eabi-gcc -static -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\lib" -L"C:\AIM\uOne\F2\lib" -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\StdPeriph_Driver\lib" -L"C:\Program Files\AIM\uOne\Tools\eclipse\..\..\F2\STM32_Ethernet\lib" -L"C:\AIM\uOne\F2\STM32_Ethernet\lib" -L"C:\AIM\uOne\F2\StdPeriph_Driver\lib" -mthumb -mcpu=cortex-m3 -fsigned-char -ffunction-sections -fdata-sections -Wl,-T,../ldscripts/flash.ld,-Map,Debug.map,--gc-sections -o "test_serverweb_v0" ./src/urts/urts_init.o ./src/stm32f2xx/startup_stm32f2xx.o ./src/stm32f2xx/system_stm32f2xx.o ./src/library/aes.o ./src/library/aesni.o ./src/library/arc4.o ./src/library/asn1parse.o ./src/library/asn1write.o ./src/library/base64.o ./src/library/bignum.o ./src/library/blowfish.o ./src/library/camellia.o ./src/library/certs.o ./src/library/cipher.o ./src/library/cipher_wrap.o ./src/library/ctr_drbg.o ./src/library/debug.o ./src/library/des.o ./src/library/dhm.o ./src/library/ecdh.o ./src/library/ecdsa.o ./src/library/ecp.o ./src/library/ecp_curves.o ./src/library/entropy.o ./src/library/entropy_poll.o ./src/library/error.o ./src/library/gcm.o ./src/library/havege.o ./src/library/md.o ./src/library/md2.o ./src/library/md4.o ./src/library/md5.o ./src/library/md_wrap.o ./src/library/memory.o ./src/library/memory_buffer_alloc.o ./src/library/net.o ./src/library/oid.o ./src/library/padlock.o ./src/library/pbkdf2.o ./src/library/pem.o ./src/library/pk.o ./src/library/pk_wrap.o ./src/library/pkcs11.o ./src/library/pkcs12.o ./src/library/pkcs5.o ./src/library/pkparse.o ./src/library/pkwrite.o ./src/library/ripemd160.o ./src/library/rsa.o ./src/library/sha1.o ./src/library/sha256.o ./src/library/sha512.o ./src/library/ssl_cache.o ./src/library/ssl_ciphersuites.o ./src/library/ssl_cli.o ./src/library/ssl_srv.o ./src/library/ssl_tls.o ./src/library/threading.o ./src/library/timing.o ./src/library/version.o ./src/library/x509.o ./src/library/x509_create.o ./src/library/x509_crl.o ./src/library/x509_crt.o ./src/library/x509_csr.o ./src/library/x509write_crt.o ./src/library/x509write_csr.o ./src/library/xtea.o ./src/agilia/agilia_VC.o ./src/agilia/agilia_VS.o ./src/agilia/agilia_init_uRTS.o ./src/agilia/agilia_login_sha1.o ./src/agilia/agilia_moteur_info.o ./src/agilia/agilia_targetId.o ./src/agilia/agilia_xbin_mem.o ./src/Service_HttpServeur/AFS.o ./src/Service_HttpServeur/AgiliaGV.o ./src/Service_HttpServeur/Base64.o ./src/Service_HttpServeur/HtmlPage.o ./src/Service_HttpServeur/HtmlPageDynamic.o ./src/Service_HttpServeur/Http.o ./src/Service_HttpServeur/HttpServer.o ./src/Service_HttpServeur/HttpUsers.o ./src/Service_HttpServeur/MoteurHTTP.o ./src/Service_HttpServeur/StdAfx.o ./src/Service_HttpServeur/UTF8.o ./src/Service_HttpServeur/WebSite.o ./src/Service_HttpServeur/divers.o ./src/Service_HttpServeur/httpd.o ./src/Service_HttpServeur/mime.o ./src/Service_HttpServeur/sgf_sdcard.o ./src/Library_StackIP/Driver_phyter_f2/drv_buffer.o ./src/Library_StackIP/Driver_phyter_f2/drv_mac.o ./src/Library_StackIP/Driver_phyter_f2/drv_phyter_f2.o ./src/Library_StackIP/Driver_phyter_f2/drv_stats.o ./src/Library_StackIP/arp.o ./src/Library_StackIP/hntonh.o ./src/Library_StackIP/icmp.o ./src/Library_StackIP/icmpv6.o ./src/Library_StackIP/interface_ethernet.o ./src/Library_StackIP/ipv4.o ./src/Library_StackIP/ipv6.o ./src/Library_StackIP/sck_api.o ./src/Library_StackIP/tcp.o ./src/Library_StackIP/udp.o ./src/config_user.o ./src/ethernet_init.o ./src/hardware_init.o ./src/main.o ./src/peripherals_config.o ./src/ressources.o ./src/ssl_init_uRTS.o ./src/systickDelay.o ./src/timer_uRTS.o ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o -lservice_strformat -lagcomethernet -ltest_syscalls_v2 -lagcore -lagstr -lagtrycatch -lagvariables -lcrc16_soft -lcrc32_f2 -lsha1_soft -lagmetadebug -lflash_f2 -ldrv_phyter_f2 -lservice_horodateur -lservice_httpServeur -lservice_socket -lservice_STM32 -lsysirq -lsysrtc_f2 -lurts -lurtscore -ltrap12 -ltrap12core -lsystime -lsystick -lstm32_stdperiph_driver -lstm32_ethernet -lRessources
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-signalr.o): In function `_kill_r':
signalr.c:(.text._kill_r+0xe): undefined reference to `_kill'
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-signalr.o): In function `_getpid_r':
signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid'
c:/program files/aim/uone/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/armv7-m\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
collect2: ld returned 1 exit status
aim-make: *** [test_serverweb_v0] Error 1
**** Build Finished ****
答案 0 :(得分:1)
你不需要在Newlib中“删除”任何东西,你也不应该 - 而且我认为它不会有所帮助 - 我想知道你在哪里阅读它?
你需要提供系统调用存根,虽然其中许多可以是空函数,或者至少返回错误状态,以防有人或某事无意中调用它们 - 它们与进程控制,内存分配和流I / O.这些几乎肯定是由您使用的第三方代码间接引用的。
如果您将Newlib构建为静态库,它只会链接解析代码中符号所需的代码,因此如果您获得了未定义的引用,那么您将调用依赖于它们的内容。
您不应该做的是将Newlib代码直接编译并链接到您的应用程序代码 - 这将链接大量未使用的代码,并要求您提供其他未使用的存根。
答案 1 :(得分:0)
我知道这些是使用newlib(标准c lib实现)所必需的OS函数。在一个没有提供它们的系统上(如@wildplasser所说:没有操作系统?),显然需要明确定义它们。也许这个链接有助于:http://wiki.osdev.org/Porting_Newlib。我从http://balau82.wordpress.com/2010/12/16/using-newlib-in-arm-bare-metal-programs/到达那里。
答案 2 :(得分:0)
在编译MCU时,不要使用选项-nostartfiles
进行编译。
答案 3 :(得分:0)
根据forum尝试添加:
-specs = nosys.specs
答案 4 :(得分:-1)
就我而言,我使用 C++ 进行编译并关闭异常解决了我的问题。
将 -fno-exceptions
添加到您的编译标志。您可能还想关闭 Run Time Type Information (RTTI),即 -fno-rtti
。
CPPFLAGS += -fno-exceptions -fno-rtti