From 12341118e373cce10cb868f234009e9d37bff940 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 1 Jul 2022 16:24:58 +0700 Subject: [PATCH] add get-deps target update ci to get-deps first --- .github/workflows/build_arm.yml | 13 +++++++++---- docs/reference/getting_started.rst | 7 ++++++- examples/make.mk | 5 ----- examples/rules.mk | 27 ++++++++++++++++++--------- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build_arm.yml b/.github/workflows/build_arm.yml index 27cb9f1f..7cc1b10f 100644 --- a/.github/workflows/build_arm.yml +++ b/.github/workflows/build_arm.yml @@ -67,6 +67,11 @@ jobs: - name: Setup Python uses: actions/setup-python@v3 + - name: Install ARM GCC + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '11.2-2022.02' + - name: Checkout TinyUSB uses: actions/checkout@v3 @@ -86,10 +91,10 @@ jobs: echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk git submodule update --init hw/mcu/raspberry_pi/Pico-PIO-USB - - name: Install ARM GCC - uses: carlosperate/arm-none-eabi-gcc-action@v1 - with: - release: '11.2-2022.02' + - name: Get Dependencies + run: | + b=`find hw/bsp/${{ matrix.family }}/boards -depth -maxdepth 1 -type d -name '[^.]?*' -printf %f -quit` + make BOARD={b} get-deps - name: Build run: python3 tools/build_family.py ${{ matrix.family }} diff --git a/docs/reference/getting_started.rst b/docs/reference/getting_started.rst index fa5c51ef..1088d470 100644 --- a/docs/reference/getting_started.rst +++ b/docs/reference/getting_started.rst @@ -50,7 +50,12 @@ Some TinyUSB examples also requires external submodule libraries in ``/lib`` suc $ git submodule update --init lib -In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the ``make`` to build your board. +In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. To download these depencies for your board, run the ``get-dpes`` as follow. + +.. code-block:: + + $ make BOARD=feather_nrf52840_express get-deps + Some modules will also require a module-specific SDK (e.g. RP2040) or binary (e.g. Sony Spresense) to build examples. diff --git a/examples/make.mk b/examples/make.mk index 27e1db38..47520d66 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -45,11 +45,6 @@ else SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c)) endif -# Fetch submodules depended by family -fetch_submodule_if_empty = $(if $(wildcard $(TOP)/$1/*),,$(info $(shell git -C $(TOP) submodule update --init $1))) -ifdef DEPS_SUBMODULES - $(foreach s,$(DEPS_SUBMODULES),$(call fetch_submodule_if_empty,$(s))) -endif #-------------- Cross Compiler ------------ # Can be set by board, default to ARM GCC diff --git a/examples/rules.mk b/examples/rules.mk index 538dffbc..c3134056 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -5,6 +5,7 @@ # Set all as default goal .DEFAULT_GOAL := all +# ---------------- GNU Make Start ----------------------- # ESP32-Sx and RP2040 has its own CMake build system ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040)) @@ -141,7 +142,23 @@ $(BUILD)/obj/%_asm.o: %.S @echo AS $(notdir $@) @$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $< -endif # GNU Make +endif + +.PHONY: clean +clean: +ifeq ($(CMDEXE),1) + rd /S /Q $(subst /,\,$(BUILD)) +else + $(RM) -rf $(BUILD) +endif +# ---------------- GNU Make End ----------------------- + +# get depenecies +.PHONY: get-deps +get-deps: + ifdef DEPS_SUBMODULES + git -C $(TOP) submodule update --init $(DEPS_SUBMODULES) + endif size: $(BUILD)/$(PROJECT).elf -@echo '' @@ -152,14 +169,6 @@ size: $(BUILD)/$(PROJECT).elf linkermap: $(BUILD)/$(PROJECT).elf @linkermap -v $<.map -.PHONY: clean -clean: -ifeq ($(CMDEXE),1) - rd /S /Q $(subst /,\,$(BUILD)) -else - $(RM) -rf $(BUILD) -endif - # --------------------------------------- # Flash Targets # ---------------------------------------