From 226d36a17f25a310f7ccf5c61140c4a3e6e35463 Mon Sep 17 00:00:00 2001 From: keeramis Date: Thu, 4 Aug 2022 00:34:15 -0500 Subject: [PATCH 1/2] Replace PLATFORM_IDs with hal define --- dynalib/inc/dynalib.h | 4 +++- hal/inc/hal_platform.h | 4 ++++ hal/src/nRF52840/hal_platform_nrf52840_config.h | 4 +++- hal/src/rtl872x/hal_platform_rtl8721x_config.h | 2 ++ services/inc/include.mk | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dynalib/inc/dynalib.h b/dynalib/inc/dynalib.h index db8052a43e..2444d29188 100644 --- a/dynalib/inc/dynalib.h +++ b/dynalib/inc/dynalib.h @@ -30,6 +30,8 @@ // DYNALIB_IMPORT is defined to produce a set of function stubs // +#include "hal_platform_config.h" + // DYNALIB_EXTERN_C to mark symbols with C linkage #ifdef __cplusplus #define DYNALIB_EXTERN_C extern "C" @@ -125,7 +127,7 @@ constexpr T2* dynalib_checked_cast(T2 *p) { #define __S(x) #x #define __SX(x) __S(x) - #if PLATFORM_ID == 32 + #if HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION #define DYNALIB_FN_IMPORT(index, tablename, name, counter) \ DYNALIB_STATIC_ASSERT(index == counter, "Index of the dynamically exported function has changed"); \ const char check_name_##tablename_##name[0]={}; /* this will fail if the name is already defined */ \ diff --git a/hal/inc/hal_platform.h b/hal/inc/hal_platform.h index 5f07a48476..6bb9c91169 100644 --- a/hal/inc/hal_platform.h +++ b/hal/inc/hal_platform.h @@ -513,4 +513,8 @@ #define HAL_PLATFORM_CELLULAR_MODEM_VOLTAGE_TRANSLATOR (1) #endif // HAL_PLATFORM_CELLULAR_MODEM_VOLTAGE_TRANSLATOR +#ifndef HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION +#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (0) +#endif // HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION + #endif /* HAL_PLATFORM_H */ diff --git a/hal/src/nRF52840/hal_platform_nrf52840_config.h b/hal/src/nRF52840/hal_platform_nrf52840_config.h index 02273391fb..3576a64e98 100644 --- a/hal/src/nRF52840/hal_platform_nrf52840_config.h +++ b/hal/src/nRF52840/hal_platform_nrf52840_config.h @@ -108,4 +108,6 @@ #define HAL_PLATFORM_PROHIBIT_XIP (1) -#define HAL_PLATFORM_CONCURRENT_DUMP_THREADS (1) \ No newline at end of file +#define HAL_PLATFORM_CONCURRENT_DUMP_THREADS (1) + +#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (0) \ No newline at end of file diff --git a/hal/src/rtl872x/hal_platform_rtl8721x_config.h b/hal/src/rtl872x/hal_platform_rtl8721x_config.h index 61b2a09947..bc0525ce9c 100644 --- a/hal/src/rtl872x/hal_platform_rtl8721x_config.h +++ b/hal/src/rtl872x/hal_platform_rtl8721x_config.h @@ -130,3 +130,5 @@ #define HAL_PLATFORM_SYSTEM_POOL_SIZE 1024 #define HAL_PLATFORM_MODULE_SUFFIX_EXTENSIONS (1) + +#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (1) diff --git a/services/inc/include.mk b/services/inc/include.mk index 97a857126b..900ffe2dcf 100644 --- a/services/inc/include.mk +++ b/services/inc/include.mk @@ -2,6 +2,9 @@ TARGET_SPARK_SERVICES_PATH=$(SERVICES_MODULE_PATH) INCLUDE_DIRS += $(TARGET_SPARK_SERVICES_PATH)/inc +INCLUDE_DIRS += $(PROJECT_ROOT)/hal/src/$(PLATFORM_DYNALIB_MODULES) +INCLUDE_DIRS += $(PROJECT_ROOT)/hal/src/$(PLATFORM_MCU) +INCLUDE_DIRS += $(PROJECT_ROOT)/hal/shared SERVICES_DEPS = third_party/nanopb SERVICES_DEPS_INCLUDE_SCRIPTS =$(foreach module,$(SERVICES_DEPS),$(PROJECT_ROOT)/$(module)/import.mk) From 30bece788ef562e13aedaffca90c154885a99958 Mon Sep 17 00:00:00 2001 From: keeramis Date: Thu, 4 Aug 2022 11:31:05 -0500 Subject: [PATCH 2/2] Fix typo --- dynalib/inc/dynalib.h | 2 +- hal/inc/hal_platform.h | 6 +++--- hal/src/nRF52840/hal_platform_nrf52840_config.h | 2 +- hal/src/rtl872x/hal_platform_rtl8721x_config.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dynalib/inc/dynalib.h b/dynalib/inc/dynalib.h index 2444d29188..7fc49ddb6c 100644 --- a/dynalib/inc/dynalib.h +++ b/dynalib/inc/dynalib.h @@ -127,7 +127,7 @@ constexpr T2* dynalib_checked_cast(T2 *p) { #define __S(x) #x #define __SX(x) __S(x) - #if HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION + #if HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION #define DYNALIB_FN_IMPORT(index, tablename, name, counter) \ DYNALIB_STATIC_ASSERT(index == counter, "Index of the dynamically exported function has changed"); \ const char check_name_##tablename_##name[0]={}; /* this will fail if the name is already defined */ \ diff --git a/hal/inc/hal_platform.h b/hal/inc/hal_platform.h index 6bb9c91169..b9b42fce3f 100644 --- a/hal/inc/hal_platform.h +++ b/hal/inc/hal_platform.h @@ -513,8 +513,8 @@ #define HAL_PLATFORM_CELLULAR_MODEM_VOLTAGE_TRANSLATOR (1) #endif // HAL_PLATFORM_CELLULAR_MODEM_VOLTAGE_TRANSLATOR -#ifndef HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION -#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (0) -#endif // HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION +#ifndef HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION +#define HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION (0) +#endif // HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION #endif /* HAL_PLATFORM_H */ diff --git a/hal/src/nRF52840/hal_platform_nrf52840_config.h b/hal/src/nRF52840/hal_platform_nrf52840_config.h index 3576a64e98..31a82c2a44 100644 --- a/hal/src/nRF52840/hal_platform_nrf52840_config.h +++ b/hal/src/nRF52840/hal_platform_nrf52840_config.h @@ -110,4 +110,4 @@ #define HAL_PLATFORM_CONCURRENT_DUMP_THREADS (1) -#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (0) \ No newline at end of file +#define HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION (0) \ No newline at end of file diff --git a/hal/src/rtl872x/hal_platform_rtl8721x_config.h b/hal/src/rtl872x/hal_platform_rtl8721x_config.h index bc0525ce9c..72140d0414 100644 --- a/hal/src/rtl872x/hal_platform_rtl8721x_config.h +++ b/hal/src/rtl872x/hal_platform_rtl8721x_config.h @@ -131,4 +131,4 @@ #define HAL_PLATFORM_MODULE_SUFFIX_EXTENSIONS (1) -#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (1) +#define HAL_PLATFORM_DYNALIB_DYNAMIC_LOCATION (1)