From c41d2074f0fed4af0be9eb8150556fdb67640f01 Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Wed, 30 Jul 2025 13:44:34 +1200 Subject: [PATCH 1/3] Add support for 64-bit ticks on ARM CM0 and CM33 --- portable/GCC/ARM_CM0/portmacro.h | 3 +++ portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/portable/GCC/ARM_CM0/portmacro.h b/portable/GCC/ARM_CM0/portmacro.h index 41519997bd..a76e408b51 100644 --- a/portable/GCC/ARM_CM0/portmacro.h +++ b/portable/GCC/ARM_CM0/portmacro.h @@ -69,6 +69,9 @@ typedef unsigned long UBaseType_t; /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do * not need to be guarded with a critical section. */ #define portTICK_TYPE_IS_ATOMIC 1 +#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS) + typedef uint64_t TickType_t; + #define portMAX_DELAY (TickType_t)0xffffffffffffffffULL #else #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width. #endif diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 33f21d85b6..96ce13d920 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -84,6 +84,9 @@ typedef unsigned long UBaseType_t; /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do * not need to be guarded with a critical section. */ #define portTICK_TYPE_IS_ATOMIC 1 +#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS) + typedef uint64_t TickType_t; + #define portMAX_DELAY (TickType_t)0xffffffffffffffffULL #else #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width. #endif From f542c3de99ecb51b8dbafce062a0effde65f02f9 Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Wed, 30 Jul 2025 13:44:58 +1200 Subject: [PATCH 2/3] Fix heap_4.c when using 64-bit ticks --- portable/MemMang/heap_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portable/MemMang/heap_4.c b/portable/MemMang/heap_4.c index d2914bb792..b9b9aebf93 100644 --- a/portable/MemMang/heap_4.c +++ b/portable/MemMang/heap_4.c @@ -560,7 +560,7 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ) /* PRIVI void vPortGetHeapStats( HeapStats_t * pxHeapStats ) { BlockLink_t * pxBlock; - size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */ + size_t xBlocks = 0, xMaxSize = 0, xMinSize = SIZE_MAX; vTaskSuspendAll(); { From bad67c7647f1ff013ce55a9d557ba769a52cef25 Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Wed, 30 Jul 2025 14:39:51 +1200 Subject: [PATCH 3/3] Keep formatting consistent --- portable/GCC/ARM_CM0/portmacro.h | 6 +++--- portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/portable/GCC/ARM_CM0/portmacro.h b/portable/GCC/ARM_CM0/portmacro.h index a76e408b51..bdc765803f 100644 --- a/portable/GCC/ARM_CM0/portmacro.h +++ b/portable/GCC/ARM_CM0/portmacro.h @@ -69,9 +69,9 @@ typedef unsigned long UBaseType_t; /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do * not need to be guarded with a critical section. */ #define portTICK_TYPE_IS_ATOMIC 1 -#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS) - typedef uint64_t TickType_t; - #define portMAX_DELAY (TickType_t)0xffffffffffffffffULL +#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS ) + typedef uint64_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL #else #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width. #endif diff --git a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h index 96ce13d920..17e3d40c7f 100644 --- a/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h +++ b/portable/GCC/ARM_CM33_NTZ/non_secure/portmacrocommon.h @@ -84,9 +84,9 @@ typedef unsigned long UBaseType_t; /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do * not need to be guarded with a critical section. */ #define portTICK_TYPE_IS_ATOMIC 1 -#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS) - typedef uint64_t TickType_t; - #define portMAX_DELAY (TickType_t)0xffffffffffffffffULL +#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS ) + typedef uint64_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffffffffffULL #else #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width. #endif