Setting up firmware for STM32F3

Hi,

I am trying to set up the CW-Lite 2 part with a STM32F target for the fault 2_1 Voltage glitching lab, but i am experiencing som issues. I get the following error message (See below). Does anyone know how to resolve this?

SS_VER set to SS_VER_2_1
SS_VER set to SS_VER_2_1
SS_VER set to SS_VER_2_1
SS_VER set to SS_VER_2_1
gmake[1]: ‘.dep’ is up to date.
SS_VER set to SS_VER_2_1
SS_VER set to SS_VER_2_1
.
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (Arm GNU Toolchain 12.2 (Build arm-12-mpacbti.34)) 12.2.1 20230214
Copyright (C) 2022 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.

.
Assembling: …/./hal/stm32f3/stm32f3_startup.S
arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -fmessage-length=0 -ffunction-sections -DF_CPU=7372800 -Wa,-gstabs,-adhlns=objdir-CW308_STM32F3/stm32f3_startup.lst -I…/./simpleserial/ -I…/./simpleserial/ -I…/./hal -I…/./hal/stm32f3 -I…/./hal/stm32f3/CMSIS -I…/./hal/stm32f3/CMSIS/core -I…/./hal/stm32f3/CMSIS/device -I…/./hal/stm32f4/Legacy -I…/./crypto/ …/./hal/stm32f3/stm32f3_startup.S -o objdir-CW308_STM32F3/stm32f3_startup.o
.
Compiling:
-en …/./hal/stm32f3/stm32f3_sysmem.c …
…/./hal/stm32f3/stm32f3_sysmem.c:63:1: error: unknown type name ‘caddr_t’
63 | caddr_t _sbrk(int incr)
| ^~~~~~~
…/./hal/stm32f3/stm32f3_sysmem.c: In function ‘_sbrk’:
…/./hal/stm32f3/stm32f3_sysmem.c:76:25: error: ‘caddr_t’ undeclared (first use in this function)
76 | return (caddr_t) -1;
| ^~~~~~~
…/./hal/stm32f3/stm32f3_sysmem.c:76:25: note: each undeclared identifier is reported only once for each function it appears in
…/./hal/stm32f3/stm32f3_sysmem.c:81:25: error: expected ‘;’ before ‘prev_heap_end’
81 | return (caddr_t) prev_heap_end;
| ^~~~~~~~~~~~~~
| ;
…/./hal/stm32f3/stm32f3_sysmem.c:67:15: warning: variable ‘prev_heap_end’ set but not used [-Wunused-but-set-variable]
67 | char *prev_heap_end;
| ^~~~~~~~~~~~~
…/./hal/stm32f3/stm32f3_sysmem.c:82:1: warning: control reaches end of non-void function [-Wreturn-type]
82 | }
| ^
gmake[1]: *** […/./Makefile.inc:495: objdir-CW308_STM32F3/stm32f3_sysmem.o] Error 1
gmake[1]: *** Waiting for unfinished jobs…
.
Compiling:
-en simpleserial-glitch.c …
-e Done!
.
Compiling:
-en …/./hal/stm32f3/stm32f3_hal.c …
-e Done!
.
Compiling:
-en …/./simpleserial/simpleserial.c …
-e Done!
.
Compiling:
-en …/./hal/stm32f3/stm32f3_hal_lowlevel.c …
-e Done!
gmake: *** […/./Makefile.inc:338: all] Error 2

CalledProcessError Traceback (most recent call last)
Cell In[9], line 1
----> 1 get_ipython().run_cell_magic(‘bash’, ‘-s “$PLATFORM” “$SS_VER”’, ‘cd /Users/Thomas/Downloads/chipwhisperer-5.7.0/hardware/victims/firmware/simpleserial-glitch\ngmake PLATFORM=$1 CRYPTO_TARGET=NONE SS_VER=$2 -j\n’)

File ~/.pyenv/versions/3.9.5/lib/python3.9/site-packages/IPython/core/interactiveshell.py:2478, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2476 with self.builtin_trap:
2477 args = (magic_arg_s, cell)
→ 2478 result = fn(*args, **kwargs)
2480 # The code below prevents the output from being displayed
2481 # when using magics with decodator @output_can_be_silenced
2482 # when the last Python token in the expression is a ‘;’.
2483 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File ~/.pyenv/versions/3.9.5/lib/python3.9/site-packages/IPython/core/magics/script.py:154, in ScriptMagics._make_script_magic..named_script_magic(line, cell)
152 else:
153 line = script
→ 154 return self.shebang(line, cell)

File ~/.pyenv/versions/3.9.5/lib/python3.9/site-packages/IPython/core/magics/script.py:314, in ScriptMagics.shebang(self, line, cell)
309 if args.raise_error and p.returncode != 0:
310 # If we get here and p.returncode is still None, we must have
311 # killed it but not yet seen its return code. We don’t wait for it,
312 # in case it’s stuck in uninterruptible sleep. -9 = SIGKILL
313 rc = p.returncode or -9
→ 314 raise CalledProcessError(rc, cell)

CalledProcessError: Command ‘b’cd /Users/Thomas/Downloads/chipwhisperer-5.7.0/hardware/victims/firmware/simpleserial-glitch\ngmake PLATFORM=$1 CRYPTO_TARGET=NONE SS_VER=$2 -j\n’’ returned non-zero exit status 2.

Hi,

caddr_t seems to not be present on some versions of arm-none-eabi-gcc. We’ve removed it from the code in an earlier commit, so if you update ChipWhisperer via git, it should fix your error.

Alex

This solved it. Thank you:)