diff --git a/Apps.cmake b/Apps.cmake index 890aa19..5d87e10 100644 --- a/Apps.cmake +++ b/Apps.cmake @@ -41,7 +41,7 @@ function(build_and_flash_app APP ADDR) message(STATUS "Flashing ${APP} to address ${ADDR}") execute_process( - COMMAND esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash ${ADDR} ${CMAKE_SOURCE_DIR}/apps/${APP}/build/${APP}.bin + COMMAND esptool.py --before default_reset --after hard_reset write_flash ${ADDR} ${CMAKE_SOURCE_DIR}/apps/${APP}/build/${APP}.bin RESULT_VARIABLE flash_result ) if(NOT flash_result EQUAL 0) diff --git a/README.md b/README.md index a80f3e3..b7e4d0d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ 3rd stage graphical bootloader which let's you pick an applications whic are stored in OTA partitions. +![ESP32-S3-Box-3 Graphical Bootloader](doc/esp32-s3-box-3-graphical-bootloader.webp) + + ## Selected board The project is by default configured for ESP32-S3-BOX-3. In case of different board please run one of following exports and then CMake command: @@ -32,6 +35,17 @@ Finish the configuration (copy of proper idf_component.yml to main and all appli cmake -P SelectBoard.cmake ``` +### Switching to other board + +If you already built a project for existing board and you'd like to build for a different one, then it's necessary remove sdkconfig created for the specific HW. + +```shell +rm -rf managed_components sdkconfig build +idf.py fullclean +``` + +You should repeat this process also for applications. + ## Quick start Build and flash all applications at once: @@ -47,22 +61,36 @@ cmake -S . -B build -P Apps.cmake idf.py build flash pushd apps/tic_tac_toe idf.py build -esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash 0x220000 build/tic_tac_toe.bin +esptool.py --before default_reset --after hard_reset write_flash 0x220000 build/tic_tac_toe.bin popd pushd apps/wifi_list -esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash 0x4E0000 build/wifi_list.bin +esptool.py --before default_reset --after hard_reset write_flash 0x4E0000 build/wifi_list.bin popd pushd apps/calculator -esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash 0x7A0000 build/calculator.bin +esptool.py --before default_reset --after hard_reset write_flash 0x7A0000 build/calculator.bin popd pushd apps/synth_piano -esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash 0xA60000 build/synth_piano.bin +esptool.py --before default_reset --after hard_reset write_flash 0xA60000 build/synth_piano.bin popd pushd apps/game_of_life -esptool.py --chip esp32s3 --baud 921600 --before default_reset --after hard_reset write_flash 0xD20000 build/game_of_life.bin +esptool.py --before default_reset --after hard_reset write_flash 0xD20000 build/game_of_life.bin popd ``` +### Merging all applications + +Following command merges all applications into UF2 format: + +``` +esptool.py --chip esp32s3 merge_bin --format uf2 -o build/uf2.bin --flash_mode dio --flash_size 16MB \ + 0x10000 build/esp32-graphical-bootloader.bin \ + 0x220000 apps/tic_tac_toe/build/tic_tac_toe.bin \ + 0x4E0000 apps/wifi_list/build/wifi_list.bin \ + 0x7A0000 apps/calculator/build/calculator.bin \ + 0xA60000 apps/synth_piano/build/synth_piano.bin \ + 0xD20000 apps/game_of_life/build/game_of_life.bin +``` + ## Build Initial build and flash of the application and partition table. diff --git a/SingleImage.cmake b/SingleImage.cmake new file mode 100644 index 0000000..f227705 --- /dev/null +++ b/SingleImage.cmake @@ -0,0 +1,40 @@ +# Paths to binaries +set(BOOTLOADER_BIN "${CMAKE_SOURCE_DIR}/build/bootloader/bootloader.bin") +set(PARTITION_TABLE_BIN "${CMAKE_SOURCE_DIR}/build/partition_table/partition-table.bin") + +set(TIC_TAC_TOE_BIN "${CMAKE_SOURCE_DIR}/apps/tic_tac_toe/build/tic_tac_toe.bin") +set(WIFI_LIST_BIN "${CMAKE_SOURCE_DIR}/apps/wifi_list/build/wifi_list.bin") +set(CALCULATOR_BIN "${CMAKE_SOURCE_DIR}/apps/calculator/build/calculator.bin") +set(SYNTH_PIANO_BIN "${CMAKE_SOURCE_DIR}/apps/synth_piano/build/synth_piano.bin") +set(GAME_OF_LIFE_BIN "${CMAKE_SOURCE_DIR}/apps/game_of_life/build/game_of_life.bin") + +# Output files +set(COMBINED_BIN "${CMAKE_SOURCE_DIR}/combined.bin") +set(COMBINED_UF2 "${CMAKE_SOURCE_DIR}/combined.uf2") + +# Add custom target to merge binaries +add_custom_target(merge_binaries ALL + COMMAND ${CMAKE_COMMAND} -E echo "Merging binaries into ${COMBINED_BIN}..." + COMMAND esptool.py --chip esp32s3 merge_bin -o ${COMBINED_BIN} + --flash_mode dio --flash_freq 80m --flash_size 16MB + 0x1000 ${BOOTLOADER_BIN} + 0x8000 ${PARTITION_TABLE_BIN} + 0x220000 ${TIC_TAC_TOE_BIN} + 0x4E0000 ${WIFI_LIST_BIN} + 0x7A0000 ${CALCULATOR_BIN} + 0xA60000 ${SYNTH_PIANO_BIN} + 0xD20000 ${GAME_OF_LIFE_BIN} + COMMAND ${CMAKE_COMMAND} -E echo "Converting ${COMBINED_BIN} to ${COMBINED_UF2}..." + COMMAND python ${CMAKE_SOURCE_DIR}/uf2conv.py ${COMBINED_BIN} --chip esp32s3 --base 0x0 --output ${COMBINED_UF2} + COMMENT "Merging and converting binaries to UF2" + VERBATIM +) + +# Ensure merge_binaries runs after all binaries are built +add_dependencies(merge_binaries + tic_tac_toe_app + wifi_list_app + calculator_app + synth_piano_app + game_of_life_app +) diff --git a/apps/calculator/main/idf_component.yml b/apps/calculator/main/idf_component.yml index 742503f..b2f6efb 100644 --- a/apps/calculator/main/idf_component.yml +++ b/apps/calculator/main/idf_component.yml @@ -1,11 +1,8 @@ -## IDF Component Manager Manifest File +description: ESP32 Graphical Bootloader + dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/apps/calculator/sdkconfig.defaults.esp32_p4_function_ev_board b/apps/calculator/sdkconfig.defaults.esp32_p4_function_ev_board new file mode 100644 index 0000000..c9a7edc --- /dev/null +++ b/apps/calculator/sdkconfig.defaults.esp32_p4_function_ev_board @@ -0,0 +1,33 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +#CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32=y + +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 +CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y +CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y +CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +## LVGL9 ## +CONFIG_LV_CONF_SKIP=y + +#CLIB default +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y + diff --git a/apps/game_of_life/main/idf_component.yml b/apps/game_of_life/main/idf_component.yml index 742503f..b2f6efb 100644 --- a/apps/game_of_life/main/idf_component.yml +++ b/apps/game_of_life/main/idf_component.yml @@ -1,11 +1,8 @@ -## IDF Component Manager Manifest File +description: ESP32 Graphical Bootloader + dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/apps/game_of_life/sdkconfig.defaults.esp32_p4_function_ev_board b/apps/game_of_life/sdkconfig.defaults.esp32_p4_function_ev_board new file mode 100644 index 0000000..c9a7edc --- /dev/null +++ b/apps/game_of_life/sdkconfig.defaults.esp32_p4_function_ev_board @@ -0,0 +1,33 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +#CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32=y + +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 +CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y +CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y +CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +## LVGL9 ## +CONFIG_LV_CONF_SKIP=y + +#CLIB default +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y + diff --git a/apps/synth_piano/main/idf_component.yml b/apps/synth_piano/main/idf_component.yml index 742503f..b2f6efb 100644 --- a/apps/synth_piano/main/idf_component.yml +++ b/apps/synth_piano/main/idf_component.yml @@ -1,11 +1,8 @@ -## IDF Component Manager Manifest File +description: ESP32 Graphical Bootloader + dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/apps/synth_piano/sdkconfig.defaults.esp32_p4_function_ev_board b/apps/synth_piano/sdkconfig.defaults.esp32_p4_function_ev_board new file mode 100644 index 0000000..c9a7edc --- /dev/null +++ b/apps/synth_piano/sdkconfig.defaults.esp32_p4_function_ev_board @@ -0,0 +1,33 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +#CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32=y + +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 +CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y +CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y +CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +## LVGL9 ## +CONFIG_LV_CONF_SKIP=y + +#CLIB default +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y + diff --git a/apps/tic_tac_toe/main/idf_component.yml b/apps/tic_tac_toe/main/idf_component.yml index 742503f..b2f6efb 100644 --- a/apps/tic_tac_toe/main/idf_component.yml +++ b/apps/tic_tac_toe/main/idf_component.yml @@ -1,11 +1,8 @@ -## IDF Component Manager Manifest File +description: ESP32 Graphical Bootloader + dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/apps/tic_tac_toe/sdkconfig.defaults.esp32_p4_function_ev_board b/apps/tic_tac_toe/sdkconfig.defaults.esp32_p4_function_ev_board new file mode 100644 index 0000000..c9a7edc --- /dev/null +++ b/apps/tic_tac_toe/sdkconfig.defaults.esp32_p4_function_ev_board @@ -0,0 +1,33 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +#CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32=y + +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 +CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y +CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y +CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +## LVGL9 ## +CONFIG_LV_CONF_SKIP=y + +#CLIB default +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y + diff --git a/apps/wifi_list/main/idf_component.yml b/apps/wifi_list/main/idf_component.yml index 742503f..b2f6efb 100644 --- a/apps/wifi_list/main/idf_component.yml +++ b/apps/wifi_list/main/idf_component.yml @@ -1,11 +1,8 @@ -## IDF Component Manager Manifest File +description: ESP32 Graphical Bootloader + dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - ## Required IDF version - idf: - version: ">=5.0.0" diff --git a/apps/wifi_list/sdkconfig.defaults.esp32_p4_function_ev_board b/apps/wifi_list/sdkconfig.defaults.esp32_p4_function_ev_board new file mode 100644 index 0000000..aca718d --- /dev/null +++ b/apps/wifi_list/sdkconfig.defaults.esp32_p4_function_ev_board @@ -0,0 +1,33 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32=y + +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y +CONFIG_SPIRAM_RODATA=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2 +CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y +CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y +CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_IDF_EXPERIMENTAL_FEATURES=y + +## LVGL9 ## +CONFIG_LV_CONF_SKIP=y + +#CLIB default +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y + diff --git a/diagram.json b/diagram.json new file mode 100644 index 0000000..6576a3d --- /dev/null +++ b/diagram.json @@ -0,0 +1,16 @@ +{ + "version": 1, + "author": "Uri Shaked", + "editor": "wokwi", + "parts": [ + { + "type": "board-esp32-s3-box-3", + "id": "esp32", + "top": -24.91, + "left": -388.54, + "attrs": { "psramSize": "16", "flashSize": "16" } + } + ], + "connections": [ [ "$serialMonitor:RX", "esp32:G14", "", [] ], [ "$serialMonitor:TX", "esp32:G11", "", [] ] ], + "dependencies": {} +} \ No newline at end of file diff --git a/doc/esp32-s3-box-3-graphical-bootloader.webp b/doc/esp32-s3-box-3-graphical-bootloader.webp new file mode 100644 index 0000000..57bd3e8 Binary files /dev/null and b/doc/esp32-s3-box-3-graphical-bootloader.webp differ diff --git a/main/idf_component.yml b/main/idf_component.yml index 0174849..b2f6efb 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -1,11 +1,8 @@ description: ESP32 Graphical Bootloader dependencies: - espressif/esp-box: "^3.1.0" - #espressif/esp-box-3: "^1.2.0" + espressif/esp-box-3: "^1.2.0" # Workaround for i2c: CONFLICT! driver_ng is not allowed to be used with this old driver esp_codec_dev: public: true version: "==1.1.0" - #m5stack_core_s3: - # version: "^1.0.0" diff --git a/wokwi.toml b/wokwi.toml new file mode 100644 index 0000000..689fc7e --- /dev/null +++ b/wokwi.toml @@ -0,0 +1,5 @@ +[wokwi] +version = 1 +elf = "build/uf2.bin" +firmware = "build/uf2.bin" +