Nucleo_f446re: Assertion failed: ((bank->size >> 10) == flash_size_in_kb)


#1

Hi,

I installed platformIO under vscode on my mac without issue and everything works as it should but the debugger is having a little tantrum:

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : tcl server disabled
Info : telnet server disabled
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.281213
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from pipe
Info : device id = 0x10006421
Info : flash size = 65450kbytes
Assertion failed: ((bank->size >> 10) == flash_size_in_kb), function stm32x_probe, file /Users/ilg/Work/openocd/openocd.git/src/flash/nor/stm32f2x.c, line 1074.
.pioinit:10: Error in sourced command file:
Remote connection closed

My board is an STM32F446.

and my platform.ini:

[env:nucleo_f446re]
platform = ststm32
board = nucleo_f446re
framework = mbed
debug_tool = stlink
build_flags = -D PIO_FRAMEWORK_MBED_EVENTS_PRESENT -D PIO_FRAMEWORK_MBED_RTOS_PRESENT -D PIO_FRAMEWORK_MBED_FILESYSTEM_PRESENT

Any idea what’s going on ?

Thanks


#2

Hi @lcc! Just tried to debug similar boards nucleo_f401re and disco_f407 and they both work as expected.
I can recommend you two options:

  • Try to use the stlink tool as the debug server:
[env:nucleo_f446re]
platform = ststm32
board = nucleo_f446re
framework = mbed
debug_tool = custom
debug_port = :4242
debug_server = $PLATFORMIO_HOME_DIR/packages/tool-stlink/bin/st-util
build_flags = -D PIO_FRAMEWORK_MBED_EVENTS_PRESENT -D PIO_FRAMEWORK_MBED_RTOS_PRESENT -D PIO_FRAMEWORK_MBED_FILESYSTEM_PRESENT
  • Try to update the stlink firmware on your board as described here