Makefile: For 5340 build both HAL versions as separate libraries

For the 5340,
so far we were only building the network core hal as part of the
HW models library.
Instead, split the HALs into their own libraries and build
both a network core and application core variant.

The 52833 variant build remains unchanged.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-10-20 14:09:50 +02:00
parent 68aa50bdcd
commit b9e1f00fcf
2 changed files with 40 additions and 9 deletions

35
5340.mk
View File

@ -4,16 +4,32 @@
include make_inc/pre.mk
VARIANT=NRF5340
HAL_VARIANT=NRF5340_XXAA_NETWORK
HW_SRCS_FILE=make_inc/5340_hw_files
HAL_SRCS_FILE=make_inc/5340_net_hal_files
HAL_NET_SRCS_FILE=make_inc/5340_net_hal_files
HAL_APP_SRCS_FILE=make_inc/5340_app_hal_files
SRCS_HW=$(shell cat ${HW_SRCS_FILE})
SRCS_HAL=$(shell cat ${HAL_SRCS_FILE})
SRCS_HAL_NET=$(shell cat ${HAL_NET_SRCS_FILE})
SRCS_HAL_APP=$(shell cat ${HAL_APP_SRCS_FILE})
SRCS=${SRCS_HW} ${SRCS_HAL}
ifneq (,$(findstring hal_net,$(MAKECMDGOALS)))
SRCS:=${SRCS_HAL_NET}
LIB_VARIANT:=_hal_net
HAL_VARIANT=NRF5340_XXAA_NETWORK
else ifneq (,$(findstring hal_app,$(MAKECMDGOALS)))
SRCS:=${SRCS_HAL_APP}
LIB_VARIANT:=_hal_app
HAL_VARIANT=NRF5340_XXAA_APPLICATION
else #hw
SRCS:=${SRCS_HW}
LIB_VARIANT:=
HAL_VARIANT=NRF5340_XXAA_NETWORK
endif
VARIANT=NRF5340${LIB_VARIANT}
hw: all
hal_net: all
hal_app: all
INCLUDES:=-I${NATIVE_SIM_PATH}/common/src/include/ \
-I${NATIVE_SIM_PATH}/common/src/ \
@ -40,8 +56,13 @@ WARNINGS:=-Wall -Wpedantic
COVERAGE:=
CFLAGS=${ARCH} ${DEBUG} ${OPT} ${WARNINGS} -MMD -MP -std=gnu11 \
${INCLUDES} -fdata-sections -ffunction-sections \
-D${VARIANT} -D_XOPEN_SOURCE=500 -D${HAL_VARIANT}
-DNRF5340 -D_XOPEN_SOURCE=500 -D${HAL_VARIANT}
LDFLAGS:=${ARCH} ${COVERAGE}
CPPFLAGS:=
include make_inc/common_post.mk
.PHONY: hw hal_net hal_app
# Let's explicitly tell make there is rule to make this file
5340.mk: ;

View File

@ -13,10 +13,20 @@ default: NRF52833
compile: NRF52833
NRF52833:
@$(MAKE) -f 52833.mk
@$(MAKE) --no-print-directory -f 52833.mk
NRF5340:
@$(MAKE) -f 5340.mk
@$(MAKE) --no-print-directory -f 5340.mk hw
@$(MAKE) --no-print-directory -f 5340.mk hal_net
@$(MAKE) --no-print-directory -f 5340.mk hal_app
NRF5340_hal_net:
@$(MAKE) --no-print-directory -f 5340.mk hw
@$(MAKE) --no-print-directory -f 5340.mk hal_net
NRF5340_hal_app:
@$(MAKE) --no-print-directory -f 5340.mk hw
@$(MAKE) --no-print-directory -f 5340.mk hal_app
# Let's just let the 52833 build handle any other target by default
%::