Update WEEK06

This commit is contained in:
Kevin Thomas
2026-05-30 16:50:15 -04:00
parent af0d84f9cc
commit f22ef2907e
21 changed files with 1554 additions and 425 deletions
+29 -36
View File
@@ -1,6 +1,6 @@
# 📘 Week 10: Conditionals in Embedded Systems: Debugging and Hacking Static & Dynamic Conditionals w/ SG90 Servo Motor PWM Basics
# Week 10: Conditionals in Embedded Systems: Debugging and Hacking Static & Dynamic Conditionals w/ SG90 Servo Motor PWM Basics
## 🎯 What You'll Learn This Week
## What You'll Learn This Week
By the end of this tutorial, you will be able to:
- Understand the difference between static and dynamic conditionals in C
@@ -468,7 +468,7 @@ Embedded-Hacking/
---
## 🔧 Part 9: Hands-On Tutorial - Static Conditionals Code
## Part 9: Hands-On Tutorial - Static Conditionals Code
### Step 1: Review the Source Code
@@ -572,18 +572,14 @@ one
---
## 🐛 Part 10: Debugging with GDB (Static Conditionals)
## Part 10: Debugging with GDB (Static Conditionals)
### Step 5: Start OpenOCD (Terminal 1)
Open a terminal and start OpenOCD:
```powershell
openocd ^
-s "C:\Users\assem.KEVINTHOMAS\.pico-sdk\openocd\0.12.0+dev\scripts" ^
-f interface/cmsis-dap.cfg ^
-f target/rp2350.cfg ^
-c "adapter speed 5000"
```cmd
openocd -s "%USERPROFILE%\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"
```
You should see output indicating OpenOCD connected successfully to your Pico 2 via the Debug Probe.
@@ -592,7 +588,7 @@ You should see output indicating OpenOCD connected successfully to your Pico 2 v
Open a **new terminal** and launch GDB with the binary:
```powershell
```cmd
arm-none-eabi-gdb build\0x001d_static-conditionals.elf
```
@@ -601,7 +597,7 @@ arm-none-eabi-gdb build\0x001d_static-conditionals.elf
In GDB, connect to OpenOCD:
```gdb
target remote :3333
target extended-remote :3333
```
### Step 8: Halt the Running Binary
@@ -704,13 +700,13 @@ quit
---
## 🔧 Part 11: Setting Up Ghidra for Static Conditionals
## Part 11: Setting Up Ghidra for Static Conditionals
### Step 17: Start Ghidra
Open a terminal and type:
```powershell
```cmd
ghidraRun
```
@@ -750,7 +746,7 @@ Wait for analysis to complete.
---
## 🔍 Part 12: Resolving Functions in Ghidra (Static)
## Part 12: Resolving Functions in Ghidra (Static)
### Step 22: Navigate to Main
@@ -827,7 +823,7 @@ bl FUN_xxxxx ; sleep_ms
---
## ✏️ Part 13: Hacking Static Conditionals
## Part 13: Hacking Static Conditionals
### Step 28: Open the Bytes Editor
@@ -881,7 +877,7 @@ Find the sleep_ms delay value:
Convert and flash:
```powershell
```cmd
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x001d_static-conditionals
python ..\uf2conv.py build\0x001d_static-conditionals-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
```
@@ -901,7 +897,7 @@ fun
---
## 📌 Part 14: Dynamic Conditionals - The Source Code
## Part 14: Dynamic Conditionals - The Source Code
### Step 34: Review the Dynamic Code
@@ -972,18 +968,14 @@ int main(void) {
---
## 🐛 Part 15: Debugging with GDB (Dynamic Conditionals)
## Part 15: Debugging with GDB (Dynamic Conditionals)
### Step 37: Start OpenOCD (Terminal 1)
Open a terminal and start OpenOCD:
```powershell
openocd ^
-s "C:\Users\assem.KEVINTHOMAS\.pico-sdk\openocd\0.12.0+dev\scripts" ^
-f interface/cmsis-dap.cfg ^
-f target/rp2350.cfg ^
-c "adapter speed 5000"
```cmd
openocd -s "%USERPROFILE%\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"
```
You should see output indicating OpenOCD connected successfully to your Pico 2 via the Debug Probe.
@@ -992,7 +984,7 @@ You should see output indicating OpenOCD connected successfully to your Pico 2 v
Open a **new terminal** and launch GDB with the binary:
```powershell
```cmd
arm-none-eabi-gdb build\0x0020_dynamic-conditionals.elf
```
@@ -1001,7 +993,7 @@ arm-none-eabi-gdb build\0x0020_dynamic-conditionals.elf
In GDB, connect to OpenOCD:
```gdb
target remote :3333
target extended-remote :3333
```
### Step 40: Halt the Running Binary
@@ -1103,7 +1095,7 @@ quit
---
## 🔧 Part 16: Setting Up Ghidra for Dynamic Conditionals
## Part 16: Setting Up Ghidra for Dynamic Conditionals
### Step 49: Create New Project
@@ -1159,7 +1151,7 @@ This confirms it's a UART initialization function!
---
## 🔬 Part 17: Understanding Branch Instructions
## Part 17: Understanding Branch Instructions
### ARM Branch Instructions
@@ -1207,7 +1199,7 @@ skip_printf:
---
## ✏️ Part 18: Advanced Hacking - Creating Stealth Commands
## Part 18: Advanced Hacking - Creating Stealth Commands
### The Goal
@@ -1301,7 +1293,7 @@ Little-endian: 00 00 f0 41
1. Export as `0x0020_dynamic-conditionals-h.bin`
2. Convert to UF2:
```powershell
```cmd
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0020_dynamic-conditionals
python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
```
@@ -1314,7 +1306,7 @@ python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 -
---
## 📊 Part 19: Summary and Review
## Part 19: Summary and Review
### What We Accomplished
@@ -1380,7 +1372,7 @@ python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 -
---
## 💡 Key Takeaways
## Key Takeaways
1. **Static conditionals have fixed outcomes** - The same path always executes
@@ -1404,7 +1396,7 @@ python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 -
---
## 📖 Glossary
## Glossary
| Term | Definition |
| ----------------------- | --------------------------------------------------- |
@@ -1422,7 +1414,7 @@ python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 -
---
## 📚 Additional Resources
## Additional Resources
### ASCII Reference Table
@@ -1464,7 +1456,7 @@ python ..\uf2conv.py build\0x0020_dynamic-conditionals-h.bin --base 0x10000000 -
---
## 🌍 Real-World Implications
## Real-World Implications
### Why Stealth Commands Matter
@@ -1502,3 +1494,4 @@ A fast-moving servo is like a nuclear fuel rod:
Happy hacking! ?