Linking failed while building firmware on Mac M3

I just got started with CW and have a CW Husky. I’m trying to do the Connecting to Hardware Jupyter notebook. In the building Firmware, when I do

make PLATFORM=CW308_SAM4S CRYPTO_TARGET=NONE

and got the following error:

LINKING:
-en     simpleserial-base-CW308_SAM4S.elf ...
arm-none-eabi-gcc: fatal error: /Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/lib/nano.specs: attempt to rename spec 'link' to already defined spec 'nano_link'
compilation terminated.

Hi,

Can you try removing -specs=nano.specs from chipwhisperer/hardware/victims/firmware/hal/sam4s/Makefile.sam4s?

1 Like

Hi,
I removed both -specs=nano.specs and -specs=nosys.specs from

LDFLAGS += -specs=nano.specs -specs=nosys.specs -T $(HALPATH)/sam4s/flash_sam4s.ld -Wl,--gc-sections -lm

then I got the following error

LINKING:
-en     simpleserial-base-CW308_SAM4S.elf ...
/Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: error: linker script file '.././hal/sam4s/flash_sam4s.ld' appears multiple times

Weird, it seems like things are being called or included multiple times? Can you try building with make VERBOSE=true and posting the resulting text?

Sorry, here is what I got

SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
make[1]: '.dep' is up to date.
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
.
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.1 20231009
Copyright (C) 2023 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:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/simpleserial-base.lst -MMD -MP -MF .dep/simpleserial-base.o.d simpleserial-base.c -o objdir-CW308_SAM4S/simpleserial-base.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/simpleserial.lst -MMD -MP -MF .dep/simpleserial.o.d .././simpleserial/simpleserial.c -o objdir-CW308_SAM4S/simpleserial.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/startup_sam4s.lst -MMD -MP -MF .dep/startup_sam4s.o.d .././hal/sam4s/startup_sam4s.c -o objdir-CW308_SAM4S/startup_sam4s.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/sam4s_hal.lst -MMD -MP -MF .dep/sam4s_hal.o.d .././hal/sam4s/sam4s_hal.c -o objdir-CW308_SAM4S/sam4s_hal.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/uart.lst -MMD -MP -MF .dep/uart.o.d .././hal/sam4s/uart.c -o objdir-CW308_SAM4S/uart.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/pio.lst -MMD -MP -MF .dep/pio.o.d .././hal/sam4s/pio.c -o objdir-CW308_SAM4S/pio.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/system_sam4s.lst -MMD -MP -MF .dep/system_sam4s.o.d .././hal/sam4s/system_sam4s.c -o objdir-CW308_SAM4S/system_sam4s.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/sysclk.lst -MMD -MP -MF .dep/sysclk.o.d .././hal/sam4s/sysclk.c -o objdir-CW308_SAM4S/sysclk.o ...
-e Done!

.
Compiling:
-en     arm-none-eabi-gcc -c -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/pmc.lst -MMD -MP -MF .dep/pmc.o.d .././hal/sam4s/pmc.c -o objdir-CW308_SAM4S/pmc.o ...
-e Done!

.
LINKING:
-en     arm-none-eabi-gcc simpleserial-base-CW308_SAM4S.elf w/ opts -mcpu=cortex-m4 -I. -I/usr/local/include/gmp.h -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns= -fdata-sections -ffunction-sections -mthumb -mlong-calls -mfloat-abi=soft -fdata-sections -ffunction-sections -mlong-calls -g3 -Wall -pipe  -fno-strict-aliasing -Wall -Wstrict-prototypes -Wmissing-prototypes -Wchar-subscripts  -Wcomment -Wformat=2 --param max-inline-insns-single=500 -DDEBUG -DARM_MATH_CM3=true -Dprintf=iprintf -Dscanf=iscanf -DPLATFORMCW1190=1 -funsigned-char -funsigned-bitfields -fshort-enums -D__SAM4S2B__ -DUDD_NO_SLEEP_MGR -gdwarf-2 -DSS_VER=SS_VER_1_1 -DHAL_TYPE=HAL_sam4s -DPLATFORM=CW308_SAM4S -DSS_VER=SS_VER_1_1 -DF_CPU=7372800UL -DSS_VER_2_0=2 -DSS_VER_2_1=3 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-prototypes -I.././simpleserial/ -I.././hal -I.././hal/sam4s -I.././hal/sam4s/inc -I.././simpleserial/ -I.././crypto/ -std=gnu99 -Wno-discarded-qualifiers -Wno-unused-function -Wno-unused-variable -Wno-strict-prototypes -Wno-missing-prototypes -Wno-pointer-sign -Wno-unused-value -Wno-implicit-function-declaration  -Wa,-adhlns=objdir-CW308_SAM4S/simpleserial-base.o -MMD -MP -MF .dep/simpleserial-base-CW308_SAM4S.elf.d -L/usr/local/lib -L/usr/local/opt/openssl/lib -T .././hal/sam4s/flash_sam4s.ld -Wl,--gc-sections -lm -Wl,-Map=simpleserial-base.map,--cref   -lm   -mthumb -Wl,--start-group -L naeusb -lm -Wl,--end-group    -Wl,--gc-sections  -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -Wl,-Map=simpleserial-base-CW308_SAM4S.map,--cref   -lm   -T .././hal/sam4s/flash_sam4s.ld -Wl,--gc-sections -lm -Wl,-Map=simpleserial-base.map,--cref   -lm   -mthumb -Wl,--start-group -L naeusb -lm -Wl,--end-group    -Wl,--gc-sections  -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -Wl,-Map=simpleserial-base-CW308_SAM4S.map,--cref   -lm   ... objdir-CW308_SAM4S/simpleserial-base.o objdir-CW308_SAM4S/simpleserial.o objdir-CW308_SAM4S/startup_sam4s.o objdir-CW308_SAM4S/sam4s_hal.o objdir-CW308_SAM4S/uart.o objdir-CW308_SAM4S/pio.o objdir-CW308_SAM4S/system_sam4s.o objdir-CW308_SAM4S/sysclk.o objdir-CW308_SAM4S/pmc.o
/Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: error: linker script file '.././hal/sam4s/flash_sam4s.ld' appears multiple times
collect2: error: ld returned 1 exit status
make[1]: *** [.././Makefile.inc:498: simpleserial-base-CW308_SAM4S.elf] Error 1
make: *** [.././Makefile.inc:350: all] Error 2

I just pushed a new commit to chipwhisperer. Can you try building after pulling that commit?

1 Like

Just to be sure, I pulled and got

hardware/victims/firmware/Makefile.inc | 10 +++++-----

then built but still got the same error

/Applications/ArmGNUToolchain/13.2.Rel1/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: error: linker script file '.././hal/sam4s/flash_sam4s.ld' appears multiple times
collect2: error: ld returned 1 exit status

Can you run make --version and post that?

Yes

GNU Make 4.4.1
Built for aarch64-apple-darwin23.0.0

The latest I’ve tested was 4.3, so my guess is there’s some breaking change between that version and your version. I’ve pushed another commit. Can you try that one?

1 Like

It worked!! Thank you very much :smile:

Thank you so much for your help!
I have another question. When I run

cw.program_target(scope, cw.programmers.SAM4SProgrammer, "../hardware/victims/firmware/simpleserial-base/simpleserial-base-CW308_SAM4S.hex")

it does not always work. Sometimes I get the warning

(ChipWhisperer Target WARNING|File programmers.py:214) Boot flash not set, target may require power cycle

It works sometimes to restart the Jupyter kernel and unplug the usb then plug it in again. But it does not always work. Does this problem have something to do with the USB and is there a way to reset the USB from the terminal?

No, IIRC this is an issue with the SAM4S bootrom. You may need to power cycle the target (scope.io.target_pwr = 0, wait then scope.io.target_pwr = 1) to get it to reboot.

I did scope.io.target_pwr = 0 , wait then scope.io.target_pwr = 1, but it didn’t seem to help.

In Lab 2_1A - Instruction Power Differences (MAIN), there is also

if PLATFORM == "CW308_SAM4S" or PLATFORM == "CWHUSKY":
    scope.io.target_pwr = 0
    time.sleep(0.2)
    scope.io.target_pwr = 1
    time.sleep(0.2)

before

cw.program_target(scope, prog, "../../../hardware/victims/firmware/simpleserial-base-lab2/simpleserial-base-{}.hex".format(PLATFORM))

but it still returns Boot flash not set, target may require power cycle

It works, I just need to rerun the program_target command a couple of times.