add explicit get-deps target to fetch submodule dependency

- fix app linker warnings for imxrt port
- fix GIT_SUBMODULE_VERSIONS missing lib in some cases
This commit is contained in:
hathach 2023-02-07 19:30:04 +07:00
parent bcfb07c748
commit ab89757696
5 changed files with 18 additions and 11 deletions

View file

@ -76,6 +76,7 @@ jobs:
- name: Build
run: |
arm-none-eabi-gcc --version
make -C $ENV_PORT BOARD=${{ matrix.board }} get-deps
make -C $ENV_PORT BOARD=${{ matrix.board }} all self-update copy-artifact
for app in ${{ env.ENV_PORT }}/apps/*/; do if [ $app != 'apps/self_update/' ]; then make -C $app BOARD=${{ matrix.board }} all; fi done

View file

@ -49,14 +49,18 @@ To build this for a specific board, we need to change current directory to its p
$ cd ports/stm32f4
```
Then compile with `make BOARD=[board_name] all`, for example
Firstly we need to get all of submodule dependecy for our board e.g mcu driver with `get-deps` target. You only need to do this once for each mcu family
```
make BOARD=feather_stm32f405_express get-deps
```
Then compile with `all` target:
```
make BOARD=feather_stm32f405_express all
```
The required mcu driver submodule if any will be clone automatically if needed.
### Flash
`flash` target will use the default on-board debugger (jlink/cmsisdap/stlink/dfu) to flash the binary, please install those support software in advance. Some board use bootloader/DFU via serial which is required to pass to make command

View file

@ -40,13 +40,6 @@ ifeq ($(wildcard $(TOP)/$(BOARD_DIR)/),)
$(error Invalid BOARD specified)
endif
# Fetch submodules depended by family
fetch_submodule_if_empty = $(if $(wildcard $(TOP)/lib/$1/*),,$(info $(shell git -C $(TOP)/lib submodule update --init $1)))
ifdef GIT_SUBMODULES
$(foreach s,$(GIT_SUBMODULES),$(call fetch_submodule_if_empty,$(s)))
endif
# Build directory
BUILD = _build/$(BOARD)
BIN = $(TOP)/$(PORT_DIR)/_bin/$(BOARD)
@ -56,7 +49,7 @@ OUTNAME ?= tinyuf2-$(BOARD)
# UF2 version with git tag and submodules
GIT_VERSION := $(shell git describe --dirty --always --tags)
GIT_SUBMODULE_VERSIONS := $(shell git submodule status $(addprefix ../../lib/,$(GIT_SUBMODULES)) | cut -d" " -f3,4 | paste -s -d" " -)
GIT_SUBMODULE_VERSIONS := $(shell git submodule status $(addprefix ../../lib/,$(GIT_SUBMODULES)) | cut -b 43- | paste -s -d" " -)
GIT_SUBMODULE_VERSIONS := $(subst ../../lib/,,$(GIT_SUBMODULE_VERSIONS))
CFLAGS += \

View file

@ -18,4 +18,5 @@ MEMORY
m_interrupts (RX) : ORIGIN = _interrupts_origin , LENGTH = _interrupts_length
m_text (RX) : ORIGIN = _text_origin , LENGTH = _text_length
m_data (RW) : ORIGIN = 0x20000000 , LENGTH = 32K
m_data2 (RW) : ORIGIN = _ocram_base , LENGTH = _ocram_size
}

View file

@ -65,6 +65,14 @@ clean:
$(RM) -rf $(BUILD)
$(RM) -rf $(BIN)
# get depenecies
.PHONY: get-deps
get-deps:
ifdef GIT_SUBMODULES
git -C $(TOP) submodule update --init $(addprefix lib/,$(GIT_SUBMODULES))
endif
#-------------- Artifacts --------------
SELF_UF2 ?= apps/self_update/$(BUILD)/update-$(OUTNAME).uf2