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

fix(build): Allow Cordio to build without LIB_BOARD=1 #1209

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EricB-ADI
Copy link
Contributor

Pull Request Template

Description

Cordio depends on led.h and led.c, which required board.h and board.c. If LIB_BOARD=0 cordio fails to build. This is an issue with custom boards not in the MSDK. cordio.mk now uses BOARD_DIR directly to allow this to override the LIB_BOARD switch.

@github-actions github-actions bot added the BLE Related to Bluetooth label Oct 3, 2024
@@ -92,11 +92,11 @@ ${CORDIO_BUILD_DIR}/${CORDIO_LIB}: ${CORDIO_C_FILES} ${PROJECTMK}
$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk lib MAXIM_PATH=${MAXIM_PATH} PROJECT=${CORDIO_LIB} \
CORDIO_LIB_VAR=${CORDIO_LIB_VAR} BUILD_DIR=${CORDIO_BUILD_DIR} MFLOAT_ABI=$(MFLOAT_ABI) \
DUAL_CORE=$(DUAL_CORE) RISCV_CORE=$(RISCV_CORE) TRACE=${TRACE} DEBUG=${DEBUG} RTOS=${RTOS} \
CFG_DEV="${CFG_DEV}" PROJECTMK=${PROJECTMK} BOARD=${BOARD} MXC_OPTIMIZE_CFLAGS=${CORDIO_OPTIMIZE_CFLAGS} \
CFG_DEV="${CFG_DEV}" PROJECTMK=${PROJECTMK} BOARD=${BOARD} BSP_SEARCH_DIR=$(BSP_SEARCH_DIR) BOARD_DIR=$(BOARD_DIR) MXC_OPTIMIZE_CFLAGS=${CORDIO_OPTIMIZE_CFLAGS} \
Copy link
Contributor

Choose a reason for hiding this comment

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

@EricB-ADI @kevin-gillespie LIB_BOARD=0 isn't intended as the mechanism for implementing custom BSPs. It disables the BSP abstraction entirely (which Cordio is dependent on for the HAL).

Custom BSPs should use the existing options to provide a "board.h", so I think adding BSP_SEARCH_DIR to CFG_DEV here would be sufficient to get them working.

Supporting LIB_BOARD=0 would mean supporting a build without the concept of a BSP which implies no "board.h". We could check for the LIB_BOARD definition to wrap the inclusion. It gets added here:

PROJ_CFLAGS += -DLIB_BOARD

diff --git a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c
index 16dd4dd44a..635dfb725d 100644
--- a/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c
+++ b/Libraries/Cordio/platform/targets/maxim/max32655/sources/pal_uart.c
@@ -35,7 +35,9 @@
 #include "pal_led.h"
 #include "pal_sys.h"
 
+#ifdef LIB_BOARD
 #include "board.h"
+#endif
 
 #include "uart.h"
 #include "sema.h"
diff --git a/Libraries/MiscDrivers/LED/led.h b/Libraries/MiscDrivers/LED/led.h
index 6ea14a3362..a3353123c9 100644
--- a/Libraries/MiscDrivers/LED/led.h
+++ b/Libraries/MiscDrivers/LED/led.h
@@ -27,7 +27,9 @@
 #define LIBRARIES_MISCDRIVERS_LED_LED_H_
 
 #include "mxc_assert.h"
+#ifdef LIB_BOARD
 #include "board.h"
+#endif
 #include "gpio.h"
 
 #ifdef __cplusplus

... but the build error moves to missing definitions on TERMINAL_UART, etc.

"board.h" seems the only mechanism for users to pass these in to the HAL, so this may not even be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BLE Related to Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants