最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

STM32H7 Dual Core Project in CLion with Platformio and CubeMX - Stack Overflow

programmeradmin1浏览0评论

I am working on a dual-core project for the STM32H745 and I want to use CubeMX for code generation, PlatformIO for building and flashing, and CLion as my IDE. My goal is to set up the M7 core to handle communication and safety logic, while the M4 core runs control algorithms for a power electronics system.

Currently, I have generated a dual-core project in CubeMX, but I am facing several issues:

Boot Mode & Startup Sequence:

CubeMX disables the option to change the dual-core boot mode (grayed out). The default setting is Both CPUs booting at once, but I want to start the M7 core first and then the M4 core. Some resources suggest this is not supported yet, but I found an ST application note mentioning that clock gating can be used to achieve this. AN5557 ST Forum Boot Mode

Toolchain & IDE in CubeMX:

What is the best toolchain setting for generating code to work with PlatformIO? I originally used EWARM, but I also tried CMake, which generated a lot of extra files (CMakeLists.txt, etc.), making me question if this is necessary when using PlatformIO. Is EWARM the right choice, or should I pick something else? PlatformIO Configuration:

My platformio.ini file has two environments, one for M4 and one for M7, with separate folders.

Example configuration:

[env:m7]
platform = ststm32
board = nucleo_h745zi_q
framework = stm32cube
build_flags = -DCORE_CM7
build_src_filter = +<CM7/> +<Common/> +<Drivers/> -<CM4/>

[env:m4]
platform = ststm32
board = nucleo_h745zi_q
framework = stm32cube
build_flags = -DCORE_CM4
build_src_filter = +<CM4/> +<Common/> +<Drivers/> -<CM7/>

Is this the correct way to structure a dual-core project in PlatformIO?

Missing Startup Files:

Some expected startup files are missing (e.g., startup_stm32h745xx_cm4.s is not generated). However, I found system_stm32h7xx_dualcore_boot_cm4_cm7.c in the Common folder. Is CubeMX expected to generate separate startup files for each core, or is this handled differently in dual-core setups?

What I've Tried

Changing the Boot Mode:

The "Both CPUs boot at once" option is grayed out in CubeMX. I looked at ST forums and found that separate booting may not be officially supported, but I found an Application Note suggesting that clock gating might work. AN5557 ST Forum Boot Mode

Toolchain Settings in CubeMX:

Originally used EWARM, which worked before, but I also tried CMake, which created additional files. Not sure if I should stick with EWARM or switch to something else when using PlatformIO.

PlatformIO Configuration:

Set up separate environments for M4 and M7 in platformio.ini. Structured the project into CM4 and CM7 folders with build_src_filter. Not sure if this is the correct way to handle dual-core compilation in PlatformIO.

Startup File Issues:

startup_stm32h745xx_cm4.s is missing. Found a dual-core startup file in the Common folder (system_stm32h7xx_dualcore_boot_cm4_cm7.c). Not sure if separate startup files should be generated for M4 and M7, or if the dual-core file is intended to handle this.

Key Questions:

Is it possible to change the dual-core boot sequence in CubeMX (M7 first, then M4)? What is the best toolchain setting in CubeMX for a PlatformIO-based project? Is my platformio.ini configuration correct for a dual-core STM32 project? Should CubeMX generate separate startup files for M4 and M7, or is a single dual-core startup file expected?

Any insights or suggestions would be greatly appreciated! Thank You Leon

发布评论

评论列表(0)

  1. 暂无评论