From f6ec4e8bc36c42496d9c0c7c8b4272e9f4371e75 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Fri, 14 Jun 2019 21:26:34 +0200 Subject: [PATCH] build: Fix mistake while testing TARGET_BOARD Preprocessor can't use == on strings", so new symbols are introduced to test configurations at build time. Note, this mistake was harmless because there weren't any spefic parts among boards, but this will change in upcoming change. Change-Id: I45d87cccc086af05661eaf7b762a4a0274fb2ede Relate-to: https://github.com/rzr/webthing-iotjs/issues/3 Forwarded: https://github.com/pando-project/iotjs/pull/1892 IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com --- CMakeLists.txt | 3 +++ src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c | 2 +- src/platform/nuttx/iotjs_systemio-nuttx.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e865de58c7..0bbba3a20a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,9 @@ endif() # Add board-dependant flags iotjs_add_compile_flags(-DTARGET_BOARD=${TARGET_BOARD}) +string(TOUPPER ${TARGET_BOARD} TARGET_BOARD_UPPER) +string(CONCAT TARGET_BOARD_SYMBOL "TARGET_BOARD_" ${TARGET_BOARD_UPPER}) +iotjs_add_compile_flags(-D${TARGET_BOARD_SYMBOL}=1) if("${TARGET_BOARD}" STREQUAL "artik05x") iotjs_add_compile_flags(-mcpu=cortex-r4 -mfpu=vfp3) diff --git a/src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c b/src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c index 0ef2f6ede3..1075bf13f9 100644 --- a/src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c +++ b/src/modules/nuttx/iotjs_module_stm32f7nucleo-nuttx.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#if defined(__NUTTX__) && (TARGET_BOARD == stm32f7nucleo) +#if defined(__NUTTX__) && defined(TARGET_BOARD_STM32F7NUCLEO) #include "iotjs_systemio-nuttx.h" #include "stm32_gpio.h" diff --git a/src/platform/nuttx/iotjs_systemio-nuttx.c b/src/platform/nuttx/iotjs_systemio-nuttx.c index 3636143d10..b60d67e6cb 100644 --- a/src/platform/nuttx/iotjs_systemio-nuttx.c +++ b/src/platform/nuttx/iotjs_systemio-nuttx.c @@ -13,8 +13,8 @@ * limitations under the License. */ -#if defined(__NUTTX__) && \ - (TARGET_BOARD == stm32f4dis || TARGET_BOARD == stm32f7nucleo) +#if defined(__NUTTX__) && (defined(TARGET_BOARD_STM32F4DIS) || \ + (defined(TARGET_BOARD_STM32F7NUCLEO))) #include