Skip to content

Commit e52f3e7

Browse files
committed
cmake self-update is generic app
1 parent 24797f4 commit e52f3e7

File tree

4 files changed

+12
-46
lines changed

4 files changed

+12
-46
lines changed
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#------------------------------------
2-
# Self Update
2+
# Application
33
# This file is meant to be include by add_subdirectory() in the root CMakeLists.txt
44
#------------------------------------
5+
cmake_minimum_required(VERSION 3.17)
6+
7+
include(${FAMILY_PATH}/app.cmake)
58

69
# Generate bootloader_bin.c
710
add_custom_command(OUTPUT bootloader_bin.c
8-
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} --carray -o bootloader_bin.c $<TARGET_FILE_DIR:tinyuf2>/tinyuf2.bin
11+
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} --carray -o ${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c $<TARGET_FILE_DIR:tinyuf2>/tinyuf2.bin
912
DEPENDS tinyuf2
1013
)
1114

12-
# self_update target
1315
add_executable(self_update
14-
${TOP}/apps/self_update/self_update.c
15-
${CMAKE_CURRENT_LIST_DIR}/../../boards.c
16-
${CMAKE_CURRENT_LIST_DIR}/../../board_flash.c
16+
self_update.c
17+
${FAMILY_PATH}/boards.c
18+
${FAMILY_PATH}/board_flash.c
1719
${CMAKE_CURRENT_BINARY_DIR}/bootloader_bin.c
1820
)
1921

@@ -25,10 +27,7 @@ target_compile_definitions(self_update PUBLIC
2527
BUILD_NO_TINYUSB
2628
BUILD_APPLICATION
2729
)
28-
target_link_options(self_update PUBLIC
29-
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/../../linker/stm32h5_app.ld"
30-
)
3130

32-
family_configure_common(self_update)
31+
family_configure_app(self_update)
3332
family_gen_uf2(self_update ${UF2_FAMILY_ID})
3433
family_flash_uf2(self_update ${UF2_FAMILY_ID})

ports/stm32f4/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ family_flash_stlink(tinyuf2)
2525
#------------------------------------
2626
# Application
2727
#------------------------------------
28-
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps/self_update)
28+
add_subdirectory(${TOP}/apps/self_update ${CMAKE_BINARY_DIR}/apps/self_update)
2929
add_subdirectory(${TOP}/apps/blinky ${CMAKE_BINARY_DIR}/apps/blinky)
3030
add_subdirectory(${TOP}/apps/erase_firmware ${CMAKE_BINARY_DIR}/apps/erase_firmware)

ports/stm32f4/apps/self_update/CMakeLists.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.

ports/stm32h5/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ family_flash_jlink(tinyuf2)
2222
family_flash_stlink(tinyuf2)
2323

2424
#------------------------------------
25-
# Application (e.g self update)
25+
# Application
2626
#------------------------------------
27-
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps/self_update)
27+
add_subdirectory(${TOP}/apps/self_update ${CMAKE_BINARY_DIR}/apps/self_update)
2828
add_subdirectory(${TOP}/apps/blinky ${CMAKE_BINARY_DIR}/apps/blinky)
2929
add_subdirectory(${TOP}/apps/erase_firmware ${CMAKE_BINARY_DIR}/apps/erase_firmware)

0 commit comments

Comments
 (0)