File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
2832int 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};
Original file line number Diff line number Diff line change @@ -262,6 +262,11 @@ if [ "$THIS_DIR" = "ARDUINO" ]; then
262262 # Copy examples
263263 mkdir -p " .${ROOT_SRC_DIR} " /examples
264264
265+ EXAMPLES_DIR_REAL_PATH=$( realpath " .${EXAMPLES_DIR} " )
266+ echo " Source WOLFSSL_EXAMPLES_ROOT=$WOLFSSL_EXAMPLES_ROOT "
267+ echo " Destination EXAMPLES_DIR=.${EXAMPLES_DIR} "
268+ echo " EXAMPLES_DIR_REAL_PATH=${EXAMPLES_DIR_REAL_PATH} "
269+
265270 if [ -n " $WOLFSSL_EXAMPLES_ROOT " ]; then
266271 echo " Copy template example...."
267272 mkdir -p " .${EXAMPLES_DIR} " /template/wolfssl_library/src
@@ -294,6 +299,9 @@ if [ "$THIS_DIR" = "ARDUINO" ]; then
294299 else
295300 NO_ARDUINO_EXAMPLES=1
296301 fi
302+ echo " Examples copied to .${EXAMPLES_DIR} "
303+ echo " ls ${EXAMPLES_DIR_REAL_PATH} "
304+ ls " ${EXAMPLES_DIR_REAL_PATH} "
297305else
298306 echo " ERROR: You must be in the IDE/ARDUINO directory to run this script"
299307 exit 1
Original file line number Diff line number Diff line change 9292#elif defined(WOLFSSL_SERVER_EXAMPLE )
9393 #define NO_WOLFSSL_CLIENT
9494#elif defined(WOLFSSL_TEMPLATE_EXAMPLE )
95+ #define NO_TLS
96+ #define WOLFCRYPT_ONLY
9597 #define NO_WOLFSSL_SERVER
9698 #define NO_WOLFSSL_CLIENT
9799#elif defined(WOLFSSL_AES_CTR_EXAMPLE )
100+ #define NO_TLS
101+ #define WOLFCRYPT_ONLY
98102 #define NO_WOLFSSL_SERVER
99103 #define NO_WOLFSSL_CLIENT
100104 #define WOLFSSL_AES
Original file line number Diff line number Diff line change 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__ )
You can’t perform that action at this time.
0 commit comments