Hi everyone.
I got some troubles when I use CW305 and CWlite.
- There is
KeyError: 'flash'
during running jupyter/archive/PA_Intro_1-Firmware_Build_Setup.
Also had the same problem during running jupyter/archive/Fault_1-Introduction_to_Clock_Glitch_Attacks.
Below is part of the code:
SCOPETYPE = 'OPENADC'
PLATFORM = 'CWLITEXMEGA'
cw.program_target(scope, prog, fw_path)
KeyError Traceback (most recent call last)
<ipython-input-16-b876eeece5c0> in <module>
----> 1 cw.program_target(scope, prog, fw_path)
c:\users\user\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\__init__.py in program_target(scope, prog_type, fw_path, **kwargs)
64 prog.find()
65 prog.erase()
---> 66 prog.program(fw_path, memtype="flash", verify=True)
67 prog.close()
68 except:
c:\users\user\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\api\programmers.py in func_wrapper(self, *args, **kwargs)
69 self.scope.io.nrst = 'high_z'
70 try:
---> 71 val = func(self, *args, **kwargs)
72 finally:
73 target_logger.debug('Restoring pdic, pdid, and nrst pin configuration')
c:\users\user\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\api\programmers.py in program(self, filename, memtype, verify)
255 Programmer.lastFlashedFile = filename
256 xmega = self.xmegaprog()
--> 257 xmega.program(filename, memtype, verify)
258
259 @save_and_restore_pins
c:\users\user\chipwh~1\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_xmega.py in program(self, filename, memtype, verify, logfunc, waitfunc)
257 fdata, fsize = FileReader(filename)
258
--> 259 startaddr = self._chip.memtypes[memtype]["offset"]
260 maxsize = self._chip.memtypes[memtype]["size"]
261
KeyError: 'flash'
The error may not be due to the wiring.
Just in case, my hardware device is as shown below.
- Someone had asked related questions (Key_error “flash”), but it didn’t work (skipping the program_target()).
ktp = cw.ktp.Basic() # object to generate fixed/random key and text (default fixed key, random text)
key, text = ktp.next() # get our fixed key and random text
target.simpleserial_write('k', key)
target.simpleserial_wait_ack()
scope.arm()
target.simpleserial_write('p', text)
ret = scope.capture()
trace = scope.get_last_trace()
output = target.simpleserial_read('r', 16)
from binascii import hexlify
print(hexlify(output))
print(hexlify(text))
ERROR:ChipWhisperer Target:Ack error:
WARNING:ChipWhisperer Scope:Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid. Status: 0b
WARNING:ChipWhisperer Scope:Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid. Status: 0a
WARNING:ChipWhisperer Target:Unexpected start to command:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-33-e3e540d26394> in <module>
13
14 from binascii import hexlify
---> 15 print(hexlify(output))
16 print(hexlify(text))
TypeError: a bytes-like object is required, not 'NoneType'
All the best,
Astrid.