Chipwhisperer build firmware error

Hi,ereryone, When I was learning Lab 4_3 - ChipWhisperer Analyzer CPA Attack in SCA101 there was a problem,So I need help here, thank you
0FD9C965
.
My settings are as follows:


The output of the run is as follows:
INFO: Found ChipWhisperer😍
Building for platform LATFORM with CRYPTO_TARGET=RYPTO_TARGET
SS_VER set to SS_VER_1_1
…/./hal/Makefile.hal:234: *** Invalid or empty PLATFORM: LATFORM. Known platforms:
±------------------------------------------------------+
| PLATFORM | DESCRIPTION |
+=======================================================+
| AVR/XMEGA Targets (8-Bit RISC) |
+=======================================================+
±------------------------------------------------------+
| CWLITEXMEGA | CW-Lite XMEGA (Alias for CW303) |
±------------------------------------------------------+
| CW301_AVR | Multi-Target Board, AVR Target |
±------------------------------------------------------+
| CW303 | XMEGA Target (CWLite), Also works |
| | for CW308T-XMEGA |
±------------------------------------------------------+
| CW304 | ATMega328P (NOTDUINO), Also works |
| | for CW308T-AVR |
±------------------------------------------------------+
| CW308_MEGARF | ATMega2564RFR2 Target for CW308T |
±------------------------------------------------------+
+=======================================================+

  • ARM Cortex-M Targets (Generic) |
    +=======================================================+
    ±------------------------------------------------------+
    | CWLITEARM | CW-Lite Arm (Alias for CW308_STM32F3) |
    ±------------------------------------------------------+
    | CWNANO | CW-Lite Nano (STM32F0_NANO) |
    ±------------------------------------------------------+
    | CW308_STM32F0 | CW308T-STM32F0 (ST Micro STM32F0) |
    ±------------------------------------------------------+
    | CW308_STM32F1 | CW308T-STM32F0 (ST Micro STM32F1) |
    ±------------------------------------------------------+
    | CW308_STM32F2 | CW308T-STM32F2 (ST Micro STM32F2) |
    ±------------------------------------------------------+
    | CW308_STM32F3 | CW308T-STM32F3 (ST Micro STM32F3) |
    ±------------------------------------------------------+
    | CW308_STM32F4 | CW308T-STM32F4 (ST Micro STM32F405) |
    ±------------------------------------------------------+
    +=======================================================+
  • ARM Cortex-M Targets (Support CRYPTO_TARGET=HWAES) |
    +=======================================================+
    ±------------------------------------------------------+
    | CW308_CC2538 | CW308T-CC2538 (TI CC2538) |
    ±------------------------------------------------------+
    | CW308_ | CW308T-EFM32GG11 |
    | EFM32GG11 | (Silicon Labs Giant Gecko) |
    ±------------------------------------------------------+
    | CW308_ | CW-Lite EFM32TG11B |
    | EFM32TG11B | (Silicon Labs Tiny Geko) |
    ±------------------------------------------------------+
    | CW308_ | CW308T-EFR32MG21 (A version without |
    | EFR32MG21A | ‘secure vault’) |
    ±------------------------------------------------------+
    | CW308_ | CW308T-IMXRT1062 (iMX RT1062) |
    | IMXRT1062 | NXP “Cross-Over” Microcontroller |
    ±------------------------------------------------------+
    | CW308_K24F | CW308T-K24F (NXP Kinetis K24F) |
    ±------------------------------------------------------+
    | CW308_K82F | CW308T-K82F (NXP Kinetis K82F) |
    ±------------------------------------------------------+
    | CW308_LPC55S6X| CW308T-LPC55S69 (NXP LPC55S69) |
    ±------------------------------------------------------+
    | CW308_NRF52 | CW308T-NRF52840 (Nordic Semi) |
    ±------------------------------------------------------+
    | CW308_PSOC62 | CW308T-PSOC62 (Cypress PSOC 62) |
    ±------------------------------------------------------+
    | CW308_SAM4L | CW308T-SAM4L (Atmel SAM4L) |
    ±------------------------------------------------------+
    | CW308_SAML11 | CW-Lite SAML11 (Atmel SAML11) |
    ±------------------------------------------------------+
    | CW308_STM32F2 | CW308T-STM32F2HWC (ST Micro STM32F215)|
    ±------------------------------------------------------+
    | CW308_STM32F4 | CW308T-STM32F4HWC (ST Micro STM32F415)|
    ±------------------------------------------------------+
    | CW308_STM32L4 | CW308T-STM32L4 (ST Micro STM32L443) |
    ±------------------------------------------------------+
    | CW308_STM32L5 | CW308T-STM32L5HWC (ST Micro STM32L562)|
    ±------------------------------------------------------+
    +=======================================================+
  • Other 32-bit Architecture |
    +=======================================================+
    ±------------------------------------------------------+
    | CW308_AURIX | CW-Lite AURIX (Infineon TC233A) |
    ±------------------------------------------------------+
    | CW308_FE310 | CW308T-FE310-G002 (RISC-V) |
    ±------------------------------------------------------+
    | CW308_ | CW308T-MPC5676R (NXP MPC5676R) |
    | MPC5676R | |
    ±--------------|---------------------------------------+

Options to define platform:
(1) Run make with PLATFORM specified as follows:
make PLATFORM=CW304

(2) Save a file called Makefile.platform with contents:
PLATFORM=CW304
. Stop.

CalledProcessError Traceback (most recent call last)
~\chipwhisperer\jupyter\courses\sca101\Lab 4_3 - ChipWhisperer Analyzer CPA Attack (HARDWARE).ipynb in
----> 1 get_ipython().run_cell_magic(‘bash’, ‘-s “$PLATFORM” “$CRYPTO_TARGET” “$SET_KEY”’, ‘cd …/…/…/hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2\n’)

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2401 with self.builtin_trap:
2402 args = (magic_arg_s, cell)
→ 2403 result = fn(*args, **kwargs)
2404 return result
2405

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magics\script.py in named_script_magic(line, cell)
140 else:
141 line = script
→ 142 return self.shebang(line, cell)
143
144 # write a basic docstring:

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
→ 232 return caller(func, *(extras + args), **kw)
233 fun.name = func.name
234 fun.doc = func.doc

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magic.py in (f, *a, **k)
185 # but it’s overkill for just that one bit of state.
186 def magic_deco(arg):
→ 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magics\script.py in shebang(self, line, cell)
243 sys.stderr.flush()
244 if args.raise_error and p.returncode!=0:
→ 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
246
247 def _run_script(self, p, cell, to_close):

CalledProcessError: Command ‘b’cd …/…/…/hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2\n’’ returned non-zero exit status 2.


CalledProcessError Traceback (most recent call last)
C:\Users\MB\AppData\Local\Temp/ipykernel_23276/2276307429.py in
1 if VERSION == ‘HARDWARE’:
----> 2 get_ipython().run_line_magic(‘run’, ‘“Lab 4_3 - ChipWhisperer Analyzer CPA Attack (HARDWARE).ipynb”’)
3 elif VERSION == ‘SIMULATED’:
4 get_ipython().run_line_magic(‘run’, ‘“Lab 4_2 - CPA on Firmware Implementation of AES (SIMULATED).ipynb”’)

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2346 kwargs[‘local_ns’] = self.get_local_scope(stack_depth)
2347 with self.builtin_trap:
→ 2348 result = fn(*args, **kwargs)
2349 return result
2350

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
→ 232 return caller(func, *(extras + args), **kw)
233 fun.name = func.name
234 fun.doc = func.doc

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magic.py in (f, *a, **k)
185 # but it’s overkill for just that one bit of state.
186 def magic_deco(arg):
→ 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magics\execution.py in run(self, parameter_s, runner, file_finder)
722 with preserve_keys(self.shell.user_ns, ‘file’):
723 self.shell.user_ns[‘file’] = filename
→ 724 self.shell.safe_execfile_ipy(filename, raise_exceptions=True)
725 return
726

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in safe_execfile_ipy(self, fname, shell_futures, raise_exceptions)
2833 result = self.run_cell(cell, silent=True, shell_futures=shell_futures)
2834 if raise_exceptions:
→ 2835 result.raise_error()
2836 elif not result.success:
2837 break

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in raise_error(self)
329 raise self.error_before_exec
330 if self.error_in_exec is not None:
→ 331 raise self.error_in_exec
332
333 def repr(self):

[... skipping hidden 1 frame]

C:\Users\MB\AppData\Local\Temp/ipykernel_23276/1100948782.py in
----> 1 get_ipython().run_cell_magic(‘bash’, ‘-s “$PLATFORM” “$CRYPTO_TARGET” “$SET_KEY”’, ‘cd …/…/…/hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2\n’)

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2401 with self.builtin_trap:
2402 args = (magic_arg_s, cell)
→ 2403 result = fn(*args, **kwargs)
2404 return result
2405

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magics\script.py in named_script_magic(line, cell)
140 else:
141 line = script
→ 142 return self.shebang(line, cell)
143
144 # write a basic docstring:

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
→ 232 return caller(func, *(extras + args), **kw)
233 fun.name = func.name
234 fun.doc = func.doc

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magic.py in (f, *a, **k)
185 # but it’s overkill for just that one bit of state.
186 def magic_deco(arg):
→ 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):

~\WPy64-3771\python-3.7.7.amd64\lib\site-packages\IPython\core\magics\script.py in shebang(self, line, cell)
243 sys.stderr.flush()
244 if args.raise_error and p.returncode!=0:
→ 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
246
247 def _run_script(self, p, cell, to_close):

CalledProcessError: Command ‘b’cd …/…/…/hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2\n’’ returned non-zero exit status 2.

You seem to have corrupted some of your notebook cells and inserted typos which are leading to these errors. Revert your changes and things should work better.
Jean-Pierre

Hello. Tell me why I can’t compile the project for attacking STM32F215? I launch the project for compilation

SCOPETYPE = 'OPENADC'
PLATFORM = 'CW308_STM32F2'
CRYPTO_TARGET = 'HWAES'
%%bash -s "$PLATFORM" "$CRYPTO_TARGET" "$SS_VER"
cd ../../../hardware/victims/firmware/simpleserial-aes
make PLATFORM=$1 CRYPTO_TARGET=$2 SS_VER=$3

The log during compilation looks like this:

Building for platform CW308_STM32F2 with CRYPTO_TARGET=HWAES
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
Blank crypto options, building for AES128
Building for platform CW308_STM32F2 with CRYPTO_TARGET=HWAES
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
Blank crypto options, building for AES128
make[1]: '.dep' is up to date.
Building for platform CW308_STM32F2 with CRYPTO_TARGET=HWAES
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
Blank crypto options, building for AES128
.
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.
Compiling:
    simpleserial-aes.c ...Done!
.
Compiling:
    .././simpleserial/simpleserial.c ...Done!
.
Compiling:
    .././hal/stm32f2/stm32f2_hal.c ...Done!
.
Compiling:
    .././hal/stm32f2/stm32f2_hal_lowlevel.c ...Done!
.
Compiling:
    .././hal/stm32f2/stm32f2_sysmem.c ...Done!
.
Compiling:
    .././crypto/aes-independant.c ...Done!
.
Assembling: .././hal/stm32f2/stm32f2_startup.S
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections -DF_CPU=7372800 -Wa,-gstabs,-adhlns=objdir-CW308_STM32F2/stm32f2_startup.lst -I.././simpleserial/ -I.././simpleserial/ -I.././hal -I.././hal/stm32f2 -I.././hal/stm32f2/CMSIS -I.././hal/stm32f2/CMSIS/core -I.././hal/stm32f2/CMSIS/device -I.././hal/stm32f2/Legacy -I.././crypto/ .././hal/stm32f2/stm32f2_startup.S -o objdir-CW308_STM32F2/stm32f2_startup.o
.
LINKING:
b:/chipwhisperer5_70_v2/cw/home/portable/armgcc/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: objdir-CW308_STM32F2/aes-independant.o: in function `aes_indep_init':
B:\ChipWhisperer5_70_V2\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes/.././crypto/aes-independant.c:26: undefined reference to `HW_AES128_Init'
b:/chipwhisperer5_70_v2/cw/home/portable/armgcc/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: objdir-CW308_STM32F2/aes-independant.o: in function `aes_indep_key':
B:\ChipWhisperer5_70_V2\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes/.././crypto/aes-independant.c:31: undefined reference to `HW_AES128_LoadKey'
b:/chipwhisperer5_70_v2/cw/home/portable/armgcc/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: objdir-CW308_STM32F2/aes-independant.o: in function `aes_indep_enc_pretrigger':
B:\ChipWhisperer5_70_V2\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes/.././crypto/aes-independant.c:36: undefined reference to `HW_AES128_Enc_pretrigger'
b:/chipwhisperer5_70_v2/cw/home/portable/armgcc/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: objdir-CW308_STM32F2/aes-independant.o: in function `aes_indep_enc_posttrigger':
B:\ChipWhisperer5_70_V2\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes/.././crypto/aes-independant.c:41: undefined reference to `HW_AES128_Enc_posttrigger'
b:/chipwhisperer5_70_v2/cw/home/portable/armgcc/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: objdir-CW308_STM32F2/aes-independant.o: in function `aes_indep_enc':
B:\ChipWhisperer5_70_V2\cw\home\portable\chipwhisperer\hardware\victims\firmware\simpleserial-aes/.././crypto/aes-independant.c:46: undefined reference to `HW_AES128_Enc'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [.././Makefile.inc:486: simpleserial-aes-CW308_STM32F2.elf] Error 1
make: *** [.././Makefile.inc:338: all] Error 2
    simpleserial-aes-CW308_STM32F2.elf ...
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[13], line 1
----> 1 get_ipython().run_cell_magic('bash', '-s "$PLATFORM" "$CRYPTO_TARGET" "$SS_VER"', 'cd ../../../hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2 SS_VER=$3\n')

File B:\ChipWhisperer5_70_V2\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\interactiveshell.py:2422, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2420 with self.builtin_trap:
   2421     args = (magic_arg_s, cell)
-> 2422     result = fn(*args, **kwargs)
   2423 return result

File B:\ChipWhisperer5_70_V2\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\magics\script.py:153, in ScriptMagics._make_script_magic.<locals>.named_script_magic(line, cell)
    151 else:
    152     line = script
--> 153 return self.shebang(line, cell)

File B:\ChipWhisperer5_70_V2\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\IPython\core\magics\script.py:305, in ScriptMagics.shebang(self, line, cell)
    300 if args.raise_error and p.returncode != 0:
    301     # If we get here and p.returncode is still None, we must have
    302     # killed it but not yet seen its return code. We don't wait for it,
    303     # in case it's stuck in uninterruptible sleep. -9 = SIGKILL
    304     rc = p.returncode or -9
--> 305     raise CalledProcessError(rc, cell)

CalledProcessError: Command 'b'cd ../../../hardware/victims/firmware/simpleserial-aes\nmake PLATFORM=$1 CRYPTO_TARGET=$2 SS_VER=$3\n'' returned non-zero exit status 2.

Do I understand correctly that in the near future we should not expect the addition of code for compilation on the hardware version of the STM32F215 microcontroller?

You probably just need to copy the crypto functions from stm32f4_hal.c over to stm32f2_hal.c. It should be pretty quick, but I’ll need to test before pushing.