Menu

#224 samde53 openocd 0.10.0 Error: Failed to read memory at 0x400e0944

0.9.0
new
nobody
None
2019-01-29
2019-01-28
No

I tried to flash atsame53j18 with openocd 0.10.0. I used following .cfg file:

# Atmel-ICE JTAG/SWD in-circuit debugger.
source [find interface/cmsis-dap.cfg]

transport select swd

# Chip info
set CHIPNAME at91same53j18

source [find target/atsamv.cfg]

# this disables Failed to read memory at 0x400e0944
# if program is not following
gdb_memory_map disable

reset_config srst_only

There is whole command with following output.

openocd -f myopenocd.cfg -c "program build/$(PROJECT).elf verify reset exit"

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
adapter speed: 4000 kHz
adapter_nsrst_delay: 100
adapter speed: 1800 kHz
cortex_m reset_config sysresetreq
Info : flash bank command
none separate
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 01.27.0082
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x2ba01477
Info : at91same53j18.cpu: hardware has 6 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x000002d0 msp: 0x2001b2e8
** Programming Started **
auto erase enabled
Info : SWD DPIDR 0x2ba01477
Error: Failed to read memory at 0x400e0944
Error: auto_probe failed
** Programming Failed **
shutdown command invoked

make: *** [upload] Error 1

It is possible to load elf to the board if I do this and then attach arm gdb:

>>openocd -f myopenocd.cfg

>>arm-none-eabi-gdb some.elf
(gdb) load some.elf
(gdb) run

However as soon as flash info is requested it fails:

(gdb) monitor flash list
{name atsamv base 4194304 size 0 bus_width 0 chip_width 0}
(gdb) monitor flash info 0
SWD DPIDR 0x2ba01477
Failed to read memory at 0x400e0944
auto_probe failed

What might cause this behaviour?

Discussion

  • Paul Fertser

    Paul Fertser - 2019-01-28

    Hello,

    On Mon, Jan 28, 2019 at 08:51:32PM -0000, Andres Vahter wrote:

    I tried to flash atsame53j18 with openocd 0.10.0. I used following .cfg file:
    ...
    source [find target/atsamv.cfg]

    Are you sure samv flash driver supports your target controller?

    this disables Failed to read memory at 0x400e0944

    if program is not following

    gdb_memory_map disable

    This just makes gdb unaware of the flash region mapping so...

    (gdb) load some.elf

    ... this makes GDB use regular "write to memory" commands instead of
    "write to flash".

    Are you saying that in this case the target flash memory is actually
    modified?

    --
    Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
    mailto:fercerpav@gmail.com

     
  • Andres Vahter

    Andres Vahter - 2019-01-29

    It seems that atsame5x.cfg is removed from everywhere, however there is patch that can be added:

    # openocd mirror in github
    git clone https://github.com/ntfreak/openocd.git
    cd openocd
    git fetch http://openocd.zylin.com/openocd refs/changes/72/4272/5 && git checkout FETCH_HEAD
    ./bootstrap
    ./configure
    make -j8
    sudo make install
    

    myopenocd.cfg for atsame5x:

    # Atmel-ICE JTAG/SWD in-circuit debugger.
    source [find interface/cmsis-dap.cfg]
    
    transport select swd
    adapter_khz 4000
    
    # Chip info
    set CHIPNAME at91same53j18
    
    source [find target/atsame5x.cfg]
    
    gdb_memory_map disable
    reset_config srst_only
    
    > openocd -f someopenocd.cfg -c "program build/firmware.elf verify reset exit"
    Open On-Chip Debugger 0.10.0+dev-00409-g1ae106d-dirty (2019-01-29-11:15)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 4000 kHz
    none separate
    adapter speed: 2000 kHz
    cortex_m reset_config sysresetreq
    srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Info : CMSIS-DAP: SWD  Supported
    Info : CMSIS-DAP: JTAG Supported
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Info : CMSIS-DAP: FW Version = 01.27.0082
    Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
    Info : CMSIS-DAP: Interface ready
    Info : clock speed 2000 kHz
    Info : SWD DPIDR 0x2ba01477
    Info : at91same53j18.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Listening on port 3333 for gdb connections
    Info : SWD DPIDR 0x2ba01477
    target halted due to debug-request, current mode: Thread
    xPSR: 0x81000000 pc: 0x0000dab6 msp: 0x2001b2c0
    ** Programming Started **
    auto erase enabled
    Info : SAM MCU: SAME53J18A (256KB Flash, 128KB RAM)
    wrote 73728 bytes from file build/firmware.elf in 1.420442s (50.688 KiB/s)
    ** Programming Finished **
    ** Verify Started **
    verified 66384 bytes in 0.196583s (329.775 KiB/s)
    ** Verified OK **
    ** Resetting Target **
    Info : SWD DPIDR 0x2ba01477
    shutdown command invoked
    

    So this worked very nicely. Not sure why atsame5x.cfg was removed in first place. Probably atsamv.cfg should support E5X series but it seems to be buggy. I can test E5X support if it lands somewhere.

     
    • Paul Fertser

      Paul Fertser - 2019-01-29

      On Tue, Jan 29, 2019 at 10:04:32AM -0000, Andres Vahter wrote:

      gdb_memory_map disable

      This shouldn't be used for normal microcontroller development
      workflow.

      So this worked very nicely. Not sure why atsame5x.cfg was removed in first
      place.

      It wasn't removed from anywhere AFACT. Can you please add a comment to
      Gerrit and possibly test this patch with other related devices if you
      have any?

      --
      Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
      mailto:fercerpav@gmail.com

       
  • Andres Vahter

    Andres Vahter - 2019-01-29

    I also have SAME54 Xplained board and flashing also worked for that.
    What do you mean by it wasn't removed from anywhere - I couldn't find it from latest version.

    > openocd -f makefile_deps/openocd.cfg -c "program sam54.elf verify reset exit"
    Open On-Chip Debugger 0.10.0+dev-00409-g1ae106d-dirty (2019-01-29-11:15)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 4000 kHz
    none separate
    adapter speed: 2000 kHz
    cortex_m reset_config sysresetreq
    srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Info : CMSIS-DAP: SWD  Supported
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Info : CMSIS-DAP: FW Version = 03.25.01B6
    Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
    Info : CMSIS-DAP: Interface ready
    Info : clock speed 2000 kHz
    Info : SWD DPIDR 0x2ba01477
    Info : at91same54p20.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Listening on port 3333 for gdb connections
    Info : SWD DPIDR 0x2ba01477
    target halted due to debug-request, current mode: Thread
    xPSR: 0x41000000 pc: 0x0000141c msp: 0x2001a248
    ** Programming Started **
    auto erase enabled
    Info : SAM MCU: SAME54P20A (1024KB Flash, 256KB RAM)
    wrote 57344 bytes from file sam54.elf in 1.119043s (50.043 KiB/s)
    ** Programming Finished **
    ** Verify Started **
    verified 49740 bytes in 0.182609s (266.001 KiB/s)
    ** Verified OK **
    ** Resetting Target **
    Info : SWD DPIDR 0x2ba01477
    shutdown command invoked
    
     
    • Paul Fertser

      Paul Fertser - 2019-01-29

      On Tue, Jan 29, 2019 at 01:02:59PM -0000, Andres Vahter wrote:

      I also have SAME54 Xplained board and flashing also worked for that.
      What do you mean by it wasn't removed from anywhere - I couldn't find it from
      latest version.

      It wasn't removed from the sources as it wasn't ever merged in the
      first place. It's a pending change and it needed some review and
      testing. If you add your feedback to the Gerrit change it would be
      nice.

      --
      Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
      mailto:fercerpav@gmail.com

       
  • Andres Vahter

    Andres Vahter - 2019-01-29
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.