Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bootloader:openocd [2021/01/30 17:32]
admin
bootloader:openocd [2021/01/30 17:58] (current)
admin [Acknowledge & Links]
Line 1: Line 1:
-====== OpenOCD with the Raspberry Pi ======+====== OpenOCD Raspberry Pi ======
  
 {{:bootloader:swd-raspi_programmer_seeeduinoxiao.jpg?400|}}\\ {{:bootloader:swd-raspi_programmer_seeeduinoxiao.jpg?400|}}\\
  
-On a Raspberry Pi following the openOCD manual by [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview|Lady Ada]].+To install the [[http://openocd.org/|open On-Chip Debugger]] on a Raspberry Pi following the manual by [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview|Lady Ada]].
  
 Install: Install:
Line 10: Line 10:
   $ git clone http://openocd.zylin.com/openocd   $ git clone http://openocd.zylin.com/openocd
   $ cd openocd/   $ cd openocd/
-Configure & install:+Configure & Install:
   $ ./bootstrap    $ ./bootstrap 
   $ ./configure --enable-sysfsgpio --enable-bcm2835gpio   $ ./configure --enable-sysfsgpio --enable-bcm2835gpio
   $ make   $ make
   $ sudo make install   $ sudo make install
-Check  list of interfaces:+Check  Interfaces:
   $ cd /usr/local/share/openocd/scripts/interface/   $ cd /usr/local/share/openocd/scripts/interface/
   $ ls   $ ls
-Make a folder:+New Folder:
   $ cd ~   $ cd ~
   $ mkdir bootloader   $ mkdir bootloader
   $ cd bootloader   $ cd bootloader
-Download the bootloader:+Download the Bootloader:
   $ wget https://github.com/arduino/ArduinoCore-samd/raw/master/bootloaders/zero/samd21_sam_ba.bin   $ wget https://github.com/arduino/ArduinoCore-samd/raw/master/bootloaders/zero/samd21_sam_ba.bin
   $ wget https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin   $ wget https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin
-  $ wget "https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/mkrzero/samd21_sam_ba_arduino_mkrzero.hex+  $ wget "https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/mkrzero/samd21_sam_ba_arduino_mkrzero.bin
-Make your config file:+Make your Config File:
   $ nano openocd.cfg   $ nano openocd.cfg
 Add: Add:
 +  source [find interface/raspberrypi3-native.cfg] 
 +  transport select swd 
 +   
 +  set CHIPNAME at91samd21g18 
 +  source [find target/at91samdXX.cfg] 
 +   
 +  # did not yet manage to make a working setup using srst 
 +  #reset_config srst_only 
 +  reset_config srst_nogate 
 +   
 +  adapter srst delay 100 
 +  adapter srst pulse_width 100 
 +   
 +  #bcm2835gpio_swd_nums 25 24 
 +  #bcm2835gpio_trst_num 7 
 +  #bcm2835gpio_srst_num 18 
 +   
 +  init 
 +  targets 
 +  reset halt 
 +   
 +  #at91samd chip-erase 
 +  #at91samd restore 
 +  at91samd bootloader 0 
 +  program samd21_sam_ba.bin verify 
 +  #program bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin verify 
 +  #flash write_image unlock bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin 
 +  at91samd bootloader 8192 
 +   
 +  reset 
 +  shutdown 
 +... and run it
   $ sudo openocd -f openocd.cfg   $ sudo openocd -f openocd.cfg
 If needed change the Raspberry Pi interface file: If needed change the Raspberry Pi interface file:
   $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi2-native.cfg   $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi2-native.cfg
   $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi3-native.cfg   $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi3-native.cfg
 +Change:
 +  # Each of the SWD lines need a gpio number set: swclk swdio
 +  # Header pin numbers: 23 22
 +  bcm2835gpio_swd_nums 25 24
 +
 +  # If you define trst or srst, use appropriate reset_config
 +  # Header pin numbers: TRST - 26, SRST - 18
 +  bcm2835gpio_trst_num 7
 +  bcm2835gpio_srst_num 18
  
 ---- ----
-==== HEX files =====+==== Bootloader =====
  
 - [[https://github.com/arduino/ArduinoCore-samd|Arduino]]\\ - [[https://github.com/arduino/ArduinoCore-samd|Arduino]]\\
Line 44: Line 84:
 ---- ----
 ==== Pinout ==== ==== Pinout ====
 +
 +  SWD         Raspberry Pi
 +  
 +   Reset       GPIO 18
 +   SWDIO       GPIO 24
 +   SWCLK       GPIO 25
  
 **Arduino MKR ZERO**\\ **Arduino MKR ZERO**\\
Line 69: Line 115:
 ==== Acknowledge & Links ==== ==== Acknowledge & Links ====
  
 +[[http://openocd.org/|open OCD]]\\
 +[[http://openocd.org/doc-release/pdf/openocd.pdf|OpenOCD user Guide]]\\
 [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview|Programming Microcontrollers using OpenOCD on a Raspberry Pi by Lady Ada]]\\ [[https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/overview|Programming Microcontrollers using OpenOCD on a Raspberry Pi by Lady Ada]]\\
 +[[https://iosoft.blog/2019/01/28/raspberry-pi-openocd/|Raspberry Pi and OpenOCD by iosoft.blog]]\\
  
  
 ---- ----