Just selectively copy the init functions and take care of possible interrupts and callbacks being declared as extern "C"
when written in .cpp
files (or directly put them in .c
files), otherwise they won’t be found by the in-C written STM32HAL.
I’ve went ahead and used CubeMX to generate a project that inits I2S1 with
it generated code in main.c
, msp_init.c
and the header files. Picking and placing the init functions in a C file an exposing said functions gives a compilable firmware. Throw some minimal code to generate a sine wave at 100Hz frequency in the mix and you got yourself a minimal firmware that compiles nicely.
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 13.2% (used 69320 bytes from 523624 bytes)
Flash: [== ] 18.2% (used 143064 bytes from 786432 bytes)
Building .pio\build\portenta_h7_m7\firmware.bin
======================= [SUCCESS] Took 6.37 seconds =======================
See