project:arm_debugging:start
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| project:arm_debugging:start [2019/12/20 19:20] – [Reflashing BMP back STLink] v2 vs v2.1 abyssal | project:arm_debugging:start [2021/06/05 19:29] (current) – [Example: Unbricking (restoring) Proxmark bootloader] Flash bootloader and fullimage from same build abyssal | ||
|---|---|---|---|
| Line 303: | Line 303: | ||
| This is happening mostly on cheap clones of proxmark3 Easy. | This is happening mostly on cheap clones of proxmark3 Easy. | ||
| + | To debug Proxmark on newer OpenOCD >= 0.10.0, you may set fast memory access and fast DCC downloads: | ||
| + | < | ||
| + | openocd -c " | ||
| + | </ | ||
| + | Seems that flashing bootloader may not be enough, flash bootloader.elf and fullimage.elf from the same build in a single session (e.g. use '' | ||
| ===== J-link connected to Proxmark ===== | ===== J-link connected to Proxmark ===== | ||
| {{ : | {{ : | ||
| + | ===== SystemView for J-link - visualization of interrupts or other functions ===== | ||
| + | |||
| + | There is an instrumentation possible with changes to code to show how your functions and interrupts behave - [[https:// | ||
| + | |||
| + | Here is an example showing "tail chaining" | ||
| + | |||
| + | {{: | ||
| + | |||
| + | If you add extra functions, it may measure your functions as well: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | As a side note, ST-link on STM32 discovery boards can be reflashed to JLink (works only on discovery boards, not on separate ST-links). | ||
| + | |||
| + | ===== ARM ETM trace - recording executed instructions ===== | ||
| + | |||
| + | ARM processors (Cortex M1+ and others) have built-in a nifty feature that you can record all instructions executed. This requires quite costly hardware (expect 2000 EUR price - JTrace, Lauterbach and uLink), but it can be handy in debugging DMA and interrupts. | ||
| + | |||
| + | An example ETM trace: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== ARM ITM trace - recording samples of executed instructions, | ||
| + | |||
| + | You can get code profile like this with ITM (screenshow from '' | ||
| + | |||
| + | {{: | ||
| + | To get this working, [[https:// | ||
| ====== Flyswatter connected to Proxmark ====== | ====== Flyswatter connected to Proxmark ====== | ||
| Line 510: | Line 542: | ||
| < | < | ||
| - | PROBE_HOST=stlink ST_BOOTLOADER=1 | + | make PROBE_HOST=stlink ST_BOOTLOADER=1 |
| </ | </ | ||
| Line 595: | Line 627: | ||
| //B.t.w,BMP with git can now run some things from the command line, when PC-hosted, e.g. " | //B.t.w,BMP with git can now run some things from the command line, when PC-hosted, e.g. " | ||
| + | |||
| + | ==== Cheap Chinese STLink v2 clones ==== | ||
| + | |||
| + | Some of them can be reflashed to BMP, some can't (stlink-tool reports error). There are more versions, so the pinout on the outside and also on the board depends on the specific clone type. | ||
| + | |||
| + | An example how to [[http:// | ||
| + | |||
| + | Original STLink (flashed with BMP with ST bootloader) using to program BMP on the cheap clone (haven' | ||
| + | |||
| + | {{: | ||
| + | |||
| + | |||
| + | ==== BMP PC-hosted with BMP HW target ==== | ||
| + | |||
| + | For BMP built with '' | ||
| + | |||
| + | < | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | It will create port 2000 listening for GDB connection and you can use the classic BMP commands like scan and attach: | ||
| + | |||
| + | < | ||
| + | >>> | ||
| + | Remote debugging using :2000 | ||
| + | >>> | ||
| + | Target voltage: unknown | ||
| + | Available Targets: | ||
| + | No. Att Driver | ||
| + | | ||
| + | >>> | ||
| + | Attaching to program: blackmagic-stlink-v2/ | ||
| + | 0x0800effc in st_usbfs_ep_read_packet (dev=< | ||
| + | 230 USB_SET_EP_RX_STAT(addr, | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ==== BMP PC-hosted with unmodified STLink v2 target (requires firmware >= V2J32xx) ==== | ||
| + | |||
| + | Upgrade STLink fw first with the STLinkUpgrade tool mentioned before. | ||
| + | |||
| + | With this firmware you can use external unmodified STLink with BMP ('' | ||
| + | |||
| + | < | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | It will create port 2000 listening for GDB connection and you can use the classic BMP commands like scan and attach: | ||
| + | |||
| + | < | ||
| + | >>> | ||
| + | Remote debugging using :2000 | ||
| + | >>> | ||
| + | Target voltage: unknown | ||
| + | Available Targets: | ||
| + | No. Att Driver | ||
| + | | ||
| + | >>> | ||
| + | Attaching to program: blackmagic-stlink-v2/ | ||
| + | 0x0800effc in st_usbfs_ep_read_packet (dev=< | ||
| + | 230 USB_SET_EP_RX_STAT(addr, | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| ===== Other useful tools that are specific to STM32 chips ===== | ===== Other useful tools that are specific to STM32 chips ===== | ||
project/arm_debugging/start.1576869612.txt.gz · Last modified: 2019/12/20 19:20 by abyssal