cancel
Showing results for 
Search instead for 
Did you mean: 

Imported Atollic TS project to STM32CubeIDE. Project uses bootloader, but ignored in STM32CubeIDE

MFend
Associate III

I built a bootloader and a project using the Atollic TS pdf How-to. The bootloader works well (at 0x0800 0000), and I can debug the program (at 0x0800 8000).

I imported the project to the STM32CubeIDE, but the project doesn't seem to start at the correct address.

When I used an *.ld file in which the project starts at 0x0800 0000, it seemed to work OK. but once I make space for the bootloader, and use address 0x0800 8000 in the *.ld file, I cannot manage to debug the project.

When I upload an image of the bootloader + FW to 0x0800 0000, the device works well.

7 REPLIES 7
MFend
Associate III

In Atollic, I remember dealing with the Startup scripts - but I don't see this in the STM32CubeIDE.

Here's the script from TS:

# Default GDB command file (FLASH) for SEGGER J-LINK and STMicroelectronics STM32L451VE microcontroller.
 
# Set character encoding
set host-charset CP1252
set target-charset CP1252
 
# Set JTAG speed to 30 kHz
monitor speed 30
 
# Set GDBServer to little endian
monitor endian little
 
# Reset the chip to get to a known state.
monitor reset
 
# Set auto JTAG speed
monitor speed auto
 
# Setup GDB FOR FASTER DOWNLOADS
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
 
# Enable flash download
monitor flash download = 1
 
# 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
# Set a breakpoint at main().
tbreak main
 
# Run to the breakpoint.
continue

I'm running on STM32L451VE

MFend
Associate III

Below from the debugger console.

Why is there a reference to the following addresses?

Read 4 bytes @ address 0x08000EFC (Data = 0x0F04F01E)

Read 2 bytes @ address 0x08000EFC (Data = 0xF01E)

Read 4 bytes @ address 0x08000194 (Data = 0xFFFFFFFF)

Read 2 bytes @ address 0x08000194 (Data = 0xFFFF)

Until address 0x08008000 in internal flash is memory reserved and used for the Bootloader.

All program and data must start at 0x8008000

SEGGER J-Link GDB Server V6.44c Command Line Version
 
JLinkARM.dll V6.44c (DLL compiled Mar 22 2019 17:26:40)
 
Command line: -port 2331 -s -device STM32L451VE -endian little -speed 4000 -if swd -swoport 2332 -vd
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            off
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 STM32L451VE
Target interface:              SWD
Target interface speed:        4000kHz
Target endian:                 little
 
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V10 compiled Mar 21 2019 15:43:57
Hardware: V10.10
S/N: 600107275
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.32 V
Listening on TCP/IP port 2331
Connecting to target...WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000EFC (Data = 0x0F04F01E)
Read 2 bytes @ address 0x08000EFC (Data = 0xF01E)
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000EFC (Data = 0x0F04F01E)
Read 2 bytes @ address 0x08000EFC (Data = 0xF01E)
Received monitor command: WriteDP 0x2 0x000000F0
O.K.
Received monitor command: ReadAP 0x2
O.K.:0xE00FF003
Reading 32 bytes @ address 0xE00FFFD0
Received monitor command: reset
Resetting target
Downloading 404 bytes @ address 0x08008000 - Verified OK
Downloading 16176 bytes @ address 0x080081A0 - Verified OK
Downloading 16032 bytes @ address 0x0800C0D0 - Verified OK
Downloading 16048 bytes @ address 0x0800FF70 - Verified OK
Downloading 16064 bytes @ address 0x08013E20 - Verified OK
Downloading 16128 bytes @ address 0x08017CE0 - Verified OK
Downloading 16064 bytes @ address 0x0801BBE0 - Verified OK
Downloading 16112 bytes @ address 0x0801FAA0 - Verified OK
Downloading 16048 bytes @ address 0x08023990 - Verified OK
Downloading 15984 bytes @ address 0x08027840 - Verified OK
Downloading 16048 bytes @ address 0x0802B6B0 - Verified OK
Downloading 16016 bytes @ address 0x0802F560 - Verified OK
Downloading 11680 bytes @ address 0x080333F0 - Verified OK
Downloading 15560 bytes @ address 0x08036190 - Verified OK
Downloading 8 bytes @ address 0x08039E58 - Verified OK
Downloading 8 bytes @ address 0x08039E60 - Verified OK
Downloading 4 bytes @ address 0x08039E68 - Verified OK
Downloading 3752 bytes @ address 0x08039E6C - Verified OK
Writing register (PC = 0x 8008fb8)
Read 4 bytes @ address 0x08008FB8 (Data = 0xD034F8DF)
Read 2 bytes @ address 0x08008FB8 (Data = 0xF8DF)
Read 2 bytes @ address 0x08008FBA (Data = 0xD034)
Read 4 bytes @ address 0x2001FFFC (Data = 0x41000000)
Reading 64 bytes @ address 0x2001FFC0
Read 4 bytes @ address 0x08000194 (Data = 0xFFFFFFFF)
Read 2 bytes @ address 0x08000194 (Data = 0xFFFF)
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0xFFFFFFFE
Read 4 bytes @ address 0xE000ED14 (Data = 0x00000200)
Downloading 4 bytes @ address 0xE000ED14 - Verified OK
Reading all registers
Read 4 bytes @ address 0x08008FB8 (Data = 0xD034F8DF)
Read 2 bytes @ address 0x08008FB8 (Data = 0xF8DF)
Read 2 bytes @ address 0x08008FBA (Data = 0xD034)
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0xFFFFFFFE
Read 4 bytes @ address 0xE000EDFC (Data = 0x01000000)
Downloading 4 bytes @ address 0xE000EDFC - Verified OK
Reading all registers
Read 4 bytes @ address 0x08008FB8 (Data = 0xD034F8DF)
Read 2 bytes @ address 0x08008FB8 (Data = 0xF8DF)
Read 2 bytes @ address 0x08008FBA (Data = 0xD034)
Writing register (PC = 0x 8000000)
Reading all registers
Read 4 bytes @ address 0x08000000 (Data = 0x20020000)
Read 2 bytes @ address 0x08000000 (Data = 0x0000)
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0xFFFFFFFE
Reading 64 bytes @ address 0x08026800
Read 4 bytes @ address 0x08026850 (Data = 0x2000F999)
Read 4 bytes @ address 0x08026850 (Data = 0x2000F999)
Read 2 bytes @ address 0x0802681C (Data = 0x4B0C)
Setting breakpoint @ address 0x0802681C, Size = 2, BPHandle = 0x0001
Starting target CPU...
WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.
...Target halted (Vector catch, PC = 0x08000EFC)
Reading all registers
Removing breakpoint @ address 0x0802681C, Size = 2
Read 4 bytes @ address 0x08000EFC (Data = 0x0F04F01E)
Read 2 bytes @ address 0x08000EFC (Data = 0xF01E)
Read 4 bytes @ address 0x2001FFFC (Data = 0x41000000)
Reading 64 bytes @ address 0x2001FFC0
Read 4 bytes @ address 0x08000194 (Data = 0xFFFFFFFF)
Read 2 bytes @ address 0x08000194 (Data = 0xFFFF)
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0xFFFFFFFE

MFend
Associate III

0690X00000BvmfZQAR.jpgUsing STLink:

STMicroelectronics ST-LINK GDB server. Version 5.3.2
Copyright (c) 2019, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
 
Waiting for debugger connection...
Debugger connected
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.2.0                  
      -------------------------------------------------------------------
 
 
 
Log output file:   C:\Users\mfendel\AppData\Local\Temp\STM32CubeProgrammer_a17088.log
ST-LINK SN  : 54FF71067871575149361767
ST-LINK FW  : V2J34S7
Voltage     : 3.22V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x462
Device name : STM32L45x/L46x
Flash size  : 512 KBytes
Device type : MCU
Device CPU  : Cortex-M4
 
 
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a17088.srec
  File          : ST-LINK_GDB_server_a17088.srec
  Size          : 208268 Bytes
  Address       : 0x08008000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [16 117]
Download in Progress:
 
File download complete
Time elapsed during download operation: 00:00:07.093
 
Verifying ...
 
Download verified successfully 

MFend
Associate III

This is after I specified starting address0690X00000BvmyWQAR.png

MFend
Associate III

We are a team of FW developers. Until now, IAR was the IDE being used. Since we switched to STM MCUs, we want to incorporate the STM32Cube IDE as the IDE for all team members. Until this problem is solved, we cannot recommend the switch.

I would appreciate if someone can relate to this problem.

Thanks,

Mechi

MFend
Associate III

How do I see entire conversation?

From the post at https://www.openstm32.org/forumthread2364 I understood another step, but it still didn't help the debugger to know where to start...

0690X00000Bvtd6QAB.png

MFend
Associate III

I upgraded to STM32CubeIDE 1.2.0 - still no change...debugger insists on starting at 0x8000efc!