From b9fd1d475e93fa4d2533baa6321694027945267d Mon Sep 17 00:00:00 2001 From: Brumi-2021 Date: Wed, 14 Aug 2024 21:12:06 +0200 Subject: [PATCH 1/2] Needed_changes_to_compile_with_gcc_13.2.1 --- firmware/application/event_m0.cpp | 2 ++ firmware/standalone/pacman/CMakeLists.txt | 2 +- firmware/tools/export_external_apps.py | 8 ++++++-- firmware/tools/make_spi_image.py | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index 2f9478709..82f0e6bde 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -281,6 +281,7 @@ void EventDispatcher::emulateTouch(ui::TouchEvent event) { while (injected_touch_event != nullptr) { chThdSleepMilliseconds(5); } + injected_touch_event = nullptr; // to clean event_mo.cpp, compile warning error : "storing the address of local variable 'event' in 'this_4(D)->injected_touch_event' [-Wdangling-pointer=]" } void EventDispatcher::emulateKeyboard(ui::KeyboardEvent event) { @@ -288,6 +289,7 @@ void EventDispatcher::emulateKeyboard(ui::KeyboardEvent event) { while (injected_keyboard_event != nullptr) { chThdSleepMilliseconds(5); } + injected_keyboard_event = nullptr; // to clean event_mo.cpp, compile warning error : "storing the address of local variable 'event' in 'this_4(D)->injected_keyboard_event' [-Wdangling-pointer=]" } void EventDispatcher::on_keyboard_event(ui::KeyboardEvent event) { diff --git a/firmware/standalone/pacman/CMakeLists.txt b/firmware/standalone/pacman/CMakeLists.txt index 30023db6a..0c530f144 100644 --- a/firmware/standalone/pacman/CMakeLists.txt +++ b/firmware/standalone/pacman/CMakeLists.txt @@ -31,7 +31,7 @@ include(CheckCXXCompilerFlag) project(pacman_app) # Compiler options here. -set(USE_OPT "-Os -g --specs=nano.specs") +set(USE_OPT "-Os -g --specs=nano.specs --specs=nosys.specs") # C specific options here (added to USE_OPT). set(USE_COPT "-std=gnu99") diff --git a/firmware/tools/export_external_apps.py b/firmware/tools/export_external_apps.py index b187eddb7..f0216a6d3 100755 --- a/firmware/tools/export_external_apps.py +++ b/firmware/tools/export_external_apps.py @@ -55,8 +55,12 @@ def write_image(data, path): def patch_image(path, image_data, search_address, replace_address): if (len(image_data) % 4) != 0: - print("file size not divideable by 4") - sys.exit(-1) + #sys.exit(-1) + print("\n External App image file:", path, ", size not divideable by 4 :", len(image_data)) + j=0 + while (len(image_data) % 4) != 0: + image_data += b'\x00' ; j+=1 + print("file size:", len(image_data)," after padded:",j, "bytes") external_application_image = bytearray() diff --git a/firmware/tools/make_spi_image.py b/firmware/tools/make_spi_image.py index 11180b309..6ac746405 100755 --- a/firmware/tools/make_spi_image.py +++ b/firmware/tools/make_spi_image.py @@ -135,8 +135,8 @@ def get_gcc_version_from_elf_files_in_giving_path_or_filename_s_path(path): padded_data = image['data'] + (spi_image_default_byte * pad_size) spi_image += padded_data -if len(spi_image) > spi_size - 4: - raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image) + 4, spi_size)) +# if len(spi_image) > spi_size - 4: + # raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image) + 4, spi_size)) pad_size = spi_size - 4 - len(spi_image) for i in range(pad_size): From e30c824e5a615163843a6faa5d6fe32f3a2273cf Mon Sep 17 00:00:00 2001 From: Brumi-2021 Date: Thu, 15 Aug 2024 17:00:15 +0200 Subject: [PATCH 2/2] re-activate_length_binary_size_protect --- firmware/tools/make_spi_image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/tools/make_spi_image.py b/firmware/tools/make_spi_image.py index 6ac746405..11180b309 100755 --- a/firmware/tools/make_spi_image.py +++ b/firmware/tools/make_spi_image.py @@ -135,8 +135,8 @@ def get_gcc_version_from_elf_files_in_giving_path_or_filename_s_path(path): padded_data = image['data'] + (spi_image_default_byte * pad_size) spi_image += padded_data -# if len(spi_image) > spi_size - 4: - # raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image) + 4, spi_size)) +if len(spi_image) > spi_size - 4: + raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image) + 4, spi_size)) pad_size = spi_size - 4 - len(spi_image) for i in range(pad_size):