mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-05-22 23:49:41 +02:00
Updated WEEK05
This commit is contained in:
+17
-14
@@ -1,4 +1,4 @@
|
||||
# Week 4: Variables in Embedded Systems: Debugging and Hacking Variables w/ GPIO Output Basics
|
||||
# Week 4: Variables in Embedded Systems: Debugging and Hacking Variables w/ GPIO Output Basics
|
||||
|
||||
## 🎯 What You'll Learn This Week
|
||||
|
||||
@@ -417,10 +417,10 @@ This instruction loads the value `0x2b` (43) into register `r1` before calling `
|
||||
|
||||
We're going to change `0x2b` (43) to `0x46` (70)!
|
||||
|
||||
1. Click on the instruction `movs r1,#0x2b`
|
||||
1. At address `1000023a`, click the instruction `movs r1,#0x2b`
|
||||
2. Right-click and select **Patch Instruction**
|
||||
3. Change `0x2b` to `0x46`
|
||||
4. Press Enter
|
||||
3. Replace immediate `0x2b` with `0x46`
|
||||
4. Press Enter and verify the instruction bytes change from `2b 21` to `46 21`
|
||||
|
||||
The instruction now reads:
|
||||
```assembly
|
||||
@@ -446,7 +446,7 @@ The Pico 2 expects UF2 files, not raw BIN files. We need to convert it!
|
||||
**Open a terminal and navigate to your project directory:**
|
||||
|
||||
```powershell
|
||||
cd C:\Users\assem.KEVINTHOMAS\OneDrive\Documents\Embedded-Hacking\0x0005_intro-to-variables
|
||||
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0005_intro-to-variables
|
||||
```
|
||||
|
||||
**Run the conversion command:**
|
||||
@@ -609,10 +609,10 @@ This is where `gpio_init(LED_PIN)` is called with GPIO 16.
|
||||
|
||||
We'll change the red LED (GPIO 16) to the green LED (GPIO 17)!
|
||||
|
||||
1. Find the instruction `movs r0,#0x10`
|
||||
1. At address `1000023a`, select `movs r0,#0x10`
|
||||
2. Right-click -> **Patch Instruction**
|
||||
3. Change `0x10` to `0x11` (17 in hex)
|
||||
4. Click **OK**
|
||||
3. Replace immediate `0x10` with `0x11` (17 decimal)
|
||||
4. Click **OK** and verify bytes change from `10 20` to `11 20`
|
||||
|
||||
### Step 28: Find All GPIO 16 References
|
||||
|
||||
@@ -629,6 +629,9 @@ This is used in `gpio_set_dir`. Patch this to `0x11` as well.
|
||||
```
|
||||
|
||||
This is inside the loop for `gpio_put`. Patch this to `0x11` as well.
|
||||
Patch each one with **Patch Instruction**, then verify:
|
||||
- `10000244`: `10 23` -> `11 23`
|
||||
- `10000252`: `10 24` -> `11 24`
|
||||
|
||||
### Step 29: Bonus - Change the Printed Value
|
||||
|
||||
@@ -639,8 +642,8 @@ Let's also change the printed value from `0` to `0x42` (66 in decimal):
|
||||
```
|
||||
|
||||
1. Right-click -> **Patch Instruction**
|
||||
2. Change `0x0` to `0x42`
|
||||
3. Click **OK**
|
||||
2. Replace immediate `0x0` with `0x42`
|
||||
3. Click **OK** and verify bytes change from `00 21` to `42 21`
|
||||
|
||||
---
|
||||
|
||||
@@ -656,7 +659,7 @@ Let's also change the printed value from `0` to `0x42` (66 in decimal):
|
||||
### Step 31: Convert to UF2
|
||||
|
||||
```powershell
|
||||
cd C:\Users\assem.KEVINTHOMAS\OneDrive\Documents\Embedded-Hacking\0x0008_uninitialized-variables
|
||||
cd C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0008_uninitialized-variables
|
||||
python ..\uf2conv.py build\0x0008_uninitialized-variables-h.bin --base 0x10000000 --family 0xe48bff59 --output build\hacked.uf2
|
||||
```
|
||||
|
||||
@@ -802,7 +805,7 @@ delay2:
|
||||
+-----------------------------------------------------------------+
|
||||
| 3. Find the values/instructions to patch |
|
||||
| - Look in the assembly listing |
|
||||
| - Right-click -> Patch Instruction |
|
||||
| - Patch Instruction, then verify old bytes -> new bytes |
|
||||
+-----------------------------------------------------------------+
|
||||
| 4. Export the patched binary |
|
||||
| - File -> Export Program |
|
||||
@@ -832,7 +835,7 @@ delay2:
|
||||
| Action | How To Do It |
|
||||
| ----------------- | ------------------------------------- |
|
||||
| Rename function | Right-click -> Edit Function Signature |
|
||||
| Patch instruction | Right-click -> Patch Instruction |
|
||||
| Patch instruction | Right-click -> Patch Instruction, then verify old bytes -> new bytes |
|
||||
| Export binary | File -> Export Program -> Raw Bytes |
|
||||
| Go to address | Press 'G' and enter address |
|
||||
|
||||
@@ -903,4 +906,4 @@ The RP2350 GPIO coprocessor instructions:
|
||||
**Remember:** Every binary you encounter in the real world can be analyzed and understood using these same techniques. Practice makes perfect!
|
||||
|
||||
Happy hacking! 🔧
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user