Page 1 of 1

mqtt_ssl_mutual_auth test

Posted: Thu Aug 25, 2022 2:38 pm
by venkatesha kj
i am trying to test the secured mqtt test publish and subscribe in platformio but when i try to include the certificates i am getting errors like
Building in release mode
Linking .pio\build\esp32doit-devkit-v1\firmware.elf
c:/users/91889/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32doit-devkit-v1\src\wifi_app.o:(.literal.mqtt_app_start+0x8): undefined reference to `_binary_aws_root_ca_pem_start'
c:/users/91889/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32doit-devkit-v1\src\wifi_app.o:(.literal.mqtt_app_start+0xc): undefined reference to `_binary_certificate_pem_crt_start'
c:/users/91889/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32doit-devkit-v1\src\wifi_app.o:(.literal.mqtt_app_start+0x10): undefined reference to `_binary_private_pem_key_start'

i have added the the certificates in src/cert folder

i have added below commands in platformio.ini file
board_build.embed_txtfiles =
src/cert/private.pem.key
src/cert/certificate.pem.crt
src/cert/aws-root-ca.pem


and also i have added below commands in the cmakelist.txt file
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "src/cert/certificate.pem.crt" TEXT)
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "src/cert/private.pem.key" TEXT)
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "src/cert/aws-root-ca.pem" TEXT)