Skip to content

Commit

Permalink
fix unclear function and use Setup.ipynb to setup cw in all labs
Browse files Browse the repository at this point in the history
  • Loading branch information
carosa committed Oct 2, 2025
1 parent 6faf1f1 commit d3a8756
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
26 changes: 19 additions & 7 deletions jupyter/lab/1_SCA_Lab/SCA_lab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@
"metadata": {},
"outputs": [],
"source": [
"SCOPETYPE = 'OPENADC'\n",
"PLATFORM = 'CW308_SAM4S'\n",
"CRYPTO_TARGET = 'TINYAES128C'\n",
"SS_VER = 'SS_VER_1_1'"
"SS_VER = 'SS_VER_1_1'\n",
"\n",
"# SCOPETYPE for CW Husky and CW Light\n",
"SCOPETYPE = 'OPENADC'\n",
"\n",
"# For STM32F Target board in individual package\n",
"PLATFORM = 'CW308_STM32F4'\n",
"\n",
"# For STM32F Target board in CW Light package\n",
"# PLATFORM = 'CW308_STM32F3'\n",
"\n",
"# CW Nano:\n",
"# SCOPETYPE = 'CWNANO'\n",
"# PLATFORM = 'CWNANO'\n"
]
},
{
Expand All @@ -46,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"%run \"./Setup.ipynb\""
"%run \"../Setup.ipynb\""
]
},
{
Expand All @@ -56,7 +67,7 @@
"outputs": [],
"source": [
"%%bash -s \"$PLATFORM\" \"$CRYPTO_TARGET\" \"$SS_VER\"\n",
"cd ../../firmware/mcu/simpleserial-aes\n",
"cd ../../../firmware/mcu/simpleserial-aes\n",
"make PLATFORM=$1 CRYPTO_TARGET=$2 EXTRA_OPTS=ADD_JITTER SS_VER=$3"
]
},
Expand All @@ -66,7 +77,7 @@
"metadata": {},
"outputs": [],
"source": [
"cw.program_target(scope, prog, \"../../firmware/mcu/simpleserial-aes/simpleserial-aes-{}.hex\".format(PLATFORM))"
"cw.program_target(scope, prog, \"../../../firmware/mcu/simpleserial-aes/simpleserial-aes-{}.hex\".format(PLATFORM))"
]
},
{
Expand Down Expand Up @@ -198,7 +209,8 @@
"def calculate_trace_offset(ref_trace, orig_offset, target_trace, threshold):\n",
" ref_len = len(ref_trace)\n",
" for i in range(0, len(target_trace) - ref_len):\n",
" if SAD_SUM < threshold:\n",
" sad_sum = #sum together the difference between the reference trace and target trace at a the offset given by i and ref_len.\n",
" if sad_sum < threshold:\n",
" return i - orig_offset"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"metadata": {},
"outputs": [],
"source": [
"%run \"../../Setup_Scripts/Setup_Generic.ipynb\""
"%run \"../Setup.ipynb\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"metadata": {},
"outputs": [],
"source": [
"%run \"../../Setup_Scripts/Setup_Generic.ipynb\""
"%run \"../Setup.ipynb\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion jupyter/lab/2_Fault_Lab/3_Glitching_a_Memory_Dump.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"metadata": {},
"outputs": [],
"source": [
"%run \"../../Setup_Scripts/Setup_Generic.ipynb\""
"%run \"../Setup.ipynb\""
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions jupyter/lab/2_Fault_Lab/4_Glitching_a_Bootloader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"metadata": {},
"outputs": [],
"source": [
"%run \"../../Setup_Scripts/Setup_Generic.ipynb\""
"%run \"../Setup.ipynb\""
]
},
{
Expand All @@ -100,7 +100,7 @@
"metadata": {},
"outputs": [],
"source": [
"fw_path = \".../../../firmware/mcu/simpleserial-aes-bootloader/simpleserial-bootloader-{}.hex\".format(PLATFORM)\n",
"fw_path = \"../../../firmware/mcu/simpleserial-aes-bootloader/simpleserial-bootloader-{}.hex\".format(PLATFORM)\n",
"cw.program_target(scope, prog, fw_path)\n",
"target.reset_comms()"
]
Expand Down
File renamed without changes.

0 comments on commit d3a8756

Please sign in to comment.