Skip to content

Commit

Permalink
hal: Allow to set used PLO_DEVICES from outside
Browse files Browse the repository at this point in the history
PLO_DEVICES is allowed to be steered by buildsystem. It allows to
decrease PLO size by not including unneeded devices in plo binary

JIRA: DEND-366
  • Loading branch information
anglov committed Mar 29, 2024
1 parent 514edce commit afab84e
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CFLAGS += -I.
CPPFLAGS += -DVERSION=\"$(VERSION)\"

OBJS :=
# hal Makefile should be included first as it add cmds and devices definitions
# hal Makefile needs to be included first as it adds cmds and devices definitions
include hal/$(TARGET_SUFF)/Makefile
include lib/Makefile
include devices/Makefile
Expand Down
5 changes: 5 additions & 0 deletions devices/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
#

OBJS += $(addprefix $(PREFIX_O)devices/, devs.o)

PLO_DEVICES ?= $(PLO_ALLDEVICES)

PLO_USED_DEVS := $(filter $(PLO_ALLDEVICES), $(PLO_DEVICES))
include $(foreach dev, $(PLO_USED_DEVS), devices/$(dev)/Makefile)
28 changes: 22 additions & 6 deletions hal/armv7a/imx6ull/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,33 @@ CFLAGS += -DVADDR_KERNEL_INIT=$(VADDR_KERNEL_INIT)
PLO_COMMANDS ?= alias app call console copy dump echo erase go help jffs2 kernel map mem phfs script \
test-dev test-ddr wait

ifeq ($(PLO_NAND), y)
include devices/nand-imx6ull/Makefile
PLO_ALLDEVICES := nand-imx6ull flash-imx6ull uart-imx6ull usbc-cdc

ifdef PLO_NAND
$(warning Usage of PLO_NAND is deprecated, devices should be passed explicitly)
PLO_DEVCFG_DEPRECATED = y
endif
ifeq ($(PLO_NOR), y)
include devices/flash-imx6ull/Makefile

ifdef PLO_NOR
$(warning Usage of PLO_NOR is deprecated, devices should be passed explicitly)
PLO_DEVCFG_DEPRECATED = y
endif

ifdef PLO_DEVCFG_DEPRECATED
PLO_ALLDEVICES := $(filter-out nand-imx6ull flash-imx6ull, $(PLO_ALLDEVICES))
ifeq ($(PLO_NAND), y)
PLO_ALLDEVICES += nand-imx6ull
endif

ifeq ($(PLO_NOR), y)
PLO_ALLDEVICES += flash-imx6ull
endif
endif


ifeq ($(PLO_NOR_BOOT), y)
CFLAGS += -DPLO_NOR_BOOT
endif
include devices/uart-imx6ull/Makefile
include devices/usbc-cdc/Makefile

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/$(TARGET_SUBFAMILY)/, _init.o imx6ull.o hal.o timer.o \
interrupts.o console.o)
6 changes: 1 addition & 5 deletions hal/armv7a/zynq7000/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ CFLAGS += -DVADDR_KERNEL_INIT=$(VADDR_KERNEL_INIT)
PLO_COMMANDS ?= alias app bitstream call console copy dump echo erase go help jffs2 kernel map mem \
phfs reboot script test-ddr test-dev wait

include devices/gpio-zynq7000/Makefile
include devices/usbc-cdc/Makefile
include devices/uart-zynq7000/Makefile
include devices/flash-zynq7000/Makefile
include devices/sdcard-zynq7000/Makefile
PLO_ALLDEVICES := gpio-zynq7000 usbc-cdc uart-zynq7000 flash-zynq7000 sdcard-zynq7000

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/$(TARGET_SUBFAMILY)/, _init.o hal.o zynq.o timer.o \
interrupts.o console.o)
6 changes: 2 additions & 4 deletions hal/armv7m/imxrt/10xx/105x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ CFLAGS+= -mfloat-abi=soft
PLO_COMMANDS ?= alias app call console copy dump echo erase go help kernel kernelimg map \
mem mpu otp phfs reboot script wait

#include devices/pipe-rtt/Makefile
include devices/usbc-cdc/Makefile
include devices/uart-imxrt106x/Makefile
include devices/flash-imxrt/Makefile
# pipe-rtt is disabled due to small amount of space in DTCM; RTT_ADDR is not defined for this architecture
PLO_ALLDEVICES := usbc-cdc uart-imxrt106x flash-imxrt

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/imxrt/10xx/105x/, _init.o imxrt.o)
5 changes: 1 addition & 4 deletions hal/armv7m/imxrt/10xx/106x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ CFLAGS+= -mfloat-abi=soft
PLO_COMMANDS ?= alias app bootrom call console copy dump echo erase go help kernel kernelimg map \
mem mpu otp phfs reboot script wait

include devices/pipe-rtt/Makefile
include devices/usbc-cdc/Makefile
include devices/uart-imxrt106x/Makefile
include devices/flash-imxrt/Makefile
PLO_ALLDEVICES := pipe-rtt usbc-cdc uart-imxrt106x flash-imxrt

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/imxrt/10xx/106x/, _init.o imxrt.o bootrom.o)
5 changes: 1 addition & 4 deletions hal/armv7m/imxrt/117x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ CFLAGS += -mfloat-abi=soft
PLO_COMMANDS ?= alias app bootcm4 bootrom call console copy dump echo erase go help kernel kernelimg \
map mem mpu otp phfs reboot script wait

include devices/pipe-rtt/Makefile
include devices/usbc-cdc/Makefile
include devices/uart-imxrt117x/Makefile
include devices/flash-imxrt/Makefile
PLO_ALLDEVICES := pipe-rtt usbc-cdc uart-imxrt117x flash-imxrt

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/imxrt/117x/, _init.o imxrt.o timer.o console.o bootrom.o otp.o)
5 changes: 1 addition & 4 deletions hal/armv7m/stm32/l4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ CFLAGS += -mfloat-abi=soft
PLO_COMMANDS ?= alias app bankswitch call console copy dump echo go help kernelimg map mem mpu \
phfs reboot script wait

#include devices/pipe-rtt/Makefile
include devices/uart-stm32l4x6/Makefile
include devices/flash-stm32/Makefile
include devices/ram-storage/Makefile
PLO_ALLDEVICES := pipe-rtt uart-stm32l4x6 flash-stm32 ram-storage

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/stm32/l4/, _init.o stm32l4.o timer.o console.o)
3 changes: 1 addition & 2 deletions hal/armv8m/nrf/91/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ CFLAGS += -mfloat-abi=soft
PLO_COMMANDS ?= alias app call console copy dump echo go help kernel kernelimg map mem phfs \
reboot script wait

include devices/uart-nrf9160/Makefile
include devices/flash-nrf9160/Makefile
PLO_ALLDEVICES := uart-nrf9160 flash-nrf9160

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/nrf/91/, _init.o nrf91.o timer.o console.o)
4 changes: 1 addition & 3 deletions hal/ia32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ CFLAGS += -Ihal/ia32

PLO_COMMANDS ?= alias app call console copy dump echo go help kernel lspci map mem phfs script reboot syspage wait

include devices/disk-bios/Makefile
include devices/tty-bios/Makefile
include devices/uart-16550/Makefile
PLO_ALLDEVICES := disk-bios tty-bios uart-16550

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/, _exceptions.o _init.o _interrupts.o cpu.o exceptions.o hal.o interrupts.o memory.o pci.o string.o timer.o acpi.o)

Expand Down
8 changes: 2 additions & 6 deletions hal/riscv64/generic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ GCCLIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)

PLO_COMMANDS ?= alias app call console copy dump echo go help kernel map mem phfs reboot script wait

include devices/ram-storage/Makefile
ifeq ($(TARGET_PROJECT),spike)
include devices/tty-spike/Makefile
else
include devices/uart-16550/Makefile
endif
# tty-spike and uart-16550 registers under same major
PLO_ALLDEVICES := ram-storage tty-spike uart-16550

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/$(TARGET_SUBFAMILY)/, hal.o)
3 changes: 1 addition & 2 deletions hal/sparcv8leon3/gaisler/gr712rc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CFLAGS += -DVADDR_KERNEL_INIT=$(VADDR_KERNEL_INIT)

PLO_COMMANDS ?= alias app call console copy dump echo go help jffs2 kernel map mem phfs reboot script wait test-dev

include devices/uart-grlib/Makefile
include devices/flash-gr712rc/Makefile
PLO_ALLDEVICES := uart-grlib flash-gr712rc

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/gaisler/$(TARGET_SUBFAMILY)/, _init.o hal.o gr712rc.o)
6 changes: 1 addition & 5 deletions hal/sparcv8leon3/gaisler/gr716/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ CFLAGS += -DVADDR_KERNEL_INIT=$(VADDR_KERNEL_INIT)

PLO_COMMANDS ?= alias app call console copy dump echo go help kernel map mem phfs reboot script wait

include devices/gpio-gr716/Makefile
include devices/uart-grlib/Makefile
ifeq ($(TARGET_PROJECT), mini)
include devices/flash-gr716/Makefile
endif
PLO_ALLDEVICES := gpio-gr716 uart-grlib flash-gr716

OBJS += $(addprefix $(PREFIX_O)hal/$(TARGET_SUFF)/gaisler/$(TARGET_SUBFAMILY)/, _init.o hal.o gr716.o)

0 comments on commit afab84e

Please sign in to comment.