Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover from BlackMagic probe does not work #1

Closed
joric opened this issue Mar 31, 2019 · 4 comments
Closed

Recover from BlackMagic probe does not work #1

joric opened this issue Mar 31, 2019 · 4 comments

Comments

@joric
Copy link

joric commented Mar 31, 2019

Module E73-2G4M04S1B

Black Magic Probe (Firmware v1.6.1-267-g302ff20) (Hardware Version 0).

arm-none-eabi-gdb 8-2018-q4-major) 8.2.50.20181213-git

nrfjprog --recover works, arm-none-eabi-gdb does not.

The probe works (attaches just fine after nrfjprog --recover from J-Link).

arm-none-eabi-gdb.exe --quiet --batch -ex "target extended-remote \\.\COM8" -ex "set non-stop on" -ex "mon swdp_scan" -ex "att 2" -ex "mon erase_mass"
Target voltage: unknown                    
Available Targets:                         
No. Att Driver                             
 1      Nordic nRF52                       
 2      Nordic nRF52 Access Port           
Attaching to Remote target failed with: T05

Also posted to blackmagic-debug/blackmagic#230

@joric joric changed the title Dl Does not work Mar 31, 2019
@joric joric changed the title Does not work Recover from BlackMagic probe does not work on E73-2G4M04S1B Mar 31, 2019
@joric joric changed the title Recover from BlackMagic probe does not work on E73-2G4M04S1B Recover from BlackMagic probe does not work Mar 31, 2019
@UweBonnes
Copy link

Why do you use some script coming from nowhere without further investigation? Did you attach by hand to port 2 and query the available commands as I requested before? It seems, not! A look at the source will tell you that port 2 has only one command:
const struct command_s nrf51_mdm_cmd_list[] = {
{"erase_mass", (cmd_handler)nrf51_mdm_cmd_erase_mass, "Erase entire flash memory"},
{NULL, NULL, NULL}
};
And what should "ex "set non-stop on" do here?

@joric
Copy link
Author

joric commented Mar 31, 2019

It worked. Weird. Thanks. What did I do:

arm-none-eabi-gdb.exe
For help, type "help".                                                                
Type "apropos word" to search for commands related to "word".                         
(gdb) target extended-remote \\.\COM8                                                 
Remote debugging using \\.\COM8                                                       
(gdb) mon swdp_scan                                                                   
Target voltage: unknown                                                               
Available Targets:                                                                    
No. Att Driver                                                                        
 1      ARM Cortex-M                                                                  
 2      Nordic nRF52 Access Port                                                      
(gdb) attach 2                                                                        
Attaching to Remote target                                                            
warning: while parsing target description: no element found                           
warning: Could not load XML target description; ignoring                              
PC register is not available                                                          
(gdb) mon help                                                                        
General commands:                                                                     
        version -- Display firmware version info                                      
        help -- Display help for monitor commands                                     
        jtag_scan -- Scan JTAG chain for devices                                      
        swdp_scan -- Scan SW-DP for devices                                           
        targets -- Display list of available targets                                  
        morse -- Display morse error message                                          
        halt_timeout -- Timeout (ms) to wait until Cortex-M is halted: (Default 2000) 
        connect_srst -- Configure connect under SRST: (enable|disable)                
        hard_srst -- Force a pulse on the hard SRST line - disconnects target         
        traceswo -- Start trace capture [(baudrate) for async swo]                    
Nordic nRF52 Access Port specific commands:                                           
        erase_mass -- Erase entire flash memory                                       
(gdb) mon erase_mass                                                                  
(gdb) quit                                              
A debugging session is active.                          
                                                        
        Inferior 1 [Remote target] will be detached.    
                                                        
Quit anyway? (y or n) y                                 
Detaching from program: , Remote target                 
[Inferior 1 (Remote target) detached]                   
                                                        
C:\SDK\gcc-arm-none-eabi-8-2018-q4-major-win32\bin>                        

Actual "erase_mass" took just a moment (I guess it just removed the protection bits). After that it became fully programmable and for al that I didn't need J-Link at all. Worked with E73-2G4M08S1C and E73-2G4M04S1B (both are new from the factory).

Thanks! I don't really know why batch didn't work, probably timings or something. Didn't need "set non-stop on" either.

@joric joric closed this as completed Mar 31, 2019
@drelephant
Copy link

Probably OT a bit but what are the two boards in the bottom-right and bottom-left of that picture?

@joric
Copy link
Author

joric commented May 2, 2019

Probably OT a bit but what are the two boards in the bottom-right and bottom-left of that picture?

The latter is mine, the former is nRF52832-based and does not have hardware USB, only charger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants