ARC: MWDT: enable back BUILD_ASSERT macro
BUILD_ASSERT macro was disabled for MWDT toolchain from the moment of adding MWDT support to Zephyr. Built-in _Static_assert is now working fine for the most of the cases with MWDT toolchain so we can use it in BUILD_ASSERT. The only exception is _ARCH_MEM_PARTITION_ALIGN_CHECK macro as it often used with variable addresses as parameters which need to be checked at compile time. We disable _ARCH_MEM_PARTITION_ALIGN_CHECK for MWDT toolchain so we can use BUILD_ASSERT in other places. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
parent
8882467b53
commit
235a98e371
2 changed files with 12 additions and 6 deletions
|
@ -279,6 +279,12 @@ BUILD_ASSERT(CONFIG_PRIVILEGED_STACK_SIZE % Z_ARC_MPU_ALIGN == 0,
|
|||
#define K_MEM_PARTITION_IS_EXECUTABLE(attr) \
|
||||
((attr) & (AUX_MPU_ATTR_KE | AUX_MPU_ATTR_UE))
|
||||
|
||||
/*
|
||||
* BUILD_ASSERT in case of MWDT is a bit more picky in performing compile-time check.
|
||||
* For example it can't evaluate variable address at build time like GCC toolchain can do.
|
||||
* That's why we don't provide _ARCH_MEM_PARTITION_ALIGN_CHECK for MWDT toolchain.
|
||||
*/
|
||||
#ifndef __CCAC__
|
||||
#if CONFIG_ARC_MPU_VER == 2
|
||||
#define _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size) \
|
||||
BUILD_ASSERT(!(((size) & ((size) - 1))) && (size) >= Z_ARC_MPU_ALIGN \
|
||||
|
@ -295,6 +301,7 @@ BUILD_ASSERT(CONFIG_PRIVILEGED_STACK_SIZE % Z_ARC_MPU_ALIGN == 0,
|
|||
" and greater than or equal to 32." \
|
||||
"start address of the partition must align with 32.")
|
||||
#endif
|
||||
#endif /* __CCAC__ */
|
||||
#endif /* CONFIG_ARC_MPU*/
|
||||
|
||||
/* Typedef for the k_mem_partition attribute*/
|
||||
|
|
|
@ -84,13 +84,12 @@
|
|||
|
||||
#include <toolchain/gcc.h>
|
||||
|
||||
/* Metaware toolchain has _Static_assert. However it not able to calculate
|
||||
* conditional expression in build time for some realy complex cases. ARC GNU
|
||||
* toolchain works fine in this cases, so it looks like MWDT bug. So, disable
|
||||
* BUILD_ASSERT macro until we fix that issue in MWDT toolchain.
|
||||
*/
|
||||
#undef BUILD_ASSERT
|
||||
#define BUILD_ASSERT(EXPR, MSG...)
|
||||
#ifdef __cplusplus
|
||||
#define BUILD_ASSERT(EXPR, MSG...) static_assert(EXPR, "" MSG)
|
||||
#else
|
||||
#define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
|
||||
#endif
|
||||
|
||||
#define __builtin_arc_nop() _nop()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue