From 85db836f8e17a9db55c2c2c6e3f0496e8291d77a Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Sun, 28 Apr 2024 16:11:24 +0800 Subject: [PATCH] soc: imx7d: fix CPP application building error For CPP application, such as samples/cpp/cpp_synchronization/, it will report the following building errors: ... zephyrproject/modules/hal/nxp/imx/devices/MCIMX7D/./MCIMX7D_M4.h:5101:51: error: 'reinterpret_cast(808976384)' is not a constant expression ... The error is caused by commit: 72312feeadcdffd6e0f5d5d0d73a75110c7109b7 " arch: arm: cortex_m: Use cmsis api instead of inline asm in arch_irq_*" This patch will cause kernel.h includes cmsis_core.h which includes soc.h, so that soc.h will be used by c++ code. This patch make soc.h can be c++ compatible. Signed-off-by: Jiafei Pan --- soc/nxp/imx/imx7d/soc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/soc/nxp/imx/imx7d/soc.h b/soc/nxp/imx/imx7d/soc.h index 5f9540084b..8998d11ee0 100644 --- a/soc/nxp/imx/imx7d/soc.h +++ b/soc/nxp/imx/imx7d/soc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NXP + * Copyright 2017,2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,12 +9,18 @@ #ifndef _ASMLANGUAGE +#include + +#ifndef __cplusplus + #include "rdc.h" #include "rdc_defs_imx7d.h" #include "ccm_imx7d.h" #include "clock_freq.h" #include "soc_clk_freq.h" +#endif /* !__cplusplus */ + #endif /* !_ASMLANGUAGE */ #endif /* _SOC__H_ */