Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/actions/setup_toolchain/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,32 @@ runs:
- name: Get Toolchain URL
if: >-
inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf'
id: set-toolchain-url
run: |
TOOLCHAIN_JSON='{
"aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz",
"arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64.tar.xz",
"msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2",
"riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz",
"rx-gcc": "http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run"
}'
TOOLCHAIN_URL=$(echo $TOOLCHAIN_JSON | jq -r '.["${{ inputs.toolchain }}"]')
TOOLCHAIN_URL=$(jq -r '."${{ inputs.toolchain }}"' .github/actions/setup_toolchain/toolchain.json)
echo "toolchain_url=$TOOLCHAIN_URL"
echo "toolchain_url=$TOOLCHAIN_URL" >> $GITHUB_OUTPUT
shell: bash

- name: Download Toolchain
if: >-
inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download
with:
toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ steps.set-toolchain-url.outputs.toolchain_url }}

- name: Set toolchain option
id: set-toolchain-option
run: |
BUILD_OPTION=""
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
BUILD_OPTION="--toolchain clang"
elif [[ "${{ inputs.toolchain }}" == "arm-iar" ]]; then
BUILD_OPTION="--toolchain iar"
fi
echo "build_option=$BUILD_OPTION"
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
shell: bash
22 changes: 18 additions & 4 deletions .github/actions/setup_toolchain/download/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,25 @@ runs:
if: steps.cache-toolchain-download.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/${{ inputs.toolchain }}
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz

if [[ ${{ inputs.toolchain }} == rx-gcc ]]; then
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.run
chmod +x toolchain.run
./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y
elif [[ ${{ inputs.toolchain }} == arm-iar ]]; then
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O ~/cache/${{ inputs.toolchain }}/cxarm.deb
else
wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz
fi
shell: bash

- name: Set Toolchain Path
- name: Setup Toolchain
run: |
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
if [[ ${{ inputs.toolchain }} == arm-iar ]]; then
sudo apt-get install -y ~/cache/${{ inputs.toolchain }}/cxarm.deb
echo >> $GITHUB_PATH "/opt/iar/cxarm/arm/bin"
else
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
fi
shell: bash
9 changes: 9 additions & 0 deletions .github/actions/setup_toolchain/toolchain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"aarch64-gcc": "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz",
"arm-clang": "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-19.1.1/LLVM-ET-Arm-19.1.1-Linux-x86_64.tar.xz",
"arm-gcc": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v14.2.1-1.1/xpack-arm-none-eabi-gcc-14.2.1-1.1-linux-x64.tar.gz",
"msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2",
"riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz",
"rx-gcc": "https://github.com/hathach/rx_device/releases/download/0.0.1/gcc-8.3.0.202411-GNURX-ELF.run",
"arm-iar": "https://netstorage.iar.com/FileStore/STANDARD/001/003/583/cxarm-9.60.4.deb"
}
63 changes: 22 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# ---------------------------------------
# Build ARM
# ---------------------------------------
arm:
arm-make:
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
Expand All @@ -65,15 +65,34 @@ jobs:
- 'lpc55'
- 'mimxrt10xx'
- 'stm32f3'
- 'stm32f4'
- 'stm32h5'
- 'stm32l4'
with:
port: ${{ matrix.port }}
boards: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.port].board) }}
build-system: 'make'
toolchain: 'arm-gcc'

# ---------------------------------------
# Build ARM with CMake
# ---------------------------------------
arm-cmake:
needs: set-matrix
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
port:
# Alphabetical order by family
# - 'stm32f303disco' # overflows flash
- 'stm32f4'
- 'stm32h5'
with:
port: ${{ matrix.port }}
boards: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.port].board) }}
build-system: 'cmake'
toolchain: 'arm-gcc'


# ---------------------------------------
# Build ESP
# ---------------------------------------
Expand Down Expand Up @@ -115,41 +134,3 @@ jobs:
uses: ./.github/workflows/build_ghostfat.yml
with:
boards: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)['test_ghostfat'].board) }}

# ---------------------------------------
# Build ARM with CMake
# ---------------------------------------
arm-cmake:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board:
# Alphabetical order by family
#- 'metro_m7_1011'
# - 'stm32f303disco' # overflows flash
- 'stm32f411ve_discovery'

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

- name: Fetch tags
run: git fetch --tags

- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1
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
21 changes: 15 additions & 6 deletions .github/workflows/build_util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ jobs:
- name: Build
if: inputs.toolchain != 'esp-idf'
run: |
make -C ports/${{ inputs.port }} BOARD=${{ matrix.board }} all self-update copy-artifact
if [ -d "ports/${{ inputs.port }}/apps" ]; then
for app in ports/${{ inputs.port }}/apps/*/; do if [ $app != 'apps/self_update/' ]; then make -C $app BOARD=${{ matrix.board }} all; fi done
if [[ ${{ inputs.build-system }} == cmake ]]; then
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DBOARD=${{ matrix.board }} ports/${{ inputs.port }}
cmake --build build
else
make -C ports/${{ inputs.port }} BOARD=${{ matrix.board }} all self-update copy-artifact
if [ -d "ports/${{ inputs.port }}/apps" ]; then
for app in ports/${{ inputs.port }}/apps/*/; do if [ $app != 'apps/self_update/' ]; then make -C $app BOARD=${{ matrix.board }} all; fi done
fi
fi

- name: Build using ESP-IDF docker
Expand All @@ -70,9 +75,13 @@ jobs:
run: |
if [ ${{ inputs.toolchain }} == 'esp-idf' ]; then
zip -jr tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip ${{ env.BIN_PATH }}
cp ${{ env.BIN_PATH }}/update-tinyuf2.uf2 update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2
cp ${{ env.BIN_PATH }}/apps/update-tinyuf2.uf2 update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2
else
for f in ${{ env.BIN_PATH }}/*; do mv $f ${f%.*}-${{ github.event.release.tag_name }}."${f#*.}"; done
if [[ ${{ inputs.build-system }} == cmake ]]; then
cp ${{ env.BIN_PATH }}/apps/update-tinyuf2.uf2 update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2
else
cp ${{ env.BIN_PATH }}/apps/update-tinyuf2-${{ matrix.board }}.uf2 update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2
fi
zip -jr tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.zip ${{ env.BIN_PATH }}
fi

Expand All @@ -82,7 +91,7 @@ jobs:
with:
files: |
tinyuf2-${{ matrix.board }}-*.zip
${{ env.BIN_PATH }}/update-tinyuf2-${{ matrix.board }}-*.uf2
update-tinyuf2-${{ matrix.board }}-${{ github.event.release.tag_name }}.uf2

- name: Upload Release Assets To AWS S3
env:
Expand Down
13 changes: 13 additions & 0 deletions .idea/debugServers/imxrt1011.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/debugServers/stm32f411.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#------------------------------------
# Application
# This file is meant to be include by add_subdirectory() in the root CMakeLists.txt
#------------------------------------
cmake_minimum_required(VERSION 3.17)

include(${FAMILY_PATH}/app.cmake)

# self_update target
add_executable(blinky
${TOP}/apps/blinky/blinky.c
${CMAKE_CURRENT_LIST_DIR}/../../boards.c
${CMAKE_CURRENT_LIST_DIR}/../../board_flash.c
src/blinky.c
${FAMILY_PATH}/boards.c
# ${FAMILY_PATH}/board_flash.c
)
target_include_directories(blinky PUBLIC
${TOP}/src
)
target_compile_definitions(blinky PUBLIC
BUILD_NO_TINYUSB
BUILD_APPLICATION
)
target_link_options(blinky PUBLIC
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/../../linker/stm32h5_app.ld"
BUILD_NO_TINYUSB
)

family_configure_common(blinky)
family_add_uf2(blinky ${UF2_FAMILY_ID})
family_configure_app(blinky)
family_gen_uf2(blinky ${UF2_FAMILY_ID})
family_flash_uf2(blinky ${UF2_FAMILY_ID})
22 changes: 6 additions & 16 deletions apps/blinky/blinky.c → apps/blinky/src/blinky.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,25 @@
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
uint8_t const RGB_WRITING[] = { 0xcc, 0x66, 0x00 };
uint8_t const RGB_OFF[] = { 0x00, 0x00, 0x00 };
uint8_t const RGB_WRITING[] = { 0xcc, 0x66, 0x00 };
uint8_t const RGB_OFF[] = { 0x00, 0x00, 0x00 };
static volatile uint32_t _timer_count = 0;

int main(void) {
TUF2_LOG1_LOCATION();
board_init();
TUF2_LOG1_LOCATION();
board_timer_start(1);

while (1) {
// nothing to do
}
}

void board_timer_handler(void)
{
void board_timer_handler(void) {
_timer_count++;

if ((_timer_count & 0xfful) == 0) {
// Fast toggle with both LED and RGB
static bool is_on = false;
is_on = !is_on;
const uint32_t is_on = (_timer_count >> 8) & 0x1u;

// fast blink LED if available
board_led_write(is_on ? 0xff : 0x000);

// blink RGB if available
board_rgb_write(is_on ? RGB_WRITING : RGB_OFF);
}
}
Expand All @@ -75,9 +66,8 @@ void board_timer_handler(void)
#include "SEGGER_RTT.h"
#endif

__attribute__ ((used)) int _write (int fhdl, const void *buf, size_t count)
{
(void) fhdl;
__attribute__ ((used)) int _write(int fhdl, const void* buf, size_t count) {
(void)fhdl;

#if defined(LOGGER_RTT)
SEGGER_RTT_Write(0, (char*) buf, (int) count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#------------------------------------
cmake_minimum_required(VERSION 3.17)

include(${CMAKE_CURRENT_LIST_DIR}/../app.cmake)
include(${FAMILY_PATH}/app.cmake)

#------------------------------------
# Application
#------------------------------------
add_executable(erase_firmware
${TOP}/apps/erase_firmware/erase_firmware.c
${CMAKE_CURRENT_LIST_DIR}/../../boards.c
src/erase_firmware.c
${FAMILY_PATH}/boards.c
)
target_include_directories(erase_firmware PUBLIC
${TOP}/src
)
target_compile_definitions(erase_firmware PUBLIC
BUILD_APPLICATION
BUILD_NO_TINYUSB
)

configure_app(erase_firmware)
family_configure_app(erase_firmware)
family_gen_uf2(erase_firmware ${UF2_FAMILY_ID})
family_flash_uf2(erase_firmware ${UF2_FAMILY_ID})
33 changes: 33 additions & 0 deletions apps/self_update/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#------------------------------------
# Application
# This file is meant to be include by add_subdirectory() in the root CMakeLists.txt
#------------------------------------
cmake_minimum_required(VERSION 3.17)

include(${FAMILY_PATH}/app.cmake)

# Generate bootloader_bin.c
add_custom_command(OUTPUT bootloader_bin.c
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} --carray -o ${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c $<TARGET_FILE_DIR:tinyuf2>/tinyuf2.bin
DEPENDS tinyuf2
)

add_executable(update-tinyuf2
self_update.c
${FAMILY_PATH}/boards.c
${FAMILY_PATH}/board_flash.c
${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c
)

target_include_directories(update-tinyuf2 PUBLIC
${TOP}/src
)
target_compile_definitions(update-tinyuf2 PUBLIC
TINYUF2_SELF_UPDATE
BUILD_NO_TINYUSB
BUILD_APPLICATION
)

family_configure_app(update-tinyuf2)
family_gen_uf2(update-tinyuf2 ${UF2_FAMILY_ID})
family_flash_uf2(update-tinyuf2 ${UF2_FAMILY_ID})
2 changes: 1 addition & 1 deletion ports/ch32v20x/family.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include_guard()
include_guard(GLOBAL)

set(UF2_FAMILY_ID 0x699b62ec)
set(CH32_FAMILY ch32v20x)
Expand Down
Loading
Loading