適切な Makefile の作成を手伝ってください。
Linux で gcc-arm-none-eabi を使用して STM32L4 Discovery Azure デモ fw をコンパイルしようとしています。STM32CubeMX で生成された Makefile を取得し、キール プロジェクト ファイル (.uvprojx) のファイルと設定を入力しました。残念ながら、結果はリンク エラーで終了します。いくつかの掘り下げと汚れたパッチの後、エラーなしで Makefile を実行することができました。それでも私の目標は、適切な Makefile を作成することです。リンク中にサードパーティのコードが競合しないようにするにはどうすればよいですか?
C_SOURCE = \
...
Src/azure_base64.c \
Middlewares/Third_Party/mbedTLS/library/base64.c
Src/azure_base64.c
ただのラッパーに見える
#Include "../Middlewares/Third_Party/Azure-IoT-SDK-C/c-utility/src/base64.c"
https://github.com/acornblue/AZURE_LAB
Projects/Multi/Applications/Azure_Sns_DM/Makefile
Projects/Multi/Applications/Azure_Sns_DM/MDK-ARM/B-L475E-IOT01/Project.uvprojx
リンク エラー -
build/base64.o: In function `Base64_Decoder': /home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:188: multiple definition of `Base64_Decoder'
build/azure_base64.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:188: first defined here
build/base64.o: In function `base64char': /home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:19: multiple definition of `Base64_Encode_Bytes'
build/azure_base64.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:19: first defined here
build/base64.o: In function `base64char': /home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:19: multiple definition of `Base64_Encoder'
build/azure_base64.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/base64.c:19: first defined here
build/sha1.o: In function `SHA1Reset':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:84: multiple definition of `SHA1Reset'
build/azure_sha1.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:84: first defined here
build/sha1.o: In function `SHA1ProcessMessageBlock':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: multiple definition of `SHA1Input'
build/azure_sha1.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: first defined here
build/sha1.o: In function `SHA1ProcessMessageBlock':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: multiple definition of `SHA1FinalBits'
build/azure_sha1.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: first defined here
build/sha1.o: In function `SHA1ProcessMessageBlock':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: multiple definition of `SHA1Result'
build/azure_sha1.o:/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/Src/../../../../../Middlewares/Third_Parties/Azure-IoT-SDK-C/c-utility/src/sha1.c:366: first defined here
build/md_wrap.o: In function `sha1_process_wrap':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:364: undefined reference to `mbedtls_sha1_process'
build/md_wrap.o: In function `sha1_clone_wrap':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:352: undefined reference to `mbedtls_sha1_clone'
build/md_wrap.o: In function `sha1_ctx_free':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:358: undefined reference to `mbedtls_sha1_free'
build/md_wrap.o: In function `sha1_ctx_alloc':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:345: undefined reference to `mbedtls_sha1_init'
build/md_wrap.o: In function `sha1_finish_wrap':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:337: undefined reference to `mbedtls_sha1_finish'
build/md_wrap.o: In function `sha1_update_wrap':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:332: undefined reference to `mbedtls_sha1_update'
build/md_wrap.o: In function `sha1_starts_wrap':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/md_wrap.c:326: undefined reference to `mbedtls_sha1_starts'
build/md_wrap.o: (.rodata.mbedtls_sha1_info+0x1c): undefined reference to `mbedtls_sha1'
build/pem.o: In function `mbedtls_pem_read_buffer':/home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/pem.c:322: undefined reference to `mbedtls_base64_decode' /home/mxuser/projects/AZURE_LAB/Projects/Multi/Applications/Azure_Sns_DM/../../../../Middlewares/Third_Parties/mbedtls/library/pem.c:330: undefined reference to `mbedtls_base64_decode'
collect2: error: ld returned 1 exit status