Repository : ssh://git@diktynna/doc
On branches: backup-redmine/2021-08-07,backup-redmine/2021-09-11,backup-redmine/2021-10-09,backup-redmine/2021-11-13,backup-redmine/2021-12-11,backup-redmine/2022-01-08,backup-redmine/2022-02-12,backup-redmine/2022-03-12,backup-redmine/2022-04-09,backup-redmine/2022-05-07,backup-redmine/2022-06-11,backup-redmine/2022-08-06,backup-redmine/2022-10-07,backup-redmine/2022-11-14,backup-redmine/2023-01-14,main
commit 1c6474f656b5f1904e8617dd303ac3b94826753f Author: Sven Eckelmann sven@narfation.org Date: Mon Jul 26 19:30:49 2021 +0000
doc: open-mesh/Kernel_debugging_over_JTAG
1c6474f656b5f1904e8617dd303ac3b94826753f open-mesh/Kernel_debugging_over_JTAG.textile | 47 +++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/open-mesh/Kernel_debugging_over_JTAG.textile b/open-mesh/Kernel_debugging_over_JTAG.textile index 84d63003..66b7da35 100644 --- a/open-mesh/Kernel_debugging_over_JTAG.textile +++ b/open-mesh/Kernel_debugging_over_JTAG.textile @@ -57,6 +57,52 @@ source [find board/8devices-lima.cfg] EOF </code></pre>
+ +h3. Raspberry PI (4 B) + +The Raspberry PI 4B can be used as a simple adapter board because there are plenty of GPIOs available and OpenOCD is able to control them directly. But it is a rather slow debug adapter compared to one which was specifically build for this purpose. For example a <code>flash read_bank 0 flash.img 0 65536</code> takes 117.896889s. + +Only the correctly "raw GPIO number for each Pin":https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-heade... has to be found. A good way to connect them (while keeping the SPI pins free for reflashing SPI chips) is: + +* GND: Pin 9 +* TDO: GPIO17 (Pin 11) +* TDI: GPIO27 (Pin 13) +* TCK: GPIO22 (Pin 15) +* TMS: GPIO23 (Pin 16) + +The hardest part is to find the "correct base of the GPIO controller and to set the speed settings":https://openwrt.org/toh/meraki/mr18/jtag + +The configuration of the adapter board and the target board is also possible since the release of OpenOCD 0.11 + +<pre><code class="diff"> +cat > jtag_debug.cfg << "EOF" +adapter driver bcm2835gpio + +# GPIOs for: tck tms tdi tdo +bcm2835gpio_jtag_nums 22 23 27 17 + +# configuration for raspberry pi 4B +bcm2835gpio_peripheral_base 0xFE000000 +bcm2835gpio_speed_coeffs 236181 60 + +adapter speed 1000 + +transport select jtag + +# in case to start debugging session without "reset halt": +# "reset halt" would be necessary here because otherwise the flash chip cannot +# be detected and the gdb attach fails with +# "Unknown flash device (ID 0x00000000)" +gdb_memory_map disable + +source [find board/8devices-lima.cfg] + + +# allow to connect via telnet/gdb to OpenOCD from actual development machine +bindto 0.0.0.0 +EOF +</code></pre> + h3. 8devices target board
The board which should run the firmware must be connected to at least following pins of the debug adapter hardware: @@ -79,7 +125,6 @@ The 8devices lima reference board exposes all over its GPIO pins:
!/attachments/download/944/jtag-8devices-lima.svg!
- h2. Preparing OpenWrt
There is nearly no requirements from OpenWrt but there are several things which can make the debugging a lot easier.