Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
public:flashing_olimex_stm32-h103_using_a_raspberry_pi [2016/08/24 23:21]
Fufu Fang [Flashing Olimex STM32-H103 using a Raspberry Pi]
public:flashing_olimex_stm32-h103_using_a_raspberry_pi [2018/03/31 00:38] (current)
Line 1: Line 1:
 +====== Flashing Olimex STM32-H103 using a Raspberry Pi ======
 +If you want to flash an Olimex STM32-H103, you don't actually need an expensive JTAG cable. The expensive JTAG cable was suggested by GNUK's README [(gnuk_readme)]. Well, I decided to buy a STM32-H103 to store my OpenPGP master key, using GNUK. This is possibly the cheapest option to obtain a OpenPGP smartcard. STM32-H103 is available on Amazon for £14 [([[https://​www.amazon.co.uk/​HEADER-BOARD-STM32F103-STM32-H103-OLIMEX/​dp/​B00AQNYM0U|HEADER BOARD FOR STM32F103 STM32-H103 By OLIMEX]])].
  
 +**It might be possible to read the STM32-H103'​s ROM content back into the Raspberry Pi**. I haven'​t personally tried it yet. I know the ROM is read-locked if you follow the flashing process above. However, the rumour says that is is fairly easy to do. So using a USB smartcard may not deter GCHQ / NSA from extracting your private key! I don't actually know if this is safer than storing your private key on an encrypted USB drive. However if you use a GNUK device, it is safer than storing your private key on the actual computer, and it is more convenient to use the private key than having to re-import it from a USB drive. ​
 +
 +===== Pinouts =====
 +You need to connect the two devices together following the two diagrams below:
 +<columns 100% - ->
 +
 +==== Raspberry Pi JTAG using GPIO pins====
 +{{:​public:​rasperry_pi_jtag_pinout.png}}
 +<​newcolumn>​
 +
 +==== STM32-H103 JTAG connector ====
 +{{:​public:​stm32_h103_jtag_pinout.gif}}
 +Note: nTRST connects to TRST on Raspberry Pi. [([[https://​www.olimex.com/​Products/​ARM/​ST/​STM32-H103/​resources/​STM32-H103.pdf|STM32-H103 manual]])]
 +</​columns>​
 +
 +===== Starting OpenOCD =====
 +<code bash>
 +sudo openocd -f interface/​raspberrypi-native.cfg -f board/​olimex_stm32_h103.cfg
 +</​code>​
 +
 +===== Flashing STM32-H103 =====
 +<​code>​
 +telnet localhost 4444
 +reset halt
 +stm32f1x unlock 0
 +reset halt
 +flash erase_sector 0 0 127
 +flash erase_check 0
 +flash write_image erase gnuk.elf
 +verify_image gnuk.elf
 +stm32f1x lock 0
 +reset
 +shutdown
 +</​code>​
 +
 +Note: You need to shutdown OpenOCD before using the GNUK device. ​
 +
 +[(gnuk_readme>​ "Q7: How much does it cost? A7: Olimex STM32-H103 plus ARM-USB-TINY-H cost 70 Euro or so.", [[https://​anonscm.debian.org/​cgit/​gnuk/​gnuk/​gnuk.git/​tree/​README | GNUK Readme]])]
  • public/flashing_olimex_stm32-h103_using_a_raspberry_pi.1472080865.txt.bz2
  • Last modified: 2018/03/31 00:38
  • (external edit)