Add modules.dmp embedding and runtime loading#40
Merged
JohnAmadis merged 6 commits intomasterfrom Nov 20, 2025
Merged
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add embedding of modules.dmp file to firmware
Add modules.dmp embedding and runtime loading
Nov 20, 2025
JohnAmadis
reviewed
Nov 20, 2025
| add_custom_command( | ||
| OUTPUT "${MODULES_DMP_OBJECT}" | ||
| COMMAND ${CMAKE_COMMAND} -E echo "Checking for modules.dmp..." | ||
| COMMAND bash -c "if [ -f ${MODULES_DMP_FILE} ]; then echo 'Embedding modules.dmp'; ${CMAKE_OBJCOPY} --input-target=binary --output-target=elf32-littlearm --binary-architecture=arm --rename-section .data=.embedded.modules_dmp,alloc,load,readonly,data,contents ${MODULES_DMP_FILE} ${MODULES_DMP_OBJECT}; else echo 'No modules.dmp found, creating empty object'; ${CMAKE_OBJCOPY} --input-target=binary --output-target=elf32-littlearm --binary-architecture=arm --rename-section .data=.embedded.modules_dmp,alloc,load,readonly,data,contents /dev/null ${MODULES_DMP_OBJECT}; fi" |
Contributor
There was a problem hiding this comment.
@copilot Coś tutaj zmieniasz tutaj przez co ten plik nie chce się załadować. Sprawdź sobie w trybie emulacji jak to działa
[INFO] Loading modules.dmp from ROM: addr=0x80190C0, size=7489 bytes
[INFO] Module is DMP package - loading from package
[INFO] Package buffer added: modules
[WARN] Dmod_Mutex_New interface not implemented
[WARN] Could not create mutex
[ERROR] Cannot load header - invalid signature: 0x%08x
[WARN] dmheap: Module Unknown is not registered.
[ERROR] Failed to load modules.dmp package
Contributor
Author
There was a problem hiding this comment.
I need more information to debug this. The modules.dmp file is being embedded (7489 bytes), but the DMP package format appears corrupted.
Could you check:
- Does the modules.dmp file exist in the build directory before embedding?
- Can you run
./bin/tools/todmp -l build/modules.dmpto verify the package is valid before embedding? - What module is listed in modules/modules.dmd?
The embedding code I added is identical to how startup.dmp is embedded, so the issue might be with how modules.dmp is being created by the todmp tool in modules/CMakeLists.txt, or there might be a dependency ordering issue.
5d1bb15 to
4106e02
Compare
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.
Plan: Add modules.dmp embedding support
.embedded.modules_dmpinlinker/common.ldCMakeLists.txtto handle build-time generation ofmodules.dmpsrc/main.cfor modules_dmpload_embedded_modules_dmp()function insrc/main.cmain()after DMOD initializationIssue Investigation & Fix
The user reported that modules.dmp was loading (7489 bytes) but had an invalid signature error. After investigation, I found the issue was likely in how
todmpwas being called inmodules/CMakeLists.txt.Root Cause:
The
todmpcommand was being called with an absolute path for the input directory while WORKING_DIRECTORY was already set to that same directory. This could cause todmp to incorrectly interpret paths or create malformed packages.Solution (commit 5d1bb15):
${TODMP} modules ${DMBOOT_MODULES_OUT_DIR} ${DMBOOT_MODULES_DMP}to${TODMP} modules . ${DMBOOT_MODULES_DMP}This follows the pattern shown in the documentation where todmp is called with relative paths like
./dmf.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.