Skip to content

Conversation

@Igor-Misic
Copy link
Member

@Igor-Misic Igor-Misic commented Jun 21, 2025

This PR replaces the use of FlashAdapter_program with a direct call to memcpy for copying the binary to RAM. The previous approach was a abuse of FlashAdapter_program function, while this version offers a cleaner and more maintainable solution.

It removes the cppcheck configuration for the IMUtility submodule.

It also cleans up the linker scripts to make them easier to use.

⚠️ Known STM32H7 Issue! ⚠️

AXI-SRAM and DTCMRAM loses the most recent writes after a system reset.
This can lead to code/data corruption if not handled properly.

More details on this problem are available here:
https://community.st.com/t5/stm32-mcus-products/axi-sram-losing-last-few-writes-across-reset/td-p/363788/highlight/true

Workarounds Used

We currently apply a couple of workarounds that have proven to be effective in practice. However, they might not represent a permanent or universal fix. The approach will likely evolve as we continue testing and refining the solution.

For DTCM, where we store the restart_info data, we write an extra byte before reset that we expect to be corrupted.

For AXISRAM, we reserve an extra 4 bytes in the linker script, which we also expect to be corrupted after reset.

Some examples of how corrupted data looks after a restart:

32 bytes aliment (Not OK)

AXISRAM_issue3

16 bytes aliment (Not OK)

AXISRAM_issue2

16 bytes aliment with 4 byte extra at the end (OK)

AXISRAM_issue1

8 bytes aliment with 4 byte extra at the end (OK)

AXISRAM_issue4

@Igor-Misic Igor-Misic merged commit b7457e0 into master Jun 21, 2025
18 checks passed
@Igor-Misic Igor-Misic deleted the running_from_ram_improvements branch June 21, 2025 16:41
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.

2 participants