Skip to content

Commit

Permalink
fix(Build): Allow Cordio to Build with Custom BSPs (#1209)
Browse files Browse the repository at this point in the history
Co-authored-by: Jake Carter <[email protected]>
  • Loading branch information
EricB-ADI and Jake-Carter authored Oct 4, 2024
1 parent f4649e2 commit ffa42a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Libraries/Cordio/platform/targets/maxim/build/cordio_lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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} MXC_OPTIMIZE_CFLAGS=${CORDIO_OPTIMIZE_CFLAGS} \
BT_VER=${BT_VER}

clean.cordio:
@$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk BUILD_DIR=${CORDIO_BUILD_DIR} clean

query.cordio:
@$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk query QUERY_VAR="${QUERY_VAR}"
@$(MAKE) -f ${CORDIO_DIR}/platform/targets/maxim/build/libCordio.mk query QUERY_VAR="${QUERY_VAR}"
9 changes: 6 additions & 3 deletions Libraries/Cordio/platform/targets/maxim/build/libCordio.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ SRCS += $(C_FILES)
VPATH += %.c $(sort $(dir $(C_FILES)))
IPATH += $(INC_DIRS)

# Add dependencies in the Board library and the PeripheralDrivers

IPATH += ${LIBS_DIR}/MiscDrivers/PushButton
IPATH += ${LIBS_DIR}/MiscDrivers/LED
IPATH += ${LIBS_DIR}/Boards/$(TARGET_UC)/$(BOARD)/Include
include ${LIBS_DIR}/PeriphDrivers/periphdriver.mk

# Add dependencies in the Board library and the PeripheralDrivers
LIB_BOARD = 1
LIB_PERIPHDRIVERS = 1
include ${LIBS_DIR}/libs.mk

# Use absolute paths if building within eclipse environment.
ifeq "$(ECLIPSE)" "1"
Expand Down
12 changes: 12 additions & 0 deletions Libraries/libs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,21 @@ LIBS_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# ************************
LIB_BOARD ?= 1
ifeq ($(LIB_BOARD), 1)

ifeq "$(BOARD)" ""
$(error ERROR: BOARD not set!)
endif

BSP_SEARCH_DIR ?= $(LIBS_DIR)/Boards/$(TARGET_UC)
BOARD_DIR := $(BSP_SEARCH_DIR)/$(BOARD)
PROJ_CFLAGS += -DLIB_BOARD

# Export BOARD and BSP_SEARCH_DIR so that all recursive Make sub-calls
# that include libs.mk will use the same BSP. Exports in general should
# be used sparingly since they will override ALL recursive sub-calls, but
# in this case we want to avoid building with mismatched BSPs.
export BOARD
export BSP_SEARCH_DIR
include $(BOARD_DIR)/board.mk
endif
# ************************
Expand Down

0 comments on commit ffa42a7

Please sign in to comment.