Skip to content

fix: re-enable config_fs_size guard in mount_config_filesystem and document dmgpio hard fault#90

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-renode-issues
Draft

fix: re-enable config_fs_size guard in mount_config_filesystem and document dmgpio hard fault#90
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-renode-issues

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

Two Renode CI issues: the test permanently times out (infinite loop) due to a commented-out size guard, and — once that is fixed — a hard fault fires when dmdevfs initialises dmgpio_port against STM32 GPIO hardware registers.

Fix: infinite loop in mount_config_filesystem

The if(config_fs_size > 0) guard was commented out, so dmffs was always invoked even when no config FS was embedded (size=0 in the emulation build). dmffs reads flash location from FLASH_FS_ADDR/FLASH_FS_SIZE env vars — not mount_opts as the old code assumed — and hung when both were unset and size was 0.

// Before: guard disabled, wrong mount_opts keys, no env vars set
// if(config_fs_size > 0)
{
    char mount_opts[128];
    Dmod_SnPrintf(mount_opts, sizeof(mount_opts), "flash_addr=0x%X;flash_size=%u", ...);
    dmvfs_mount_fs("dmffs", "/configs", mount_opts);
}

// After: guard restored, env vars set, mount_opts dropped
if(config_fs_size > 0)
{
    dmenv_seti(env_ctx, "FLASH_FS_ADDR", (uint32_t)(uintptr_t)config_fs_start);
    dmenv_seti(env_ctx, "FLASH_FS_SIZE", (uint32_t)config_fs_size);
    dmvfs_mount_fs("dmffs", "/configs", NULL);
}

dmenv_ctx is now threaded through mount_embedded_filesystems()mount_config_filesystem().

Documentation: dmgpio hard fault in Renode

Added docs/dmgpio-renode-hard-fault.md with reproduction steps, root cause analysis, and proposed fixes for the external repository. The fault occurs inside dmvfs_mount_fs("dmdevfs", "/dev", "/configs") when dmgpio_port v0.4 writes to STM32 GPIO/RCC MMIO registers that Renode's stm32f7_discovery-bb.repl does not fully emulate. The fix belongs in dmgpio (guard hardware access under emulation) or dmdevfs (tolerate driver init failure instead of propagating the exception).

Original prompt

This section details on the original issue you should resolve

<issue_title>Naprawić problemy na renode</issue_title>
<issue_description>Mamy problemy na CI:
https://productionresultssa2.blob.core.windows.net/actions-results/50fe23c4-0347-4366-ba0e-1d4ac3e7f976/workflow-job-run-bf55618c-f2ea-51fc-b435-fad2a2ca0927/logs/job/job-logs.txt?rsct=text%2Fplain&se=2026-03-09T22%3A05%3A10Z&sig=r%2BmhVpSLPzT%2FT0bvdTq2Bb40NtwcCBlynbBC%2BxZSbTA%3D&ske=2026-03-10T01%3A52%3A13Z&skoid=ca7593d4-ee42-46cd-af88-8b886a2f84eb&sks=b&skt=2026-03-09T21%3A52%3A13Z&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skv=2025-11-05&sp=r&spr=https&sr=b&st=2026-03-09T21%3A55%3A05Z&sv=2025-11-05

Aktualnie jest jakiś problem prawdopodobnie infinit loop, który sprawia, że test failuje. Gorsze jest jednak to, co się dzieje potem (po naprawie tego błędu) - z jakiegoś powodu po zamontowaniu dmgpio w dmdevfs następuje crash (hard fault). Celem tego zadania jest ustalenie jak największej ilości szczegółów na temat tego crasha i przygotowanie opisu zadania dla repozytorium dmdevfs lub dmgpio (chyba, że błąd jest po naszej stronie, to wtedy naprawienie). Nie wprowadzaj proszę żadnych workaroundów - jeśli błąd jest w innym repozytorium to dokładnie go opisz, a nie próbuj workaroundować </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

…t FLASH_FS env vars

The if(config_fs_size > 0) check was commented out, causing dmffs to be
invoked even when no config filesystem was embedded in ROM (size=0).
dmffs reads flash location from FLASH_FS_ADDR/FLASH_FS_SIZE env vars
and would hang when those were unset and size was 0, causing the Renode
CI test to timeout without ever printing DMOD-Boot started.

Changes:
- Re-enable size guard so dmffs is only mounted when config_fs_size > 0
- Set FLASH_FS_ADDR and FLASH_FS_SIZE env vars via dmenv_seti before
  calling dmvfs_mount_fs("dmffs") - this is what dmffs actually reads
- Thread dmenv_ctx through mount_embedded_filesystems and
  mount_config_filesystem function signatures
- Remove now-unused mount_opts snprintf
- Add docs/dmgpio-renode-hard-fault.md documenting the hard fault that
  occurs when dmgpio_port accesses STM32 GPIO hardware in Renode after
  dmdevfs is mounted with a proper config filesystem

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix problems on renode CI fix: re-enable config_fs_size guard in mount_config_filesystem and document dmgpio hard fault Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Naprawić problemy na renode

2 participants