Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
947601c
rt10xx added board cmake
hathach Dec 27, 2025
9d7ab82
clean up rt10xx port, extract _flash_base from linker to calculate FL…
hathach Dec 27, 2025
baacca2
update app/blinky blink pattern to be more distinguish
hathach Dec 27, 2025
c8d3f81
add supported_boards.md, update port README.md to point to its section
hathach Dec 27, 2025
c1b51af
refactor ivt to board_flash.c
hathach Dec 27, 2025
0e0717b
use predefined FLASH_BASE instead of manual FLEXSPI_FLASH_BASE
hathach Dec 27, 2025
f50489d
update clock_config.c
hathach Dec 29, 2025
aa63e77
update clock_config.c
hathach Dec 29, 2025
64d4512
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
dbfe423
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
03d0b50
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
dc036b3
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
345b68c
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
cc6377b
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
ba0c9b8
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
86c890b
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
36e1acb
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
4192f25
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
712343c
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
a3feba4
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
4263111
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
949d7ca
refactor pin_mux to use mcux pin config tool
hathach Dec 29, 2025
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
100 changes: 100 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
Language: Cpp
BasedOnStyle: LLVM
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCaseColons: false
AlignEscapedNewlines: LeftWithLastLine
AlignOperands: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BracedInitializerIndentWidth: 2
BreakBeforeBinaryOperators: None
BreakConstructorInitializers: AfterColon
BreakConstructorInitializersBeforeComma: false
ContinuationIndentWidth: 2
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: true
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*'
Priority: 1
- Regex: '^".*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentPPDirectives: BeforeHash
InsertBraces: true
IndentCaseLabels: true
InsertNewlineAtEOF: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PenaltyBreakBeforeFirstCallParameter: 1000000
PenaltyBreakOpenParenthesis: 1000000
PPIndentWidth: 2
QualifierAlignment: Custom
QualifierOrder: ['static', 'const', 'volatile', 'restrict', 'type']
SpaceAfterTemplateKeyword: false
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SortIncludes: false
TabWidth: 2
UseTab: Never
...
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ Not all features are implemented for all MCUs, following is supported MCUs and i
| STM32F4 | ✔ | ✔ | ✔ | ✔ | ✔ | |
| STM32H5 | ✔ | ✔ | ✔ | ✔ | | |

## Supported MCUs and Boards

Please refer to [supported boards](./supported_boards.md) for the complete list of supported MCUs and boards.

## Build and Flash

Following is generic compiling information. Each port may require extra set-up and slight different process e.g esp32s2 require setup IDF.
Following is generic compiling information. Each port may require extra set-up and slight different process e.g esp32s2
require ESP-IDF.

### Clone

Expand Down
18 changes: 11 additions & 7 deletions apps/blinky/src/blinky.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,22 @@ int main(void) {
board_timer_start(1);

while (1) {
// nothing to do
if ((_timer_count & 0xfful) == 0) {
uint32_t count = _timer_count >> 8;
// Toggle 2 times then pause 1
if (count & 0x1ul || count & 0x4ul) {
board_led_write(0x000);
board_rgb_write(RGB_OFF);
} else {
board_led_write(0xff);
board_rgb_write(RGB_WRITING);
}
}
}
}

void board_timer_handler(void) {
_timer_count++;
if ((_timer_count & 0xfful) == 0) {
const uint32_t is_on = (_timer_count >> 8) & 0x1u;

board_led_write(is_on ? 0xff : 0x000);
board_rgb_write(is_on ? RGB_WRITING : RGB_OFF);
}
}

//--------------------------------------------------------------------+
Expand Down
1 change: 1 addition & 0 deletions cmake/toolchain/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if (TOOLCHAIN STREQUAL "gcc")
-ffunction-sections
-fsingle-precision-constant
-fno-strict-aliasing
-g
)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
-Wl,--print-memory-usage
Expand Down
30 changes: 3 additions & 27 deletions ports/espressif/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
# TinyUF2 "Bootloader Application" for ESP32-S2 and ESP32-S3
# TinyUF2 "Bootloader Application" for Espressif (S2/S3/P4)

The project is composed of customizing the 2nd stage bootloader from IDF and UF2 factory application as 3rd stage bootloader.

**Note**: IDF is actively developed and change very often, TinyUF2 is developed and tested with IDF v5.3.2. Should you have a problem please try to change your IDF version.

Following boards are supported:

- [Adafruit Magtag 2.9" E-Ink WiFi Display](https://www.adafruit.com/product/4800)
- [Adafruit Metro ESP32-S2](https://www.adafruit.com/product/4775)
- [Deneyap Kart 1A v2](https://magaza.deneyapkart.org/tr/product/detail/deneyap-kart-1a-v2-type-c)
- [Deneyap Mini](https://magaza.deneyapkart.org/tr/product/detail/deneyap-mini)
- [Deneyap Mini v2](https://magaza.deneyapkart.org/tr/product/detail/deneyap-mini-v2-type-c)
- [ES3ink](https://github.com/dronecz/es3ink)
- [Espressif Kaluga 1](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp32-s2-kaluga-1-kit.html)
- [Espressif HMI 1](https://github.com/espressif/esp-dev-kits/tree/master/esp32-s2-hmi-devkit-1)
- [Espressif Saola 1R (WROVER) and 1M (WROOM)](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html)
- [Gravitech Cucumber RIS ESP32-S2 w/Sensors ](https://www.gravitech.us/curisdebowis.html)
- [Heltec Wireless Tracker](https://heltec.org/project/wireless-tracker)
- [LILYGO® TTGO T8 ESP32-S2 V1.1](http://www.lilygo.cn/prod_view.aspx?TypeId=50063&Id=1300&FId=t3:50063:3)
- [LILYGO® TTGO T8 ESP32-S2 V1.1 ST7789 ](http://www.lilygo.cn/prod_view.aspx?TypeId=50033&Id=1321&FId=t3:50033:3)
- [LILYGO® TTGO T8 ESP32-S2-WROOM](http://www.lilygo.cn/prod_view.aspx?TypeId=50063&Id=1320&FId=t3:50063:3)
- [LILYGO® TTGO T-Beam Supreme](https://www.lilygo.cc/products/softrf-t-beamsupreme)
- [LILYGO® TTGO T-TWR Plus](https://www.lilygo.cc/products/t-twr-plus)
- [LILYGO® T-Dongle S3](https://www.lilygo.cc/products/t-dongle-s3)
- [LOLIN Wemos® S2 Pico](https://www.wemos.cc/en/latest/s2/s2_pico.html)
- [Maker badge](https://github.com/dronecz/maker_badge)
- [MicroDev microS2](https://github.com/microDev1/microS2/wiki)
- [Morpheans MorphESP-240](https://github.com/ccadic/ESP32-S2-DevBoardTFT) or [MorphESP CrowdSupply](https://www.crowdsupply.com/morpheans/morphesp-240)
- [Olimex ESP32S2 DevKit Lipo vB1 (WROVER and WROOM)](https://www.olimex.com/Products/IoT/ESP32-S2/ESP32-S2-DevKit-Lipo/open-source-hardware)
- [Seeed XIAO ESP32S3](https://www.seeedstudio.com/XIAO-ESP32S3-p-5627.html)
- [Unexpected Maker FeatherS2](https://feathers2.io)
## Supported Boards

See the board list for this family in [supported_boards.md](../../supported_boards.md#espressif).

## Build & Flash

Expand Down
44 changes: 31 additions & 13 deletions ports/family_support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
endif ()


if (NOT DEFINED JLINKEXE)
if (CMAKE_HOST_WIN32)
set(JLINKEXE JLink.exe)
else ()
set(JLINKEXE JLinkExe)
endif ()
endif ()

if (NOT DEFINED JLINK_IF)
set(JLINK_IF swd)
endif ()

#-------------------------------------------------------------
# FAMILY and BOARD
#-------------------------------------------------------------
Expand Down Expand Up @@ -150,7 +163,7 @@ function(family_configure_common TARGET)
target_compile_definitions(${TARGET} PUBLIC LOGGER_${LOGGER})

# Add segger rtt to example
if(LOGGER STREQUAL "RTT" OR LOGGER STREQUAL "rtt")
if (LOGGER STREQUAL "RTT")
target_sources(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c)
target_include_directories(${TARGET} PUBLIC ${TOP}/lib/SEGGER_RTT/RTT)
# target_compile_definitions(${TARGET} PUBLIC SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
Expand Down Expand Up @@ -231,18 +244,6 @@ endfunction()

# Add flash jlink target, optional parameter is the extension of the binary file
function(family_flash_jlink TARGET)
if (NOT DEFINED JLINKEXE)
if(CMAKE_HOST_WIN32)
set(JLINKEXE JLink.exe)
else()
set(JLINKEXE JLinkExe)
endif()
endif ()

if (NOT DEFINED JLINK_IF)
set(JLINK_IF swd)
endif ()

if (NOT DEFINED JLINK_OPTION)
set(JLINK_OPTION "")
endif ()
Expand Down Expand Up @@ -281,6 +282,23 @@ exit
)
endfunction()

function(family_jlink_erase_external TARGET START_ADDR END_ADDR)
file(GENERATE
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-erase64k.jlink
CONTENT "halt
exec EnableEraseAllFlashBanks
r
erase ${START_ADDR} ${END_ADDR}
r
exit
"
)

add_custom_target(${TARGET}-erase-external-jlink
COMMAND ${JLINKEXE} -device ${JLINK_DEVICE} -if ${JLINK_IF} -JTAGConf -1,-1 -speed auto -CommandFile ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-erase64k.jlink
)
endfunction()


# Add flash stlink target
function(family_flash_stlink TARGET)
Expand Down
5 changes: 2 additions & 3 deletions ports/make.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,14 @@ CFLAGS += \
-DUF2_VERSION_BASE='"$(GIT_VERSION)"'\
-DUF2_VERSION='"$(GIT_VERSION) - $(GIT_SUBMODULE_VERSIONS)"'\

# Bootloader src, board folder and TinyUSB stack
# Bootloader src and TinyUSB stack
SRC_C += \
src/ghostfat.c \
src/images.c \
src/main.c \
src/msc.c \
src/screen.c \
src/usb_descriptors.c \
$(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_DIR)/*.c))
src/usb_descriptors.c

endif # BUILD_APPLICATION

Expand Down
9 changes: 4 additions & 5 deletions ports/maxim/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# TinyUF2 - MAX32690 Port

This folder contains the port of TinyUF2 for Analog Devices' MAX32xxx/MAX78000 MCUs.
# TinyUF2 for Analog Maxim

## Navigation

Expand All @@ -22,13 +20,15 @@ This folder contains the port of TinyUF2 for Analog Devices' MAX32xxx/MAX78000 M
- [Re-Entering Bootloader Mode](#re-entering-bootloader-mode)
- [Port Directory Structure](#port-directory-structure)

## Supported Boards

See the board list for this family in [supported_boards.md](../../supported_boards.md#maxim).

## Requirements

This guide focuses on building TinyUF2 for Analog Devices' MAX32 parts.
It is written with Windows users in mind using the **MSDK**, but TinyUF2 is fully portable and can be built with a standard toolchain on Linux and macOS.


### Requirements for Linux/macOS (Generic)

You do **not** need the MSDK to build TinyUF2 on Linux or macOS.
Expand All @@ -49,7 +49,6 @@ or
python tools/get_deps.py --board apard32690
```


#### macOS Dependency Install
```bash
brew install arm-none-eabi-gcc make cmake git
Expand Down
6 changes: 5 additions & 1 deletion ports/mimxrt10xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ family_configure_tinyuf2(tinyuf2 OPT_MCU_MIMXRT1XXX)
family_flash_sdp(tinyuf2)
family_flash_jlink(tinyuf2 hex)

# erase first 64KB to ensure clean state for UF2 update
math(EXPR ERASE_END_ADDR "( ${FLASH_BASE} + 0x10000 )" OUTPUT_FORMAT HEXADECIMAL)
family_jlink_erase_external(tinyuf2 ${FLASH_BASE} ${ERASE_END_ADDR})

# imxrt run entirely on SRAM and can update its self using uf2
family_gen_uf2_from_bin(tinyuf2 ${UF2_FAMILY_ID} ${UF2_ADDR})
family_gen_uf2_from_bin(tinyuf2 ${UF2_FAMILY_ID} ${FLASH_FCFB_ADDR})
family_flash_uf2(tinyuf2 ${UF2_FAMILY_ID})

# copy to ARTIFACT_PATH
Expand Down
Loading
Loading