Repository navigation
Slim firmware: only what brings /ext up stays in the internal flash - #149
Merged
Merged
Conversation
The STM32F746G-DISCO firmware kept every driver, the network stack, the SD card, the display and the audio in its 1 MB flash. Now flash.dmd of the board holds the way to /ext and the console (clocks, pins, usart1, SDRAM, DMA, QUADSPI, the chip, littlefs, systemd/devscan/console and ls/mount/umount/ ymodem/mklittlefs); the rest is in the new late.dmd files (common, MCU, board), which DMBOOT_EXT_TOOLS sends to /ext instead of the firmware - their drivers, units and rules to /ext/cfg, loaded once /ext is mounted. Renode (DMBOOT_EXT_TOOLS=OFF) keeps everything in the firmware as before. The splash logo moves to /ext/views too (the display driver is on /ext now); splash.cmake builds a logo under the external flash's mount point into build/ext. ymodem_send waits longer for the receiver after a file, which a fresh littlefs sometimes needs. Internal flash image: 1.00 MB -> 390 kB (MinSizeRel). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…-all late.dmd is gone: the modules go to the board's ext.dmd, the common services (dmdevmon, dmutc) to tools.dmd, which DMBOOT_EXT_TOOLS already sends to /ext. Renode is no different from the board any more: run_renode_tests.sh formats the emulated flash, sends build/ext over the UART (ymodem_send.py --port tcp:HOST:PORT) and mounts /ext again, which starts the units. The upload of a fresh /ext stopped after ~75 modules: creating a file in a directory of that size makes littlefs compact it, which took up to 5.5 s with the default 16 byte reads (1.9 s with 64, 1.3 s with 256). The sender waited 3 s for the answer to the header, sent it again, and the two sides lost each other (the receiver answered ACK and NAK). The sender now waits up to 60 s for a header, and the ext unit mounts with read=256 (not part of the on-disk format). When the device does not answer, ymodem_send says what it did say. test_renode_ext.py no longer formats: /ext is filled before it runs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
automount was on /ext, so unmounting /ext stopped its unit, which unmounts the cards it mounted - and the card holds the car HMI, which does not stop within the time the unmount gives it (15 s): the HMI was killed, the card stayed busy and `umount /ext` (so format-ext) took minutes and left the system half stopped. With automount (and libautomount, dmblkid, its unit and rules) in flash.dmd, umount /ext stops the units of /ext in ~15 s and the card and the HMI stay; mount brings the units back. format-ext: 51 s -> 25 s. The image grows by 13 kB: 404 kB. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JohnAmadis
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-DCMAKE_BUILD_TYPE=MinSizeRel;Debughas no optimization and is ~485 kB).flash.dmdof the board keeps only the way to/extand the console (clocks, pins, usart1, SDRAM, DMA, QUADSPI, the chip, littlefs, systemd/devscan/console, ls/mount/umount/ymodem/mklittlefs) andautomount(13 kB): withautomounton/ext,umount /extstopped its unit, which unmounted the SD card, and the car HMI on the card did not stop in time (the card stayed busy, minutes, system half stopped). Nowumount /exttakes ~15 s, leaves the card and the HMI alone, andmountbrings the units back.ext.dmd(and the common services intools.dmd, whichDMBOOT_EXT_TOOLSalready sends to/ext): modules in/ext/bin, drivers/units/rules in/ext/cfg, loaded once/extis mounted. Renode is the same as the board:run_renode_tests.shformats the emulated flash, sendsbuild/extover the UART (ymodem_send.py --port tcp:HOST:PORT) and mounts/extagain (new step 4b)./ext/views/(built intobuild/ext, sent byupload-ext); it shows once/extis mounted./extstopped after ~75 modules: creating a file in a directory of that size makes littlefs compact it, which took up to 5.5 s with the default 16 byte reads (1.9 s with 64, 1.3 s with 256).ymodem_send.pywaited 3 s for the answer to the header, sent it again, and sender and receiver lost each other (ACK and NAK). Now it waits up to 60 s for a header, and theextunit mounts withread=256(not part of the on-disk format). When the device does not answer,ymodem_send.pyprints what it did say.Depends on
choco-technologies/dmdevfs#78 "A driver configured into a mounted instance learns about its friends" - without it
dmwm8994fails (I2C bus friend is not ready) because its drivers are now loaded from/ext/cfg/drivers.Tested
/ext+upload-ext(first try): dmview, carhmi, dmaudio@wm8994, eth0 (DHCP, ping), wlan0, telnetd, touch, rtc, rng, crypto, SD card with music. About 34 kB more main heap and 0.4 MB more SDRAM than with everything in the firmware.scripts/run_renode_tests.sh): UART, SD card, LCD (splash logo from/ext), touch and QUADSPI pass; the network test is skipped (needs root).Known
umount /extstill stops the units of/extand printsdmdevmon ... did not stop within 5000 ms, killing itandCannot disable module 'dmicmp' - required by module 'dmudp'(libraries are stopped without regard to their dependencies); harmless.calendar_set=0(NTP never set it); there is no baseline to compare with.🤖 Generated with Claude Code