0
\$\begingroup\$

I have a SAM4E-Xplained-Pro Board. Everything works ok with atmel studio.

I'm trying to set a development environment with openOCD. I was able to load and run my code through gdb, but after resetting the board, the code doesn't persist.

What's the proper way to flash my device?

This is my cfg:

#
# Atmel SAM4S Xplained Pro evaluation kit.
# https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATSAM4E-XPRO
#

source [find interface/cmsis-dap.cfg]

set CHIPNAME SAM4E16E

source [find target/at91sam4sXX.cfg]

OpenOCD log when using loading through gdb

>$ openocd -f board/atmel_sam4e_xplained_pro.cfg -c "init; reset halt"
Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
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 500 kHz
Info : SWD IDCODE 0x2ba01477
Info : SAM4E16E.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0080004c msp: 0x20000800
Info : accepting 'gdb' connection on tcp/3333
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0080004c msp: 0x20000800
Info : sam4 does not auto-erase while programming (Erasing relevant sectors)
Info : sam4 First: 0x00000000 Last: 0x00000000
Info : Erasing sector: 0x00000000
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0080004c msp: 0x20000800

my gdb commands

$> arm-none-eabi-gdb output.elf
target remote localhost:3333
load
continue

With openOCD and telnet I wasn't even able to load and run the code.

> flash write_image erase output.elf  
auto erase enabled
sam4 does not auto-erase while programming (Erasing relevant sectors)
sam4 First: 0x00000000 Last: 0x00000000
Erasing sector: 0x00000000
wrote 8192 bytes from file output.elf in 0.556914s (14.365 KiB/s)
> resume
Polling target SAM4E16E.cpu failed, trying to reexamine
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.