Skip to content

Commit 8e47edb

Browse files
authored
Merge pull request #557 from LinuxJedi/pico-fixes
Fixes to the Pi Pico build
2 parents eaea852 + b821577 commit 8e47edb

5 files changed

Lines changed: 25 additions & 10 deletions

File tree

RPi-Pico/CMakeLists.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
# Pull in Pico and FreeRTOS
3+
# Pull in Pico SDK
44
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
55
#include(pico_extras_import_optional.cmake)
6-
include($ENV{FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake)
6+
7+
# Pull in FreeRTOS if available (required for WiFi/TCP/TLS examples)
8+
if (DEFINED ENV{FREERTOS_KERNEL_PATH})
9+
include($ENV{FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake)
10+
endif()
711

812

913
if(PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0")
@@ -27,6 +31,10 @@ if (USE_WIFI AND NOT PICO_CYW43_SUPPORTED)
2731
message(FATAL_ERROR "You can only set USE_WIFI when a PICO_BOARD with wifi is used")
2832
endif()
2933

34+
if (USE_WIFI AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH})
35+
message(FATAL_ERROR "FREERTOS_KERNEL_PATH environment variable must be set when USE_WIFI is enabled")
36+
endif()
37+
3038
### Global Include Path
3139
include_directories(config)
3240
include_directories(include)
@@ -38,9 +46,11 @@ endif()
3846
#include_directories(${PICO_SDK_PATH}/lib/btstack/test/embedded/)
3947

4048
set(WOLFSSL_ROOT $ENV{WOLFSSL_ROOT})
41-
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH})
42-
include_directories(${FREERTOS_KERNEL_PATH}/include/)
43-
include_directories(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include)
49+
if (DEFINED ENV{FREERTOS_KERNEL_PATH})
50+
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH})
51+
include_directories(${FREERTOS_KERNEL_PATH}/include/)
52+
include_directories(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/include)
53+
endif()
4454
include_directories(${WOLFSSL_ROOT})
4555
### End of Global Include Path
4656

RPi-Pico/benchmark/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ target_link_libraries(benchmark
1111

1212
target_compile_definitions(benchmark PRIVATE
1313
WOLFSSL_RPI_PICO
14+
PICO_STACK_SIZE=4096
1415
)
1516

1617
if (USE_UART)

RPi-Pico/config/user_settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern time_t myTime(time_t *);
4545
/* ------------------------------------------------------------------------- */
4646
/* Platform */
4747
/* ------------------------------------------------------------------------- */
48-
#define WOLFSSL_GENERAL_ALIGNMENT 4
48+
#define WOLFSSL_GENERAL_ALIGNMENT 0
4949
#define SIZEOF_LONG_LONG 8
5050
#if 0
5151
#define NO_64BIT /* disable use of 64-bit variables */
@@ -76,7 +76,7 @@ extern time_t myTime(time_t *);
7676
// #define WOLFSSL_SP_384 /* Enable ECC 384-bit SECP384R1 support */
7777

7878
// #define WOLFSSL_SP_CACHE_RESISTANT
79-
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
79+
//#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
8080
#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
8181

8282
// #define WOLFSSL_SP_NO_MALLOC

RPi-Pico/src/bench_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ int main(int argc, char **argv)
3737
int ret;
3838

3939
stdio_init_all();
40-
printf("\nSystem clock = %dMHz\n\n", clock_get_hz(clk_sys)/1000000);
41-
ret = benchmark_test(NULL);
42-
printf("End: %d\n", ret);
40+
while(1) {
41+
printf("\nSystem clock = %dMHz\n\n", clock_get_hz(clk_sys)/1000000);
42+
ret = benchmark_test(NULL);
43+
printf("End: %d\n", ret);
44+
}
4345
return ret;
4446
}
4547

RPi-Pico/wolfssl_import.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ target_compile_definitions(wolfssl PUBLIC
3131
WOLFSSL_USER_SETTINGS
3232
)
3333

34+
add_compile_definitions(PICO_USE_STACK_GUARDS=1)
35+
3436
if (${PICO_PLATFORM} STREQUAL "rp2350-arm-s")
3537
add_compile_definitions(wolfssl WOLFSSL_SP_ARM_CORTEX_M_ASM)
3638
elseif (${PICO_PLATFORM} STREQUAL "rp2350-riscv")

0 commit comments

Comments
 (0)