Skip to content

Commit

Permalink
try to generate update-tinyuf2.uf2
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Nov 7, 2023
1 parent d3f49c1 commit 9497037
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ports/espressif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

if(IDF_TARGET STREQUAL "esp32s3")
set(UF2_FAMILY_ID 0xc47e5767)
elseif(IDF_TARGET STREQUAL "esp32s2")
set(UF2_FAMILY_ID 0xbfdd4eee)
else()
message(FATAL_ERROR "Unsupported ${target}.")
endif()

execute_process(COMMAND git describe --dirty --always --tags
OUTPUT_VARIABLE GIT_VERSION)
string(STRIP ${GIT_VERSION} GIT_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ externalproject_add(self_update
-DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DBOARD=${BOARD}
-DUF2_FAMILY_ID=${UF2_FAMILY_ID}
${extra_cmake_args}
INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ add_custom_target(bootloader_bin DEPENDS bootloader_bin.c)
add_dependencies(${COMPONENT_LIB} bootloader_bin)
set_property(DIRECTORY "${COMPONENT_DIR}" APPEND PROPERTY
ADDITIONAL_CLEAN_FILES bootloader_bin.c)

cmake_print_variables(elf COMPONENT_LIB)
add_custom_command(TARGET ${COMPONENT_LIB} POST_BUILD
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} -f ${UF2_FAMILY_ID} -b 0x0 -c -o ${CMAKE_BINARY_DIR}/update-tinyuf2.uf2 ${CMAKE_BINARY_DIR}/update-tinyuf2.bin
VERBATIM)

0 comments on commit 9497037

Please sign in to comment.