This project turns STM32F4-Discovery board, or any STM32F4 board with USB port into a hardware random number generator.
- GNU Arm Embedded Toolchain
- STM32CubeMX
- Firmware programming tool
- Clone this project, open
stm32_rand.ioc
with STM32CubeMX. The clickGenerate Code
underProject
menu to download and copy STM32F4 drivers and USB libraries toDrivers/CMSIS
,Drivers/STM32F4xx_HAL_Driver
andMiddlewares/ST/STM32_USB_Device_Library
. - Type
make
to build, ormake DEBUG=0 OPT=-O2
to build a release version.
- Programme the binary to board. With the onboard ST-Link, varity of tools can be employed to programme the flash memory. Such as ST-LINK utility on Windows, or stlink from texane which works on both Linux and macOS.
- Connect the micro USB port to PC, a new serial port will be available.
- Random numbers can be accessed by simply reading data from the new serial port. A python script
dump_rand.py
is provided as an example.