From 5ffba82ec287c0d4bc6e7cbbb47baa4f155f5855 Mon Sep 17 00:00:00 2001 From: Winford Date: Tue, 14 May 2024 16:34:26 -0700 Subject: [PATCH 1/2] Have `idf.py build` assemble the complete ESP32 image Rather than having the user or CI scripts run the extra ./build/mkimage.sh sript, it will be run automatically if the `esp32boot.avm` libraries are found in the `AtomVM/build/libs/esp32boot` directory from a previous generic_unix build. This includes a prominet message for the user with instruction to flash the complete image to the device. Updates the esp32-build.yaml workflow to use the updated build steps, and only create the necessary esp32 related libraries, excluding the creation of uf2 files. Signed-off-by: Winford --- .github/workflows/esp32-mkimage.yaml | 6 ------ CHANGELOG.md | 4 ++++ src/platforms/esp32/CMakeLists.txt | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/esp32-mkimage.yaml b/.github/workflows/esp32-mkimage.yaml index 8a638c2a5..79ecebe3a 100644 --- a/.github/workflows/esp32-mkimage.yaml +++ b/.github/workflows/esp32-mkimage.yaml @@ -123,12 +123,6 @@ jobs: idf.py reconfigure idf.py build - - name: "Create a ${{ matrix.soc }} image" - working-directory: ./src/platforms/esp32/build - run: | - ./mkimage.sh - ls -l *.img - - name: "Upload ${{ matrix.soc }} artifacts" uses: actions/upload-artifact@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index cb3422cca..f3775522c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix bug (with code compiled with OTP-21) with binary pattern matching: the fix introduced with `02411048` was not completely right, and it was converting match context to bogus binaries. +### Changed + +- ESP32 builds now assemble the complet image automatically if `esp32boot.avm` is found from a previous generic_unix build. + ## [0.6.2] - 25-05-2024 ### Added diff --git a/src/platforms/esp32/CMakeLists.txt b/src/platforms/esp32/CMakeLists.txt index 55407bc33..1fbd77ff7 100644 --- a/src/platforms/esp32/CMakeLists.txt +++ b/src/platforms/esp32/CMakeLists.txt @@ -62,3 +62,20 @@ option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF) option(AVM_CREATE_STACKTRACES "Create stacktraces" ON) add_subdirectory(tools) + +add_custom_command( + OUTPUT atomvm-${IDF_TARGET}.img + DEPENDS gen_project_binary bootloader + COMMENT "Assembling complete image" + COMMAND ${CMAKE_BINARY_DIR}/mkimage.sh + COMMAND echo && cmake -E cmake_echo_color --yellow "ATTENTION: Ignore the following output and use: \"./build/flashimage.sh\" to flash the complete AtomVM image, including libraries." + VERBATIM + USES_TERMINAL) + +if (EXISTS ${CMAKE_SOURCE_DIR}/../../../build/libs/esp32boot/esp32boot.avm) + add_custom_target(atomvm_image ALL DEPENDS atomvm-${IDF_TARGET}.img) +endif() + + +set_property(DIRECTORY "${BUILD_DIR}" APPEND PROPERTY + ADDITIONAL_CLEAN_FILES atomvm-${IDF_TARGET}.img) From 492105f5127250dad3246bdbeaf1882fcfb922dd Mon Sep 17 00:00:00 2001 From: Winford Date: Wed, 22 May 2024 00:25:20 -0700 Subject: [PATCH 2/2] Allow setting esp32 cmake options from menuconfig Exposes the settable cmake build options for the esp32 platform to the `idf.py menuconfig` utility. Signed-off-by: Winford --- CHANGELOG.md | 1 + src/platforms/esp32/main/Kconfig.projbuild | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3775522c..927e8f7ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - ESP32 builds now assemble the complet image automatically if `esp32boot.avm` is found from a previous generic_unix build. +- ESP32 cmake build options are now also exposed in `idf.py menuconfig`. ## [0.6.2] - 25-05-2024 diff --git a/src/platforms/esp32/main/Kconfig.projbuild b/src/platforms/esp32/main/Kconfig.projbuild index e0cd7bfce..eed640bb4 100755 --- a/src/platforms/esp32/main/Kconfig.projbuild +++ b/src/platforms/esp32/main/Kconfig.projbuild @@ -26,4 +26,22 @@ menu "AtomVM configuration" help Reboot the ESP32 device if the start/0 entrypoint does not return the `ok` atom. + config AVM_CREATE_STACKTRACES + bool "Create BEAM stack traces." + default y + help + Create stacktraces for AtomVM application debugging, when an application crashes a stacktrace will be emitted. + + config AVM_VERBOSE_ABORT + bool "Verbose error when a VM abort occurs." + default n + help + Print the C module and line number when a VM abort occurs. + + config ENABLE_REALLOC_GC + bool "Enable experimental optimized realloc garbage collection." + default n + help + Enable experimental optimized garbage collection mode that makes use of C realloc instead of copying data. + endmenu