Skip to content

Commit

Permalink
Merge pull request #367 from adafruit/fix-322
Browse files Browse the repository at this point in the history
Fix 322
  • Loading branch information
hathach authored Dec 15, 2023
2 parents 9389877 + 9e2cb35 commit 368cc6e
Show file tree
Hide file tree
Showing 22 changed files with 284 additions and 105 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build_arm.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
name: Build ARM

on:
pull_request:
push:
paths:
- 'src/**'
- 'ports/**'
- '!ports/espressif/**'
- 'lib/**'
- '.github/workflows/build_arm.yml'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'ports/**'
- '!ports/espressif/**'
- 'lib/**'
- '.github/workflows/build_arm.yml'
repository_dispatch:
release:
types:
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
name: Build CMake

on:
pull_request:
push:
paths:
- 'src/**'
- 'ports/**'
- '!ports/espressif/**'
- 'lib/**'
- '.github/workflows/build_cmake.yml'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'ports/**'
- '!ports/espressif/**'
- 'lib/**'
- '.github/workflows/build_cmake.yml'
repository_dispatch:
release:
types:
Expand All @@ -25,6 +38,7 @@ jobs:
# Alphabetical order by family
- 'metro_m7_1011'
- 'stm32f303disco'
- 'stm32f411ve_discovery'

steps:
- name: Setup Python
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/build_esp32.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
name: Build ESP32

on:
pull_request:
push:
paths:
- 'src/**'
- 'ports/espressif/**'
- 'lib/tinyusb'
- '.github/workflows/build_esp32.yml'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'ports/espressif/**'
- 'lib/tinyusb'
- '.github/workflows/build_esp32.yml'
repository_dispatch:
release:
types:
- created

jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
# ---------------------------------------
# Build ESP32SX family
# ---------------------------------------
Expand Down
18 changes: 13 additions & 5 deletions .idea/cmake.xml

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

10 changes: 10 additions & 0 deletions .idea/runConfigurations/imxrt1011.xml

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

10 changes: 10 additions & 0 deletions .idea/runConfigurations/stm32f303vc.xml

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

10 changes: 10 additions & 0 deletions .idea/runConfigurations/stm32f411ve.xml

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

2 changes: 1 addition & 1 deletion ports/mimxrt10xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.17)
include(${CMAKE_CURRENT_LIST_DIR}/../family_support.cmake)

project(tinyuf2 C ASM)
set(CMAKE_EXECUTABLE_SUFFIX .elf)

#------------------------------------
# TinyUF2
#------------------------------------
set(CMAKE_EXECUTABLE_SUFFIX .elf)
add_executable(tinyuf2
board_flash.c
boards.c
Expand Down
4 changes: 0 additions & 4 deletions ports/mimxrt10xx/family.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
include_guard()

if (NOT BOARD)
message(FATAL_ERROR "BOARD not specified")
endif ()

#------------------------------------
# Config
#------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions ports/stm32f3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ cmake_minimum_required(VERSION 3.17)
include(${CMAKE_CURRENT_LIST_DIR}/../family_support.cmake)

project(tinyuf2 C ASM)
set(CMAKE_EXECUTABLE_SUFFIX .elf)

#------------------------------------
# TinyUF2
#------------------------------------
set(CMAKE_EXECUTABLE_SUFFIX .elf)
add_executable(tinyuf2
board_flash.c
boards.c
boards.h
${TOP}/lib/tinyusb/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
)
#target_compile_options(tinyuf2 PUBLIC)
target_link_options(tinyuf2 PUBLIC
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/linker/stm32f3_boot.ld"
)
Expand Down
6 changes: 3 additions & 3 deletions ports/stm32f3/apps/self_update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ add_custom_command(OUTPUT bootloader_bin.c
# self_update target
add_executable(self_update
${TOP}/apps/self_update/self_update.c
${PORT_DIR}/boards.c
${PORT_DIR}/board_flash.c
${CMAKE_CURRENT_LIST_DIR}/../../boards.c
${CMAKE_CURRENT_LIST_DIR}/../../board_flash.c
${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c
)

Expand All @@ -26,7 +26,7 @@ target_compile_definitions(self_update PUBLIC
BUILD_APPLICATION
)
target_link_options(self_update PUBLIC
"LINKER:--script=${PORT_DIR}/linker/stm32f3_app.ld"
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/../../linker/stm32f3_app.ld"
)

family_configure_common(self_update)
Expand Down
2 changes: 2 additions & 0 deletions ports/stm32f3/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#include "board.h"

#define BOARD_FLASH_ADDR_ZERO 0x08000000

// Flash Start Address of Application
#ifndef BOARD_FLASH_APP_START
#define BOARD_FLASH_APP_START 0x08004000
Expand Down
5 changes: 0 additions & 5 deletions ports/stm32f3/family.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
include_guard()

if (NOT BOARD)
message(FATAL_ERROR "BOARD not specified")
endif ()

#------------------------------------
# Config
#------------------------------------
Expand All @@ -12,7 +8,6 @@ set(UF2_FAMILY_ID 0x6b846188)
set(ST_HAL_DRIVER ${TOP}/lib/st/stm32f3xx_hal_driver)
set(ST_CMSIS ${TOP}/lib/st/cmsis_device_f3)
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
set(PORT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(FAMILY_SUBMODULE_DEPS ${ST_CMSIS} ${ST_HAL_DRIVER})

include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
Expand Down
26 changes: 26 additions & 0 deletions ports/stm32f4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.17)

include(${CMAKE_CURRENT_LIST_DIR}/../family_support.cmake)

project(tinyuf2 C ASM)
set(CMAKE_EXECUTABLE_SUFFIX .elf)

#------------------------------------
# TinyUF2
#------------------------------------
add_executable(tinyuf2
board_flash.c
boards.c
${TOP}/lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
)
target_link_options(tinyuf2 PUBLIC
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/linker/stm32f4_boot.ld"
)

family_configure_tinyuf2(tinyuf2 OPT_MCU_STM32F4)
family_flash_jlink(tinyuf2)

#------------------------------------
# Application (e.g self update)
#------------------------------------
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps/self_update)
33 changes: 33 additions & 0 deletions ports/stm32f4/apps/self_update/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#------------------------------------
# Self Update
# This file is meant to be include by add_subdirectory() in the root CMakeLists.txt
#------------------------------------

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

# self_update target
add_executable(self_update
${TOP}/apps/self_update/self_update.c
${CMAKE_CURRENT_LIST_DIR}/../../boards.c
${CMAKE_CURRENT_LIST_DIR}/../../board_flash.c
${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c
)

target_include_directories(self_update PUBLIC
${TOP}/src
)
target_compile_definitions(self_update PUBLIC
TINYUF2_SELF_UPDATE
BUILD_NO_TINYUSB
BUILD_APPLICATION
)
target_link_options(self_update PUBLIC
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/../../linker/stm32f4_app.ld"
)

family_configure_common(self_update)
family_add_uf2(self_update ${UF2_FAMILY_ID})
2 changes: 2 additions & 0 deletions ports/stm32f4/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

#include "board.h"

#define BOARD_FLASH_ADDR_ZERO 0x08000000

// Flash Start Address of Application
#ifndef BOARD_FLASH_APP_START
#define BOARD_FLASH_APP_START 0x08010000
Expand Down
11 changes: 11 additions & 0 deletions ports/stm32f4/boards/stm32f411ve_discovery/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(JLINK_DEVICE stm32f411ve)

function(update_board TARGET)
target_sources(${TARGET} PUBLIC
${ST_CMSIS}/Source/Templates/gcc/startup_stm32f411xe.s
)
target_compile_definitions(${TARGET} PUBLIC
STM32F411xE
HSE_VALUE=8000000U
)
endfunction()
Loading

0 comments on commit 368cc6e

Please sign in to comment.