From c5bec0e4b2c65034189f7dc05eac559a438c6546 Mon Sep 17 00:00:00 2001 From: "Dennis Lambe Jr." Date: Tue, 5 Aug 2025 06:32:03 -0400 Subject: [PATCH 1/2] LLVM assembler compatibility for ARM_CRx_MPU (#1303) GNU as makes unrecognized sections loadable and writable by default, but LLVM's assembler requires specifying flags explicitly. Without them, the linker generates "has non-ABS relocation" errors when trying to link the resulting object files. --- portable/GCC/ARM_CRx_MPU/mpu_wrappers_v2_asm.S | 2 +- portable/GCC/ARM_CRx_MPU/portASM.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/portable/GCC/ARM_CRx_MPU/mpu_wrappers_v2_asm.S b/portable/GCC/ARM_CRx_MPU/mpu_wrappers_v2_asm.S index 142486adf..caf31ff76 100644 --- a/portable/GCC/ARM_CRx_MPU/mpu_wrappers_v2_asm.S +++ b/portable/GCC/ARM_CRx_MPU/mpu_wrappers_v2_asm.S @@ -30,7 +30,7 @@ .arm .syntax unified - .section freertos_system_calls + .section freertos_system_calls, "ax" #define FREERTOS_ASSEMBLY #include "FreeRTOSConfig.h" diff --git a/portable/GCC/ARM_CRx_MPU/portASM.S b/portable/GCC/ARM_CRx_MPU/portASM.S index bc0345a80..2b6f22ef2 100644 --- a/portable/GCC/ARM_CRx_MPU/portASM.S +++ b/portable/GCC/ARM_CRx_MPU/portASM.S @@ -28,7 +28,7 @@ .arm .syntax unified - .section privileged_functions + .section privileged_functions, "ax" #define FREERTOS_ASSEMBLY #include "portmacro_asm.h" From e9440d4079894e0d6c52ce80e4c79fc072743d9d Mon Sep 17 00:00:00 2001 From: creiter64 <106512497+creiter64@users.noreply.github.com> Date: Tue, 5 Aug 2025 13:11:54 +0200 Subject: [PATCH 2/2] Move windows headers to port.c (#1302) * [MSVC-MingW] Move windows headers to port.c This prevents the inclusion of windows.h. into all header files using FreeRTOS.h and thus defining several macros conflicting with common definitions. * [MSVC-MingW] Include correct header for compiler intrinsics --------- Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> --- portable/MSVC-MingW/port.c | 8 ++++++++ portable/MSVC-MingW/portmacro.h | 18 +++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/portable/MSVC-MingW/port.c b/portable/MSVC-MingW/port.c index 9ce0c1b15..74dd777ef 100644 --- a/portable/MSVC-MingW/port.c +++ b/portable/MSVC-MingW/port.c @@ -33,6 +33,14 @@ #include "FreeRTOS.h" #include "task.h" +#ifdef WIN32_LEAN_AND_MEAN + #include +#else + #include +#endif + +#include + #ifdef __GNUC__ #include "mmsystem.h" #else diff --git a/portable/MSVC-MingW/portmacro.h b/portable/MSVC-MingW/portmacro.h index eb94758be..37bfb2586 100644 --- a/portable/MSVC-MingW/portmacro.h +++ b/portable/MSVC-MingW/portmacro.h @@ -29,17 +29,6 @@ #ifndef PORTMACRO_H #define PORTMACRO_H -#ifdef WIN32_LEAN_AND_MEAN - #include -#else - #include -#endif - -#include -#include -#include -#include - #ifdef __cplusplus extern "C" { #endif @@ -156,22 +145,25 @@ void vPortExitCritical( void ); : "cc" ) #else /* __GNUC__ */ + #include /* BitScanReverse returns the bit position of the most significant '1' * in the word. */ #if defined( __x86_64__ ) || defined( _M_X64 ) + #pragma intrinsic(_BitScanReverse64) #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \ do \ { \ - DWORD ulTopPriority; \ + unsigned long ulTopPriority; \ _BitScanReverse64( &ulTopPriority, ( uxReadyPriorities ) ); \ uxTopPriority = ulTopPriority; \ } while( 0 ) #else /* #if defined( __x86_64__ ) || defined( _M_X64 ) */ + #pragma intrinsic(_BitScanReverse) - #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) ) + #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( unsigned long * ) &( uxTopPriority ), ( uxReadyPriorities ) ) #endif /* #if defined( __x86_64__ ) || defined( _M_X64 ) */