Setup / Husky -- multiple errors in jupyter notebooks

Continuing the discussion from ChipWhisperer Setup :Javascript Error: IPython is not defined.

Configuration:

  • Ubuntu 24.04.4 LTS
    • under WSL2 under Windows 11
    • with networkingMode=mirrored in .wslconfig
    • successfully using USBIPD to redirect CWHuskyPlus
  • CW repo at commit `7b3206b0`
  • CW/jupyter repo at commit `fe7e2aa1`
  • Followed installation instructions

From here, I’ll post multiple issues as linked threads.

Hit discourse limit on new topics. Sigh…

Although having multiple issues in one thread will make for a messy thread, here’s the next issue:

Title: Setup / Husky - Clarification for new users

Continuing the discussion from Setup / Husky – multiple errors in jupyter notebooks, which lists the config:

Walking through 1 - Connecting to Hardware.ipynb, in section CW-Husky with CW313/SAM4S:

This file appears to be intended for first-time users / first-time setup.

The photo properly shows both POS measurement and CROWBAR being connected between the CW-Husky and the CW313 board’s J3 and J4 connectors.

As a first-time user, I worried about connecting them incorrectly. However, the two cables go offscreen in that photo, preventing implicit documentation on whether CROWBAR goes to J3 or J4, and the same question for POS measurement.

It was only after looking through the CW313 schematics that I could confirm that J3 and J4 are bridged. Thus, it doesn’t matter which connector is used on the CW313.

Could the docs be updated to make the connections explicit here, or for the photo to show the full cables pathed to make it easy to visually trace the connections (or both)?

Although having multiple issues in one thread will make for a messy thread, here’s the next issue:

Title: Setup / CWHUSKY / SAM4S - firmware too large?

Continuing the discussion from Setup / Husky – multiple errors in jupyter notebooks, which lists the config:

Walking through 1 - Connecting to Hardware.ipynb, in section Building and Uploading Firmware:

The compilation worked fine. Relevant part:

LINKING:
-en     simpleserial-base-CWHUSKY.elf ...
Memory region         Used Size  Region Size  %age Used
             rom:        3424 B       128 KB      2.61%
             ram:        4648 B        64 KB      7.09%
...
Size after:
   text	   data	    bss	    dec	    hex	filename
   3424	      4	   4644	   8072	   1f88	simpleserial-base-CWHUSKY.elf

However, the following attempt to upload the firmware fails:

cw.program_target(scope, cw.programmers.SAM4SProgrammer, "../firmware/mcu/simpleserial-base/simpleserial-base-CWHUSKY.elf")

With the error:

OSError: File too big (need 887 pages, have 256)

Full Compilation Log

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[8], line 4
      1 #cw.program_target(scope, cw.programmers.XMEGAProgrammer, "path/to/firmware.hex")
      2 #cw.program_target(scope, cw.programmers.STM32FProgrammer, "path/to/firmware.hex")
      3 #cw.program_target(scope, cw.programmers.AVRProgrammer, "path/to/firmware.hex")
----> 4 cw.program_target(scope, cw.programmers.SAM4SProgrammer, "../firmware/mcu/simpleserial-base/simpleserial-base-CWHUSKY.elf")

File ~/src/chipwhisperer/software/chipwhisperer/__init__.py:183, in program_target(scope, prog_type, fw_path, **kwargs)
    181     prog.find()
    182     prog.erase()
--> 183     prog.program(fw_path, memtype="flash", verify=True)
    184     prog.close()
    185 except:

File ~/src/chipwhisperer/software/chipwhisperer/capture/api/programmers.py:129, in save_and_restore_pins.<locals>.func_wrapper(self, *args, **kwargs)
    126 target_logger.debug('Changing {} pin configuration'.format(pin_setup))
    128 try:
--> 129     val = func(self, *args, **kwargs)
    130 finally:
    131     target_logger.debug('Restoring {} pin configuration'.format(pin_setup))

File ~/src/chipwhisperer/software/chipwhisperer/capture/api/programmers.py:207, in SAM4SProgrammer.program(self, filename, memtype, verify)
    204     fw_data = open(filename, "rb").read()
    206 target_logger.info("Programming...")
--> 207 prog.write(fw_data)
    208 target_logger.info("Verifying...")
    209 if prog.verify(fw_data):
    210     # prog.reset()

File ~/src/chipwhisperer/software/chipwhisperer/hardware/naeusb/bootloader_sam3u.py:446, in Samba.write(self, bindata, doprint)
    444 totalpages = (len(bindata) + page_size - 1) / page_size
    445 if totalpages > page_max:
--> 446     raise IOError("File too big (need %d pages, have %d)" % (totalpages, page_max))
    448 bytesleft = len(bindata)
    450 i = 0

OSError: File too big (need 887 pages, have 256)

It seems REALLY unlikely that a firmware whose .text section is only 0x1F88 bytes would require 0x337 pages … that would make the page size ~24 bytes per page(!).

Is this expected to fail?

Is there a workaround?

Better yet, is there a proper fix available? :slight_smile:

Thank you!

Replace "../firmware/mcu/simpleserial-base/simpleserial-base-CWHUSKY.elf" with "../firmware/mcu/simpleserial-base/simpleserial-base-CWHUSKY.hex"

1 Like

:ewe: Don’t I feel sheep-ish. :ewe:

Yes, that got me past. Thanks for the quick response, and apologies for not noticing what should have been obvious!

I had the same difficulty and it took me quite some time to figure out they’re electrically equivalent. (i believe I discovered this on a related wiki page, rather than the schematic.)

1 Like

Good point, we can make that more clear, but note that in this case there is no way to connect the SMA cables that would lead to damage.

Also, for your reference, while the Jupyter notebooks are the primary means for learning how to use ChipWhisperer, we have lots of documentation over on our readthedocs site. For example, the answer to your question here: CW313 - 20-Pin to Card Edge (CW312 Style) Breakout/Adapter Board — ChipWhisperer Documentation

1 Like