682 | | The following will create a gw16126.cfg OpenOCD interface file specifying SWD and mapping the SWCLK/SWDIO pins to the FT231X CBUS2/CBUS1 pins: |
683 | | 1. Create an OpenOCD interface file for the GW16126 that defines the Linux gpio signals for SWD: |
| 682 | Note that the OpenOCD package from Ubuntu lacks the necessary nRF52840 support so we must either build OpenOCD from source manually or use the Gateworks Ubuntu PPA: |
| 683 | * Installing from Gateworks Ubuntu PPA: |
| 684 | {{{#!bash |
| 685 | sudo add-apt-repository ppa:gateworks-software/packages |
| 686 | apt update |
| 687 | apt install openocd |
| 688 | }}} |
| 689 | * Building from source: |
| 690 | {{{#!bash |
| 691 | apt install build-essential libusb-1.0-0-dev autoconf libtool pkg-config git |
| 692 | git clone git://git.code.sf.net/p/openocd/code openocd |
| 693 | cd openocd |
| 694 | ./bootstrap |
| 695 | ./configure --enable-sysfsgpio |
| 696 | make install |
| 697 | }}} |
| 698 | |
| 699 | Next you will need a gw16126.cfg OpenOCD interface file specifying SWD and mapping the SWCLK/SWDIO pins to the FT231X CBUS2/CBUS1 pins: |
694 | | 2. Build OpenOCD from git master for nRF52840 support: |
695 | | {{{#!bash |
696 | | apt-get install build-essential git flex bison pkg-config libtool autoconf automake texinfo libusb-1.0-0-dev |
697 | | git clone git://git.code.sf.net/p/openocd/code openocd |
698 | | cd openocd |
699 | | ./bootstrap |
700 | | ./configure --enable-sysfsgpio |
701 | | make install |
702 | | }}} |
703 | | - alternatively you can fetch from a zip archive via {{{wget --no-check-certificate |
704 | | https://repo.or.cz/openocd.git/snapshot/refs/heads/master.zip}}} but note that the bootstrap script which checkout jimtcl as git submodules so this doesn't really help |
705 | | - I've been having issues on bionic because NTP isn't working right which leads to certificate issues. You can disable by {{{git config --global http.sslverify false}}} |
706 | | 3. Program firmware: |
| 709 | |
| 710 | Now you can program an Intel HEX file with OpenOCD: |