Changing frequency (F_CPU) in simpleserial-aes


#1

I’m building the simpleserial-aes, from the chip whisperer project, for running in my own board on an Atmega168p. I need to change the CPU frequency, due to different crystal, but when I change the defined value in the makefile, it doesn’t get changed when I build. Build command is: chipwhisperer/hardware/victims/firmware/simpleserial-aes/make PLATFORM=CW301_AVR

The constant F_CPU=7372800 is found here: https://github.com/newaetech/chipwhisperer/blob/develop/hardware/victims/firmware/hal/Makefile.hal

A piece of compilation output: Compiling C: simpleserial-aes.c avr-gcc -c -mmcu=atmega328 -I. -fpack-struct -gdwarf-2 - DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_avr -DPLATFORM=CW301_AVR - DAVRCRYPTOLIB -DF_CPU=7372800UL -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=objdir/simpleserial- aes.lst -I.././simpleserial/ -I.././hal -I.././hal/avr -I.././crypto/ - I.././crypto/avrcryptolib//aes -I.././crypto/avrcryptolib//gf256mul - std=gnu99 -MMD -MP -MF .dep/simpleserial-aes.o.d simpleserial-aes.c -o objdir/simpleserial-aes.o

I’ve tried editing in the right place and also tried adding some extra compiler options in Makefile.inc (https://github.com/newaetech/chipwhisperer/blob/develop/hardware/victims/firmware/Makefile.inc ) , but nothing seems to get through.

I’ve also tried make clean between the tries and I even made a brute force find-and-replace of all places in the project where I could find a definition of F_CPU. But no difference. Also tried restarting computer between tries.

I am a bit suspicious of compiler output showing -DF_CPU=7372800UL , and source code showing F_CPU = 7372800. Does this mean that F_CPU is not defined in Makefile.hal? But when I search all files in the project for 7372800UL, it can’t be found, so where is it defined then?


#2

Nevermind. From some reason, changing the constant sticks now.


#3

Hello,

The system really works best when the clocks are synchronized hence I would suggest to try and get that working.