Reading STM32F4 unique device ID from MBED compiler

When working with the STM32 family of microcontrollers, it can be useful to evaluate the factory-programmed 96-bit UUID. The electronic signature is stored in the Flash memory area. It can be read using the JTAG/SWD or the CPU. It contains factory-programmed identification data that allow the user firmware or other external devices to automatically match its interface to the characteristics of the STM32F4xx microcontrollers.

The unique device identifier is ideally suited:
* for use as serial numbers (for example USB string serial numbers or other end applications)
* for use as security keys in order to increase the security of code in Flash memory while using and combining this unique ID with software cryptographic primitives and protocols before programming the internal Flash memory
* to activate secure boot processes, etc.

The 96-bit unique device identifier provides a reference number which is unique for any device and in any context. These bits can never be altered by the user.
The 96-bit unique device identifier can also be read in single bytes/half-words/words in different ways and then be concatenated using a custom algorithm.
According to the STM32F4 reference manual, the UUID is stored in memory at address 0x1FFF7A10.

Examples:

1. STM32-UID.h

2. Usage

References: techoverflow 1, techoverflow 2, alternative link for STM32F4 reference manual