V5:Installing ChipWhisperer/Required Tools - Windows

From ChipWhisperer Wiki
Jump to: navigation, search

Python

For any of the other installation methods, you'll need to have Python 3 installed on your computer. If you already a recent version of Python installed (3.5.x+), you can skip this step. Note that Python 2.x will not work with this codebase. There's also a bit of setup that's needed to get other tools and prepare other drivers.

The recommend method of installing Python is to use a distribution called WinPython. This setup avoids installing Python globally, and includes most of the software you will need. In addition it makes it possible to install 32-bit and 64-bit Python on the same system with minimal problems. This can be very useful as the 64-bit version is handy for doing analysis on large data sets.

To install WinPython 3.7.x, Download a release in the 3.7.x branch from the WinPython site. ChipWhisperer works with both 32-bit and 64-bit versions of Python. If you run into issues connecting on Windows with 64-bit Python, see https://github.com/newaetech/chipwhisperer/issues/199.

Choose a reasonable location to install this to - note the default is simply in the download directory. Instead it's recommended to find a directory such as c:\WinPython32bit-3.7.1.0, or into your local directory such as c:\Users\yourname\<code>WinPython32bit-3.7.1.0</code>.

Go to your installation directory for WinPython, and run the shortcut called WinPython Command Prompt.exe. This will give you a command prompt which is setup to run Python along with associated scripts.

Optional: You can add the python.exe you just installed to your PATH. To do so navigate to your installation folder, and run the WinPython Control Panel.exe program. Then select Advanced -> Register distribution.... If you do not do this, you will have to run all commands in this document via the WinPython Command Prompt.exe. If you plan on running both 32-bit and 64-bit Python, you should not register them. Instead explicitly call the correct Python by always running the WinPython Command Prompt.exe, and then calling specific scripts or notebooks.

Python Packages

There are a number of packages that the ChipWhisperer project uses. You'll need to install these so that the software can run. With your WinPython command prompt, navigate to where you downloaded ChipWhisperer to, then move to the software/ directory.

Run the following commands to get the needed packages:

  • ConfigObj: pip install -r requirements.txt

Installing Hardware Drivers

Details of driver installation are on specific pages for supported hardware (such as cwcapturerev2 and naecw1173_cwlite). Drivers are available from ChipWhisperer release section.

Getting AVR Compiler Toolchain

The following section is not required for your first attack - you can jump right to the tutorial if you wish. However you'll ultimately wish to modify the code of the device under test, and these instructions tell you how. You should first follow the tutorial to confirm your system is working before modifying the code however!

To build the code, you'll need to install avr-gcc on Windows (if using the Virtual Machine, the following is not required, as the VM comes setup with the AVR compiler already). On Windows, you could choose to install:

  • AVR-GCC standalone - see avr-gcc standalone. You'll need to unzip this file and add the bin folder to your path. See this link for instructions on how to add something to your path.
  • WinAVR. WinAVR is rather old at this point, so its use is not recommended. Last release - 2010, see WinAVR Page

To test the code build, follow these steps:

cd to the directory with the avr-serial example, and run make:

cd c:\chipwhisperer\hardware\victims\firmware\simpleserial-aes
make

If this is successful, you'll see an output like the following:

image

If instead you get an error something like make: *** No rule to make target `simpleserial.elf', needed by `elf'. Stop., this means a required file was missing.

Programming the target AVR is accomplished in one of two methods depending on your hardware. The ChipWhisperer Capture Rev 2 uses the external "AVR Studio" program, whereas the CW1173 and CW1200 use a programmer menu from the ChipWhisperer-Capture software.

For details about programming the targets, see Tutorial B1 Building a SimpleSerial Project.

WinAVR Path Settings

By default, WinAVR is added to your system path. This means you can run avr-gcc, make and other programs from your normal Windows command line. You may not want this on certain systems where you already have similar tools installed. In which case either uncheck the Add WinAVR to Path option, or edit your system path to remove the WinAVR directories.

If you do not add it to the system path, you’ll need a method of readding the WinAVR directories when you want to use WinAVR. To do so create a file called winavr.bat in C:\WinAVR-20100110 with the following contents:

set PATH=%PATH%;C:\WinAVR-20100110\bin;C:\WinAVR-20100110\utils\bin
cmd

Now when you want to run WinAVR (e.g. to continue the examples here), you can simply double-click on the winavr.bat file. This will configure the path for just that terminal, rather than every terminal you open.

Note if using WinAVR on Windows 8.1 and possibly Windows 10, you must replace the dll msys-1.0.dll with an updated version. See Windows 8.1 Fix for a link to this DLL replacement.

Installing Arm Toolchain

To be able to build firmware for ARM Targets, you'll need to install the GNU Toolchain for ARM Devices. An installer for Windows and archives for Linux/Windows can be found here. Make sure you install the 2018-q2 version of the software, as 2018-q4 has a bug that prevents compiling and earlier ones may not work once uploaded. If you use the installer, make sure the "Add path to environment variable", "Add registry information", and "Launch gccvar.bat" boxes are ticked. Otherwise, you'll need to add the compiler to your path as with avr-gcc.

Once you've done this, open a terminal and type arm-none-eabi-gcc. If this fails, you'll need to add the toolchain to your path manually.

This doesn't install make like WinAVR does, so if you haven't installed that, you'll need to on your own (the easiest way is just to install WinAVR as well).