Skip to content

Commit 80ffa81

Browse files
authored
Merge pull request #16 from gojimmypi/Arduino-5.8.0-post-release
Arduino 5.8.0 post release
2 parents a2f4ff3 + c4052f6 commit 80ffa81

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

src/user_settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@
9090
#elif defined(WOLFSSL_SERVER_EXAMPLE)
9191
#define NO_WOLFSSL_CLIENT
9292
#elif defined(WOLFSSL_TEMPLATE_EXAMPLE)
93+
#define NO_TLS
94+
#define WOLFCRYPT_ONLY
9395
#define NO_WOLFSSL_SERVER
9496
#define NO_WOLFSSL_CLIENT
9597
#elif defined(WOLFSSL_AES_CTR_EXAMPLE)
98+
#define NO_TLS
99+
#define WOLFCRYPT_ONLY
96100
#define NO_WOLFSSL_SERVER
97101
#define NO_WOLFSSL_CLIENT
98102
#define WOLFSSL_AES

src/wolfssl-arduino.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,33 @@
2525
/* Function to allow wolfcrypt to use Arduino Serial.print for debug messages.
2626
* See wolfssl/wolfcrypt/logging.c */
2727

28+
#if defined(__AVR__)
29+
#include <avr/pgmspace.h> /* Required for PROGMEM handling on AVR */
30+
#endif
31+
2832
int wolfSSL_Arduino_Serial_Print(const char* const s)
2933
{
3034
/* Reminder: Serial.print is only available in C++ */
31-
Serial.println(F(s));
35+
int is_progmem = 0;
36+
37+
#if defined(__AVR__)
38+
const char* t;
39+
t = s;
40+
41+
/* Safely check if `s` is in PROGMEM, 0x8000 is typical for AVR flash */
42+
if (reinterpret_cast<uint16_t>(t) >= 0x8000) {
43+
while (pgm_read_byte(t)) {
44+
Serial.write(pgm_read_byte(t++));
45+
}
46+
Serial.println();
47+
is_progmem = 1;
48+
}
49+
#endif
50+
51+
/* Print normally for non-AVR boards or RAM-stored strings */
52+
if (!is_progmem) {
53+
Serial.println(s);
54+
}
55+
3256
return 0;
3357
};

src/wolfssl/wolfcrypt/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316

317317
/* board-specific */
318318
#if defined(__AVR__)
319+
#define WOLFSSL_USER_IO
319320
#define WOLFSSL_NO_SOCK
320321
#define NO_WRITEV
321322
#elif defined(__arm__)

0 commit comments

Comments
 (0)