Skip to content

Commit 407c9d5

Browse files
committed
MCU8MASS-3048 MCU8MASS-2997 Fix compatibility issues with latest version of ArduionJson. This commit also fixes some of the warnings when using the -Wall flag with arduino-cli, namely unused arguments in functions.
1 parent 1a494e7 commit 407c9d5

File tree

17 files changed

+101
-77
lines changed

17 files changed

+101
-77
lines changed

.vscode/settings.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
{
22
"C_Cpp.errorSquiggles": "enabled",
3-
"cSpell.words": [
4-
"atcab",
5-
"CEREG",
6-
"CFUN",
7-
"CREG",
8-
"Sequans",
9-
"SQNHTTPQRY",
10-
"SQNHTTPRCV",
11-
"SQNHTTPSND"
12-
],
13-
"C_Cpp.clang_format_fallbackStyle": "{ IndentWidth: 4, AllowShortLoopsOnASingleLine: true, AllowShortBlocksOnASingleLine: true, ColumnLimit: 80, BinPackParameters: false, BinPackArguments: false, AllowAllParametersOfDeclarationOnNextLine: false, AlignConsecutiveMacros: true, FixNamespaceComments: false, NamespaceIndentation: All, AlignConsecutiveAssignments: true, AlignEscapedNewlines: true, AlignOperands: Align, AlignTrailingComments: true, AllowAllParametersOfDeclarationOnNextLine: false, AllowAllArgumentsOnNextLine: false, PenaltyBreakAssignment: 50, PointerAlignment: Left, ReferenceAlignment: Left }",
3+
"C_Cpp.clang_format_fallbackStyle": "{ IndentWidth: 4, AllowShortLoopsOnASingleLine: true, AllowShortBlocksOnASingleLine: true, ColumnLimit: 80, BinPackParameters: false, BinPackArguments: false, AlignConsecutiveMacros: true, FixNamespaceComments: false, NamespaceIndentation: All, AlignConsecutiveAssignments: true, AlignEscapedNewlines: true, AlignOperands: Align, AlignTrailingComments: true, AllowAllParametersOfDeclarationOnNextLine: false, AllowAllArgumentsOnNextLine: false, PenaltyBreakAssignment: 50, PointerAlignment: Left, ReferenceAlignment: Left }",
144
"pytest.testing.cwd": "${workspaceFolder}/test",
155
"python.testing.pytestArgs": [
16-
"--port=COM12",
6+
"--port=COM14",
177
"--ignore=lib",
188
"-s"
199
],

examples/extract_certificates/extract_certificates.ino

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void setup() {
2828
ATCA_STATUS atca_status = ECC608.begin();
2929

3030
if (atca_status != ATCA_SUCCESS) {
31-
Log.errorf(F("Failed to initialize ECC608, status code: 0x%X\r\n"),
31+
Log.errorf(F("Failed to initialize ECC608, status code: %d\r\n"),
3232
atca_status);
3333
return;
3434
}
@@ -46,28 +46,26 @@ void setup() {
4646
&max_root_certificate_size)) != ATCACERT_E_SUCCESS) {
4747

4848
Log.errorf(F("Failed to get root certificate's max size, status code: "
49-
"0x%X\r\n"),
49+
"%d\r\n"),
5050
atca_cert_status);
5151
return;
5252
}
5353

5454
if ((atca_cert_status = ECC608.getSignerCertificateSize(
5555
&max_signer_certificate_size)) != ATCACERT_E_SUCCESS) {
5656

57-
Log.errorf(
58-
F("Failed to get signer certificate's max size, status code: "
59-
"0x%X\r\n"),
60-
atca_cert_status);
57+
Log.errorf(F("Failed to get signer certificate's max size, status "
58+
"code: %d\r\n"),
59+
atca_cert_status);
6160
return;
6261
}
6362

6463
if ((atca_cert_status = ECC608.getDeviceCertificateSize(
6564
&max_device_certificate_size)) != ATCACERT_E_SUCCESS) {
6665

67-
Log.errorf(
68-
F("Failed to get device certificate's max size, status code: "
69-
"0x%X\r\n"),
70-
atca_cert_status);
66+
Log.errorf(F("Failed to get device certificate's max size, status "
67+
"code: %d\r\n"),
68+
atca_cert_status);
7169
return;
7270
}
7371

@@ -90,7 +88,7 @@ void setup() {
9088
&root_certificate_size)) != ATCACERT_E_SUCCESS) {
9189

9290
Log.errorf(F("Failed to get root certificate, status code: "
93-
"0x%X\r\n"),
91+
"%d\r\n"),
9492
atca_cert_status);
9593
return;
9694
} else {
@@ -110,7 +108,7 @@ void setup() {
110108
&signer_certificate_size)) != ATCACERT_E_SUCCESS) {
111109

112110
Log.errorf(F("Failed to get signer certificate, status code: "
113-
"0x%X\r\n"),
111+
"%d\r\n"),
114112
atca_cert_status);
115113
return;
116114
} else {

examples/mqtt_aws/mqtt_aws.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void setup() {
9090
if (published_successfully) {
9191
Log.info(F("Published message"));
9292
} else {
93-
Log.error(F("Failed to publish\r\n"));
93+
Log.error(F("Failed to publish"));
9494
}
9595

9696
delay(2000);

examples/plant_monitoring/plant_monitoring.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void setup() {
109109
*/
110110
size_t retrieveData(char* data, const size_t data_capacity) {
111111
// Get air metrics
112-
StaticJsonDocument<50> air_data;
112+
JsonDocument air_data;
113113
sensors_event_t humidity, temperature;
114114
aht.getEvent(&humidity, &temperature);
115115

@@ -118,16 +118,16 @@ size_t retrieveData(char* data, const size_t data_capacity) {
118118
air_data["Illumination"] = veml.readLux();
119119

120120
// Get soil metrics
121-
StaticJsonDocument<25> soil_data;
121+
JsonDocument soil_data;
122122
const float moisture_level = 100 * ((float)seesaw.touchRead(0) / 1023);
123123
soil_data["Moisture"] = moisture_level;
124124

125125
// Get device metrics
126-
StaticJsonDocument<25> device_data;
126+
JsonDocument device_data;
127127
device_data["SupplyVoltage"] = LowPower.getSupplyVoltage();
128128

129129
// Build data payload
130-
StaticJsonDocument<200> payload;
130+
JsonDocument payload;
131131
payload["Device_ID"] = DEVICE_ID;
132132
payload["Air"] = air_data;
133133
payload["Soil"] = soil_data;

examples/provision/provision.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,8 @@ static ATCA_STATUS constructCSR(char* pem, size_t* pem_size) {
11421142
.cert_elements = NULL,
11431143
.cert_elements_count = 0,
11441144
.cert_template = csr,
1145-
.cert_template_size = length};
1145+
.cert_template_size = length,
1146+
.ca_cert_def = NULL};
11461147

11471148
return (ATCA_STATUS)atcacert_create_csr_pem(&csr_definition, pem, pem_size);
11481149
}
@@ -1672,7 +1673,7 @@ void otherServiceMqttProvision() {
16721673

16731674
while (!requestAndSaveToNVM(
16741675
F("Please paste in the CA certificate and press enter. It "
1675-
"should be on the follwing form:\r\n"
1676+
"should be on the following form:\r\n"
16761677
"-----BEGIN CERTIFICATE-----\r\n"
16771678
"MIIDXTCCAkWgAwIBAgIJAJC1[...]j3tCx2IUXVqRs5mlSbvA==\r\n"
16781679
"-----END CERTIFICATE-----\r\n"),
@@ -1775,7 +1776,7 @@ void otherServiceMqttProvision() {
17751776
while (!requestAndSaveToNVM(
17761777
F("Please paste in the public key certificate provide by "
17771778
"your broker after having signed the CSR\r\nand press "
1778-
"enter. It should be on the follwing form:\r\n"
1779+
"enter. It should be on the following form:\r\n"
17791780
"-----BEGIN CERTIFICATE-----\r\n"
17801781
"MIIDXTCCAkWgAwIBAgIJAJC1[...]j3tCx2IUXVqRs5mlSbvA=="
17811782
"\r\n"
@@ -1870,7 +1871,7 @@ void otherServiceMqttProvision() {
18701871
while (!requestAndSaveToNVM(
18711872
F("Please paste in the public key certificate and press "
18721873
"enter. It "
1873-
"should be on the follwing form:\r\n"
1874+
"should be on the following form:\r\n"
18741875
"-----BEGIN CERTIFICATE-----\r\n"
18751876
"MIIDXTCCAkWgAwIBAgIJAJC1[...]j3tCx2IUXVqRs5mlSbvA==\r\n"
18761877
"-----END CERTIFICATE-----\r\n"),
@@ -2001,7 +2002,7 @@ void provisionHttp() {
20012002
while (!requestAndSaveToNVM(
20022003
F("Please paste in the CA certificate and press enter. It "
20032004
"should "
2004-
"be on the follwing form:\r\n"
2005+
"be on the following form:\r\n"
20052006
"-----BEGIN CERTIFICATE-----\r\n"
20062007
"MIIDXTCCAkWgAwIBAgIJAJC1[...]j3tCx2IUXVqRs5mlSbvA=="
20072008
"\r\n"

examples/sandbox/sandbox.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ void resetInterrupt(void) {
9595
void disconnectedFromNetwork(void) { event_flags |= NETWORK_DISCONN_FLAG; }
9696
void disconnectedFromBroker(void) { event_flags |= BROKER_DISCONN_FLAG; }
9797

98-
void receivedMessage(const char* topic,
99-
const uint16_t msg_length,
98+
void receivedMessage(__attribute__((unused)) const char* topic,
99+
__attribute__((unused)) const uint16_t msg_length,
100100
const int32_t msg_id) {
101101

102102
received_message_identifiers_head = (received_message_identifiers_head +
@@ -143,7 +143,7 @@ void startStreamTimer() {
143143

144144
void stopStreamTimer() { TCA0.SINGLE.CTRLA = 0; }
145145

146-
static StaticJsonDocument<256> doc;
146+
static JsonDocument doc;
147147

148148
void decodeMessage(const char* message) {
149149
DeserializationError error = deserializeJson(doc, message);
@@ -182,12 +182,12 @@ void decodeMessage(const char* message) {
182182

183183
if (strcmp_P(target_led, PSTR("USER")) == 0) {
184184
led = Led::USER;
185-
} else if (strcmp(target_led, "ERROR") == 0) {
185+
} else if (strcmp_P(target_led, PSTR("ERROR")) == 0) {
186186
led = Led::ERROR;
187187
} else {
188188
Log.errorf(F("Invalid LED value provided, "
189189
"led provided = %s\r\n"),
190-
led);
190+
target_led);
191191
return;
192192
}
193193

scripts/compile_examples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BOARD_CONFIG="DxCore:megaavr:avrdb:appspm=no,chip=avr128db48,clock=24internal,bo
55
# Test for AVR-IoT Cellular Mini
66
for d in examples/*/ ; do
77
echo "Compiling $d...";
8-
arduino-cli compile -b $BOARD_CONFIG --libraries=".." "$d" --build-path "builds/mini/$(basename $d)";
8+
arduino-cli compile -b $BOARD_CONFIG --libraries=".." "$d" --build-path "builds/mini/$(basename $d)" --warnings all;
99

1010
# Check the error code
1111
if [ $? != 0 ]; then

scripts/make.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ pushd %~dp0
44
set SCRIPTPATH=%CD%
55
popd
66

7-
set TARGET="%SCRIPTPATH%\..\examples\mqtt_azure\mqtt_azure.ino"
7+
set TARGET="%SCRIPTPATH%\..\examples\mqtt_custom_broker\mqtt_custom_broker.ino"
88
set BUILD_DIR="%SCRIPTPATH%\..\build"
99
set BOARD_CONFIG="DxCore:megaavr:avrdb:appspm=no,chip=avr128db48,clock=24internal,bodvoltage=1v9,bodmode=disabled,eesave=enable,resetpin=reset,millis=tcb2,startuptime=8,wiremode=mors2,printf=full"
1010

1111
rmdir /s /q %BUILD_DIR%
1212

1313
echo Compiling...
1414

15-
arduino-cli compile %TARGET% -b %BOARD_CONFIG% --build-path %BUILD_DIR%
15+
arduino-cli compile %TARGET% -b %BOARD_CONFIG% --build-path %BUILD_DIR% --warnings all

scripts/make.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ fi
1111
echo "Compiling..."
1212

1313
# Extra args appended to the end, e.g. --clean by the $1 flag
14-
arduino-cli compile "$TARGET" -b $BOARD_CONFIG --build-path "$SCRIPTPATH/../build" $1
14+
arduino-cli compile "$TARGET" -b $BOARD_CONFIG --build-path "$SCRIPTPATH/../build" --warnings all $1

src/cryptoauthlib/lib/atca_iface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ uint8_t ifacecfg_get_address(ATCAIfaceCfg * cfg)
465465
ATCA_STATUS ifacecfg_set_address(
466466
ATCAIfaceCfg * cfg, /**< [in] Interface configuration structure to update */
467467
uint8_t addr, /**< [in] Desired address */
468-
ATCAKitType kitiface /**< [in] Optional parameter to set the kit iface type */
468+
__attribute__((unused)) ATCAKitType kitiface /**< [in] Optional parameter to set the kit iface type */
469469
)
470470
{
471471
ATCA_STATUS status = ATCA_BAD_PARAM;

0 commit comments

Comments
 (0)