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
+19 -22
View File
@@ -1,6 +1,6 @@
# 📘 Week 7: Constants in Embedded Systems: Debugging and Hacking Constants w/ 1602 LCD I2C Basics
# Week 7: Constants in Embedded Systems: Debugging and Hacking Constants w/ 1602 LCD I2C 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 `#define` macros and `const` variables
@@ -385,7 +385,7 @@ Embedded-Hacking/
---
## 🔧 Part 7: Hands-On Tutorial - Constants and I2C LCD
## Part 7: Hands-On Tutorial - Constants and I2C LCD
### Step 1: Review the Source Code
@@ -463,7 +463,7 @@ OTHER_FAV_NUM: 1337
---
## 🐛 Part 8: Debugging with GDB (Dynamic Analysis)
## Part 8: Debugging with GDB (Dynamic Analysis)
> ? **REVIEW:** This setup is identical to previous weeks. If you need a refresher on OpenOCD and GDB connection, refer back to Week 3 Part 6.
@@ -471,24 +471,20 @@ OTHER_FAV_NUM: 1337
**Terminal 1 - 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"
```
**Terminal 2 - Start GDB:**
```powershell
```cmd
arm-none-eabi-gdb build\0x0017_constants.elf
```
**Connect to target:**
```gdb
(gdb) target remote :3333
(gdb) target extended-remote :3333
(gdb) monitor reset halt
```
@@ -695,7 +691,7 @@ i r r0 r1
---
## 🔬 Part 9: Understanding the Assembly
## Part 9: Understanding the Assembly
Now that we've explored the binary in GDB, let's make sense of the key patterns we found.
@@ -766,7 +762,7 @@ These are stored consecutively in the `.rodata` section. Note the addresses - we
---
## ✏️ Part 10: Hacking the Binary with a Hex Editor
## Part 10: Hacking the Binary with a Hex Editor
Now for the fun part - we'll patch the `.bin` file directly using a hex editor!
@@ -870,19 +866,19 @@ From our GDB analysis in Step 10, we found the string at `0x10003ee8`. File offs
---
## 🚀 Part 11: Converting and Flashing the Hacked Binary
## Part 11: Converting and Flashing the Hacked Binary
### Step 21: Convert to UF2 Format
Open a terminal and navigate to your project directory:
```powershell
```cmd
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0017_constants
```
Run the conversion command:
```powershell
```cmd
python ..\uf2conv.py build\0x0017_constants-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
```
@@ -909,11 +905,11 @@ OTHER_FAV_NUM: 1337
The numbers are unchanged - we only patched the LCD string!
🎉 **BOOM! We successfully changed the LCD text from "Reverse" to "Exploit" without access to the source code!**
**BOOM! We successfully changed the LCD text from "Reverse" to "Exploit" without access to the source code!**
---
## 📊 Part 12: Summary and Review
## Part 12: Summary and Review
### What We Accomplished
@@ -991,7 +987,7 @@ The numbers are unchanged - we only patched the LCD string!
---
## 💡 Key Takeaways
## Key Takeaways
1. **#define is text replacement** - It happens before compilation, no memory used.
@@ -1015,7 +1011,7 @@ The numbers are unchanged - we only patched the LCD string!
---
## 📖 Glossary
## Glossary
| Term | Definition |
| ----------------------- | --------------------------------------------------- |
@@ -1036,7 +1032,7 @@ The numbers are unchanged - we only patched the LCD string!
---
## 📚 Additional Resources
## Additional Resources
### I2C Timing Reference
@@ -1078,3 +1074,4 @@ The numbers are unchanged - we only patched the LCD string!
Happy hacking! ?