David:

As I suspected, the problem was that the device came write-protected and the 
normal debug scripts cannot erase the flash when it is write-protected.

There might be a better way to do this, but here is what I did:

/* Write to the register which enables erase */
(gdb) set {unsigned long}0x4001e504=2

/* Now read it back to make sure the value is set */
(gdb) x/1wx 0x4001e504
0x4001e504:     0x00000002

/* This should erase the area that is protected */
(gdb) set {unsigned long}0x4001e50c=1
Info : SWD DPIDR 0x2ba01477
Error: Failed to read memory at 0x000008e8

/* Now I just read from location 0 to make sure it is all ff */
(gdb) x/32wx 0x0
0x0 <os_init_idle_task>:        0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x10 <os_init_idle_task+16>:    0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x20 <os_init_idle_task+32>:    0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x30 <os_init_idle_task+48>:    0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x40 <os_init_idle_task+64>:    0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x50 <os_init_idle_task+80>:    0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x60 <os_init+96>:      0xffffffff      0xffffffff      0xffffffff      
0xffffffff
0x70 <os_init+112>:     0xffffffff      0xffffffff      0xffffffff      
0xffffffff

Now you should be able to load up the bootloader and an application.

Thanks for pointing it out. Happy Mynewting.

> On Feb 22, 2017, at 1:31 PM, david zuhn <[email protected]> wrote:
> 
> Having just received  my Nano2 device, I'm trying to get the basic blinky
> application installed.   I've gotten a build to complete (which is another
> email I need to write to document the issues I encountered in that
> process), but now getting bits on the device itself is not working:
> 
> After getting a new version of openocd (the one referred in the
> blinky_primo tutorial, after a helpful note from Aditi), this is what I'm
> now seeing:
> 
> I get the same errors whether I run on Mac OS X (10.12.3) or Ubuntu (15.10)
> (the same openocd release, compiled with the configure command).
> 
> Any help would be greatly appreciated....
> 
> 
> david zuhn
> 
> $ newt -v load nano2_boot
> 
> Loading bootloader
> 
> Load command:
> /Users/zoo/Programming/Nano2/b5/repos/apache-mynewt-core/hw/bsp/rb-nano2/rb-nano2_download.sh
> /Users/zoo/Programming/Nano2/b5/repos/apache-mynewt-core/hw/bsp/rb-nano2
> /Users/zoo/Programming/Nano2/b5/bin/targets/nano2_boot/app/apps/boot/boot
> 
> Error: Downloading
> /Users/zoo/Programming/Nano2/b5/bin/targets/nano2_boot/app/apps/boot/boot.elf.bin
> to 0x0
> 
> Open On-Chip Debugger 0.10.0-dev-snapshot (2017-02-21-23:08)
> 
> 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: 10000 kHz
> 
> cortex_m reset_config sysresetreq
> 
> Info : CMSIS-DAP: SWD  Supported
> 
> Info : CMSIS-DAP: Interface Initialised (SWD)
> 
> Info : CMSIS-DAP: FW Version = 1.0
> 
> Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
> 
> Info : CMSIS-DAP: Interface ready
> 
> Info : reduce speed request: 10000kHz to 5000kHz maximum
> 
> Info : clock speed 10000 kHz
> 
> Info : SWD DPIDR 0x2ba01477
> 
> Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
> 
> nrf52.cpu: target state: halted
> 
> target halted due to debug-request, current mode: Thread
> 
> xPSR: 0x01000000 pc: 0x000008e4 msp: 0x20000400
> 
> auto erase enabled
> 
> Warn : Unknown device (HWID 0x000000c7)
> 
> Error: Cannot erase protected sector at 0x0
> 
> Error: failed erasing sectors 0 to 2
> 
> -- 
> zoo @ statebeltrailway.org

Reply via email to