From 7f8282315e0207097f317d19e5b493f6c314fb02 Mon Sep 17 00:00:00 2001 From: Matthias Blankertz Date: Tue, 1 Apr 2025 20:47:48 +0200 Subject: [PATCH] Restructure sources The python and C modules that are supposed to be built into the firmware image (i.e. those that are in manifest.py or in USER_C_MODULES) have been moved to the software/modules directory. The software/src directory should now only contain python scripts and other files that should be installed to the Picos flash filesystem. The idea is that these should be those scripts that implement the application behaviour, as these are the ones that a user who does not want to build the whole firmware themself wants to modify. --- .gitignore | 1 + software/{src => }/.flake8 | 0 software/CMakeLists.txt | 2 +- software/boards/RPI_PICO_W/manifest.py | 5 ++--- software/build.sh | 2 +- software/{src => modules}/.clang-format | 0 software/{src => modules}/audiocore/CMakeLists.txt | 0 software/{src => modules}/audiocore/audiocore.c | 0 software/{src => modules}/audiocore/audiocore.h | 0 software/{src => modules}/audiocore/audiocore.py | 0 software/{src => modules}/audiocore/i2s.c | 0 software/{src => modules}/audiocore/i2s.h | 0 software/{src => modules}/audiocore/i2s_max98357.pio | 0 software/{src => modules}/audiocore/micropython.cmake | 0 software/{src => modules}/audiocore/module.c | 0 software/{src => modules}/audiocore/mp3.c | 0 software/{src => modules}/audiocore/mp3.h | 0 software/{src => modules}/audiocore/test/test_audiocore.c | 0 software/{src => modules}/micropython.cmake | 0 software/{src => modules}/rp2_neopixel.py | 0 software/{src => modules}/rp2_sd/micropython.cmake | 0 software/{src => modules}/rp2_sd/module.c | 0 software/{src => modules}/rp2_sd/sd.c | 0 software/{src => modules}/rp2_sd/sd.h | 0 software/{src => modules}/rp2_sd/sd_spi.c | 0 software/{src => modules}/rp2_sd/sd_spi.h | 0 software/{src => modules}/rp2_sd/sd_spi_pio.pio | 0 software/{src => modules}/rp2_sd/sd_util.h | 0 software/{src => modules}/test/include/hardware/sync.h | 0 software/{src => modules}/test/include/py/mperrno.h | 0 software/src/{mfrc522/main.py => mfrc522_test.py} | 0 software/src/{microdot/main.py => microdot_test.py} | 0 32 files changed, 5 insertions(+), 5 deletions(-) rename software/{src => }/.flake8 (100%) rename software/{src => modules}/.clang-format (100%) rename software/{src => modules}/audiocore/CMakeLists.txt (100%) rename software/{src => modules}/audiocore/audiocore.c (100%) rename software/{src => modules}/audiocore/audiocore.h (100%) rename software/{src => modules}/audiocore/audiocore.py (100%) rename software/{src => modules}/audiocore/i2s.c (100%) rename software/{src => modules}/audiocore/i2s.h (100%) rename software/{src => modules}/audiocore/i2s_max98357.pio (100%) rename software/{src => modules}/audiocore/micropython.cmake (100%) rename software/{src => modules}/audiocore/module.c (100%) rename software/{src => modules}/audiocore/mp3.c (100%) rename software/{src => modules}/audiocore/mp3.h (100%) rename software/{src => modules}/audiocore/test/test_audiocore.c (100%) rename software/{src => modules}/micropython.cmake (100%) rename software/{src => modules}/rp2_neopixel.py (100%) rename software/{src => modules}/rp2_sd/micropython.cmake (100%) rename software/{src => modules}/rp2_sd/module.c (100%) rename software/{src => modules}/rp2_sd/sd.c (100%) rename software/{src => modules}/rp2_sd/sd.h (100%) rename software/{src => modules}/rp2_sd/sd_spi.c (100%) rename software/{src => modules}/rp2_sd/sd_spi.h (100%) rename software/{src => modules}/rp2_sd/sd_spi_pio.pio (100%) rename software/{src => modules}/rp2_sd/sd_util.h (100%) rename software/{src => modules}/test/include/hardware/sync.h (100%) rename software/{src => modules}/test/include/py/mperrno.h (100%) rename software/src/{mfrc522/main.py => mfrc522_test.py} (100%) rename software/src/{microdot/main.py => microdot_test.py} (100%) diff --git a/.gitignore b/.gitignore index 73c8582..c05765c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ hardware/tonberry-pico/tonberry-pico-backups/ software/build compile_commands.json .dir-locals.el +.cache diff --git a/software/src/.flake8 b/software/.flake8 similarity index 100% rename from software/src/.flake8 rename to software/.flake8 diff --git a/software/CMakeLists.txt b/software/CMakeLists.txt index 21df313..93d05d0 100644 --- a/software/CMakeLists.txt +++ b/software/CMakeLists.txt @@ -50,7 +50,7 @@ add_test(NAME generate-xml-report set_tests_properties(clean-reports PROPERTIES FIXTURES_SETUP "Report") set_tests_properties(generate-xml-report PROPERTIES FIXTURES_CLEANUP "Report") -add_subdirectory(src/audiocore) +add_subdirectory(modules/audiocore) add_custom_target(check-format find . -iname '*.[ch]' -exec clang-format -Werror --dry-run {} + diff --git a/software/boards/RPI_PICO_W/manifest.py b/software/boards/RPI_PICO_W/manifest.py index 58eb9e0..eb25825 100644 --- a/software/boards/RPI_PICO_W/manifest.py +++ b/software/boards/RPI_PICO_W/manifest.py @@ -5,7 +5,7 @@ require("bundle-networking") # Bluetooth require("aioble") -module("rp2_neopixel.py", "../../src") +module("rp2_neopixel.py", "../../modules") require("sdcard") require("aiorepl") @@ -14,5 +14,4 @@ module("mfrc522.py", "../../lib/micropython-mfrc522/") module("microdot.py", "../../lib/microdot/src/microdot/") # TonberryPico modules -module("audiocore.py", "../../src/audiocore") -package("nfc", base_path="../../src/") +module("audiocore.py", "../../modules/audiocore") diff --git a/software/build.sh b/software/build.sh index 30b1429..317ddd9 100755 --- a/software/build.sh +++ b/software/build.sh @@ -8,7 +8,7 @@ set -eu make -C mpy-cross -j "$(nproc)" make -C ports/rp2 BOARD=TONBERRY_RPI_PICO_W BOARD_DIR="$TOPDIR"/boards/RPI_PICO_W clean make -C ports/rp2 BOARD=TONBERRY_RPI_PICO_W BOARD_DIR="$TOPDIR"/boards/RPI_PICO_W \ - USER_C_MODULES="$TOPDIR"/src/micropython.cmake -j "$(nproc)" + USER_C_MODULES="$TOPDIR"/modules/micropython.cmake -j "$(nproc)" ) ( cd tools/mklittlefs diff --git a/software/src/.clang-format b/software/modules/.clang-format similarity index 100% rename from software/src/.clang-format rename to software/modules/.clang-format diff --git a/software/src/audiocore/CMakeLists.txt b/software/modules/audiocore/CMakeLists.txt similarity index 100% rename from software/src/audiocore/CMakeLists.txt rename to software/modules/audiocore/CMakeLists.txt diff --git a/software/src/audiocore/audiocore.c b/software/modules/audiocore/audiocore.c similarity index 100% rename from software/src/audiocore/audiocore.c rename to software/modules/audiocore/audiocore.c diff --git a/software/src/audiocore/audiocore.h b/software/modules/audiocore/audiocore.h similarity index 100% rename from software/src/audiocore/audiocore.h rename to software/modules/audiocore/audiocore.h diff --git a/software/src/audiocore/audiocore.py b/software/modules/audiocore/audiocore.py similarity index 100% rename from software/src/audiocore/audiocore.py rename to software/modules/audiocore/audiocore.py diff --git a/software/src/audiocore/i2s.c b/software/modules/audiocore/i2s.c similarity index 100% rename from software/src/audiocore/i2s.c rename to software/modules/audiocore/i2s.c diff --git a/software/src/audiocore/i2s.h b/software/modules/audiocore/i2s.h similarity index 100% rename from software/src/audiocore/i2s.h rename to software/modules/audiocore/i2s.h diff --git a/software/src/audiocore/i2s_max98357.pio b/software/modules/audiocore/i2s_max98357.pio similarity index 100% rename from software/src/audiocore/i2s_max98357.pio rename to software/modules/audiocore/i2s_max98357.pio diff --git a/software/src/audiocore/micropython.cmake b/software/modules/audiocore/micropython.cmake similarity index 100% rename from software/src/audiocore/micropython.cmake rename to software/modules/audiocore/micropython.cmake diff --git a/software/src/audiocore/module.c b/software/modules/audiocore/module.c similarity index 100% rename from software/src/audiocore/module.c rename to software/modules/audiocore/module.c diff --git a/software/src/audiocore/mp3.c b/software/modules/audiocore/mp3.c similarity index 100% rename from software/src/audiocore/mp3.c rename to software/modules/audiocore/mp3.c diff --git a/software/src/audiocore/mp3.h b/software/modules/audiocore/mp3.h similarity index 100% rename from software/src/audiocore/mp3.h rename to software/modules/audiocore/mp3.h diff --git a/software/src/audiocore/test/test_audiocore.c b/software/modules/audiocore/test/test_audiocore.c similarity index 100% rename from software/src/audiocore/test/test_audiocore.c rename to software/modules/audiocore/test/test_audiocore.c diff --git a/software/src/micropython.cmake b/software/modules/micropython.cmake similarity index 100% rename from software/src/micropython.cmake rename to software/modules/micropython.cmake diff --git a/software/src/rp2_neopixel.py b/software/modules/rp2_neopixel.py similarity index 100% rename from software/src/rp2_neopixel.py rename to software/modules/rp2_neopixel.py diff --git a/software/src/rp2_sd/micropython.cmake b/software/modules/rp2_sd/micropython.cmake similarity index 100% rename from software/src/rp2_sd/micropython.cmake rename to software/modules/rp2_sd/micropython.cmake diff --git a/software/src/rp2_sd/module.c b/software/modules/rp2_sd/module.c similarity index 100% rename from software/src/rp2_sd/module.c rename to software/modules/rp2_sd/module.c diff --git a/software/src/rp2_sd/sd.c b/software/modules/rp2_sd/sd.c similarity index 100% rename from software/src/rp2_sd/sd.c rename to software/modules/rp2_sd/sd.c diff --git a/software/src/rp2_sd/sd.h b/software/modules/rp2_sd/sd.h similarity index 100% rename from software/src/rp2_sd/sd.h rename to software/modules/rp2_sd/sd.h diff --git a/software/src/rp2_sd/sd_spi.c b/software/modules/rp2_sd/sd_spi.c similarity index 100% rename from software/src/rp2_sd/sd_spi.c rename to software/modules/rp2_sd/sd_spi.c diff --git a/software/src/rp2_sd/sd_spi.h b/software/modules/rp2_sd/sd_spi.h similarity index 100% rename from software/src/rp2_sd/sd_spi.h rename to software/modules/rp2_sd/sd_spi.h diff --git a/software/src/rp2_sd/sd_spi_pio.pio b/software/modules/rp2_sd/sd_spi_pio.pio similarity index 100% rename from software/src/rp2_sd/sd_spi_pio.pio rename to software/modules/rp2_sd/sd_spi_pio.pio diff --git a/software/src/rp2_sd/sd_util.h b/software/modules/rp2_sd/sd_util.h similarity index 100% rename from software/src/rp2_sd/sd_util.h rename to software/modules/rp2_sd/sd_util.h diff --git a/software/src/test/include/hardware/sync.h b/software/modules/test/include/hardware/sync.h similarity index 100% rename from software/src/test/include/hardware/sync.h rename to software/modules/test/include/hardware/sync.h diff --git a/software/src/test/include/py/mperrno.h b/software/modules/test/include/py/mperrno.h similarity index 100% rename from software/src/test/include/py/mperrno.h rename to software/modules/test/include/py/mperrno.h diff --git a/software/src/mfrc522/main.py b/software/src/mfrc522_test.py similarity index 100% rename from software/src/mfrc522/main.py rename to software/src/mfrc522_test.py diff --git a/software/src/microdot/main.py b/software/src/microdot_test.py similarity index 100% rename from software/src/microdot/main.py rename to software/src/microdot_test.py