modm-io / modm

modm: a C++23 library generator for AVR and ARM Cortex-M devices
https://modm.io
Mozilla Public License 2.0
720 stars 128 forks source link

Make dfu-util flash to the offset set by modm:platform:cortex-m:linkerscript.flash_offset #1163

Closed el-han closed 2 months ago

el-han commented 2 months ago

Today I started playing around with my Arduino Portenta H7 board. It has a (yet unsupported) dual core STM32H7 and a bootloader. When trying to set the flash offset with modm:platform:cortex-m:linkerscript.flash_offset I noted that the dfu scripts always flash to 0x08000000.

This is my proposal to support dfu with flash offsets. I have tested it with the Portenta H7 board using scons and make. CMake currently does not support dfu-util as a programming tool, right?

I have also verified that make and scons still work and dfu-util flashes to 0x08000000 when modm:platform:cortex-m:linkerscript.flash_offset is not specified.

I'm looking forward to add support for the STM32H747 soon, at least for the Cortex M7 core.

salkinium commented 2 months ago

There is already a PR for dual core devices: https://github.com/modm-io/modm/pull/844, I'm also fixing the atomics support, which we will need for a multi-core message queue (plus MPU support to disable caching).

el-han commented 2 months ago

CMake currently does not support dfu-util as a programming tool, right?

No, but if you need it, you can add it. There's no technical reason not to.

No, I just wondered if I need to port the flash offset to CMake, too.

el-han commented 2 months ago

There is already a PR for dual core devices: #844, I'm also fixing the atomics support, which we will need for a multi-core message queue (plus MPU support to disable caching).

Thanks for the pointer! This looks like a good start for me.