fail to download code to STM32G474CBT6 flash. yet download code to G474RE successfully.
Error: write into gap from 0x08010000 to 0x0803ffff
infos:
Building in release mode
Checking size .pio\build\genericSTM32G474CB\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [=== ] 28.5% (used 37316 bytes from 131072 bytes)
Flash: [===== ] 54.7% (used 71636 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
Uploading .pio\build\genericSTM32G474CB\firmware.elf
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
[stm32g4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002b0 msp: 0x2000d278
** Programming Started **
Warn : Adding extra erase range, 0x080119c8 .. 0x080407ff
Error: write into gap from 0x08010000 to 0x0803ffff
Error: error writing to flash at address 0x08000000 at offset 0x00000000
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1581
at file "embedded:startup.tcl", line 1516
*** [upload] Error 1
here I use STM32G474CBT6 with my own enviroment: env:genericSTM32G474CB
.
I add my own board named “genericSTM32G474CB.json” at C:\Users\xxx.platformio\platforms\ststm32\boards
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32G4xx -DSTM32G474xx",
"f_cpu": "170000000L",
"mcu": "stm32g474cbt6",
"product_line": "STM32G474xx",
"variant": "STM32G4xx/G473R(B-C-E)T_G474R(B-C-E)T_G483RET_G484RET"
},
"connectivity": [
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G474CB",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g4x",
"svd_path": "STM32G474xx.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"libopencm3",
"stm32cube",
"zephyr"
],
"name": "genericSTM32G474CB",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 131072,
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
"mbed"
]
},
"url": "https://www.st.com/en/evaluation-tools/nucleo-g474re.html",
"vendor": "ST"
}