From 513ba04168c6de6679699090d2d228250d8d2135 Mon Sep 17 00:00:00 2001 From: Dat Nguyen Duy Date: Wed, 22 Nov 2023 17:11:29 +0700 Subject: [PATCH] soc: nxp_s32: cmsis rtos v2 adaptation There are symbols are both defined by the NXP S32 HAL and the CMSIS RTOS V2 wrapper, to avoid interference between them, redefine the symbols under an enum. Also this is may a common issue for all NXP S32 platforms, move to common place to be reused Signed-off-by: Dat Nguyen Duy --- soc/arm/nxp_s32/common/cmsis_rtos_v2_adapt.h | 19 +++++++++++++++++++ soc/arm/nxp_s32/s32k3/soc.h | 7 +------ soc/arm/nxp_s32/s32ze/soc.h | 4 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 soc/arm/nxp_s32/common/cmsis_rtos_v2_adapt.h diff --git a/soc/arm/nxp_s32/common/cmsis_rtos_v2_adapt.h b/soc/arm/nxp_s32/common/cmsis_rtos_v2_adapt.h new file mode 100644 index 00000000000..ab2bcd971f0 --- /dev/null +++ b/soc/arm/nxp_s32/common/cmsis_rtos_v2_adapt.h @@ -0,0 +1,19 @@ +/* + * Copyright 2023 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_SOC_ARM_NXP_S32_COMMON_CMSIS_RTOS_V2_ADAPT_H_ +#define ZEPHYR_SOC_ARM_NXP_S32_COMMON_CMSIS_RTOS_V2_ADAPT_H_ + +/* + * The HAL is defining these symbols already. To avoid interference + * between HAL and the CMSIS RTOS wrapper, redefine them under an enum. + */ +#undef TRUE +#undef FALSE + +enum { FALSE, TRUE}; + +#endif /* ZEPHYR_SOC_ARM_NXP_S32_COMMON_CMSIS_RTOS_V2_ADAPT_H_ */ diff --git a/soc/arm/nxp_s32/s32k3/soc.h b/soc/arm/nxp_s32/s32k3/soc.h index bbc53e18023..ef2734554df 100644 --- a/soc/arm/nxp_s32/s32k3/soc.h +++ b/soc/arm/nxp_s32/s32k3/soc.h @@ -10,12 +10,7 @@ #include #if defined(CONFIG_CMSIS_RTOS_V2) -/* - * The HAL is defining these symbols already. To avoid redefinitions, - * let CMSIS RTOS wrapper define them. - */ -#undef TRUE -#undef FALSE +#include #endif /* Aliases for peripheral base addresses */ diff --git a/soc/arm/nxp_s32/s32ze/soc.h b/soc/arm/nxp_s32/s32ze/soc.h index f7c96aa2ed9..e042ebe8af9 100644 --- a/soc/arm/nxp_s32/s32ze/soc.h +++ b/soc/arm/nxp_s32/s32ze/soc.h @@ -16,6 +16,10 @@ #error "SoC not supported" #endif +#if defined(CONFIG_CMSIS_RTOS_V2) +#include +#endif + /* Aliases for peripheral base addresses */ /* SIUL2 */