Skip to content

Commit

Permalink
Merge pull request #386 from adafruit/use-python-script-remove-submodule
Browse files Browse the repository at this point in the history
Use python script to remove submodule for mcu driver
  • Loading branch information
hathach authored May 30, 2024
2 parents c22ab56 + bffea80 commit a6ff679
Show file tree
Hide file tree
Showing 48 changed files with 646 additions and 548 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ jobs:
with:
fetch-depth: 0

- name: Checkout common submodules in lib
run: git submodule update --init lib/tinyusb lib/uf2

- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '11.2-2022.02'

- name: Get Dependencies
run: |
git submodule update --init lib/tinyusb lib/uf2
#make -C $ENV_PORT BOARD=${{ matrix.board }} get-deps
python tools/get_deps.py --board ${{ matrix.board }}
- name: Find Port
run: |
ENV_PORT=`echo ports/*/boards/${{ matrix.board }}`
Expand All @@ -88,12 +91,10 @@ 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
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.board }}
path: ${{ env.BIN_PATH }}
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ jobs:
- 'stm32f411ve_discovery'

steps:
- name: Install Ninja
run: sudo apt install -y ninja-build

- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -57,15 +54,12 @@ jobs:
with:
release: '11.2-2022.02'

- name: Get Dependencies
run: |
sudo apt install -y ninja-build
python tools/get_deps.py --board ${{ matrix.board }}
- name: Build
run: |
cmake . -B _build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DBOARD=${{ matrix.board }}
cmake --build _build
# - uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.board }}
# path: |
# _build/ports/*/tinyusb.bin
# _build/ports/*/tinyusb.hex
# _build/ports/*/apps/*/*.uf2
2 changes: 1 addition & 1 deletion .github/workflows/build_esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- name: Build
run: docker run --rm -v $PWD:/project -w /project espressif/idf:v5.1.1 /bin/bash -c "git config --global --add safe.directory /project && make -C ports/espressif/ BOARD=${{ matrix.board }} all self-update copy-artifact"

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.board }}
path: ${{ env.BIN_PATH }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:

- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}
Expand Down
30 changes: 0 additions & 30 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
[submodule "lib/st/cmsis_device_f4"]
path = lib/st/cmsis_device_f4
url = https://github.com/STMicroelectronics/cmsis_device_f4.git
[submodule "lib/st/cmsis_device_l4"]
path = lib/st/cmsis_device_l4
url = https://github.com/STMicroelectronics/cmsis_device_l4.git
[submodule "lib/st/stm32f4xx_hal_driver"]
path = lib/st/stm32f4xx_hal_driver
url = https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git
[submodule "lib/st/stm32l4xx_hal_driver"]
path = lib/st/stm32l4xx_hal_driver
url = https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git
[submodule "lib/tinyusb"]
path = lib/tinyusb
url = https://github.com/hathach/tinyusb.git
[submodule "lib/uf2"]
path = lib/uf2
url = https://github.com/microsoft/uf2.git
[submodule "lib/sct_neopixel"]
path = lib/sct_neopixel
url = https://github.com/gsteiert/sct_neopixel
[submodule "lib/st/stm32f3xx_hal_driver"]
path = lib/st/stm32f3xx_hal_driver
url = https://github.com/STMicroelectronics/stm32f3xx_hal_driver
[submodule "lib/st/cmsis_device_f3"]
path = lib/st/cmsis_device_f3
url = https://github.com/STMicroelectronics/cmsis_device_f3.git
[submodule "lib/nxp/mcux-sdk"]
path = lib/nxp/mcux-sdk
url = https://github.com/NXPmicro/mcux-sdk.git
[submodule "lib/st/cmsis_device_h7"]
path = lib/st/cmsis_device_h7
url = https://github.com/STMicroelectronics/cmsis_device_h7.git
[submodule "lib/st/stm32h7xx_hal_driver"]
path = lib/st/stm32h7xx_hal_driver
url = https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ To build this for a specific board, we need to change current directory to its p
$ cd ports/stm32f4
```

Firstly we need to get all of submodule dependency for our board e.g mcu driver with `get-deps` target. You only need to do this once for each mcu family
Firstly we need to get all submodule dependency for our board using `tools/get_deps.py` script with either family input or using --board option. You only need to do this once for each family

```
make BOARD=feather_stm32f405_express get-deps
python tools/get_deps.py stm32f4
python tools/get_deps.py --board feather_stm32f405_express
```

Then compile with `all` target:
Expand Down
1 change: 0 additions & 1 deletion lib/nxp/mcux-sdk
Submodule mcux-sdk deleted from 9990f2
1 change: 0 additions & 1 deletion lib/sct_neopixel
Submodule sct_neopixel deleted from 497ca8
1 change: 0 additions & 1 deletion lib/st/cmsis_device_f3
Submodule cmsis_device_f3 deleted from 167eef
1 change: 0 additions & 1 deletion lib/st/cmsis_device_f4
Submodule cmsis_device_f4 deleted from 7ac690
1 change: 0 additions & 1 deletion lib/st/cmsis_device_h7
Submodule cmsis_device_h7 deleted from 834d18
1 change: 0 additions & 1 deletion lib/st/cmsis_device_l4
Submodule cmsis_device_l4 deleted from a54685
1 change: 0 additions & 1 deletion lib/st/stm32f3xx_hal_driver
Submodule stm32f3xx_hal_driver deleted from 75cf4f
1 change: 0 additions & 1 deletion lib/st/stm32f4xx_hal_driver
Submodule stm32f4xx_hal_driver deleted from 1d9956
1 change: 0 additions & 1 deletion lib/st/stm32h7xx_hal_driver
Submodule stm32h7xx_hal_driver deleted from 3ba4eb
1 change: 0 additions & 1 deletion lib/st/stm32l4xx_hal_driver
Submodule stm32l4xx_hal_driver deleted from ccde09
30 changes: 15 additions & 15 deletions ports/family_support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,21 @@ endfunction()
function(family_add_uf2version TARGET DEPS_REPO)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty --always --tags OUTPUT_VARIABLE GIT_VERSION)
string(STRIP ${GIT_VERSION} GIT_VERSION)
string(REPLACE ${TOP}/ "" DEPS_REPO "${DEPS_REPO}")
foreach (DEP ${DEPS_REPO})
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${TOP} submodule status ${DEP}
OUTPUT_VARIABLE DEP_VERSION
)
string(STRIP ${DEP_VERSION} DEP_VERSION)
string(FIND "${DEP_VERSION}" " " SPACE_POS)
string(SUBSTRING "${DEP_VERSION}" ${SPACE_POS} -1 DEP_VERSION)
string(STRIP ${DEP_VERSION} DEP_VERSION)

set(GIT_SUBMODULE_VERSIONS "${GIT_SUBMODULE_VERSIONS} ${DEP_VERSION}")
endforeach ()

string(STRIP ${GIT_SUBMODULE_VERSIONS} GIT_SUBMODULE_VERSIONS)
string(REPLACE lib/ "" GIT_SUBMODULE_VERSIONS ${GIT_SUBMODULE_VERSIONS})
# string(REPLACE ${TOP}/ "" DEPS_REPO "${DEPS_REPO}")
# foreach (DEP ${DEPS_REPO})
# execute_process(COMMAND ${GIT_EXECUTABLE} -C ${TOP} submodule status ${DEP}
# OUTPUT_VARIABLE DEP_VERSION
# )
# string(STRIP ${DEP_VERSION} DEP_VERSION)
# string(FIND "${DEP_VERSION}" " " SPACE_POS)
# string(SUBSTRING "${DEP_VERSION}" ${SPACE_POS} -1 DEP_VERSION)
# string(STRIP ${DEP_VERSION} DEP_VERSION)
#
# set(GIT_SUBMODULE_VERSIONS "${GIT_SUBMODULE_VERSIONS} ${DEP_VERSION}")
# endforeach ()
#
# string(STRIP ${GIT_SUBMODULE_VERSIONS} GIT_SUBMODULE_VERSIONS)
# string(REPLACE lib/ "" GIT_SUBMODULE_VERSIONS ${GIT_SUBMODULE_VERSIONS})

cmake_print_variables(GIT_VERSION)
cmake_print_variables(GIT_SUBMODULE_VERSIONS)
Expand Down
128 changes: 64 additions & 64 deletions ports/k32l2/Makefile → ports/kinetis_k32l2/Makefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
# List of git submodules that is included as part of the UF2 version
GIT_SUBMODULES = nxp/mcux-sdk tinyusb

include ../make.mk

# inline port details
UF2_FAMILY_ID = 0x7f83e793
CROSS_COMPILE = arm-none-eabi-

SDK_DIR = lib/nxp/mcux-sdk
MCU_DIR = $(SDK_DIR)/devices/$(MCU)

# Port Compiler Flags
CFLAGS += \
-flto \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m0plus

# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align -Wno-error=unused-parameter

# Port source
SRC_C += \
$(MCU_DIR)/system_$(MCU).c \
$(MCU_DIR)/drivers/fsl_clock.c \
$(SDK_DIR)/drivers/gpio/fsl_gpio.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_controller.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_flash.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_cache.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_flexnvm.c \
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c \
$(PORT_DIR)/clock_config.c \
$(PORT_DIR)/boards.c \
$(PORT_DIR)/board_flash.c

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/nxp/khci/dcd_khci.c
endif

SRC_S += $(MCU_DIR)/gcc/startup_$(MCU).S

# Port include
INC += \
$(TOP)/$(PORT_DIR) \
$(TOP)/$(BOARD_DIR) \
$(TOP)/$(SDK_DIR)/CMSIS/Include \
$(TOP)/$(MCU_DIR) \
$(TOP)/$(MCU_DIR)/drivers \
$(TOP)/$(SDK_DIR)/drivers/smc \
$(TOP)/$(SDK_DIR)/drivers/rtc \
$(TOP)/$(SDK_DIR)/drivers/common \
$(TOP)/$(SDK_DIR)/drivers/gpio \
$(TOP)/$(SDK_DIR)/drivers/port \
$(TOP)/$(SDK_DIR)/drivers/lpuart \
$(TOP)/$(SDK_DIR)/drivers/flash

LD_FILES ?= $(MCU_DIR)/gcc/$(LD_FNAME)

include ../rules.mk

#-------------- Self-update --------------
self-update:
@echo "not implemented yet"
# List of git submodules that is included as part of the UF2 version
GIT_SUBMODULES = nxp/mcux-sdk tinyusb

include ../make.mk

# inline port details
UF2_FAMILY_ID = 0x7f83e793
CROSS_COMPILE = arm-none-eabi-

SDK_DIR = lib/mcu/nxp/mcux-sdk
MCU_DIR = $(SDK_DIR)/devices/$(MCU)

# Port Compiler Flags
CFLAGS += \
-flto \
-mthumb \
-mabi=aapcs \
-mcpu=cortex-m0plus

# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=cast-align -Wno-error=unused-parameter

# Port source
SRC_C += \
$(MCU_DIR)/system_$(MCU).c \
$(MCU_DIR)/drivers/fsl_clock.c \
$(SDK_DIR)/drivers/gpio/fsl_gpio.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_controller.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_flash.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_cache.c \
$(SDK_DIR)/drivers/flash/fsl_ftfx_flexnvm.c \
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c \
$(PORT_DIR)/clock_config.c \
$(PORT_DIR)/boards.c \
$(PORT_DIR)/board_flash.c

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/nxp/khci/dcd_khci.c
endif

SRC_S += $(MCU_DIR)/gcc/startup_$(MCU).S

# Port include
INC += \
$(TOP)/$(PORT_DIR) \
$(TOP)/$(BOARD_DIR) \
$(TOP)/$(SDK_DIR)/CMSIS/Include \
$(TOP)/$(MCU_DIR) \
$(TOP)/$(MCU_DIR)/drivers \
$(TOP)/$(SDK_DIR)/drivers/smc \
$(TOP)/$(SDK_DIR)/drivers/rtc \
$(TOP)/$(SDK_DIR)/drivers/common \
$(TOP)/$(SDK_DIR)/drivers/gpio \
$(TOP)/$(SDK_DIR)/drivers/port \
$(TOP)/$(SDK_DIR)/drivers/lpuart \
$(TOP)/$(SDK_DIR)/drivers/flash

LD_FILES ?= $(MCU_DIR)/gcc/$(LD_FNAME)

include ../rules.mk

#-------------- Self-update --------------
self-update:
@echo "not implemented yet"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
MCU = K32L2B31A

CFLAGS += \
-DCPU_K32L2B31VLH0A \
-DCFG_TUSB_MCU=OPT_MCU_K32L2BXX

SRC_S +=

LD_FNAME = K32L2B31xxxxA_flash.ld

DBL_TAP_REG_ADDR = 0x4003D008

# For flash-pyocd target
PYOCD_TARGET = K32L2B3

# flash using pyocd
flash: flash-pyocd
erase: erase-jlink
MCU = K32L2B31A

CFLAGS += \
-DCPU_K32L2B31VLH0A \
-DCFG_TUSB_MCU=OPT_MCU_K32L2BXX

SRC_S +=

LD_FNAME = K32L2B31xxxxA_flash.ld

DBL_TAP_REG_ADDR = 0x4003D008

# For flash-pyocd target
PYOCD_TARGET = K32L2B3

# flash using pyocd
flash: flash-pyocd
erase: erase-jlink
File renamed without changes.
Loading

0 comments on commit a6ff679

Please sign in to comment.