Skip to content
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

cpu/stm32: fix RAM_LEN for F427, F429, F437, F439 models #18919

Merged

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Nov 15, 2022

Contribution description

This PR fixes the RAM_LEN setting for STM32 F427, F429, F437, F439 models.

While playing with bootloader/riotboot_dfu, I realized that the bootloader hard faults on a stm32f429i-disc1 board here

if (forced == 1 || *reset_addr == RIOTBOOT_MAGIC_NUMBER) {
because the RIOTBOOT_MAGIC_ADDR (which is RAM_BASE + RAM_LEN - 4) is not accessible. Although these models have 256 kByte RAM, the upper 64 kByte are used as CCM data RAM accessible at 0x1000 xxxx. Accessing 0x2003 xxxx leads to the hard fault.

Testing procedure

Use any stm32f429i-disc1 board and flash the bootloader/riotboot_dfu app:

BOARD=stm32f429i-disc1 make -C bootloaders/riotboot_dfu flash

Without this PR, the board is not listed with lsusb and dfu-util --list because it crashes in function riotboot_usb_dfu_init before the USB interface is initialized. With this PR lsusb as well as dfu-util --list should work.

Issues/PRs references

These models have 256 kByte RAM, but the upper 64 kByte are used as CCM data RAM accessible at 0x1000:0000. The access to 0x2003:xxxx leads to a hard fault.
@github-actions github-actions bot added Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Nov 15, 2022
@gschorcht gschorcht added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 15, 2022
@benpicco benpicco requested a review from fabian18 November 15, 2022 21:46
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch!
Those random crashes had me puzzled for a bit.

@riot-ci
Copy link

riot-ci commented Nov 16, 2022

Murdock results

✔️ PASSED

7b99a51 cpu/stm32: fix RAM_LEN for F427, F429, F437, F439 models

Success Failures Total Runtime
117848 0 117848 01h:35m:17s

Artifacts

@benpicco benpicco merged commit b33688d into RIOT-OS:master Nov 16, 2022
@gschorcht
Copy link
Contributor Author

Thanks

@gschorcht gschorcht deleted the cpu/stm32/fix_ram_len_stm32f4{2,3}{7,9} branch November 16, 2022 13:53
@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants