From efc9870fb1ddd286954fc056b79dddf39f68353a Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 9 May 2024 12:06:07 +0200 Subject: freertos + lwip compile working --- main/CMakeLists.txt | 2 +- main/FreeRTOSConfig.h | 12 ++---------- main/lwipopts.h | 13 +++++++++++++ main/main.cpp | 4 ++-- 4 files changed, 18 insertions(+), 13 deletions(-) (limited to 'main') diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 27b3822..b86c077 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories(lib/pico-sdk/lib/lwip/contrib/ports/freertos/include) target_include_directories(main PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries(main - pico_cyw43_arch_lwip_threadsafe_background + pico_cyw43_arch_lwip_sys_freertos pico_stdlib FreeRTOS-Kernel FreeRTOS-Kernel-Heap4 diff --git a/main/FreeRTOSConfig.h b/main/FreeRTOSConfig.h index 4897d8d..c811296 100644 --- a/main/FreeRTOSConfig.h +++ b/main/FreeRTOSConfig.h @@ -1,17 +1,13 @@ #pragma once // values from pico-examples/pico_w/wifi/freertos -#ifdef __cplusplus -extern "C" { -#endif - #define configUSE_PREEMPTION 1 #define configUSE_TICKLESS_IDLE 0 #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configTICK_RATE_HZ ((TickType_t) 1000) #define configMAX_PRIORITIES 32 -#define configMINIMAL_STACK_SIZE ((configSTACK_DEPTH_TYPE) 256) +#define configMINIMAL_STACK_SIZE ((configSTACK_DEPTH_TYPE) 512) #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 @@ -29,7 +25,7 @@ extern "C" { #define configSUPPORT_STATIC_ALLOCATION 0 #define configSUPPORT_DYNAMIC_ALLOCATION 1 #define configTOTAL_HEAP_SIZE (128 * 1024) -#define configAPPLICATION_ALLOCATED_HEAP 4 +#define configAPPLICATION_ALLOCATED_HEAP 0 #define configCHECK_FOR_STACK_OVERFLOW 0 #define configUSE_MALLOC_FAILED_HOOK 0 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0 @@ -71,7 +67,3 @@ extern "C" { #define INCLUDE_xTaskResumeFromISR 1 #define INCLUDE_xQueueGetMutexHolder 1 -#ifdef __cplusplus -} // extern "C" -#endif - diff --git a/main/lwipopts.h b/main/lwipopts.h index 71c85b2..b2b6e76 100644 --- a/main/lwipopts.h +++ b/main/lwipopts.h @@ -77,3 +77,16 @@ #define SLIP_DEBUG LWIP_DBG_OFF #define DHCP_DEBUG LWIP_DBG_OFF +#define TCPIP_THREAD_STACKSIZE 2048 +#define DEFAULT_THREAD_STACKSIZE 1024 +#define DEFAULT_RAW_RECVMBOX_SIZE 8 +#define TCPIP_MBOX_SIZE 8 + +#define DEFAULT_UDP_RECVMBOX_SIZE TCPIP_MBOX_SIZE +#define DEFAULT_TCP_RECVMBOX_SIZE TCPIP_MBOX_SIZE +#define DEFAULT_ACCEPTMBOX_SIZE TCPIP_MBOX_SIZE + +#define LWIP_TIMEVAL_PRIVATE 0 + +#define LWIP_TCPIP_CORE_LOCKING_INPUT 1 + diff --git a/main/main.cpp b/main/main.cpp index d9d5e56..ace9f01 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -31,7 +31,7 @@ int main() { // this should compile but not work lwip_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - // xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL); - // vTaskStartScheduler(); + xTaskCreate((TaskFunction_t) blink_task, "blink", 128, NULL, 1, NULL); + vTaskStartScheduler(); } -- cgit v1.2.3