Skip to main content
Scotty55
Associate III
June 27, 2026
Question

STM32G474 flash im single bank mode

  • June 27, 2026
  • 2 replies
  • 31 views

I am using STM32CubeIde version 2.1.1, STM32CubeMX version 6.15.0, Segger JLink, and a STM32G474RB chip.

The CubeMX generates a linker file which looks like single bank flash mode, I have uploaded the ioc and ld files.

With CubeProgrammer, I set the option bits to DBANK = 0 for single mode or DBANK = 1 for dual mode.

In every case the debugger stops flash programming at 0x08010000 (64kB), all beyond 0x08010000 reads 0XFFFFFFFF.

That leads to a hard fault right after starting a debugger session.

How can I fix this problem?

And no, I can’t switch to dual mode as the text section file exceeds 64kB, and I can’t update the CubeMX as all versions 6.16 and 6.17 contain a HRTIM configuration bug.

2 replies

AScha.3
Super User
June 28, 2026

>How can I fix this problem?

A: buy a chip with enough continuous flash for your program, STM32G474RE . or -C , if some cents are important.

btw. I just looked at mouser, 474RC is 30 cents more expensive than 474RB .

 

B: just for a test, until you have the cpu version with enough flash :

As there is the same die inside :

….you can try: make a new project , with Cube, set it to: STM32G474RE .

Generate…, then copy your program to main…, compile and try debug. If flash is not disabled, it should work.

  • or try: make  a new project , with Cube, set it to: STM32G474RE . Generate code.
  • Then look in the linker file, whats different and write it to your linker file; then try debug...
"If you feel a post has answered your question, please click ""Accept as Solution""."
Visitor II
June 28, 2026

The linker script generated by CubeMX might still have FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K even in single-bank mode — open the .ld file and verify LENGTH is 128K.

Also confirm the option bytes are actually being written. CubeProgrammer sometimes shows the change but doesn't commit it — power cycle the board after writing option bits, don't just reset.

For JLink specifically, make sure the device name in your debug config is STM32G474RB and not a generic G4 entry. Wrong device name = JLink uses wrong flash algorithm = stops at 64K.