Adding a Magic Probe Debugger to Raspberry Pi 4B

 Adding a Magic Probe Debugger to Raspberry Pi 4B


First test booting a Raspberry Pi 4B into Single User mode in FreeBSD 14.0 
 
 I managed to boot to another drive and edit loader.conf:
 
beastie_disable="NO" 
loader_color="YES"
 
The beastie_disable="YES" allowed me to boot to single user mode, the loader_color="NO" seems to have enabled more verbosity in the log. It then became apparent it was trying to mount the external USB HDD that I had added to /etc/fstab. Annoying that with beastie disabled it did not give any error. Regardless, I added noauto to the fstab entry and rebooted, but it still failed to mount the drive, so I tried commenting out the entire entry for my hdd. This allowed it to boot to a login prompt.
 
# Disable the beastie menu and color
beastie_disable="YES"
loader_color="NO"
 
It then became apparent it was trying to mount the external USB HDD that I had added to /etc/fstab.
Good Catch. There is another post regarding a similar problem on the forum.
https://forums.freebsd.org/threads/...with-usb-pendrive-inserted.68230/#post-407684 
 
Bob Prohaska
 

Raspberry Pi won't boot because of USB drive attached and using a weak power supply


Black Magic Probe V2.3 url Links:

https://black-magic.org/getting-started.html   Getting Started page, where to buy. Connect the Black Magic Probe to your computer’s USB port with mini USB cable.  

Video Tutorial  https://youtu.be/ANM0fdAqDow


https://black-magic.org/hardware.html  Blog with Hardware Version Pictures and Notes


Armv8a Debugger information; 5 wire Jtag description

 

Villanova GDB 7 description, older documentation 

 
 

Other GDB ARM descriptions

https://www.compuphase.com/electronics/blackmagic.htm  Explanations of Code tracing versus Start-Stop
https://people.freebsd.org/~syrinx/presentations/FreeBSD-debugging-draft.pdf  13 slide show Debugging the FreeBSD kernel for dummies





Linux-Fu UEFI Booting

Running Debian Buster on Tanix TX6

Binary Ninja for ARMv8a

https://binary.ninja/features/ 

Enable Uart0 Serial console port on Raspberry Pi 4B hardware

enable_uart

enable_uart=1 (in conjunction with console=serial0 in cmdline.txt) requests that the kernel creates a serial console, accessible using GPIOs 14 and 15 (pins 8 and 10 on the 40-pin header). Editing cmdline.txt to remove the line quiet enables boot messages from the kernel to also appear there. See also uart_2ndstage.


Jtag GPIO Hardware setup of Raspberry Pi 4B board

https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_jtag_gpio 

enable_jtag_gpio

Setting enable_jtag_gpio=1 selects Alt4 mode for GPIO pins 22-27, and sets up some internal SoC connections, thus enabling the JTAG interface for the ARM CPU. It works on all models of Raspberry Pi.

Pin #Function

GPIO22

ARM_TRST

GPIO23

ARM_RTCK

GPIO24

ARM_TDO

GPIO25

ARM_TCK

GPIO26

ARM_TDI

GPIO27

ARM_TMS

Invoke GCC with options 
|------------|--------------------------------------------|--------------|
| ARMv8-M    | -mthumb -march=armv8-m.base                | armv8-m.base |
| Baseline   |                                            |              |
|------------|--------------------------------------------|--------------|
| ARMv8-M    | -mthumb -march=armv8-m.main                | armv8-m.main |
| Mainline   |                                            |              |
| (No FP)    |                                            |              |
|------------|--------------------------------------------|--------------|
| ARMv8-M    | -mthumb -march=armv8-m.main                | armv8-m.main |
| Mainline   | -mfloat-abi=softfp -mfpu=fpv5-sp-d16       | /softfp      |
| (Soft FP)  |                                            | /fpv5-sp-d16 |
|            |--------------------------------------------|--------------|
|            | -mthumb -march=armv8-m.main                | armv8-m.main |
|            | -mfloat-abi=softfp -mfpu=fpv5-d16          | /softfp      |
|            |                                            | /fpv5-d16    |
|------------|--------------------------------------------|--------------|
| ARMv8-M    | -mthumb -march=armv8-m.main                | armv8-m.main |
| Mainline   | -mfloat-abi=hard -mfpu=fpv5-sp-d16         | /fpu         |
| (Hard FP)  |                                            | /fpv5-sp-d16 |
|            |--------------------------------------------|--------------|
|            | -mthumb -march=armv8-m.main                | armv8-m.main |
|            | -mfloat-abi=hard -mfpu=fpv5-d16            | /fpu         |
|            |                                            | /fpv5-d16    |
|------------|--------------------------------------------|--------------|

BMP V2.1E  Schematic

https://black-magic.org/_downloads/5a984c502435264dc19bc5e08c8b55cd/bmpm_v2_1e_schematic.pdf 

https://www.studiopieters.nl/raspberry-pi-4-model-b-pinout/ 


Black Magic Probe Schematic JTAG-10 X2 pin out connection to Raspberry Pi

BMP Pin     Name          RasPi4B Pins
1              VCC                       Leave open??  or use pins 17,1  3.3V
2              TMS  SWDIO        13 GPIO27 TMS
3              GND                       6,9,14,20,25,30,34,39
4             TCK  SWCKL         22 GPIO25 TCK
5             GND
6            TDO  TRACESWO  18 GPIO24 TDO 
7              key left unconnected
8            TDI                           37 GPIO26 TDI
9           GND 
10         RST                            15 GPIO22 TRST
                                                16 gpio23 rtck   unconnected ??


ENABLE JTAG  ALT4 mode in config.txt file
enable_jtag_gpio
Setting enable_jtag_gpio=1 selects Alt4 mode for GPIO pins 22-27, and sets up some internal SoC connections, thus enabling the JTAG interface for the ARM CPU. It works on all models of Raspberry Pi.

Lauhterbach JTAG Mechanical Connector PDF file

https://www2.lauterbach.com/pdf/app_arm_jtag.pdf#M9.title

FreeBSD dmesg | tail -20    output on x86_64

ugen0.7: <Black Sphere Technologies Black Magic Probe> at usbus0
ng_ubt: usbd_do_request error=USB_ERR_TIMEOUT
umodem0 on uhub2
umodem0: <Black Magic GDB Server> on usbus0
umodem0: data interface 1, has no CM over data, has no break
umodem1 on uhub2
umodem1: <Black Magic UART Port> on usbus0
umodem1: data interface 3, has no CM over data, has no break
fred@fredTC93-pc ~> 



Binary Ninja Cloud 
Free binary analysis in your browser


Wikipedia  ACORN RISC Machines Computer entry  ARM Cpu:

Understand Hardware Debug, Mike Anderson PDF file

Comments

Popular posts from this blog

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.

January 19, 2024 Howto Download a Raspberry Pi 4B bootable image from http://ghostbsdarm64.hopto.org/packages/