diff --git a/CMakeLists.txt b/CMakeLists.txt index ba4cb3f..d9e0818 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ target_link_libraries(${TARGETNAME} pico_stdlib pico_flash mbuspico_web_res - FreeRTOS-Kernel-Heap4 # FreeRTOS kernel and dynamic heap + FreeRTOS-Kernel-Heap4 mbedtls_crypto mongoose littlefs diff --git a/FreeRTOS/FreeRTOS-Kernel b/FreeRTOS/FreeRTOS-Kernel index 13f034e..553b0ad 160000 --- a/FreeRTOS/FreeRTOS-Kernel +++ b/FreeRTOS/FreeRTOS-Kernel @@ -1 +1 @@ -Subproject commit 13f034eb7480f11c9fc43e7b51a1e55656985bf4 +Subproject commit 553b0ad5d395fb06e205907edd875b0abca235d0 diff --git a/FreeRTOS/FreeRTOSConfig.h b/FreeRTOS/FreeRTOSConfig.h index eae56c4..68f14ee 100644 --- a/FreeRTOS/FreeRTOSConfig.h +++ b/FreeRTOS/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - * FreeRTOS V202111.00 + * FreeRTOS V202212.00 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -19,10 +19,9 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * - * 1 tab == 4 spaces! */ #ifndef FREERTOS_CONFIG_H @@ -61,8 +60,7 @@ #define configUSE_QUEUE_SETS 1 #define configUSE_TIME_SLICING 1 #define configUSE_NEWLIB_REENTRANT 0 -// todo need this for lwip FreeRTOS sys_arch to compile -#define configENABLE_BACKWARD_COMPATIBILITY 1 +#define configENABLE_BACKWARD_COMPATIBILITY 1 // needed for lwip FreeRTOS sys_arch to compile #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 /* System */ @@ -76,8 +74,8 @@ #define configAPPLICATION_ALLOCATED_HEAP 0 /* Hook function related definitions. */ -#define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_MALLOC_FAILED_HOOK 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0 /* Run time and task stats gathering related definitions. */ @@ -85,10 +83,6 @@ #define configUSE_TRACE_FACILITY 1 #define configUSE_STATS_FORMATTING_FUNCTIONS 0 -/* Co-routine related definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES 1 - /* Software timer related definitions. */ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) @@ -102,14 +96,12 @@ #define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application] */ -#if FREE_RTOS_KERNEL_SMP // set by the RP2040 SMP port of FreeRTOS /* SMP port only */ -#define configNUM_CORES 2 +#define configNUMBER_OF_CORES 2 +#define configNUM_CORES configNUMBER_OF_CORES // needed to make pico-sdk (cyw43) run correctly, until its fixed there #define configTICK_CORE 0 -#define configRUN_MULTIPLE_PRIORITIES 1 +#define configRUN_MULTIPLE_PRIORITIES 0 #define configUSE_CORE_AFFINITY 1 -#define configUSE_TASK_PREEMPTION_DISABLE 0 -#endif /* RP2040 specific */ #define configSUPPORT_PICO_SYNC_INTEROP 1 @@ -140,43 +132,8 @@ to exclude the API function. */ /* A header file that defines trace macro can be included here. */ -/* Include logging header files and define logging configurations in the - * following order: - * 1. Include the header file "logging_levels.h". - * 2. Define the logging configurations for your application. It is required - * to define LIBRARY_LOG_NAME, LIBRARY_LOG_LEVEL and SdkLog macros. - * 3. Include the header file "logging_stack.h". - */ - -//#include "logging_levels.h" -//#include "iot_logging_setup.h" - -/* Logging configurations for the application. */ - -/* Set the application log name. */ -#ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "rpi-mbus" -#endif - -/* Set the logging verbosity level. */ -#ifndef LIBRARY_LOG_LEVEL - #define LIBRARY_LOG_LEVEL LOG_INFO -#endif - -/* Define the metadata information to add in each log. - * The example here sets the metadata to [:]. */ -#if !defined( LOG_METADATA_FORMAT ) && !defined( LOG_METADATA_ARGS ) - #define LOG_METADATA_FORMAT "[%s:%d]" - #define LOG_METADATA_ARGS __FILE__, __LINE__ -#endif - -/* Define the platform-specific logging function to call from - * enabled logging macros. */ -#ifndef SdkLog - #define SdkLog( message ) printf(message "\n") -#endif - -/************ End of logging configuration ****************/ +/* SMP Related config. */ +#define configUSE_PASSIVE_IDLE_HOOK 0 +#define portSUPPORT_SMP 1 #endif /* FREERTOS_CONFIG_H */ - diff --git a/FreeRTOS/freertos_port.c b/FreeRTOS/freertos_port.c deleted file mode 100644 index 5282197..0000000 --- a/FreeRTOS/freertos_port.c +++ /dev/null @@ -1,65 +0,0 @@ -/* FreeRTOS includes. */ -#include "FreeRTOS.h" -#include "FreeRTOS_Sockets.h" - -void * mbuspi_platform_calloc( size_t nmemb, size_t size ) -{ - size_t totalSize = nmemb * size; - void * pBuffer = NULL; - /* Check that neither nmemb nor size were 0. */ - if( totalSize > 0 ) { - /* Overflow check. */ - if( ( totalSize / size ) == nmemb ) { - pBuffer = pvPortMalloc( totalSize ); - if( pBuffer != NULL ) { - ( void ) memset( pBuffer, 0x00, totalSize ); - } - } - } - return pBuffer; -} - -void mbuspi_platform_free( void * ptr ) -{ - vPortFree( ptr ); -} - -/*-----------------------------------------------------------*/ - -void mbuspi_platform_mutex_init( mbuspi_threading_mutex_t * pMutex ) -{ - configASSERT( pMutex != NULL ); - /* Create a statically-allocated FreeRTOS mutex. This should never fail as storage is provided. */ - pMutex->mutexHandle = xSemaphoreCreateMutexStatic( &( pMutex->mutexStorage ) ); - configASSERT( pMutex->mutexHandle != NULL ); -} - -void mbuspi_platform_mutex_free( mbuspi_threading_mutex_t * pMutex ) -{ - /* Nothing needs to be done to free a statically-allocated FreeRTOS mutex. */ - ( void ) pMutex; -} - -int mbuspi_platform_mutex_lock( mbuspi_threading_mutex_t * pMutex ) -{ - BaseType_t mutexStatus = 0; - configASSERT( pMutex != NULL ); - /* mutexStatus is not used if asserts are disabled. */ - ( void ) mutexStatus; - /* This function should never fail if the mutex is initialized. */ - mutexStatus = xSemaphoreTake( pMutex->mutexHandle, portMAX_DELAY ); - configASSERT( mutexStatus == pdTRUE ); - return 0; -} - -int mbuspi_platform_mutex_unlock( mbuspi_threading_mutex_t * pMutex ) -{ - BaseType_t mutexStatus = 0; - configASSERT( pMutex != NULL ); - /* mutexStatus is not used if asserts are disabled. */ - ( void ) mutexStatus; - /* This function should never fail if the mutex is initialized. */ - mutexStatus = xSemaphoreGive( pMutex->mutexHandle ); - configASSERT( mutexStatus == pdTRUE ); - return 0; -} diff --git a/FreeRTOS/threading_alt.h b/FreeRTOS/threading_alt.h deleted file mode 100644 index 3ded62c..0000000 --- a/FreeRTOS/threading_alt.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef THREADING_ALT_H -#define THREADING_ALT_H - -#include "FreeRTOS.h" -#include "semphr.h" - -typedef struct mbuspi_threading_mutex { - SemaphoreHandle_t mutexHandle; - StaticSemaphore_t mutexStorage; -} mbuspi_threading_mutex_t; - -/* mutex functions. */ -void mbuspi_platform_mutex_init( mbuspi_threading_mutex_t * pMutex ); -void mbuspi_platform_mutex_free( mbuspi_threading_mutex_t * pMutex ); -int mbuspi_platform_mutex_lock( mbuspi_threading_mutex_t * pMutex ); -int mbuspi_platform_mutex_unlock( mbuspi_threading_mutex_t * pMutex ); - -#endif // THREADING_ALT_H