mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 23:43:23 +00:00
make as wrapper to idf.py for consistency
update ci build script to only build esp32-s2 target with freertos examples
This commit is contained in:
parent
2824e5c97a
commit
7c33a7127f
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@ -36,15 +36,23 @@ jobs:
|
||||
|
||||
- name: Install Toolchains
|
||||
run: |
|
||||
# ARM & RISC-V GCC from xpack
|
||||
npm install --global xpm
|
||||
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
|
||||
xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest
|
||||
wget http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/8_3_0_0/exports/msp430-gcc-8.3.0.16_linux64.tar.bz2 -O /tmp/msp430-gcc.tar.bz2
|
||||
tar -C $HOME -xaf /tmp/msp430-gcc.tar.bz2
|
||||
echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`"
|
||||
echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`"
|
||||
|
||||
# TI MSP430 GCC
|
||||
wget http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/8_3_0_0/exports/msp430-gcc-8.3.0.16_linux64.tar.bz2 -O /tmp/msp430-gcc.tar.bz2
|
||||
tar -C $HOME -xaf /tmp/msp430-gcc.tar.bz2
|
||||
echo "::add-path::`echo $HOME/msp430-gcc-*_linux64/bin`"
|
||||
|
||||
|
||||
# ESP IDF
|
||||
git clone https://github.com/espressif/esp-idf.git $HOME/esp-idf
|
||||
cd $HOME/esp-idf
|
||||
./install.sh
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v2
|
||||
|
||||
@ -54,5 +62,7 @@ jobs:
|
||||
git submodule update --init --recursive
|
||||
|
||||
- name: Build
|
||||
run: python3 tools/build_all.py ${{ matrix.example }}
|
||||
run: |
|
||||
. $HOME/esp-idf/export.sh
|
||||
python3 tools/build_all.py ${{ matrix.example }}
|
||||
|
||||
|
38
.github/workflows/esp32s2.yml
vendored
38
.github/workflows/esp32s2.yml
vendored
@ -1,38 +0,0 @@
|
||||
name: Build ESP32-S2
|
||||
|
||||
on: [pull_request, push, repository_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
example: ['cdc_msc_freertos']
|
||||
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
|
||||
- name: Install ESP-IDF
|
||||
run: |
|
||||
git clone https://github.com/espressif/esp-idf.git $HOME/esp-idf
|
||||
cd $HOME/esp-idf
|
||||
./install.sh
|
||||
#echo "::add-path::`echo $HOME/msp430-gcc-*_linux64/bin`"
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# - name: Checkout Submodules
|
||||
# run: |
|
||||
# git submodule sync --recursive
|
||||
# git submodule update --init --recursive
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
. $HOME/esp-idf/export.sh
|
||||
cd examples/device/cdc_msc_freertos
|
||||
idf.py build
|
||||
#python3 tools/build_all.py ${{ matrix.example }}
|
||||
|
@ -1,6 +1,25 @@
|
||||
#
|
||||
# Common make definition for all examples
|
||||
#
|
||||
# ---------------------------------------
|
||||
# Common make rules for all examples
|
||||
# ---------------------------------------
|
||||
|
||||
ifeq ($(CROSS_COMPILE),xtensa-esp32-elf-)
|
||||
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
|
||||
|
||||
.PHONY: all clean flash
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all:
|
||||
idf.py -B$(BUILD) -DBOARD=$(BOARD) build
|
||||
|
||||
clean:
|
||||
idf.py clean
|
||||
|
||||
flash:
|
||||
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
|
||||
idf.py -p $(SERIAL) flash
|
||||
|
||||
else
|
||||
# GNU Make build system
|
||||
|
||||
# libc
|
||||
LIBS += -lgcc -lm -lnosys
|
||||
@ -28,8 +47,9 @@ SRC_C += \
|
||||
# TinyUSB stack include
|
||||
INC += $(TOP)/src
|
||||
|
||||
#
|
||||
CFLAGS += $(addprefix -I,$(INC))
|
||||
|
||||
# TODO Skip nanolib for MSP430
|
||||
ifeq ($(BOARD), msp_exp430f5529lp)
|
||||
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections
|
||||
else
|
||||
@ -135,3 +155,5 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
|
||||
# flash STM32 MCU using stlink with STM32 Cube Programmer CLI
|
||||
flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
|
||||
STM32_Programmer_CLI --connect port=swd --write $< --go
|
||||
|
||||
endif # Make target
|
||||
|
@ -27,8 +27,7 @@ if len(sys.argv) > 2:
|
||||
all_boards.append(sys.argv[2])
|
||||
else:
|
||||
for entry in os.scandir("hw/bsp"):
|
||||
# Skip board without board.mk e.g esp32s2
|
||||
if entry.is_dir() and os.path.exists(entry.path + "/board.mk"):
|
||||
if entry.is_dir():
|
||||
all_boards.append(entry.name)
|
||||
all_boards.sort()
|
||||
|
||||
@ -40,7 +39,8 @@ def build_example(example, board):
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
def build_size(example, board):
|
||||
elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board)
|
||||
#elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board)
|
||||
elf_file = 'examples/device/{}/_build/build-{}/*.elf'.format(example, board)
|
||||
size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
|
||||
size_list = size_output.split('\n')[1].split('\t')
|
||||
flash_size = int(size_list[0])
|
||||
@ -50,10 +50,18 @@ def build_size(example, board):
|
||||
def skip_example(example, board):
|
||||
ex_dir = 'examples/device/' + example
|
||||
board_mk = 'hw/bsp/{}/board.mk'.format(board)
|
||||
for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
|
||||
mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
|
||||
with open(board_mk) as mk:
|
||||
if mcu_cflag in mk.read():
|
||||
|
||||
with open(board_mk) as mk:
|
||||
mk_contents = mk.read()
|
||||
|
||||
# Skip ESP32-S2 board if example is not FreeRTOS one
|
||||
if 'freertos' not in example and 'CROSS_COMPILE = xtensa-esp32-elf-' in mk_contents:
|
||||
return 1
|
||||
|
||||
# Skip if CFG_TUSB_MCU in board.mk to match skip file
|
||||
for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
|
||||
mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
|
||||
if mcu_cflag in mk_contents:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user