Building Simple Serial for the Chipwisperer Lite

I was looking for the programmer option for the CW-Lite target board, and I ran the XMEGAProgrammer.py file, which promptly erased my target.

I want to program it back, but I need the hex file. I think I found the source code in hardware/victims/firmware/xmega-serial. The get_crypto.sh script didn’t work for me, but I figured it out, and managed to get it to build.

However, if I change the target to atxmega128d4 in the makefile, it won’t compile:

avr-gcc -c -mmcu=atxmega128d4 -I. -gdwarf-2 -DAVRCRYPTOLIB -DF_CPU=7372800UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=objdir/simpleserial.lst -I../crypto/avr-crypto-lib/aes -I../crypto -std=gnu99 -MMD -MP -MF .dep/simpleserial.o.d simpleserial.c -o objdir/simpleserial.o In file included from simpleserial.c:21:0: AES_driver.h:135:33: error: unknown type name 'AES_INTLVL_t' AES_INTLVL_t int_lvl); ^ AES_driver.h:138:29: error: unknown type name 'AES_INTLVL_t' void AES_interruptlevel_set(AES_INTLVL_t int_lvl); ^ In file included from simpleserial.c:22:0: ../crypto/aes-independant.h:33:1: warning: multi-line comment [-Wcomment] //#define DEFAULT_KEY 0x1f,0x3e,0xa0,0x47,0x76,0x30,0xce,0x21, \ ^ In file included from simpleserial.c:21:0: simpleserial.c: In function 'main': AES_driver.h:108:39: error: 'AES' undeclared (first use in this function) #define AES_software_reset() ( AES.CTRL = AES_RESET_bm ) ^ simpleserial.c:103:2: note: in expansion of macro 'AES_software_reset' AES_software_reset(); ^ AES_driver.h:108:39: note: each undeclared identifier is reported only once for each function it appears in #define AES_software_reset() ( AES.CTRL = AES_RESET_bm ) ^ simpleserial.c:103:2: note: in expansion of macro 'AES_software_reset' AES_software_reset(); ^ AES_driver.h:108:50: error: 'AES_RESET_bm' undeclared (first use in this function) #define AES_software_reset() ( AES.CTRL = AES_RESET_bm ) ^ simpleserial.c:103:2: note: in expansion of macro 'AES_software_reset' AES_software_reset(); ^ makefile:585: recipe for target 'objdir/simpleserial.o' failed

Am I using the right code and target? Do I need to change something else?

Make sure you have built the crypto libs first. Follow the instructions in section 2.1.4: newae.com/sidechannel/cwdocs/ins … le-targets

Once that’s done, you may need to manually make the obdir directory. See some of my comments in this thread if you run into these problems: viewtopic.php?f=6&t=67

I did install the crypto library, and I manage to get it to build. However, I don’t want it to build for a atmega328p (like the tutorial) or an atxmega16a4 (like the script I mentioned).

I need it to build for a atxmega128d4 (the chip on the break off board), and when I set the target to that it refuses to build. For the errors, see my last post.

Huge apologies on the slow response here - I’m having occasional troubles with getting the email notification of new posts, so managed to miss this. The error you are getting is on account of the existing code targeting the XMEGA A4U device, there is a few registers difference. To get you up and running quickly here is the .hex file programmed into the boards (see attached). I was hoping this week to commit the cleaned up code to the repo but haven’t had a chance… in the work-up to Blackhat/DEFCON I’ve been trying to get a few demos running which has slowed me way down!

If you want to build the code, just comment out references to those hardware AES registers is the quickest way. But I’ve already got some cleaned-up code, just need to finish committing it (which also involves rearranging the “firmware” directory to better support future example code).