I have an STM32F429I-DISC1 board and I'm trying to build stm32-blink example for it. I have a working C project with minimal required code to blink a LED, without HAL, just direct writes to registers.
Here's an example of line of Swift code

// (1) AHB1ENR[i] = 1 ... enable clock
setRegisterBit(baseAddress: RCC.BaseAddress, offset: RCC.Offsets.AHB1ENR, bit: 6, value: 1)

and its C counterpart

*((uint32_t *)(0x40023800 + 0x30)) = 0x40;

What I've found is that enabling clock and setting mode to output is enough for led toggling to work. I can upload projects to GitHub if that can help.
While the C code works, I can't figure out how to make Swift project work.
I guess the issue is with the linker or binary conversion logic or in Startup.c and I have to change some addresses there to make it work but I can't figure out what to change.
I also have a C example project from STM32CubeIDE for STM32F746G-DISCO board and I've looked through the startup code and linker script there but I did not manage to find clues.

Would appreciate any help!

I think a found a solution. The code worked after I changed base address to 0x08000000. Here's my branch with the changes.

1 Like

That makes sense. The STM32F74xxx MCUs boot from 0x0020_0000 (see the Boot configuration section in the reference manual), but STM32F429 needs a different setup.

CC @rauhul