1 # script for nuvoton M0517 OpenOCD 0.10 on Linux using Raspberry Pi gpio pins
3 # IMAX B6 clone pinout - Raspberry Pi
5 # DAT - pin 11 (gpio 17)
6 # CLK - pin 13 (gpio 27)
7 # RST - pin 15 (gpio 22)
12 adapter driver bcm2835gpio
14 bcm2835gpio_peripheral_base 0x3F000000
16 # Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
17 # These depend on system clock, calibrated for stock 700MHz
18 # bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET
19 bcm2835gpio_speed_coeffs 146203 36
21 # Each of the SWD lines need a gpio number set: swclk swdio
22 # swd gpio pins swclk swio
23 bcm2835gpio_swd_nums 27 17
25 # If you define trst or srst, use appropriate reset_config
26 # Header pin numbers: TRST - 26, SRST - 18
28 #bcm2835gpio_trst_num 22
29 #reset_config trst_only
31 bcm2835gpio_srst_num 22
32 # reset_config srst_only srst_push_pull
34 # or if you have both connected,
35 # reset_config trst_and_srst srst_push_pull
42 set _WORKAREASIZE 0x1000
43 set _CPUTAPID 0x0bb11477
46 swd newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
48 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
50 target create $_CHIPNAME.cpu cortex_m -dap $_CHIPNAME.dap
52 $_CHIPNAME.cpu configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
55 adapter srst delay 100
58 # if srst is not fitted use SYSRESETREQ to
59 # perform a soft reset
60 cortex_m reset_config sysresetreq