From: Thomas I. <ti...@gm...> - 2017-03-02 18:16:03
|
Hi, I recently had a discussion on #openocd about this problem. During chat I created some pastebin so that guru´s like Tomas Vanek could possible dive into this issue. @Tomas: Sorry, Paul Fertser droped your name ;-) Here are the pastebins *** the irc snipped start (removed some lines) *** mrt: can you please pastebin full output? mrt http://pastebin.com/u0vnneW5 mrt how do i increase verbosity? mrt @PaulFerster: _more_ verbos: http://pastebin.com/kXFbD57k mrt @PaulFerster: unprotected chip-erase -> http://pastebin.com/EDnB8AbT mrt @PaulFerster: protected chip-erase (failure) -> http://pastebin.com/vcYVp18m mrt @PaulFerster: created with "openocd -d3 -l debug_log_proteced.txt -f interface/cmsis-dap.cfg -c "transport select swd" -f target/at91samdXX.cfg -c "init" -c "reset halt" -c "at91samd chip-erase" -c "shutdown" " mrt @PaulFerster: Does this help? PaulFertser mrt: yes mrt @PaulFerster: can you see what mrt s going wrong? PaulFertser mrt: I'm thinking, reading PaulFertser mrt: do you have SRST line physically connected between the target and debug adapter? mrt @PaulFertser: yes - same setup works with atmel-studio mrt @PaulFertser: I guess it´s the so called "cold-plug" event which can be triggered with nRST going high while TCK is low ..? PaulFertser mrt: you need to specify "reset_config srst_only" in your config then to tell OpenOCD that the hardware line is to be used. PaulFertser mrt: then probably "reset halt" will start to work. mrt @PaulFertser: just tried without success. mrt source [find interface/cmsis-dap.cfg] mrt transport select swd mrt reset_config srst_only mrt source [find target/at91samdXX.cfg] mrt init mrt reset halt PaulFertser mrt: hm, I do not have first-hand experience with samd, unfortunately, can you please send a mail to the devel mailing list? I hope Tomas Vanek will be able to help. PaulFertser mrt: please do not paste more than 3 lines to any public channel on IRC, it's usually considered to be bad. mrt jep - sorry PaulFertser mrt: I can't yet understand how Tomas intended to deal with the situation you outline. But I think he has some ideas. *** the irc snipped end*** Thank you in advance! Br, Thomas |
From: Tomas V. <to...@us...> - 2017-03-02 21:57:25
|
On 02.03.2017 19:15, Thomas Irmen wrote: > unprotected chip-erase -> http://pastebin.com/EDnB8AbT > > protected chip-erase (failure) -> http://pastebin.com/vcYVp18m > created with "openocd -d3 -l debug_log_proteced.txt -f > interface/cmsis-dap.cfg -c "transport select swd" -f > target/at91samdXX.cfg -c "init" -c "reset halt" -c "at91samd > chip-erase" -c "shutdown" " > So if I understand correctly you have a SAMD chip with set security bit in NVM and you want to erase chip to remove security.T The problem is the secure mode prevents OpenOCD to attach the device. Actually there are more problems: 1) OpenOCD fails if device is not responsive. I commented out the error check from command_run_line(CMD_CTX, "transport init") in openocd.c as a dirty workaround. A correct solution would be to implement a SAMD specific variant of connect_assert_srst mode. 2) Secured SAMD needs reset cold-plug sequence (SWCLK kept low when nRESET is deasserted). EDBG normally issues hot-plug without CPU reset extension. I don't know if EDBG has an vendor CMSIS-DAP command for cold-plugging. The possible dirty solution is to apply http://openocd.zylin.com/3103 and use CMSIS-DAP bit control: cmsis-dap cmd 10 20 a1 cmsis-dap cmd 10 a0 a1 (now SAMD should be in extended reset) 3) Secured SAMD needs different addresses for DSU registers (DSU.CTRL at 0x41002100 instead of 0x4100200). So 'at91samd chip-erase' command is not usable, use workaround mwb 0x41002100 0x10 Problem 3 is easy to solve. Unfortunately 1 and 2 are not likely to be ever fixed: SAMD DSU design is very specific and would require a lot of changes in general infrastructure. Please use Atmel software if you need SAMD chip security. Sorry. Tomas |
From: Tomas V. <to...@us...> - 2017-03-03 21:34:02
|
On 02.03.2017 22:38, Tomas Vanek wrote: > On 02.03.2017 19:15, Thomas Irmen wrote: >> unprotected chip-erase -> http://pastebin.com/EDnB8AbT >> >> protected chip-erase (failure) -> http://pastebin.com/vcYVp18m >> created with "openocd -d3 -l debug_log_proteced.txt -f >> interface/cmsis-dap.cfg -c "transport select swd" -f >> target/at91samdXX.cfg -c "init" -c "reset halt" -c "at91samd >> chip-erase" -c "shutdown" " >> > So if I understand correctly you have a SAMD chip with set security > bit in NVM and you want to erase chip to remove security.T > The problem is the secure mode prevents OpenOCD to attach the device. > Actually there are more problems: > > 1) OpenOCD fails if device is not responsive. I commented out the > error check from command_run_line(CMD_CTX, "transport init") in openocd.c > as a dirty workaround. A correct solution would be to implement a SAMD > specific variant of connect_assert_srst mode. > > 2) Secured SAMD needs reset cold-plug sequence (SWCLK kept low when > nRESET is deasserted). EDBG normally issues hot-plug without CPU reset > extension. I don't know if EDBG has an vendor CMSIS-DAP command for > cold-plugging. The possible dirty solution is to apply > http://openocd.zylin.com/3103 > and use CMSIS-DAP bit control: > cmsis-dap cmd 10 20 a1 > cmsis-dap cmd 10 a0 a1 > (now SAMD should be in extended reset) > > 3) Secured SAMD needs different addresses for DSU registers (DSU.CTRL > at 0x41002100 instead of 0x4100200). > So 'at91samd chip-erase' command is not usable, use workaround > mwb 0x41002100 0x10 > > Problem 3 is easy to solve. Unfortunately 1 and 2 are not likely to be > ever fixed: SAMD DSU design is very specific and would require a lot > of changes in general infrastructure. > > Please use Atmel software if you need SAMD chip security. Please try patches http://openocd.zylin.com/4043 http://openocd.zylin.com/4044 Correct command to erase a secured device is in the updated documentation. Tom |
From: Tomas V. <to...@us...> - 2017-03-06 09:09:11
|
On 06.03.2017 7:57, Thomas Irmen wrote: > Hi Tom, >> Please try patches >> http://openocd.zylin.com/4043 >> http://openocd.zylin.com/4044 >> >> Correct command to erase a secured device is in the updated >> documentation. >> >> Tom > worked like a charm! > Please sign in to gerrit, put a short comment and possibly + review point ... or patches never get merged to git master. Honestly 4044 is such a hack, it will not get merged anyway... Thanks Tom |