mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-06-01 20:11:47 +02:00
Update WEEK06
This commit is contained in:
+30
-37
@@ -1,6 +1,6 @@
|
||||
# 📘 Week 11: Structures and Functions in Embedded Systems: Debugging and Hacking w/ IR Remote Control and NEC Protocol Basics
|
||||
# Week 11: Structures and Functions in Embedded Systems: Debugging and Hacking w/ IR Remote Control and NEC Protocol 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 C structures (structs) and how they organize related data
|
||||
@@ -476,7 +476,7 @@ Embedded-Hacking/
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Part 9: Hands-On Tutorial - Structures Code
|
||||
## Part 9: Hands-On Tutorial - Structures Code
|
||||
|
||||
### Step 1: Review the Source Code
|
||||
|
||||
@@ -588,18 +588,14 @@ int main(void) {
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Part 10: Debugging with GDB (Structures)
|
||||
## Part 10: Debugging with GDB (Structures)
|
||||
|
||||
### 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.
|
||||
@@ -608,7 +604,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\0x0023_structures.elf
|
||||
```
|
||||
|
||||
@@ -617,7 +613,7 @@ arm-none-eabi-gdb build\0x0023_structures.elf
|
||||
In GDB, connect to OpenOCD:
|
||||
|
||||
```gdb
|
||||
target remote :3333
|
||||
target extended-remote :3333
|
||||
```
|
||||
|
||||
### Step 8: Halt the Running Binary
|
||||
@@ -724,13 +720,13 @@ quit
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Part 11: Setting Up Ghidra for Structures
|
||||
## Part 11: Setting Up Ghidra for Structures
|
||||
|
||||
### Step 17: Start Ghidra
|
||||
|
||||
Open a terminal and type:
|
||||
|
||||
```powershell
|
||||
```cmd
|
||||
ghidraRun
|
||||
```
|
||||
|
||||
@@ -769,7 +765,7 @@ Wait for analysis to complete.
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Part 12: Resolving Functions - Structures Project
|
||||
## Part 12: Resolving Functions - Structures Project
|
||||
|
||||
### Step 22: Navigate to Main
|
||||
|
||||
@@ -858,7 +854,7 @@ bl FUN_xxxxx ; sleep_ms
|
||||
|
||||
---
|
||||
|
||||
## 🔬 Part 13: Recognizing Struct Patterns in Assembly
|
||||
## Part 13: Recognizing Struct Patterns in Assembly
|
||||
|
||||
### Step 29: Identify GPIO Set Direction
|
||||
|
||||
@@ -896,7 +892,7 @@ Create a mental (or written) map:
|
||||
|
||||
---
|
||||
|
||||
## ✏️ Part 14: Hacking Structures
|
||||
## Part 14: Hacking Structures
|
||||
|
||||
### Step 31: Open the Bytes Editor
|
||||
|
||||
@@ -935,7 +931,7 @@ LED 2 (0x18) -> GPIO 16 -> Red LED (SWAPPED!)
|
||||
|
||||
Convert and flash:
|
||||
|
||||
```powershell
|
||||
```cmd
|
||||
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0023_structures
|
||||
python ..\uf2conv.py build\0x0023_structures-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
|
||||
```
|
||||
@@ -952,7 +948,7 @@ python ..\uf2conv.py build\0x0023_structures-h.bin --base 0x10000000 --family 0x
|
||||
|
||||
---
|
||||
|
||||
## ✏️ Part 15: Security Implications - Log Desynchronization
|
||||
## Part 15: Security Implications - Log Desynchronization
|
||||
|
||||
### The Danger of Mismatched Logs
|
||||
|
||||
@@ -990,7 +986,7 @@ Our LED example demonstrates the same principle:
|
||||
|
||||
---
|
||||
|
||||
## ✏️ Part 16: Functions Project - Advanced Code
|
||||
## Part 16: Functions Project - Advanced Code
|
||||
|
||||
### Step 35: Review the Functions Code
|
||||
|
||||
@@ -1084,18 +1080,14 @@ int process_ir_led_command(int ir_command, simple_led_ctrl_t *leds, uint8_t blin
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Part 17: Debugging with GDB (Functions)
|
||||
## Part 17: Debugging with GDB (Functions)
|
||||
|
||||
### Step 38: 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.
|
||||
@@ -1104,7 +1096,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\0x0026_functions.elf
|
||||
```
|
||||
|
||||
@@ -1113,7 +1105,7 @@ arm-none-eabi-gdb build\0x0026_functions.elf
|
||||
In GDB, connect to OpenOCD:
|
||||
|
||||
```gdb
|
||||
target remote :3333
|
||||
target extended-remote :3333
|
||||
```
|
||||
|
||||
### Step 41: Halt the Running Binary
|
||||
@@ -1213,7 +1205,7 @@ quit
|
||||
|
||||
---
|
||||
|
||||
## 🔬 Part 18: Analyzing .ELF Files in Ghidra
|
||||
## Part 18: Analyzing .ELF Files in Ghidra
|
||||
|
||||
### Step 50: Create New Ghidra Project
|
||||
|
||||
@@ -1246,7 +1238,7 @@ With .ELF files, you get more information:
|
||||
|
||||
---
|
||||
|
||||
## ✏️ Part 19: Hacking the Functions Project
|
||||
## Part 19: Hacking the Functions Project
|
||||
|
||||
### Step 53: Find LED Pin Values
|
||||
|
||||
@@ -1288,7 +1280,7 @@ Button 3 -> LED 3 -> GPIO 16 -> Red (SWAPPED!)
|
||||
|
||||
### Step 56: Convert and Flash
|
||||
|
||||
```powershell
|
||||
```cmd
|
||||
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0026_functions
|
||||
python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
|
||||
```
|
||||
@@ -1305,7 +1297,7 @@ python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe
|
||||
|
||||
---
|
||||
|
||||
## 📊 Part 20: Summary and Review
|
||||
## Part 20: Summary and Review
|
||||
|
||||
### What We Accomplished
|
||||
|
||||
@@ -1384,7 +1376,7 @@ python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe
|
||||
|
||||
---
|
||||
|
||||
## 💡 Key Takeaways
|
||||
## Key Takeaways
|
||||
|
||||
1. **Structs group related data** - Better organization than separate variables
|
||||
|
||||
@@ -1408,7 +1400,7 @@ python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe
|
||||
|
||||
---
|
||||
|
||||
## 📖 Glossary
|
||||
## Glossary
|
||||
|
||||
| Term | Definition |
|
||||
| -------------------------- | -------------------------------------------------- |
|
||||
@@ -1426,7 +1418,7 @@ python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe
|
||||
|
||||
---
|
||||
|
||||
## 📚 Additional Resources
|
||||
## Additional Resources
|
||||
|
||||
### NEC IR Command Reference
|
||||
|
||||
@@ -1459,7 +1451,7 @@ python ..\uf2conv.py build\0x0026_functions-h.bin --base 0x10000000 --family 0xe
|
||||
|
||||
---
|
||||
|
||||
## 🌍 Real-World Implications
|
||||
## Real-World Implications
|
||||
|
||||
### What You've Learned in This Course
|
||||
|
||||
@@ -1502,3 +1494,4 @@ This is just the beginning:
|
||||
Happy hacking! ?
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user