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
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to