@@ -45,6 +45,7 @@ This README describes configuration of supported targets.
4545* [ STM32F4] ( #stm32f4 )
4646* [ STM32F7] ( #stm32f7 )
4747* [ STM32G0] ( #stm32g0 )
48+ * [ STM32G4] ( #stm32g4 )
4849* [ STM32H5] ( #stm32h5 )
4950* [ STM32H7] ( #stm32h7 )
5051* [ STM32L0] ( #stm32l0 )
@@ -527,6 +528,79 @@ add-symbol-file test-app/image.elf 0x08008100
527528mon reset init
528529```
529530
531+ ## STM32G4
532+
533+ Supports STM32G4 single-bank Category 3 parts (verified on NUCLEO-G491RE,
534+ STM32G491RET6: 512KB flash, 96KB SRAM, Cortex-M4F).
535+
536+ The HAL boots at 170 MHz using HSI16 + PLL with PWR Range 1 Boost mode
537+ (RM0440 6.1.4), 4 flash wait states, prefetch + I/D-cache enabled.
538+
539+ Example 512KB partitioning on STM32G491RE:
540+
541+ - Sector size: 2KB
542+ - wolfBoot partition size: 32KB
543+ - Application partition size: 232KB
544+
545+ ``` C
546+ #define WOLFBOOT_SECTOR_SIZE 0x800 /* 2 KB */
547+ #define WOLFBOOT_PARTITION_BOOT_ADDRESS 0x08008000
548+ #define WOLFBOOT_PARTITION_SIZE 0x3A000 /* 232 KB */
549+ #define WOLFBOOT_PARTITION_UPDATE_ADDRESS 0x08042000
550+ #define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x0807C000 /* 16 KB swap */
551+ ```
552+
553+ ### Building STM32G4
554+
555+ Reference configuration (see [ /config/examples/stm32g4.config] ( /config/examples/stm32g4.config ) ).
556+ You can copy this to wolfBoot root as ` .config ` : ` cp ./config/examples/stm32g4.config .config ` .
557+ To build you can use ` make ` .
558+
559+ The TARGET for this is ` stm32g4 ` : ` make TARGET=stm32g4 ` .
560+ Cortex-M4F is the default ARM core for this target.
561+ The option ` NVM_FLASH_WRITEONCE=1 ` is mandatory: the IAP driver writes one
562+ 64-bit doubleword per location and cannot rewrite without an erase first.
563+ The default signing scheme is ECC256 with SHA256.
564+
565+ NUCLEO-G491RE has no HSE, so HSI16 is used as the PLL source. The ST-LINK
566+ virtual COM port is wired to LPUART1 on PA2 (TX) / PA3 (RX) via AF12.
567+ Optional boot logs over LPUART1 at 115200 8N1 are enabled with
568+ ` CFLAGS_EXTRA+=-DDEBUG_UART ` .
569+
570+ This target is single-bank only -- keep ` DUALBANK_SWAP=0 ` .
571+
572+ ### STM32G4 Programming
573+
574+ Compile requirements: ` make TARGET=stm32g4 NVM_FLASH_WRITEONCE=1 `
575+
576+ The output is a single ` factory.bin ` that includes ` wolfboot.bin ` and
577+ ` test-app/image_v1_signed.bin ` combined together. This should be programmed
578+ to the flash start address ` 0x08000000 ` .
579+
580+ Flash using the STM32CubeProgrammer CLI:
581+
582+ ```
583+ STM32_Programmer_CLI -c port=swd -d factory.bin 0x08000000
584+ ```
585+
586+ ### STM32G4 Debugging
587+
588+ Use ` make DEBUG=1 ` and program firmware again.
589+
590+ Start GDB server on port 3333:
591+
592+ ```
593+ ST-LINK_gdbserver -d -e -r 1 -p 3333
594+ OR
595+ st-util -p 3333
596+ ```
597+
598+ ```
599+ arm-none-eabi-gdb
600+ add-symbol-file test-app/image.elf 0x08008100
601+ mon reset init
602+ ```
603+
530604## STM32C0
531605
532606Supports STM32C0x0/STM32C0x1. Instructions are for the STM Nucleo-C031C6 dev board.
0 commit comments