Help with building/flashing STM32H735 demo project with clang
I have a custom board with a STM32H735 and I have several issues with it building with clang and TouchGFX 4.26 for vscode. It works fine with 4.25 and GCC. I'm putting this migration on hold for now as many of these tools are still experimental.
What I now want is to first get a demo project working on the STM32H735G-DK board in vscode with cmake and clang.
I tried it this way:
- in TouchGFX Designer 4.26 I select my board and select Dynamic Graph example. This builds and runs in Designer.
- I open the IOC file in STM32CubeMX V6.15.0 and change toolchain to CMake+Clang
- I build in VScode using STM32Cube plugin (pre-release)
- I get build errors
[main] Building folder: C:/TouchGFXProjects/MyApplication_24/build/Debug
[build] Starting build
[driver] NOTE: You are building with preset Debug, but there are some overrides being applied from your VS Code settings.
[proc] Executing command: chcp
[proc] Executing command: cube-cmake --build C:/TouchGFXProjects/MyApplication_24/build/Debug --
[build] [1/132] Building C object CMakeFiles/STM32H735G-DK.dir/LIBJPEG/App/libjpeg.c.obj
...
[build] C:/TouchGFXProjects/MyApplication_24/Core/Src/main.c:545:23: warning: unused variable 'ospi_ram_init' [-Wunused-variable]
[build] 545 | BSP_OSPI_RAM_Init_t ospi_ram_init;
...
[build] C:\ST\STM32CubeCLT_1.19.0\GNU-tools-for-STM32\bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld: STM32H735G-DK.elf section `TouchGFX_Framebuffer' will not fit in region `DTCMRAM'
[build] C:\ST\STM32CubeCLT_1.19.0\GNU-tools-for-STM32\bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld: STM32H735G-DK.elf section `TouchGFX_Framebuffer' will not fit in region `FLASH'
[build] C:\ST\STM32CubeCLT_1.19.0\GNU-tools-for-STM32\bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld: region `DTCMRAM' overflowed by 1542024 bytes
[build] C:\ST\STM32CubeCLT_1.19.0\GNU-tools-for-STM32\bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 1256628 bytes
[build] Memory region Used Size Region Size %age Used
[build] DTCMRAM: 1673096 B 128 KB 1276.47%
[build] RAM_D1: 0 B 320 KB 0.00%
[build] RAM_D2: 0 B 32 KB 0.00%
[build] RAM_D3: 0 B 16 KB 0.00%
[build] ITCMRAM: 0 B 64 KB 0.00%
[build] FLASH: 2305204 B 1 MB 219.84%
[build] starm-clang++: error: ld command failed with exit code 1 (use -v to see invocation)
Obviously one problem is the linker file here. I will try to merge this with the GCC linker file. It also seems ospi-ram is not used.
I've also tried to make the project starting from STM32CubeMX V6.15.0, but by default TouchGFX and all the needed peripherals are not configured. It's too much work to get it working from MX.
Why doesn't it work out of the box? Or am I doing something wrong?
UPDATE:
I've copied the linker file from the STM32CubeIDE project and now it builds. But I cannot flash/debug in vscode. I can only flash it from STM32CubeProgrammer.
