IDA Pro
Hex-Rays IDA Pro
v8 vs. v9
Version 8.0
Identical to version 7.0 with the following exception:
- SWD support for non-3.3V targets.
Version 9.1
- New design based on STM32F205.
Version 9.2
Identical to version 9.1 with the following exception:
- Pin 1 (VTref) is used for measuring target reference
voltage only. Buffers on J-Link side are no longer
powered through this pin but via the J-Link internal
voltage supplied via USB.
Boards
STM32: Hello World (Shenzhen LC Technology STM32F103C8 development board)
Shenzhen LC Technology Co.,Ltd.
J-Link Device Name Settings
GNU ARM Eclipse & Segger J-Link Device Name Settings
J-Link Commander
Reading peripheral register of Cortex M0 MCU using JLink and GDB
Commands
To switch to serial wire debug (SWD):
> si 1
Set the device profile for the target MCU:
> device EFM32GG990F1024
> device STM32F103C8
Erase the flash:
> erase
Download a binary file:
> loadbin c:\blink.bin, 0x0
> loadbin /home/andreas/Downloads/generic_boot20_pc13.bin 0x0
Reset the MCU:
> r
Run the MCU (Go):
> g
Halt the MCU:
> h
To verify that a binary file was properly downloaded to MCU flash:
> verifybin c:\blink.bin, 0x0
To upload memory from MCU flash and save it to a
binary file (start-address, length):
> savebin c:\upload.bin, 0x0, 0x1084
$ /opt/SEGGER/JLink/JLinkExe -device STM32F103C8 -if SWD -speed 4000
SEGGER J-Link Commander V5.12f (Compiled May 17 2016 16:01:56)
DLL version V5.12f, compiled May 17 2016 16:01:51
Connecting to J-Link via USB...O.K.
Firmware: J-Link V9 compiled Apr 22 2016 11:47:06
Hardware version: V9.20
S/N: xxxxxxxxx
License(s): GDB, RDI, FlashBP, FlashDL, JFlash, RDDI
VTref = 3.322V
J-Link>showemulist
J-Link[0]: Connection: USB, Serial number: xxxxxxxxx, ProductName: xxxxxxxxxx
J-Link>connect
Device "STM32F103C8" selected.
Found SWD-DP with ID 0x1BA01477
Found SWD-DP with ID 0x1BA01477
Found Cortex-M3 r1p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl 0 @ E00FF000
ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 001BB000 SCS
ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 001BB002 DWT
ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 000BB003 FPB
ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 001BB001 ITM
ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 001BB923 TPIU-Lite
Cortex-M3 identified.
J-Link>loadbin /home/andreas/Downloads/F103_blink_ledNUCLEO_F103RB.bin 0x0
Halting CPU for downloading file.
Downloading file [/home/andreas/Downloads/F103_blink_ledNUCLEO_F103RB.bin]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Flash programming performed for 1 range (24576 bytes)
J-Link: Flash download: Total time needed: 1.071s (Prepare: 0.055s, Compare: 0.004s, Erase: 0.352s, Program: 0.654s, Verify: 0.000s, Restore: 0.003s)
O.K.
J-Link>loadbin /home/andreas/Downloads/generic_boot20_pc13.bin 0x0
Halting CPU for downloading file.
Downloading file [/home/andreas/Downloads/generic_boot20_pc13.bin]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Flash programming performed for 1 range (8192 bytes)
J-Link: Flash download: Total time needed: 0.480s (Prepare: 0.066s, Compare: 0.002s, Erase: 0.176s, Program: 0.218s, Verify: 0.000s, Restore: 0.016s)
O.K.
Toolchain
GNU ARM Eclipse
How to install the ARM toolchain?
GNU ARM Embedded Toolchain
Ubuntu PPA: GNU ARM Embedded Toolchain
$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update
$ sudo apt-get install gcc-arm-embedded
GCC Option Summary
-v Print the commands executed to run
the stages of compilation.
-x language Specify explicitly the language for
the following input files.
-E Stop after the preprocessing stage;
do not run the compiler proper.
-Wp,option You can use -Wp,option to bypass the
compiler driver and pass option
directly through to the preprocessor.
$ echo | arm-none-eabi-gcc -v -x c -E -
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
Target: arm-none-eabi
Configured with: /build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/src/gcc/configure --target=arm-none-eabi --prefix=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native --libexecdir=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/lib --infodir=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/build/gcc-arm-none-eabi-CE0_5N/gcc-arm-none-eabi-6-2016q4/install-native/arm-none-eabi --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=rmprofile
Thread model: single
gcc version 6.2.1 20161205 (release) [ARM/embedded-6-branch revision 243739] (GNU Tools for ARM Embedded Processors)
COLLECT_GCC_OPTIONS='-v' '-E'
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/6.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ -
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/include"
ignoring nonexistent directory "/usr/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/include-fixed"
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/usr/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/include
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/include-fixed
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
COMPILER_PATH=/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/:/usr/bin/../lib/gcc/:/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/:/usr/bin/../lib/gcc/:/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/lib/:/usr/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-E'
$ echo | arm-none-eabi-gcc -E -Wp,-v -
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/include"
ignoring nonexistent directory "/usr/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/include-fixed"
ignoring duplicate directory "/usr/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory "/usr/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/include
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/include-fixed
/usr/bin/../lib/gcc/arm-none-eabi/6.2.1/../../../../arm-none-eabi/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
Eclipse
SEGGER J-Link install
The J-Link hardware debugging Eclipse plug-in
Plug-ins install
Stepping into disassembled code
Includes:
/usr/arm-none-eabi/include
/usr/lib/gcc/arm-none-eabi/6.2.1/include
/home/andreas/src/TivaWare
Symbols:
PART_TM4C123GH6PM
or
PART_LM4F120H5QR
Debugging Libraries
GNU Libs with Debug Information: Rebuilding the GNU ARM Libraries
Semihosting with GNU ARM Embedded (LaunchPad) and GNU ARM Eclipse Debug Plugins
Serial Wire Output (SWO) / Retargeting
Semihosting on ARM Cortex-M with open-source tools
Cannot Get Semihosting To Print (STM32F4, OpenOCD)
STM32F2 + SWO + JLINK + JLINK server + GDB client elf console
Semihosting on STM32 with GNU ARM Embedded, Eclipse and JLink GDB Server
J-Link SWO Viewer
Semihosting with GNU ARM Embedded (LaunchPad) and GNU ARM Eclipse Debug Plugins
Linker error on a C project using eclipse
Getting NewLib and printf to work with the STM32 and Code Sourcery Lite eabi
Linker error, undefined reference to `_sbrk’
Cannot Get Semihosting To Print (STM32F4, OpenOCD)
Printing “Hello World” to terminal from some board including nrf51822.
printf-gcc: An example of how printf can be redirected to UART with nRF51822
STM32 – printf
Printf() – debugging
Supply own _sbrk with libnosys/rdimon
undefined reference to `_sbrk’
arm-none-eabi-gcc -ggdb -Wall -Tstm32_flash.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals src/main.c src/stm32f4xx_it.c src/system_stm32f4xx.c lib/startup_stm32f4xx.s -o main.elf -Llib -lstm32f4
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/libg.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2: error: ld returned 1 exit status
make: *** [main.elf] Error 1
Use rdimon:
--specs=rdimon.specs
undefined reference to `__end__’
arm-none-eabi-gcc -ggdb -Wall -Tstm32_flash.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals src/main.c src/stm32f4xx_it.c src/system_stm32f4xx.c lib/startup_stm32f4xx.s --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group -o main.elf -Llib -lstm32f4
/usr/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/fpu/rdimon-crt0.o: In function `_start':
(.text+0xd8): undefined reference to `__end__'
collect2: error: ld returned 1 exit status
make: *** [main.elf] Error 1
No __end__ identifier. Create one in stm32_flash.ld
.bss :
{
[...]
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
._user_heap_stack :
{
.bss :
{
[...]
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
PROVIDE(__end__ = _ebss);
._user_heap_stack :
{
Debug Register: Decimal -> Hex
Window->Preferences->C/C++->Debug
In “Opened view default settings” change “Default register format:” to “Hexadecimal”.
Questions
Busted JLink
J-Link v8 with FW newer than May 20, 2010?
OpenOCD and Segger J-Link
OpenOCD 0.5.0 not working with JLink 4.50m FW
J-Link v8 with FW newer than May 20, 2010?
Clearing lockup after double fault
J-Link v8 with FW newer than May 20, 2010?
$ sudo JLinkExe
SEGGER J-Link Commander V4.78a ('?' for help)
Compiled Oct 8 2013 13:36:53
Can not connect to J-Link via USB.
$ cat JLink.log
TB75126C0 000:000 SEGGER J-Link V4.78a Log File (0000ms, 0000ms total)
TB75126C0 000:000 DLL Compiled: Oct 8 2013 13:36:49 (0000ms, 0000ms total)
TB75126C0 000:000 Logging started @ 2013-10-11 22:18 (0000ms, 0000ms total)
TB75126C0 000:000 JLINK_SetWarnOutHandler(...) (0000ms, 0000ms total)
TB75126C0 000:000 JLINK_SelectUSB(Port = 0) returns 0x00 (0001ms, 0001ms total)
TB75126C0 000:001 JLINK_OpenEx(...)
***** Error: Can not connect to J-Link via USB. returns "Can not connect to J-Link via USB." (0136ms, 0137ms total)
TB75126C0 224:915 JLINK_ClrError() (0000ms, 0137ms total)
TB75126C0 224:915 JLINK_Close() (0000ms, 0137ms total)
TB75126C0 224:915 (0000ms, 0137ms total)
TB75126C0 224:915 Closed (0000ms, 0137ms total)
BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="jlink_rules_end"
#
# Give all users read and write access.
#
ATTRS{idProduct}=="0101", ATTRS{idVendor}=="1366", MODE="666"
ATTRS{idProduct}=="0102", ATTRS{idVendor}=="1366", MODE="666"
ATTRS{idProduct}=="0103", ATTRS{idVendor}=="1366", MODE="666"
ATTRS{idProduct}=="0104", ATTRS{idVendor}=="1366", MODE="666"
#
# J-Link OBs with CDC functionality
#
ATTRS{idProduct}=="0105", ATTRS{idVendor}=="1366", MODE="666"
LABEL="jlink_rules_end"
Breaking JLink Clone-Detection
Anyone used JLink on Linux
J-Link Commander without sudo
Local GDB rather than Segger GDB
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
[...]
This GDB was configured as "x86_64-linux-gnu".
[...]
warning: Cannot convert floating-point register value to non-floating-point type.
JLink DLL / SO
$ file /opt/SEGGER/JLink_V512f/libjlinkarm.so.5.12.6
ELF 64-bit LSB shared object,
x86-64,
version 1 (SYSV),
dynamically linked,
BuildID[sha1]=93c09423c37da8451fa0a37bbbf613b8352a6948, stripped
$ objdump -f /opt/SEGGER/JLink_V512f/libjlinkarm.so.5.12.6
/opt/SEGGER/JLink_V512f/libjlinkarm.so.5.12.6: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00000000000ff510
$ readelf -S /opt/SEGGER/JLink_V512f/libjlinkarm.so.5.12.6
There are 27 section headers, starting at offset 0x9f46a0:
Section Headers:
[Nr] Name Type Address Offset Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0
[ 1] .note.gnu.build-i NOTE 0000000000000190 00000190 0000000000000024 0000000000000000 A 0 0 4
[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000000000001350 0000000000000000 A 3 0 8
[ 3] .dynsym DYNSYM 0000000000001508 00001508 00000000000040f8 0000000000000018 A 4 2 8
[ 4] .dynstr STRTAB 0000000000005600 00005600 0000000000003334 0000000000000000 A 0 0 1
[ 5] .gnu.version VERSYM 0000000000008934 00008934 000000000000056a 0000000000000002 A 3 0 2
[ 6] .gnu.version_r VERNEED 0000000000008ea0 00008ea0 00000000000000d0 0000000000000000 A 4 5 8
[ 7] .rela.dyn RELA 0000000000008f70 00008f70 00000000000f2bf8 0000000000000018 A 3 0 8
[ 8] .rela.plt RELA 00000000000fbb68 000fbb68 0000000000002280 0000000000000018 A 3 10 8
[ 9] .init PROGBITS 00000000000fdde8 000fdde8 0000000000000018 0000000000000000 AX 0 0 4
[10] .plt PROGBITS 00000000000fde00 000fde00 0000000000001710 0000000000000010 AX 0 0 4
[11] .text PROGBITS 00000000000ff510 000ff510 0000000000153f28 0000000000000000 AX 0 0 16
[12] .fini PROGBITS 0000000000253438 00253438 000000000000000e 0000000000000000 AX 0 0 4
[13] .rodata PROGBITS 0000000000253460 00253460 00000000001337fc 0000000000000000 A 0 0 32
[14] .eh_frame_hdr PROGBITS 0000000000386c5c 00386c5c 000000000000d924 0000000000000000 A 0 0 4
[15] .eh_frame PROGBITS 0000000000394580 00394580 0000000000038bd4 0000000000000000 A 0 0 8
[16] .ctors PROGBITS 00000000005cd158 003cd158 0000000000000028 0000000000000000 WA 0 0 8
[17] .dtors PROGBITS 00000000005cd180 003cd180 0000000000000020 0000000000000000 WA 0 0 8
[18] .jcr PROGBITS 00000000005cd1a0 003cd1a0 0000000000000008 0000000000000000 WA 0 0 8
[19] .data.rel.ro PROGBITS 00000000005cd1c0 003cd1c0 000000000008bfe0 0000000000000000 WA 0 0 32
[20] .dynamic DYNAMIC 00000000006591a0 004591a0 00000000000001d0 0000000000000010 WA 4 0 8
[21] .got PROGBITS 0000000000659370 00459370 0000000000000410 0000000000000008 WA 0 0 8
[22] .got.plt PROGBITS 0000000000659780 00459780 0000000000000b98 0000000000000008 WA 0 0 8
[23] .data PROGBITS 000000000065a320 0045a320 000000000059a240 0000000000000000 WA 0 0 32
[24] .bss NOBITS 0000000000bf4560 009f4560 000000000020c8f0 0000000000000000 WA 0 0 32
[25] .comment PROGBITS 0000000000000000 009f4560 0000000000000059 0000000000000001 MS 0 0 1
[26] .shstrtab STRTAB 0000000000000000 009f45b9 00000000000000e5 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
$ objdump -s -j .rodata /opt/SEGGER/JLink_V512f/libjlinkarm.so.5.12.6
[...]
328ed0 31473137 00415439 3153414d 44323147 1G17.AT91SAMD21G
328ee0 31374100 41543931 53414d44 32314731 17A.AT91SAMD21G1
328ef0 37415500 41543931 53414d44 32314731 7AU.AT91SAMD21G1
328f00 38004154 53414d44 32314731 38004154 8.ATSAMD21G18.AT
328f10 39315341 4d443231 47313841 00415453 91SAMD21G18A.ATS
328f20 414d4432 31473138 41550041 54393153 AMD21G18AU.AT91S
328f30 414d4432 314a3134 00415453 414d4432 AMD21J14.ATSAMD2
328f40 314a3134 00415439 3153414d 4432314a 1J14.AT91SAMD21J
[...]
Start Debugging in Assembler
Command Line Programming and Debugging with GDB
Registers
Source and Machine Code
Examining Source Files
$ /opt/SEGGER/JLink_V512f/JLinkGDBServer -device ATSAMD21G18 -if SWD -speed 4000
$ arm-none-eabi-gdb
(gdb) target remote :2331
(gdb) monitor reset
(gdb) si
(gdb) info registers
r0 0x2000005c 536871004
r1 0x0 0
r2 0x20000000 536870912
r3 0x42001400 1107301376
r4 0x200003e8 536871912
r5 0x20 32
r6 0xc 12
r7 0x20000400 536871936
r8 0xffd9befd 4292460285
r9 0x75fdf1ff 1979576831
r10 0xbfe7fffb 3219652603
r11 0xd373ffff 3547594751
r12 0x0 0
sp 0x20007fec 0x20007fec
lr 0x4fc5 20421
pc 0x652 0x652
xpsr 0x41000000 1090519040
MSP 0x20007fec 536903660
PSP 0x7f6fefec 2138042348
PRIMASK 0x0 0
BASEPRI 0x0 0
FAULTMASK 0x0 0
CONTROL 0x0 0
(gdb) p/x $pc
$1 = 0x652
(gdb) x/5i $pc
=> 0x64e: ldr r0, [pc, #60] ; (0x68c)
0x650: push {r3, r4, r5, lr}
0x652: cmp r2, r0
0x654: bne.n 0x660
0x656: ldr r2, [pc, #56] ; (0x690)
Linux AT91SAM7
[ 857.978356] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[ 858.127257] usb 1-1: New USB device found, idVendor=03eb, idProduct=6124
[ 858.127264] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 858.128567] cdc_acm 1-1:1.0: ttyACM1: USB ACM device
Linux udev
$ file /opt/SEGGER/JLink_V634h/libjlinkarm.so.6.34.8
/opt/SEGGER/JLink_V634h/libjlinkarm.so.6.34.8: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=2a5fdec57f4c7979a8f453bc87e3f4f11a2b58c9, stripped
$ file /opt/SEGGER/JLink_V634h/libjlinkarm_x86.so.6.34.8
/opt/SEGGER/JLink_V634h/libjlinkarm_x86.so.6.34.8: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=87bcf47d3d0a1ce17be9b08d935ca62451c68658, stripped
$ /opt/SEGGER/JLink_V634h/JLinkExe
SEGGER J-Link Commander V6.34h (Compiled Oct 9 2018 15:50:29)
DLL version V6.34h, compiled Oct 9 2018 15:50:01
Connecting to J-Link via USB...Updating firmware: J-Link
Replacing firmware: J-Link
FAILED: Failed to activate bootloader (timeout)
J-Link>
$ sudo udevadm control --reload-rules
$ udevadm monitor --udev
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
UDEV [3055.482775] add /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV [3055.489309] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1 (usb)
UDEV [3055.489419] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [3055.493441] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1 (usb)
UDEV [3055.496803] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/tty/ttyACM1 (tty)
UDEV [3055.500750] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.2 (usb)
UDEV [3055.506381] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [3055.511787] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV [3078.917122] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1 (usb)
UDEV [3078.919208] remove /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.2 (usb)
UDEV [3078.921420] remove /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.1 (usb)
UDEV [3078.922618] remove /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/tty/ttyACM1 (tty)
UDEV [3078.928998] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [3078.931900] remove /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [3078.936413] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV [3078.941354] remove /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)