Loading...
 
Skip to main content

System Workbench for STM32


STM32F072RBT6 not properly modeled in OPENOCD? 64K instead of 128K

BOARD : NUCLEO072
PROCESSOR: SMT32F072RBT6
DEBUGGER : STLINK-V2
Problem arises once text section. size gets bigger than 65635 bytes.

Open On-Chip Debugger 0.9.0-dev-00415-g2d4ae3f-dirty (2015-06-12-17:54)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.260646
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x20016448
Info : flash size = 64kbytes - > Wrong parameter It should be 128Kbytes.__
undefined debug reason 7 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x08000428 msp: 0x20003ffc
Error message from debugger back end:
__Load failed
__
Is there a file where I can modify this setting?

Hi


Check the linker script on your project. The memory definitions are in this script file:

/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 128K
}

I don't know if this has a connection with the OpenOCD.


Regarding the OpenOCD script, do you use this script: "nucleo_f072rb.cfg" ?

Above file include "stm32f0x.cfg". In this last file seems that the flash size is checked.
But I don't know further detailes. I have seen that there is a stm32f1x !. Possibly this is not correct.

flash size will be probed
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32f1x 0x08000000 0 0 0 $_TARGETNAME


Hi

it is not related to the linker script,as it is ok,with 128KBytes ,i think that there must be a mistake in the Open OCD, i can't find the parameter in the .cfg files ,i've checked all of them,event looking for the device ID.

thank you!

Hi,

Maybe will help to activate debug level 3 (-d3) for OpenOCD.
(Here you can find how to do this http://www.openstm32.org/tiki-view_forum_thread.php?comments_parentId=977)

It is possible that OpenOCD creates a configuration that is not for STM32F0 MCU ?
My understanding is that OpenOCD creates the configuration at the beginning of the execution, but I don't know what are the inputs. Probably the variables above are initialized at this time.


Something that can be useful is this:
12.1 Flash Configuration Commands
http://openocd.org/doc/html/Flash-Commands.html#flashdriverlist
"Flash Driver: stm32f1x
Note that some devices have been found that have a flash size register that contains an invalid value, to workaround this issue you can override the probed value used by the flash driver.

flash bank $_FLASHNAME stm32f1x 0 0x20000 0 0 $_TARGETNAME"
(I think this will specify 128k)

Maybe you can ckeck if STM32 ST-LINK Utility reports the correct flash size.

I suppose you don't use on-board ST-LINK debugger. Conform with ST NUCLEO-F072RB has a V2.1 debugger but from your log there is a V2.0

Hope this help somehow.


I have a board with STM32F072CB, for the moment I use the OpenOCD script from Discovery board STM32F072-Discovery (same MCU as Nucleo)

In my OpenOCD log the flash size is correct
Debug: 376 692 target.c:2203 target_read_u16(): address: 0x1ffff7cc, value: 0x0080
Info : 377 692 stm32f1x.c:996 stm32x_probe(): flash size = 128kbytes

Could you check this lines:
Debug: 127 94 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_flash bank STM32F072RBT6.flash stm32f1x 0x08000000 0 0 0 STM32F072RBT6.cpu
Debug: 128 94 command.c:145 script_debug(): command - ocd_flash ocd_flash bank STM32F072RBT6.flash stm32f1x 0x08000000 0 0 0 STM32F072RBT6.cpu

Check the project properties -> Target tab. In my case is
Target:
Series: STM32F0
Mcu: STM32F072RBTx
Board: STM32F072B-DISCO

Project Properties > C/C++ Build > Settings > Target (tab with AC logo)


I've read source code of OpenOCD and i realized that everything is ok, so i've check my internal flash size register at ((uint16_t*)0x1FFFF7CC), and .... it is 64KBytes so the assembler mounted me STM32F072R8T6 instead of STM32F072RBT6. 😑

sorry to bother you!

Regards