Hi,
I’m new on CW and after all the installation, I try to uploading the firmware on the target chip.
I use Jupyter to execute CW programs.
I have the last version of Chipwhisperer 5.4 64bits on Windows 10 (I’m on native environment).
I use Chipwhisperer Pro 1200 with a CW308 UFO target and a STM32F1.
I execute the .ipynb “ChipWhisperer Setup Test” and it works well, except for “%%bash …” command, which tell me that the Windows for Linux subsystem has no distributions installed. Using my working computer I can’t install Ubuntu for windows. But instead I use the GitBash to execute all those commands.
Then, my problem is when I want to execute the .ipynb “Connecting to Hardware” :
scope = cw.scope()
target = cw.target(scope, cw.targets.SimpleSerial) #cw.targets.SimpleSerial can be omitted
Serial baud rate = 38400
scope.default_setup()
Then to building and uploading the firmware into STM32F1 :
For the command :
%%bash
cd ../hardware/victims/firmware/simpleserial-base/
make PLATFORM= CRYPTO_TARGET=NONE
I use the Git bash to execute those 2 commands. With PLATFORM = CW308_STM32F1
And it seems to work well :
$ make PLATFORM=CW308_STM32F1 CRYPTO_TARGET=NONE
SS_VER set to SS_VER_1_1
rm -f -- simpleserial-base-CW308_STM32F1.hex
rm -f -- simpleserial-base-CW308_STM32F1.eep
rm -f -- simpleserial-base-CW308_STM32F1.cof
rm -f -- simpleserial-base-CW308_STM32F1.elf
rm -f -- simpleserial-base-CW308_STM32F1.map
rm -f -- simpleserial-base-CW308_STM32F1.sym
rm -f -- simpleserial-base-CW308_STM32F1.lss
rm -f -- objdir/*.o
rm -f -- objdir/*.lst
rm -f -- simpleserial-base.s simpleserial.s stm32f1_hal.s stm32f1_hal_lowlevel.s
rm -f -- simpleserial-base.d simpleserial.d stm32f1_hal.d stm32f1_hal_lowlevel.d
rm -f -- simpleserial-base.i simpleserial.i stm32f1_hal.i stm32f1_hal_lowlevel.i
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
Copyright (C) 2019 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 C: simpleserial-base.c
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -mthumb -mfloat-abi=soft -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER1_1 -DSTM32F100xB -DSTM32F1 -DSTM32 -DDEBUG -DHAL_TYPE=HAL_stm32f1 -DPLATFORM=CW308_STM32F1 -DF_CPU=7372800UL -SS_VER_2_0=2 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstric-prototypes -Wa,-adhlns=objdir/simpleserial-base.lst -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -I.././al/stm32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy -I../.crypto/ -std=gnu99 -MMD -MP -MF .dep/simpleserial-base.o.d simpleserial-base.c -o objdir/simpleserial-base.o
Compiling C: .././simpleserial/simpleserial.c
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -mthumb -mfloat-abi=soft -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER1_1 -DSTM32F100xB -DSTM32F1 -DSTM32 -DDEBUG -DHAL_TYPE=HAL_stm32f1 -DPLATFORM=CW308_STM32F1 -DF_CPU=7372800UL -SS_VER_2_0=2 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstric-prototypes -Wa,-adhlns=objdir/simpleserial.lst -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -I.././hal/sm32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy -I.././crypo/ -std=gnu99 -MMD -MP -MF .dep/simpleserial.o.d .././simpleserial/simpleserial.c -o objdir/simpleserial.o
Compiling C: .././hal/stm32f1/stm32f1_hal.c
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -mthumb -mfloat-abi=soft -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER1_1 -DSTM32F100xB -DSTM32F1 -DSTM32 -DDEBUG -DHAL_TYPE=HAL_stm32f1 -DPLATFORM=CW308_STM32F1 -DF_CPU=7372800UL -SS_VER_2_0=2 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstric-prototypes -Wa,-adhlns=objdir/stm32f1_hal.lst -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -I.././hal/st32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy -I.././crypt/ -std=gnu99 -MMD -MP -MF .dep/stm32f1_hal.o.d .././hal/stm32f1/stm32f1_hal.c -o objdir/stm32f1_hal.o
Compiling C: .././hal/stm32f1/stm32f1_hal_lowlevel.c
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -mthumb -mfloat-abi=soft -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER1_1 -DSTM32F100xB -DSTM32F1 -DSTM32 -DDEBUG -DHAL_TYPE=HAL_stm32f1 -DPLATFORM=CW308_STM32F1 -DF_CPU=7372800UL -SS_VER_2_0=2 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstric-prototypes -Wa,-adhlns=objdir/stm32f1_hal_lowlevel.lst -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -I.../hal/stm32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy -I././crypto/ -std=gnu99 -MMD -MP -MF .dep/stm32f1_hal_lowlevel.o.d .././hal/stm32f1/stm32f1_hal_lowlevel.c -o obdir/stm32f1_hal_lowlevel.o
Assembling: .././hal/stm32f1/stm32f1_startup.S
arm-none-eabi-gcc -c -mcpu=cortex-m3 -I. -x assembler-with-cpp -mthumb -mfloat-abi=soft -ffunction-sections -DFCPU=7372800 -Wa,-gstabs,-adhlns=objdir/stm32f1_startup.lst -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -.././hal/stm32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy I.././crypto/ .././hal/stm32f1/stm32f1_startup.S -o objdir/stm32f1_startup.o
Linking: simpleserial-base-CW308_STM32F1.elf
arm-none-eabi-gcc -mcpu=cortex-m3 -I. -mthumb -mfloat-abi=soft -ffunction-sections -gdwarf-2 -DSS_VER=SS_VER_1_ -DSTM32F100xB -DSTM32F1 -DSTM32 -DDEBUG -DHAL_TYPE=HAL_stm32f1 -DPLATFORM=CW308_STM32F1 -DF_CPU=7372800UL -DSSVER_2_0=2 -DSS_VER_1_1=1 -DSS_VER_1_0=0 -Os -funsigned-char -funsigned-bitfields -fshort-enums -Wall -Wstrict-pototypes -Wa,-adhlns=objdir/simpleserial-base.o -I.././simpleserial/ -I.././hal -I.././hal/stm32f1 -I.././hal/sm32f1/CMSIS -I.././hal/stm32f1/CMSIS/core -I.././hal/stm32f1/CMSIS/device -I.././hal/stm32f1/Legacy -I.././crypo/ -std=gnu99 -MMD -MP -MF .dep/simpleserial-base-CW308_STM32F1.elf.d objdir/simpleserial-base.o objdir/simpleerial.o objdir/stm32f1_hal.o objdir/stm32f1_hal_lowlevel.o objdir/stm32f1_startup.o --output simpleserial-base-W308_STM32F1.elf --specs=nano.specs -T .././hal/stm32f1/LinkerScript.ld -Wl,--gc-sections -lm -mthumb -mcpu=corex-m3 -Wl,-Map=simpleserial-base-CW308_STM32F1.map,--cref -lm
Creating load file for Flash: simpleserial-base-CW308_STM32F1.hex
arm-none-eabi-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base-CW308_STM32F1.elf sipleserial-base-CW308_STM32F1.hex
Creating load file for EEPROM: simpleserial-base-CW308_STM32F1.eep
arm-none-eabi-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex simpleserial-base-CW308_STM32F1.elf simpleserial-bae-CW308_STM32F1.eep || exit 0
Creating Extended Listing: simpleserial-base-CW308_STM32F1.lss
arm-none-eabi-objdump -h -S -z simpleserial-base-CW308_STM32F1.elf > simpleserial-base-CW308_STM32F1.lss
Creating Symbol Table: simpleserial-base-CW308_STM32F1.sym
arm-none-eabi-nm -n simpleserial-base-CW308_STM32F1.elf > simpleserial-base-CW308_STM32F1.sym
Size after:
text data bss dec hex filename
4088 8 1320 5416 1528 simpleserial-base-CW308_STM32F1.elf
+--------------------------------------------------------
+ Default target does full rebuild each time.
+ Specify buildtarget == allquick == to avoid full rebuild
+--------------------------------------------------------
+--------------------------------------------------------
+ Built for platform CW308T: STM32F1 Target with:
+ CRYPTO_TARGET = NONE
+ CRYPTO_OPTIONS = AES128C
+--------------------------------------------------------
Then, back to the « ConnectingtoHardware.ipynb » I execute the command :
cw.program_target(scope, cw.programmers.STM32FProgrammer, “C:\ChipWhisperer5_64\chipwhisperer\hardware\victims\firmware\simpleserial-base\simpleserial-base-CW308_STM32F1.hex”)
And I have this error :
Serial baud rate = 115200
Serial baud rate = 38400
Failed to detect chip. Check following:
1. Connections and device power.
2. Device has valid clock (or remove clock entirely for internal osc).
3. On Rev -02 CW308T-STM32Fx boards, BOOT0 is routed to PDIC.
**---------------------------------------------------------------------------**
**OSError** Traceback (most recent call last)
**<ipython-input-38-e3b50e145d7a>** in <module>
1 **#cw.program_target(scope, cw.programmers.XMEGAProgrammer, "path/to/firmware.hex")**
**----> 2** cw **.** program_target **(** scope **,** cw **.** programmers **.** STM32FProgrammer **,** **"C:\ChipWhisperer5_64\chipwhisperer\hardware\victims\firmware\simpleserial-base\simpleserial-base-CW308_STM32F1.hex"** **)**
3 **#cw.program_target(scope, cw.programmers.AVRProgrammer, "path/to/firmware.hex")**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\__init__.py** in program_target **(scope, prog_type, fw_path, **kwargs)**
60 prog **.** _logging **=** **None**
61 prog **.** open **()**
**---> 62** prog **.** find **()**
63 prog **.** erase **()**
64 prog **.** program **(** fw_path **,** memtype **=** **"flash"** **,** verify **=** **True** **)**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\capture\api\programmers.py** in func_wrapper **(self, *args, **kwargs)**
68 self **.** scope **.** io **.** nrst **=** **'high_z'**
69 **try** **:**
**---> 70** val **=** func **(** self **,** ***** args **,** ****** kwargs **)**
71 **finally** **:**
72 logging **.** debug **(** **'Restoring pdic, pdid, and nrst pin configuration'** **)**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\capture\api\programmers.py** in find **(self)**
301 stm32f **=** self **.** stm32prog **()**
302 stm32f **.** scope **=** self **.** scope
**--> 303** sig **,** chip **=** stm32f **.** find **()**
304
305 **# logging is done at the lower level**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py** in func_wrapper **(self, *args, **kwargs)**
35 **def** func_wrapper **(** self **,** ***** args **,** ****** kwargs **):**
36 **try** **:**
**---> 37** **return** func **(** self **,** ***** args **,** ****** kwargs **)**
38 **except** **:**
39 self **.** close_port **()**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py** in find **(self, logfunc)**
171
172 **try** **:**
**--> 173** self **.** initChip **()**
174 **except** IOError **:**
175 logfunc **(** **"Failed to detect chip. Check following: "** **)**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py** in func_wrapper **(self, *args, **kwargs)**
35 **def** func_wrapper **(** self **,** ***** args **,** ****** kwargs **):**
36 **try** **:**
**---> 37** **return** func **(** self **,** ***** args **,** ****** kwargs **)**
38 **except** **:**
39 self **.** close_port **()**
**c:\chipwhisperer5_64\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py** in initChip **(self)**
350
351 self **.** releaseChip **()**
**--> 352** **raise** IOError **(** **"Could not detect STM32F, check connections, BOOT MODE entry setup"** **)**
353
354 **@** close_on_fail
**OSError** : Could not detect STM32F, check connections, BOOT MODE entry setup
I try to update the firmware board with the API.
I already try those topics to fixes but with no success :
Os error : could not detect STM32f
CW1200 Pro Erasing STM32F4 error
I’m asking if the LED1,2 and 3 should be on ?
Why there is 2 baud rate value ?
Serial baud rate = 115200
Serial baud rate = 38400
I’m rather a beginner on embedded device, so maybe I’ve missed something easy.
Thanks in advance for your answer.
Regards,
Mathieu