-
Notifications
You must be signed in to change notification settings - Fork 0
Add modules.dmp embedding and runtime loading #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
| 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.