Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gen3] Replace PLATFORM_ID checks with HAL macros in dynalib #2500

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dynalib/inc/dynalib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */ \
Expand Down
4 changes: 4 additions & 0 deletions hal/inc/hal_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling nit: missing a t in platform?


#endif /* HAL_PLATFORM_H */
4 changes: 3 additions & 1 deletion hal/src/nRF52840/hal_platform_nrf52840_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@

#define HAL_PLATFORM_PROHIBIT_XIP (1)

#define HAL_PLATFORM_CONCURRENT_DUMP_THREADS (1)
#define HAL_PLATFORM_CONCURRENT_DUMP_THREADS (1)

#define HAL_PLAFORM_DYNALIB_DYNAMIC_LOCATION (0)
2 changes: 2 additions & 0 deletions hal/src/rtl872x/hal_platform_rtl8721x_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions services/inc/include.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's better use same pattern as below for nanopb:

include $(PROJECT_ROOT)/hal/import.mk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am including this in the makefile itself, I am running into multiple definition problem -

../../../build/arm/startup/startup_rtl872x.S: Assembler messages:
../../../build/arm/startup/startup_rtl872x.S:160: Warning: ignoring changed section attributes for .text
/usr/local/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ../../../build/target/lwip/platform-32-m//liblwip.a(init.o): in function `lwip_init':
/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/init.c:333: multiple definition of `lwip_init'; ../../../build/target/lwip/platform-32-m//liblwip.a(init.o):/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/init.c:333: first defined here
/usr/local/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ../../../build/target/lwip/platform-32-m//liblwip.a(def.o): in function `lwip_htons':
/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/def.c:78: multiple definition of `lwip_htons'; ../../../build/target/lwip/platform-32-m//liblwip.a(def.o):/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/def.c:78: first defined here
/usr/local/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ../../../build/target/lwip/platform-32-m//liblwip.a(def.o): in function `lwip_htonl':
/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/def.c:93: multiple definition of `lwip_htonl'; ../../../build/target/lwip/platform-32-m//liblwip.a(def.o):/Users/keerthyamisagadda/code/device-os/third_party/lwip/lwip/src/core/def.c:93: first defined here
/usr/local/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ../../../build/target/lwip/platform-32-m//liblwip.a(def.o): in function `lwip_strnstr':

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)
Expand Down