Skip to content

Conversation

@gojimmypi
Copy link
Contributor

@gojimmypi gojimmypi commented Apr 14, 2025

Description

Related to #8514 this PR fixes the Arduino Serial.print() used by wolfSSL logging via wolfSSL_Arduino_Serial_Print().

Without this change, some Arduino targets (e.g. AVR Arduino Uno) will see a compile-time error:

C:\\Users\\gojimmypi\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\gojimmypi\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\gojimmypi\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\standard" "-Ic:\\Users\\gojimmypi\\Documents\\Arduino\\libraries\\wolfssl\\src" "c:\\Users\\gojimmypi\\Documents\\Arduino\\libraries\\wolfssl\\src\\wolfssl-arduino.cpp" -o "C:\\Users\\gojimmypi\\AppData\\Local\\arduino\\sketches\\89891228178DAE8CA0A558C95DF5D42C\\libraries\\wolfssl\\wolfssl-arduino.cpp.o"
In file included from C:\Users\gojimmypi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:28:0,
                 from c:\Users\gojimmypi\Documents\Arduino\libraries\wolfssl\src\wolfssl-arduino.cpp:22:
c:\Users\gojimmypi\Documents\Arduino\libraries\wolfssl\src\wolfssl-arduino.cpp: In function 'int wolfSSL_Arduino_Serial_Print(const char*)':
C:\Users\gojimmypi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:38:74: error: initializer fails to determine size of '__c'
 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
                                                                          ^
c:\Users\gojimmypi\Documents\Arduino\libraries\wolfssl\src\wolfssl-arduino.cpp:31:21: note: in expansion of macro 'F'
      Serial.println(F(s));
                     ^
C:\Users\gojimmypi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/WString.h:38:74: error: array must be initialized with a brace-enclosed initializer
 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
                                                                          ^
c:\Users\gojimmypi\Documents\Arduino\libraries\wolfssl\src\wolfssl-arduino.cpp:31:21: note: in expansion of macro 'F'
      Serial.println(F(s));
                     ^

Using library wolfssl at version 5.7.6 in folder: C:\Users\gojimmypi\Documents\Arduino\libraries\wolfssl 
exit status 1

Edit: during testing I added some additional logging to the IDE/ARDUINO/wolfssl-arduino.sh publishing script, as well as some board-specific checks for networking capabilities in wolfcrypt/settings.h

Fixes zd# n/a

Testing

How did you test?

Manually tested in Arduino IDE with manual install (note new example location, see wolfSSL/wolfssl-examples#499).

$ echo $WOLFSSL_EXAMPLES_ROOT
/mnt/c/workspace/wolfssl-examples-gojimmypi
gojimmypi:/mnt/c/workspace/wolfssl-gojimmypi-pr/IDE/ARDUINO
$ ./wolfssl-arduino.sh INSTALL

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gojimmypi gojimmypi requested a review from dgarske April 14, 2025 10:40
@gojimmypi gojimmypi marked this pull request as draft April 14, 2025 13:25
@gojimmypi gojimmypi added the For This Release Release version 5.8.4 label Apr 14, 2025
@gojimmypi gojimmypi marked this pull request as ready for review April 14, 2025 18:39
@dgarske dgarske requested a review from douzzer April 15, 2025 14:43
@dgarske dgarske removed the For This Release Release version 5.8.4 label Apr 17, 2025
@gojimmypi
Copy link
Contributor Author

Sorry for the delay in responding; I was away from my computer for several days.

I've removed some less-than-ideal, hardware-specific detection from the original PR settings.h file.

Although it would be nice to have this PR in the upcoming release, it is not essential. These changes can still be applied manually to the Arduino-wolfSSL used to publish the Arduino library version of wolfssl.

@gojimmypi
Copy link
Contributor Author

Jenkins retest this please

For Unable to create live FilePath for wolf-linux-cloud-node-[nnn]; wolf-linux-cloud-node-[nnn] was marked offline: Connection was broken

@dgarske dgarske merged commit 6eb8dfb into wolfSSL:master May 6, 2025
186 checks passed
gojimmypi added a commit to gojimmypi/Arduino-wolfSSL that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants