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

Changes

Jump to: navigation, search

Tutorial B1 Building a SimpleSerial Project

536 bytes removed, 15:45, 1 October 2018
no edit summary
|capture hardware = CW-Lite, CW-Lite 2-Part, CW-Pro
|Target Device =
|Target Architecture = XMEGA/ARM/Other
|Hardware Crypto = No
|Purchase Hardware =
This tutorial will introduce you to the 'simpleserial' communications system. It will show you how to perform different operations on data based on input from the ChipWhisperer software. This can be used for building your own system which you wish to 'break'.
 
For users of the ChipWhisperer Lite with ARM target, you'll want to ensure you have the latest updates to the ChipWhisperer platform. This can be done by using the ChipWhisperer Git Update program, or by using git to checkout the develop branch and pulling any updates.
{{TOC|limit=3}}
<h2> What is SimpleSerial </h2>
[[SimpleSerial]] is the communications protocol used for almost all of the ChipWhisperer demo project. It's a very basic serial protocol which can be easily implemented on most systems. This system communicates using a standard asyncronous asynchronous serial protocol, 38400 baud, 8-N-1.
All messages are sent in ASCII-text, and are normally terminated with a line-feed ('\n'). This allows you to interact with the simpleserial system over a standard terminal emulator.
: This is the response from the system. If data has been encrypted with a 'p' for example, the system will respond with the 'r' sequence automatically. So sending the earlier example means the result of the encryption was <code>cbbd4a2b34f2571758ff6a797e09859d</code>.
<h2> Building the Basic Example </h2> You'll need to have installed avr-gcc and avr-libc. You may have already done For this by following the installation guide, or if using the ChipWhisperer-VM it comes prepared with avr-gcc already setup. See the [[Installing_ChipWhisperer]] guide for details. Once you have a working compiler (check by typing 'avr-gcc' at the command line - if using Windows you may need to setup a special batch file to provide you with a avr-gcc command prompt). <ol style="list-style-type: decimal;"><li>We want to use the existing SimpleSerial firmware as a base for our project, but we don't want to edit the existing firmware. Insteadexample, we'll make a new project with a copy be working off of this firmware. Copy the directory <code>simpleserial-base</code> which is found at <code>chipwhisperer/hardware/victims/firmware/</code> of the chipwhisperer release to a new directory called <code>simpleserial-base-lab1</code>. You must keep it in the same directory, as it will reference other files within that directory for which by default just echos the build process.</li><li><dl><dt>Open a terminal with avr-gcc in the path. If using Windows the sidebar on the [[Installing_ChipWhisperer]] page - you can either add WinAVR 16 bytes we send to your system path, or you can run the 'winavr.bat' file suggested.</dt></dl></li><li><p>Change the terminal target back to the newly copied directoryus. For example:</p>{{CollapsibleSectionWindows:<pre>cd c:\chipwhisperer\hardware\victims\firmware\simpleserial-base-lab1</pre>Linux/macOS:<pre>cd chipwhisperer/hardware/victims/firmware/simpleserial-base-lab1</pre></li><li><p>Then, run <code>make</code> to build the system. Make sure you specify which platform you're using as your target. For example, |intro = === Building for the ChipWhisperer Lite target, run</p>CWLite with XMEGA Target ===<pre>make PLATFORM|content=CW303</pre><p>Which should have the following output:</p><pre>...Bunch of lines removed...Creating Extended Listing: simpleserial-base.lssavr-objdump -h -S -z simpleserial-base.elf &gt; simpleserial-base.lss Creating Symbol Table: simpleserial-base.symavr-nm -n simpleserial-base.elf &gt; simpleserial-base.sym Size after:AVR Memory Usage----------------Device: atxmega128d3 Program: 1524 bytes (1.1% Full)(.text + .data + .bootloader) Data: 224 bytes (2.7% Full)(.data + .bss + .noinit)Building for XMEGA}}
{{CollapsibleSection
|intro = === Building for CWLite with Arm Target ===
|content= Building for Arm}}
Built {{CollapsibleSection|intro = === Building for platform CW-Lite XMEGAOther Targets === -------- end --------</pre></li>Ensure that the "Built |content= Building for platform ___" matches your target device.</ol>Other Targets}}
<h2> Modifying the Basic Example </h2>
<li>Rebuild the example using the <code>make</code> command. Remember you can press the up arrow on the keyboard to get recently typed commands in most OSes.</li></ol>
== Hardware Setup ==
{{CollapsibleSection
|intro = === Completing Tutorial with CW1173 (Lite) Hardware Setup ===|content= Completing Tutorial with CW1173CWLite HW Setup}}
{{CollapsibleSection
|intro = === Completing Tutorial with CW1173 CW1200 (LitePro) + UFO Board Hardware Setup ===|content= Completing Tutorial with CW1173 UFO BoardCW1200 HW Setup}}
{{CollapsibleSection
|intro = === Completing Tutorial with CW1200 CW308 (ProUFO) Hardware Setup ===|content= Completing Tutorial with CW1200CW308 HW Setup}} == Programming the Target =={{CollapsibleSection|intro = === Programming the XMEGA Target ===|content= Programming XMEGA}} {{CollapsibleSection|intro = === Programming the STM32F3 (CW303 Arm) Target ===|content= Programming Arm}} {{CollapsibleSection|intro = === Programming Other Targets ===|content= Programming Other}} == Completing the Tutorial ==Now that the target has the modified firmware, there's only a few steps left to completing the tutorial. Note that if you've closed ChipWhisperer Capture since programming the device, you'll need to rerun the connect_cwlite_simpleserial.py and target setup scripts:# Open the status monitor under <i>Tools > Encryption Status Monitor</i>.# Resize the monitor window. The monitor will show sent &amp; received data to the target.# Hit the ''Run 1'' button ([[File:Capture One Button.PNG|image|link=http://wiki.newae.com/File:Capture_One_Button.PNG]]). You may have to hit it a few times, as the very first serial data is often lost. You should see data populate in the ''Text Out'' field of the monitor window. Note that each byte of the ''Text In'' is incremented in the ''Text Out'' field.
<h2> Conclusion </h2>
Approved_users, administrator
366
edits

Navigation menu