I am having trouble finding a cause for a hard fault in a transmission using the MQTT-TLS library, so I am trying to flash the Argon for debug. When I do this I get many errors for multiple definitions of variables that are found in the MQTT library and some mbedtls folders in firmware 1.4.0.
Does anybody know how to navigate these errors easily to run in debug mode?
Iβm having the same issue here, also using MQTT-TLS. I have not found a way around it unfortunately, and have not been able to debug adequately since adding that library. Iβd also love to see some solution to the problem. All of the libraries Iβve found that donβt use mbedTLS have licensing models not compatible with mine (MIT).
I build debug builds from Workbench inside VS Code. MQTT-TLS was installed via Workbench from the Particle library. Standard project structure with src and lib directories, building from cpp (no .ino file to preprocess).
You can reproduce the problem by creating a test project, installing the MQTT-TLS library and attempting to compile for Debug.
Sample of compiler output (truncated due to many errors):
../build/target/hal/platform-13//libhal.a(aes_alt.o): In function `mbedtls_aes_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/aes_alt.c:60: multiple definition of `mbedtls_aes_init'
../build/target/user/platform-13/tls//libuser.a(aes.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/aes.cpp:522: first defined here
../build/target/hal/platform-13//libhal.a(aes_alt.o): In function `mbedtls_aes_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/aes_alt.c:60: multiple definition of `mbedtls_aes_free'
../build/target/user/platform-13/tls//libuser.a(aes.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/aes.cpp:405: first defined here
../build/target/hal/platform-13//libhal.a(aes_alt.o): In function `mbedtls_aes_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/aes_alt.c:60: multiple definition of `mbedtls_aes_setkey_enc'
../build/target/user/platform-13/tls//libuser.a(aes.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/aes.cpp:405: first defined here
../build/target/hal/platform-13//libhal.a(aes_alt.o): In function `mbedtls_aes_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/aes_alt.c:60: multiple definition of `mbedtls_aes_setkey_dec'
../build/target/user/platform-13/tls//libuser.a(aes.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/aes.cpp:405: first defined here
../build/target/hal/platform-13//libhal.a(aes_alt.o): In function `mbedtls_aes_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/aes_alt.c:60: multiple definition of `mbedtls_aes_crypt_ecb'
../build/target/user/platform-13/tls//libuser.a(aes.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/aes.cpp:405: first defined here
../build/target/hal/platform-13//libhal.a(sha1_alt_cc310.o): In function `mbedtls_sha1_init':
/Users/reidforrest/.particle/toolchains/deviceOS/1.2.0-beta.1/firmware-1.2.0-beta.1/hal/src/nRF52840/mbedtls/sha1_alt_cc310.c:29: multiple definition of `mbedtls_sha1_init'
../build/target/user/platform-13/tls//libuser.a(sha1.o):/Users/reidforrest/software/picsilcloud/picsilsense/test/tls/lib/MQTT-TLS/src/mbedtls/sha1.cpp:83: first defined here
../build/target/hal/platform-13//libhal.a(sha1_alt_cc310.o): In function `cc310_enable':
Complete source for the project (after installing MQTT-TLS lib in Workbench):
/*
* Project tls
* Description:
* Author:
* Date:
*/
#include "MQTT-TLS.h"
// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
pinMode(D7, OUTPUT);
digitalWrite(D7, HIGH);
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
// The core of your code will likely live here.
}
This code compiles fine normally, but will throw errors about redefinition of all parts of mbedtls if compiled for debugging due to the library also being used by DeviceOS.
Hi @picsil and @varnerb - Iβll inquire internally with respect to future potential adaptation so as to permit this library in monolithic builds. Iβve received your support ticket and will convey any response I receive both there and here.
The best, and easiest, workaround here would be to switch the protocol from UDP to TCP for your cloud connection while debugging so that DeviceOS wonβt use mbedtls.
However, depending on the degree that the above is crucial to your debug process, you could mark the functions in DeviceOS that are duplicated by MQTT-TLS as weak (therefore replaceable). However, our team maintains that there is no guarantee that this will function - its possible that the mbedtls configuration at stake is different from the one we use in DeviceOS, and therefore the functions wonβt necessarily have the same behaviors.