As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.

Difference between revisions of "CW308T-STM32X7"

From ChipWhisperer Wiki
Jump to: navigation, search
(Start draft for STM32X7 target board)
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Infobox cw308target
 
{{Infobox cw308target
 
|name                  = CW308T-STM32X7
 
|name                  = CW308T-STM32X7
|image                  = STM32X7-target.jpg
+
|image                  = STM32X7-target.png
 
|caption                =  
 
|caption                =  
 
|Target Device          = ST STM32F
 
|Target Device          = ST STM32F
Line 15: Line 15:
 
== Supported Devices ==
 
== Supported Devices ==
  
The STM32X7 board supports several STM32X7 devices in the UFBGA-176 package. Various header jumpers can be set different positions to select appropriate power supply for the different power domians of the device, and different measurements points. The following table summarizes examples of suitable devices:
+
The STM32X7 board supports several STM32X7 devices in the UFBGA-176 package. The devices have the same pinout. Various header jumpers can be set different positions to select appropriate power supply for the different power dominans of the device, and different measurements points. The devices in the following table shows two compatible devices:
 
{| class="wikitable"
 
{| class="wikitable"
 
!STM32X7 Series
 
!STM32X7 Series
Line 21: Line 21:
 
!Device
 
!Device
 
!Hardware AES
 
!Hardware AES
 +
!TRNG
 
!Tested
 
!Tested
!Jumper
+
!Process node
 
!Flash
 
!Flash
 
!SRAM
 
!SRAM
 +
!OTP
 
|-
 
|-
 
|F7
 
|F7
Line 31: Line 33:
 
|No
 
|No
 
|Yes
 
|Yes
|B
+
|Yes
|128KB
+
|90 nm
|16KB
+
|1MB
 +
|320KB
 +
|1KB
 
|-
 
|-
|F7
+
|H7
 
|UFBGA-176
 
|UFBGA-176
|STM32F746IEK6
+
|STM32H743IIK6
 
|No
 
|No
 
|Yes
 
|Yes
|B
+
|Yes
|128KB
+
|40 nm
|16KB
+
|1MB
 +
|320KB
 +
|1KB
 
|-
 
|-
 
|}
 
|}
 +
There are other flavors of the devices with the same pinout, which makes them compatible with this target board.
  
=== VCC-Int Supply ===
+
== Power supply ==
Several devices (F2, F4) have internal core voltage regulators. By default the CW308 board attempts to provide power for these pins, but the voltage may not be high enough to cause the internal regulator to disable itself. In this case you can use the VADJ regulator to ensure the internal regulator is disabled. See [[Targets with Internal Regulators]] for details.
+
The device must be supplied 3v3, since the device's I/O logic uses 3v3. The logic core uses 1v2.
  
=== Pin-outs across TQFP Devices ===
+
=== Internal regulators ===
 +
The device contains an internal regulator regulating the input voltage down to 1v2. This can however be bypassed by supplying a slightly higher voltage to the target board's 1v2 pin.
  
The following shows differences in pinouts between three groups of devices. The left-most is the STM32F051RB, which uses the same 3.3V VCORE as the STM32F1/F3. It has fewer VCC pins, so the I/O occupying that are VCC/GND pins on the STM32F1 (such as PF6/PF7) are tied to GND/VCC. The right-most part is the pinout of the STM32F2/F4. It has an internal regulator, where the VCAP pins are the output of this regulator (and input to the internal core logic).
+
== Measuring power consumption ==
 +
The target board contains headers which lets the hacker select where to measure. It is possible to select to measure power on the 3v3 input and the 1v2 input/decoupling. VCAP1 and VCAP2 should be shorted, an only one shunt resistor should be used. It seems that the VCAP pins are from the same power domain, namely the digital core logic domain.
  
[[File:power_diffstm32.png|800px]]
+
== Hardware cryptography ==
 
+
Some flavors of the STM32X7 supports hardware cryptography . The tested devices in the above table do not support hardware cryptography, hence there are no firmware which supports the hardware cryptography yet.  
Note for the devices with a 3.3V VCORE, you should not mount decoupling capacitors C5/C6/C7/C8. You will still get some leakage with those capacitors mounted, but a stronger signal is present without them.
+
 
+
== Hardware AES ==
+
 
+
The STM32F21x, and STM32F41x/43x have hardware crypto modules (AES, DES, TDES) along with hardware hash (SHA1, MD5). Hardware crypto for the STM32F4 has been integrated into the Hal build system on the develop branch. To use the hardware crypto, call HW_AES128_Init() at the beginning of your program. You can update the key with HW_AES128_LoadKey(), encrypt plaintext with HW_AES128_Enc(), and decrypt data with HW_AES128_Dec().
+
 
+
== CAN Connection ==
+
 
+
A 6-pin header is present for devices which have CAN hardware support (not all devices have this). A CANoodler can be plugged in to provide the physical transceiver. This header is not normally mounted, unless the board is part of an 'automotive bundle'. The header is left unmounted as it can impede sweeping a probe over the surface of the chip.
+
  
 
== Programming Connection ==
 
== Programming Connection ==
 
+
The target board supports using both JTAG and SWD for programming. An external programmer is needed, e.g. a SEGGER Jlink or a ST-Link.  
=== ChipWhisperer Programmer via Bootloader ===
+
 
+
See further down this wiki page for details.
+
 
+
=== JTAG Programmer ===
+
 
+
The 20-pin JTAG port (J6 on CW308 Board) can be used with the [https://www.digikey.com/product-detail/en/stmicroelectronics/ST-LINK-V2/497-10484-ND/2214535 ST-LINK/V2] which is a low-cost JTAG programmer.
+
 
+
It is also possible to use other JTAG programmers such as OpenOCD. The following command worked with an Olimex OpenOCD programmer and their [https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD-H/ OpenOCD for Windows] software:
+
<pre>
+
openocd
+
  -f path/to/board/files/cw308.cfg
+
  -c init
+
  -c targets
+
  -c "halt"
+
  -c "flash write_image erase path/to/firmware.hex"     
+
  -c "verify_image path/to/firmware.hex"       
+
  -c "reset run"
+
  -c shutdown
+
</pre>
+
where the contents of <code>cw308.cfg</code> are
+
<pre>
+
source [find interface/olimex-arm-usb-ocd-h.cfg]
+
source [find target/stm32f4x.cfg]
+
reset_config srst_only
+
</pre>
+
  
 
== Example Projects ==
 
== Example Projects ==
 
+
=== STM32F7 ===
SimpleSerial builds for each of the STM32Fx Devices. Each device is a separate HAL. These HAL modules have been copied from ST's HAL (not the CUBE) and greatly reduced in size by deleting unused files (such as headers for unused devices), and combining several C-source files into a single low-level C-file.
+
SimpleSerial builds for the STM32F7 devices using the ChipWhisperer build system. Each device is a separate HAL. These HAL modules have been copied from ST's HAL.
 +
=== STM32H7 ===
 +
SimpleSerial builds for the STM32H7 devices using Arm Keil uVision. This project could easily be ported to support the ChipWhisperer build system. The Keil-project is also included in the repo. Keil IDE also supports debugging, which is helpful for working out all the kinks in your firmware.
  
 
=== Building ST Example on Command Line ===
 
=== Building ST Example on Command Line ===
Line 102: Line 78:
  
 
<code>
 
<code>
make PLATFORM=CW308_STM32F0 CRYPTO_TARGET=TINYAES128C
+
make PLATFORM=CW308_STM32F7 CRYPTO_TARGET=TINYAES128C
 
</code>
 
</code>
  
If all goes well, this command will finish by printing the output file size and the platform:
+
Program the device using your preferred method. SEGGER JFlash is a great tool for that.  
 
+
[[File:Stm32-make.png]]
+
 
+
=== Programming via ChipWhisperer Bootloader ===
+
 
+
{{:CW308T-STM32F/ChipWhisperer_Bootloader}}
+
 
+
=== Running ST Example with ST-Link ===
+
If instead of using the bootloader, you want to use a ST-Link you can instead plug your programmer into the 20 pin JTAG connector (J6 on the UFO board):
+
 
+
[[File:Stm32-jtag.jpg|600px]]
+
 
+
Then, the details of this step will depend on your programmer. If you're using an ST-Link programmer, open the ST-Link utility and connect to the device:
+
 
+
[[File:Stm32-connect.png]]
+
 
+
Load your `.hex` file and program the device with the Program and Verify button:
+
 
+
[[File:Stm32-program.png]]
+
 
+
 
After this, you're ready to go - you can use the ChipWhisperer terminal to talk to your target. You might need to reset the target before you do anything else.
 
After this, you're ready to go - you can use the ChipWhisperer terminal to talk to your target. You might need to reset the target before you do anything else.
 
=== Building and Debugging via ST's System Workbench ===
 
It's also possible to work on the example projects using [http://www.st.com/en/development-tools/sw4stm32.html ST's System Workbench IDE]. This IDE also supports debugging, which is helpful for working out all the kinks in your firmware.
 
 
To build the ChipWhisperer examples in System Workbench:
 
 
1. Create a new Mcu project by going to ''File > New > C Project'' and selecting ''<nowiki/>'<nowiki/>''Ac6 STM32 MCU Project'''.'' When you get to Target Configuration, click the Mcu tab and select the microcontroller that you want to target:
 
 
[[File:STM32 New Project.PNG|400px]]
 
 
[[File:STM32 MCU-Selection.PNG|400px]]
 
 
2. Link the external files into the project. To do this, under ''File > Import'', select ''File System''. In the `chipwhisperer\hardware\victims\firmware` directory, select all of the relevant files and folders (Makefile in base folder, Makefile in HAL folder, STM32Fx HAL folder).:
 
 
[[File:STM32 Import.PNG|400px]]
 
 
3. Set up the build command. In ''File > Properties'', go to ''C/C++ Build > Behavior'' and remove 'all''<nowiki/>''' from 'Build' and deselect 'Enable parallel build'. Next, click the ''Builder Settings'' tab and deselect 'Use default build command' and 'Generate Makefiles Automatically'. Enter the command you would normally enter on the command line and change 'Build directory' to the folder you want to build in:
 
 
[[File:STM32 Behaviour.PNG|400px]]
 
 
[[File:STM32 Build-Settings.PNG|400px]]
 
 
4. Build the project and confirm that the build works from the output in the IDE console.
 
 
Then, if you want to set up debugging:
 
 
1. Go to ''in File > Properties'' select Run/Debug Settings and create a new debug configuration. Under Debugger, click 'Show generator options...' and setup your Connection Setup based on your debugger. Change 'Reset Mode' to 'Software System reset':
 
 
[[File:STM32 Debugging.PNG|400px]]
 
 
2. Click Apply and enter debugging mode.
 
 
'''Caveat''': the I/O register map in the debugger appears to use the last known device (ie: if you debugged an STM32F4 project before your Makefile project, it sticks with F4's registers). Check that the registers' addresses are correct before you trust them!
 
  
 
== Schematic ==
 
== Schematic ==
 +
<!--
 
The following variants are possible, see the table above for SRAM/FLASH/HW-Crypto status:
 
The following variants are possible, see the table above for SRAM/FLASH/HW-Crypto status:
 
{| class="wikitable"
 
{| class="wikitable"
Line 199: Line 123:
 
|51-ohm
 
|51-ohm
 
|}
 
|}
 +
-->
 +
=== Rev -01 Schematic ===
  
=== Rev -03 Schematic ===
+
The current revision of the target is -01. The following shows this schematic:
 
+
The current revision of the target is -03. The following shows this schematic:
+
 
+
[[File:CW308T_STM32F_03.png|1100px]]
+
 
+
=== Rev -02 Schematic ===
+
 
+
The original board sold was the -02 revision. The revision is part of the part number, for example these boards will be marked STM32F-02. The -02 revision also does not have the CAN connector:
+
[[File:cw308_stm32f.jpg|400px]]
+
  
[[File:CW308T_STM32F_02.png|1100px]]
+
[[File:CW308T-STM32X7-01.png|200px]]
  
 
== Hardware ==
 
== Hardware ==

Latest revision as of 10:39, 29 November 2018

CW308T-STM32X7
STM32X7-target.png
Target Device ST STM32F
Target Architecture Cortex M7, H7
Hardware Crypto Possible
Design Files GITHub Link
Status Beta

THIS IS CURRENTLY A DRAFT, FURTHER READING NOT ADVISED

Supported Devices

The STM32X7 board supports several STM32X7 devices in the UFBGA-176 package. The devices have the same pinout. Various header jumpers can be set different positions to select appropriate power supply for the different power dominans of the device, and different measurements points. The devices in the following table shows two compatible devices:

STM32X7 Series Package Device Hardware AES TRNG Tested Process node Flash SRAM OTP
F7 UFBGA-176 STM32F746IEK6 No Yes Yes 90 nm 1MB 320KB 1KB
H7 UFBGA-176 STM32H743IIK6 No Yes Yes 40 nm 1MB 320KB 1KB

There are other flavors of the devices with the same pinout, which makes them compatible with this target board.

Power supply

The device must be supplied 3v3, since the device's I/O logic uses 3v3. The logic core uses 1v2.

Internal regulators

The device contains an internal regulator regulating the input voltage down to 1v2. This can however be bypassed by supplying a slightly higher voltage to the target board's 1v2 pin.

Measuring power consumption

The target board contains headers which lets the hacker select where to measure. It is possible to select to measure power on the 3v3 input and the 1v2 input/decoupling. VCAP1 and VCAP2 should be shorted, an only one shunt resistor should be used. It seems that the VCAP pins are from the same power domain, namely the digital core logic domain.

Hardware cryptography

Some flavors of the STM32X7 supports hardware cryptography . The tested devices in the above table do not support hardware cryptography, hence there are no firmware which supports the hardware cryptography yet.

Programming Connection

The target board supports using both JTAG and SWD for programming. An external programmer is needed, e.g. a SEGGER Jlink or a ST-Link.

Example Projects

STM32F7

SimpleSerial builds for the STM32F7 devices using the ChipWhisperer build system. Each device is a separate HAL. These HAL modules have been copied from ST's HAL.

STM32H7

SimpleSerial builds for the STM32H7 devices using Arm Keil uVision. This project could easily be ported to support the ChipWhisperer build system. The Keil-project is also included in the repo. Keil IDE also supports debugging, which is helpful for working out all the kinks in your firmware.

Building ST Example on Command Line

The regular firmware build process works with the STM32 devices. For example, to build `simpleserial-aes`, navigate to the folder `chipwhisperer\hardware\victims\firmware\simpleserial-aes` and run the following command on the command line:

make PLATFORM=CW308_STM32F7 CRYPTO_TARGET=TINYAES128C

Program the device using your preferred method. SEGGER JFlash is a great tool for that. After this, you're ready to go - you can use the ChipWhisperer terminal to talk to your target. You might need to reset the target before you do anything else.

Schematic

Rev -01 Schematic

The current revision of the target is -01. The following shows this schematic:

CW308T-STM32X7-01.png

Hardware