Harald Welte | 3f5e3dd | 2017-02-27 13:53:17 +0100 | [diff] [blame] | 1 | #******************************************************* |
| 2 | # |
| 3 | # Connect to J-Link and debug application in flash. |
| 4 | # |
| 5 | |
| 6 | # define 'reset' command |
| 7 | define reset |
| 8 | |
| 9 | # Connect to the J-Link gdb server |
| 10 | target remote localhost:2331 |
| 11 | # Reset the chip to get to a known state |
| 12 | monitor reset |
| 13 | |
| 14 | # Select flash device |
| 15 | monitor flash device = AT91SAM3S4C |
| 16 | # Enable flash download and flash breakpoints |
| 17 | monitor flash download = 1 |
| 18 | # Load the program |
| 19 | load |
| 20 | |
| 21 | # Reset peripheral (RSTC_CR) |
| 22 | set *0x400e1400 = 0xA5000004 |
| 23 | |
| 24 | # Initializing PC and stack pointer |
| 25 | mon reg sp=(0x400000) |
| 26 | set *0x400004 = *0x400004 & 0xFFFFFFFE |
| 27 | mon reg pc=(0x400004) |
| 28 | info reg |
| 29 | |
| 30 | # end of 'reset' command |
| 31 | end |