Add an embedded-files build config for Duet 3 MB6HC - #1267
Open
meeloo wants to merge 3 commits into
Open
Conversation
Derived from Duet3_MB6HC.mk with -DUSE_EMBEDDED_FILES. Kept out of the default all: target like the other special-purpose configs. Its helper targets are renamed rather than inherited: sharing duet3mb6hc-prebuild, duet3mb6hc-libs and clean-Duet3_MB6HC with the normal config made make warn about overridden commands and made clean-Duet3_MB6HC silently clean the embedded build directory. Needs the USE_EMBEDDED_FILES compile fix to build.
Companion to CrcAppender.py. Builds the structure EmbeddedFiles.cpp expects at _firmware_end: magic 0x543C2BEF, directoriesOffset, numFiles, then a descriptor per file, with every offset relative to _firmware_end. The part that is easy to get wrong is the CRC. A USE_EMBEDDED_FILES image links with _firmware_crc == _firmware_end, so vector slot 7 initially points at where the filesystem is about to go. Since AppMain CRCs everything below the address in that slot, the slot has to be moved past the filesystem - which this does, so CrcAppender.py must run after this tool and not before. Both refuse to run against an image whose slot 7 is not where they expect, rather than silently CRCing the wrong extent and leaving a board blinking on the bench. Verified end to end under the Renode emulator: the firmware accepts its own CRC, finds /sys/config.g and executes it.
An image with the filesystem appended must have vector slot 7 moved past it before the CRC is computed, or the firmware rejects its own checksum and the board sits in a 3-blink loop.
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the Duet3D CLA v2.0 and I hereby sign it |
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.
Adds
Makefiles/Duet3_MB6HC_embedded.mk, a build config for MB6HC with-DUSE_EMBEDDED_FILES, plusScripts/BuildEmbeddedFiles.pyto build the filesystem image andScripts/CrcAppender.pyto append the firmware CRC.Why it might be worth having:
Pins_Duet3_MB6HC.halready has aUSE_EMBEDDED_FILESbranch, but nothing builds it, which is how it came to be broken in three separate ways (see the three bugfix PRs). A config that builds it is what makes those bugs visible and those fixes testable.It is kept out of the default
all:target, like the other special-purpose configs. Its helper targets are renamed rather than inherited: sharingduet3mb6hc-prebuild,duet3mb6hc-libsandclean-Duet3_MB6HCwith the normal config made make warn about overridden commands and madeclean-Duet3_MB6HCsilently clean the embedded build directory.The order in
BuildEmbeddedFiles.pythenCrcAppender.pyis not interchangeable: an embedded image links with_firmware_crc == _firmware_end, so the filesystem must be appended and vector slot 7 moved before the CRC is computed. Both scripts refuse to run if slot 7 is not where they expect rather than checksumming the wrong extent.My use case is an emulator, which has no SD card, so this may be too niche for upstream. Offered because the three bugfix PRs cannot be exercised without it