Sample code for Husky/CW312T-iCE40

Hi,

Can anyone tell me if there is sample code that covers programming and trace capturing for the combination of Husky and CW312T-iCE40? I have code that works fine with Husky/SAM4S, but not with a CW312T-iCE40. I did change the programmer to NEORV32Programmer and no error was reported during programming, other than “[ INFO] Falling back to ‘slow’ USB when data is passed”. Then I used the sample in " Breaking Hardware AES on CW305 FPGA (and other FPGA targets)" to capture traces. No matter what firmware are ‘programmed’, the traces appear to remain the same.

Are there any modifications needed between the two different targets (SAM4S and iCE40)?

Thanks
Steve

The iCE40 is an FPGA so it’s very different from our non-FPGA targets. There is no single answer to your question; it depends what you want to do.

If you’re using the neorv32 soft-core on it, then look to our ice40 target page: there we show how to program it the neorv32 soft-core and its firmware.

Once you’ve programmed it with one of our example firmware, then you can capture traces from it just as you would from our “normal” (non-FPGA) targets.

The “Breaking Hardware AES on CW305 FPGA (and other FPGA targets)” notebook does not use the neorv32 soft-core. It also does not use the NEORV32Programmer. This notebook configures the FPGA as a completely different target: it’s pure hardware AES and it does not run firmware. You can run that notebook as-is, by simply setting TARGET_PLATFORM = 'CW312T_ICE40' at the top of the notebook.

Thanks for the quick response.

What I want to do is to use the neorv32 soft-core, program it with an application firmware and capture its power trace.

The first thing I did after receiving the Husky was to run the “Breaking Hardware AES on CW305 FPGA (and other FPGA targets)” notebook. Does it mean the neorv32 soft-core on the iCE40 has been erased? Is the following the correct way to reconfigure the FPGA?

(I had errors in running the code in the ice40 page, so I modified it as follows. )

import chipwhisperer as cw
from chipwhisperer.hardware.naeusb.programmer_neorv32 import Neorv32Programmer

scope = cw.scope()
scope.default_setup()

neorv = cw.programmers.Neorv32Programmer(scope)
neorv.open_port()
neorv.program("simpleserial-base-CW308_NEORV32.bin", bsfile="neorv32_iCE40CW312_MinimalBoot_directclk_7370KHz.bit")
neorv.close_port()

Then simply follow the instructions here.

For example, to run Lab 2_1A, set PLATFORM to CW308_NEORV32.
For most targets cw.program_target() takes the .hex file, but for the neorv32 core on the iCE40 you need to specify the .bin file instead. That’s all you need to change.

The iCE40 FPGA needs to be programmed every time it’s powered up. It doesn’t matter what you programmed to it before; removing power erases it.

Very helpful.
Thanks a lot.