mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-08-19 17:37:19 +02:00
Fixed WEEK06
This commit is contained in:
+9
-7
@@ -48,18 +48,20 @@ arm-none-eabi-gdb build/0x0014_static-variables.elf
|
||||
|
||||
##### Step 2: Find Where gpio_set_pulls is Called
|
||||
|
||||
From the tutorial, we know `gpio_set_pulls` is called at `0x10000250` with arguments for GPIO 15:
|
||||
From the tutorial, we know `gpio_set_pulls` is called at `0x1000024e` with arguments for GPIO 15:
|
||||
|
||||
```gdb
|
||||
(gdb) x/5i 0x1000024a
|
||||
(gdb) x/5i 0x10000240
|
||||
```
|
||||
|
||||
You should see:
|
||||
```
|
||||
0x1000024a: movs r0, #15 ; GPIO pin 15
|
||||
0x10000240: movs r0, #15 ; GPIO pin 15
|
||||
0x10000242: mov.w r3, #0 ; GPIO_IN (direction)
|
||||
0x10000246: mcrr 0, 4, r0, r3, cr4 ; gpio_set_dir via coprocessor
|
||||
0x1000024a: movs r2, #0 ; down = false
|
||||
0x1000024c: movs r1, #1 ; up = true
|
||||
0x1000024e: movs r2, #0 ; down = false
|
||||
0x10000250: bl 0x100002dc ; gpio_set_pulls
|
||||
0x1000024e: bl 0x100002d8 ; gpio_set_pulls
|
||||
```
|
||||
|
||||
##### Step 3: Disassemble gpio_set_pulls
|
||||
@@ -67,7 +69,7 @@ You should see:
|
||||
Now examine the function itself:
|
||||
|
||||
```gdb
|
||||
(gdb) x/30i 0x100002dc
|
||||
(gdb) x/30i 0x100002d8
|
||||
```
|
||||
|
||||
Study the disassembly carefully. Look for:
|
||||
@@ -79,7 +81,7 @@ Study the disassembly carefully. Look for:
|
||||
##### Step 4: Set a Breakpoint at gpio_set_pulls
|
||||
|
||||
```gdb
|
||||
(gdb) b *0x100002dc
|
||||
(gdb) b *0x100002d8
|
||||
(gdb) monitor reset halt
|
||||
(gdb) c
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user