0

ATSAMD21E18A-U OpenOCD
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ATSAMD21E18A-U OpenOCD

by ahamza61 on Fri Jan 04, 2019 8:54 am

Hello, I'm working on a custom board with ATSAMD21E18A-U and I want to flash my microcontroller with Raspberry Pi and SA636 adapter. When I use "sudo openocd" command it gives me that. Everything is fine about it? What does "Handler HardFault" mean?

Code: Select all | TOGGLE FULL SIZE
Open On-Chip Debugger 0.10.0+dev-00530-g9e2883b0 (2018-09-10-11:25)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO config: tck = 11, tms = 25, tdi = 10, tdo = 9
BCM2835 GPIO nums: swclk = 11, swdio = 25
BCM2835 GPIO nums: swclk = 25, swdio = 24
BCM2835 GPIO config: trst = 7
BCM2835 GPIO config: srst = 18
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : JTAG and SWD modes enabled
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : atsamd21e18a.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamd21e18a.cpu   cortex_m   little atsamd21e18a.cpu   halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0xd1000003 pc: 0xfffffffe msp: 0xffffffd8
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamd21e18a.cpu   cortex_m   little atsamd21e18a.cpu   halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0xd1000003 pc: 0xfffffffe msp: 0xffffffd8
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0xd1000003 pc: 0xfffffffe msp: 0xffffffd8
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21E18A (256KB Flash, 32KB RAM)
wrote 8192 bytes from file trinket.bin in 0.300111s (26.657 KiB/s)
** Programming Finished **
** Verify Started **
verified 8192 bytes in 0.674242s (11.865 KiB/s)
** Verified OK **
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000002e msp: 0xffffffd8
shutdown command invoked
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections

ahamza61
 
Posts: 2
Joined: Fri Jan 04, 2019 8:49 am

Re: ATSAMD21E18A-U OpenOCD

by adafruit_support_mike on Sat Jan 05, 2019 12:17 am

The errors are saying you've compiled the code with debbugger flags:

Code: Select all | TOGGLE FULL SIZE
Info : atsamd21e18a.cpu: hardware has 4 breakpoints, 2 watchpoints
Each halt is triggered by one of those breakpoints or watchpoints.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: ATSAMD21E18A-U OpenOCD

by ahamza61 on Sat Jan 05, 2019 3:18 am

adafruit_support_mike wrote:The errors are saying you've compiled the code with debbugger flags:

Code: Select all | TOGGLE FULL SIZE
Info : atsamd21e18a.cpu: hardware has 4 breakpoints, 2 watchpoints
Each halt is triggered by one of those breakpoints or watchpoints.


Thanks, how can I solve this problem?

ahamza61
 
Posts: 2
Joined: Fri Jan 04, 2019 8:49 am

Re: ATSAMD21E18A-U OpenOCD

by adafruit_support_mike on Sun Jan 06, 2019 1:53 am

Look through the OpenOCD documentation and find out how to disable debugging, or failing that, how to get rid of the breakpoints you've already set.

From the rest of the messages, it looks like the upload happens successfully. If so, 'just ignore it' is a perfectly valid option.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: ATSAMD21E18A-U OpenOCD

by mckenney on Tue Jan 08, 2019 8:50 pm

I hesitate to disagree with Mike, but I'm pretty sure that message just says how many breakpoints the device is capable of, not how many are set.

If your program is actually malfunctioning (ignoring for a moment what OpenOCD says) you'll need to debug it somehow:
a) try loading some "known good" code
b) attach a GDB client to OpenOCD's GDB server
c) use the telnet port that OpenOCD provides on port 4444. You'll have to look up the commands, but I recall you can read registers and memory.

mckenney
 
Posts: 13
Joined: Sun Sep 30, 2018 11:09 pm

Re: ATSAMD21E18A-U OpenOCD

by adafruit_support_mike on Wed Jan 09, 2019 1:08 am

Disagreeing is fine, and we encourage it as long as it's done politely. ;-)

I'm not an OpenOCD expert, and made my judgement based on the series of messages further along in the output:

Code: Select all | TOGGLE FULL SIZE
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21E18A (256KB Flash, 32KB RAM)
wrote 8192 bytes from file trinket.bin in 0.300111s (26.657 KiB/s)
** Programming Finished **
** Verify Started **
verified 8192 bytes in 0.674242s (11.865 KiB/s)
** Verified OK **
Anyone with more experience/insight into the OpenOCD toolchain is welcome to step in with better information.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.