cancel
Showing results for 
Search instead for 
Did you mean: 

ST-LINK fails when launching debugger if there is external memory assigned.

kurt1
Associate II
Posted on July 23, 2014 at 19:37

I have an application created for an STM32F429 target. I have been using ST-LINK/v2 debugger in an Virtual Box environment (Ubuntu). I use eclipse GNU ARM tools to compile and debug  my applications. When there is no data assigned to external SRAM, the debugger launches successfully and I can debug my code without any problem. When I add external data and change my linker files as described below then my debugger launch fails with the following messages:

929,472 15load /home/user/projects/myproject/blink-led/Debug/blink-led.elf 

929,552 13^done,groups=[{id=''i1'',type=''process'',pid=''42000''}]

929,552 (gdb) 

929,552 14^error,msg=''Can not fetch data now.''

929,553 (gdb) 

929,553 &''load /home/user/projects/myproject/blink-led/Debug/blink-led.elf \n''

929,553 ~''Loading section .eb0data, size 0x4 lma 0x64000000\n''

929,553 &''Load failed\n''

929,553 15^error,msg=''Load failed''

929,553 (gdb) 

929,553 &''\n''

929,553 ^done

Linker file settings:

(mem.ld):

MEMORY { ..

EXTMEMB0 (xrw) : ORIGIN = 0x64000000, LENGTH = 262K}

and (sections.ld)

  /* EXTMEM Bank0 */

    .eb0text :

    {

        *(.eb0text)                   /* remaining code */

        *(.eb0rodata)                 /* read-only data (constants) */

        *(.eb0rodata.*)

    } >EXTMEMB0

    

    .eb0data :

    {

        *(.eb0data)                   /* remaining data */

    } >EXTMEMB0

My st-util connection parameters are:

$ st-util

2014-07-23T09:45:07 INFO src/stlink-common.c: Loading device parameters....

2014-07-23T09:45:07 INFO src/stlink-common.c: Device connected is: F42x and F43x device, id 0x10036419

2014-07-23T09:45:07 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 16384 bytes

Chip ID is 00000419, Core ID is  2ba01477.

Target voltage is 3211 mV.

Listening at *:4242...

GDB connected.

Is this problem an ST-LINK external memory access timing issue, or could it be linker file setting?

Does anyone come cross with this problem before?

Thanks...
3 REPLIES 3
Posted on July 23, 2014 at 21:20

You'd have to create a debugger script (or whatever the GDB parlance is) to configure the external memory bus interface before you could move stuff there.

This would be equivalent to the code you have in the startup to initialize and configure the pins, then initialize the SDRAM (or whatever) controller, and then the memory chips.

Your other choices would be to define the external memory as NO LOAD or NO INIT, or define the load region to be stored in flash and copied out to the external memory after the startup code has initialized it, and before the statics are zerod or copied there.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kurt1
Associate II
Posted on October 24, 2014 at 20:43

So far so good...

In my Eclipse project (running on Ubuntu 12.04) set for Cross ARM GCC I have modified my mem.ld script file as

MEMORY

{

  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K

  FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

  CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K

  RAM (xrw)   : ORIGIN = 0x20000000, LENGTH = 192K

  MEMORY_ARRAY (xrw)  : ORIGIN = 0x20002000, LENGTH = 32

  EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0

  EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0

  EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0

  EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0

  SDRAM (rw) : ORIGIN = 0xC0000000, LENGTH = 262144K

}.

I have also modified the sections.ld by adding the following sections:

/* SDRAM_Bank0 */

    .sdramtext :

    {

        *(.sdramtext)                   /* remaining code */

        *(.sdramrodata)                 /* read-only data (constants) */

        *(.sdramrodata.*)

    } >SDRAM

    .sdramdata (NOLOAD) :

    {

        *(.extdata)                   /* remaining data */

    } >SDRAM

Then usual usage is:

volatile datum myData __attribute__( (section(''.extdata''), used));

where datum is any defined compiler native type.

The compiler places the variable correctly. On the other hand gdb and Eclipse IDE cannot read the memory correctly, even though external SDRAM configured by the firmware correctly and tested for its operation. I will post this problem separately.

Thanks for your help.

Posted on October 25, 2014 at 01:37

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/STM32F429%20-%20cannot%20view%20external%20memory%20in%20Eclipse%20memory%20pane&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx&currentviews=4]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32Java%2fSTM32F429%20-%20cannot%20view%20external%20memory%20in%20Eclipse%20memory%20pane&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https%3A%2F%2Fmy.st.com%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2FAllItems.aspx¤tviews=4

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..