diff --git a/RPi-Pico/CMakeLists.txt b/RPi-Pico/CMakeLists.txt index 17c3722f..6adc5337 100644 --- a/RPi-Pico/CMakeLists.txt +++ b/RPi-Pico/CMakeLists.txt @@ -1,9 +1,13 @@ cmake_minimum_required(VERSION 3.13) -# Pull in Pico and FreeRTOS +# Pull in Pico SDK include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) #include(pico_extras_import_optional.cmake) -include($ENV{FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake) + +# Pull in FreeRTOS if available (required for WiFi/TCP/TLS examples) +if (DEFINED ENV{FREERTOS_KERNEL_PATH}) + include($ENV{FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake) +endif() if(PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0") @@ -27,6 +31,10 @@ if (USE_WIFI AND NOT PICO_CYW43_SUPPORTED) message(FATAL_ERROR "You can only set USE_WIFI when a PICO_BOARD with wifi is used") endif() +if (USE_WIFI AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH}) + message(FATAL_ERROR "FREERTOS_KERNEL_PATH environment variable must be set when USE_WIFI is enabled") +endif() + ### Global Include Path include_directories(config) include_directories(include) @@ -38,9 +46,11 @@ endif() #include_directories(${PICO_SDK_PATH}/lib/btstack/test/embedded/) set(WOLFSSL_ROOT $ENV{WOLFSSL_ROOT}) - set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH}) - include_directories(${FREERTOS_KERNEL_PATH}/include/) - include_directories(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include) + if (DEFINED ENV{FREERTOS_KERNEL_PATH}) + set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH}) + include_directories(${FREERTOS_KERNEL_PATH}/include/) + include_directories(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include) + endif() include_directories(${WOLFSSL_ROOT}) ### End of Global Include Path diff --git a/RPi-Pico/benchmark/CMakeLists.txt b/RPi-Pico/benchmark/CMakeLists.txt index 191f5dfa..b5719974 100644 --- a/RPi-Pico/benchmark/CMakeLists.txt +++ b/RPi-Pico/benchmark/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries(benchmark target_compile_definitions(benchmark PRIVATE WOLFSSL_RPI_PICO + PICO_STACK_SIZE=4096 ) if (USE_UART) diff --git a/RPi-Pico/config/user_settings.h b/RPi-Pico/config/user_settings.h index b5c379e2..4dd84813 100644 --- a/RPi-Pico/config/user_settings.h +++ b/RPi-Pico/config/user_settings.h @@ -45,7 +45,7 @@ extern time_t myTime(time_t *); /* ------------------------------------------------------------------------- */ /* Platform */ /* ------------------------------------------------------------------------- */ -#define WOLFSSL_GENERAL_ALIGNMENT 4 +#define WOLFSSL_GENERAL_ALIGNMENT 0 #define SIZEOF_LONG_LONG 8 #if 0 #define NO_64BIT /* disable use of 64-bit variables */ @@ -76,7 +76,7 @@ extern time_t myTime(time_t *); // #define WOLFSSL_SP_384 /* Enable ECC 384-bit SECP384R1 support */ // #define WOLFSSL_SP_CACHE_RESISTANT -#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */ +//#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */ #define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */ // #define WOLFSSL_SP_NO_MALLOC diff --git a/RPi-Pico/src/bench_main.c b/RPi-Pico/src/bench_main.c index a6bc6a8c..f1dc094a 100644 --- a/RPi-Pico/src/bench_main.c +++ b/RPi-Pico/src/bench_main.c @@ -37,9 +37,11 @@ int main(int argc, char **argv) int ret; stdio_init_all(); - printf("\nSystem clock = %dMHz\n\n", clock_get_hz(clk_sys)/1000000); - ret = benchmark_test(NULL); - printf("End: %d\n", ret); + while(1) { + printf("\nSystem clock = %dMHz\n\n", clock_get_hz(clk_sys)/1000000); + ret = benchmark_test(NULL); + printf("End: %d\n", ret); + } return ret; } diff --git a/RPi-Pico/wolfssl_import.cmake b/RPi-Pico/wolfssl_import.cmake index 20e6c6fa..0a0e9fb9 100644 --- a/RPi-Pico/wolfssl_import.cmake +++ b/RPi-Pico/wolfssl_import.cmake @@ -31,6 +31,8 @@ target_compile_definitions(wolfssl PUBLIC WOLFSSL_USER_SETTINGS ) +add_compile_definitions(PICO_USE_STACK_GUARDS=1) + if (${PICO_PLATFORM} STREQUAL "rp2350-arm-s") add_compile_definitions(wolfssl WOLFSSL_SP_ARM_CORTEX_M_ASM) elseif (${PICO_PLATFORM} STREQUAL "rp2350-riscv")