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