When working with the STM32 family of microcontrollers, it can be useful to evaluate the factory-programmed 96-bit UUID using JTAG. On all major operating systems, OpenOCD provides a simple yet highly compatible and free solution in order to do this.
In this example, we’ll use a JLink adapter together with the Olimex E407 evalation board. Both the adapter and the board are interchangable, provided you have working OpenOCD configurations available.
According to the STM32F4 reference manual, the UUID is stored in memory at address 0x1FFF 7A10 (see section 39.1). Starting from this address, we have to read three times 32 bits (i.e. 3 words) of memory to get the full UUID.
In order to do this, we can use the mdw command as documented under OpenOCD General commands
openocd -f interface/jlink.cfg -f olimex-e407.cfg -c "init" -c "$target_name mdw 0x1FFF7A10 3" -c "exit"
This script tells OpenOCD to first initialize the target device, the read 3 words starting at 0x1FFF7A10 and then exit immediately.
Example output:
Open On-Chip Debugger 0.7.0 (2013-06-15-20:16) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : only one transport option; autoselect 'jtag' adapter speed: 1000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 cortex_m3 reset_config sysresetreq Info : J-Link initialization started / target CPU reset initiated Info : J-Link ARM V8 compiled Jun 19 2012 11:29:30 Info : J-Link caps 0xb9ff7bbf Info : J-Link hw version 80000 Info : J-Link hw type J-Link Info : J-Link max mem block 9320 Info : J-Link configuration Info : USB-Address: 0x0 Info : Kickstart power on JTAG-pin 19: 0xffffffff Info : Vref = 3.345 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 0 TRST = 0 Info : J-Link JTAG Interface ready Info : clock speed 1000 kHz Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020, part: 0x6413, ver: 0x0) Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints 0x1fff7a10: 00370021 32314718 39313739
The last line first display the address read, followed by three hexadecimal numbers representing the three 32-bit UUID parts.
When using other boards or interfaces, just replace the scripts referenced by -f
by the appropriate OpenOCD scripts.
Although I have not checked this in detail, I assume other STM32 families store the UUID at the same address.