Unable to Debug: Error at load statement in debug script

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

mwill195
Posts: 1
Joined: Fri Mar 29, 2019 3:58 pm

Unable to Debug: Error at load statement in debug script

Postby mwill195 » Mon Apr 01, 2019 8:25 am

Hi all,

I am having an issue when starting a debug session with an STM32 Nucleo board / St-Link. I get an error at line 6 of the debug script, which is the load command. This occurs with 9.1.0 and then I upgraded to 9.3.0 and it is the same.

The debug log shows an error with the stm cube programmer CLI exe, which I know was a new feature from 9.1.0 for programming. It generates an s record file in your application data temp folder and uses this with the CLI tool. I am thinking that this is the part of the process that is failing because I never see the files in that location - perhaps permissions related?

Code: Select all

[1.477] handleFlashPacket():  Writing to C:\Users\marwi1\AppData\Local\Temp\ST-LINK_GDB_server_a14088.srec
[1.501] spawnCubeProgrammer():   ------ Switching to STM32CubeProgrammer -----
[1.501] file_utils_spawn():  Spawning ""C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.1.0\Servers\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe" --connect port=SWD mode=UR reset=hwRst --download C:\Users\marwi1\AppData\Local\Temp\ST-LINK_GDB_server_a14088.srec --verify --log C:\Users\marwi1\AppData\Local\Temp\STM32CubeProgrammer_a14088.log"
[4.054] file_utils_spawn():  Return code 1
[4.054] spawnCubeProgrammer():  Encountered Error when opening C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.1.0\Servers\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe
[4.054] spawnCubeProgrammer():  09:16:06:715
[4.054] spawnCubeProgrammer(): 
[4.054] spawnCubeProgrammer():  09:16:06:715 Log output file:   C:\Users\marwi1\AppData\Local\Temp\STM32CubeProgrammer_a14088.log
[4.054] spawnCubeProgrammer():  09:16:06:751 Error: No debug probe detected.


When I check the temp file location the ST-LINK_GDB_server_a14088.srec file is never creared and neither is STM32CubeProgrammer_a14088.log.

I have done the usual things like run Atollic as administrator, mark the ST-link GDB server exe as "run as administrator", check folder permissions etc.

I was wondering if this path is hard coded in the the application or if you can specify where the temp file goes - for me it could go in the project sub-folder.

Edit: Just to add to the above, I do see truestudio gdbscript and hwgdbscript temp files appear in the temp data folder on each debug session, so true studio can write here. Perhaps whatever exe is creating the srecord and log files above cannot?

I have noticed other people with a similar issue but no solution yet, any ideas?

Thank you in advance, Mark

viniciusOUS
Posts: 1
Joined: Tue Apr 14, 2020 2:36 pm

Re: Unable to Debug: Error at load statement in debug script

Postby viniciusOUS » Tue Apr 14, 2020 2:59 pm

Hello, last week I was having this issue, along with many other when I tried for the first time to connect B-L072Z-LRWAN1 with Atollic 9.3. Finally I got it running by doing the following steps:

1 - Discovery kit embedded ST-LINK V2-1 firmware update through STM32CubeProgrammer -> Firmware Update -> Open in update mode -> Change Type -> STM32 Debug + Mass Storage + VCP. The firmware installed was V2J35M26.

2 - Flashing and debugger only started with debug while reset was set on Atollic and the procedure performed on the board. (Hold reset until Atollic try to access it, then release).

3 - Since I'm running an application designed by STM for B-L072Z-LRWAN1 called Ping Pong, I needed to comment out in debug.c the following lines

Code: Select all

  /* sw interface off
  GPIO_InitTypeDef GPIO_InitStructure = {0};

  GPIO_InitStructure.Mode   = GPIO_MODE_ANALOG;
  GPIO_InitStructure.Pull   = GPIO_NOPULL;
  GPIO_InitStructure.Pin    = (GPIO_PIN_13 | GPIO_PIN_14);
  __GPIOA_CLK_ENABLE() ;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
  __GPIOA_CLK_DISABLE() ;

  __HAL_RCC_DBGMCU_CLK_ENABLE();
  HAL_DBGMCU_DisableDBGSleepMode();
  HAL_DBGMCU_DisableDBGStopMode();
  HAL_DBGMCU_DisableDBGStandbyMode();
  __HAL_RCC_DBGMCU_CLK_DISABLE();

  */


Here is my Startup Script (I haven't changed anything)

Code: Select all

# Set flash parallelism mode to 32, 16, or 8 bit when using STM32 F2/F4 microcontrollers
# Uncomment next line, 2=32 bit, 1=16 bit and 0=8 bit parallelism mode
#monitor flash set_parallelism_mode 2

# Set character encoding
set host-charset CP1252
set target-charset CP1252

# Reset to known state
monitor reset

# Load the program executable
load      

# Reset the chip to get to a known state. Remove "monitor reset" command
#  if the code is not located at default address and does not run by reset.
monitor reset

# Enable Debug connection in low power modes (DBGMCU->CR)
set *0xE0042004 = (*0xE0042004) | 0x7

# Set a breakpoint at main().
tbreak main

# Run to the breakpoint.
continue


hope this helps somehow.


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 2 guests