Initial commit with strict idiomatic rust enforcement
@@ -0,0 +1,79 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
|
||||
<!-- Background grid decoration -->
|
||||
<g opacity="0.06">
|
||||
<line x1="0" y1="100" x2="1200" y2="100" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="200" x2="1200" y2="200" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="300" x2="1200" y2="300" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="400" x2="1200" y2="400" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="500" x2="1200" y2="500" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="600" x2="1200" y2="600" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="0" y1="700" x2="1200" y2="700" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="200" y1="0" x2="200" y2="800" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="400" y1="0" x2="400" y2="800" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="600" y1="0" x2="600" y2="800" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="800" y1="0" x2="800" y2="800" stroke="#00ff41" stroke-width="1"/>
|
||||
<line x1="1000" y1="0" x2="1000" y2="800" stroke="#00ff41" stroke-width="1"/>
|
||||
</g>
|
||||
|
||||
<!-- Hex rain decoration -->
|
||||
<g opacity="0.04" font-family="'Courier New',monospace" font-size="14" fill="#00ff41">
|
||||
<text x="50" y="80">4F 70 65 6E 4F 43 44</text>
|
||||
<text x="900" y="120">10 00 02 34 08 B5 01</text>
|
||||
<text x="150" y="180">47 44 42 20 52 45 56</text>
|
||||
<text x="800" y="240">20 08 20 00 FF AA 00</text>
|
||||
<text x="80" y="350">52 50 32 33 35 30 00</text>
|
||||
<text x="950" y="380">0A 0A 0F 12 12 1A 1A</text>
|
||||
<text x="100" y="520">41 52 4D 76 38 2D 4D</text>
|
||||
<text x="870" y="560">00 FF 41 00 D4 FF 88</text>
|
||||
<text x="60" y="680">47 48 49 44 52 41 00</text>
|
||||
<text x="920" y="720">FF 00 40 C0 C0 C0 00</text>
|
||||
</g>
|
||||
|
||||
<!-- Corner accents -->
|
||||
<polyline points="30,30 30,80 80,80" fill="none" stroke="#00ff41" stroke-width="2" opacity="0.3"/>
|
||||
<polyline points="1170,30 1170,80 1120,80" fill="none" stroke="#00ff41" stroke-width="2" opacity="0.3"/>
|
||||
<polyline points="30,770 30,720 80,720" fill="none" stroke="#00ff41" stroke-width="2" opacity="0.3"/>
|
||||
<polyline points="1170,770 1170,720 1120,720" fill="none" stroke="#00ff41" stroke-width="2" opacity="0.3"/>
|
||||
|
||||
<!-- Top accent line -->
|
||||
<rect x="100" y="140" width="1000" height="2" fill="#00ff41" opacity="0.4"/>
|
||||
|
||||
<!-- Course Title -->
|
||||
<text x="600" y="210" text-anchor="middle" font-family="'Courier New',monospace" font-size="56" font-weight="bold" fill="#00ff41">Embedded Systems</text>
|
||||
<text x="600" y="278" text-anchor="middle" font-family="'Courier New',monospace" font-size="56" font-weight="bold" fill="#00ff41">Reverse Engineering</text>
|
||||
|
||||
<!-- Divider -->
|
||||
<rect x="300" y="310" width="600" height="2" fill="#00d4ff" opacity="0.6"/>
|
||||
|
||||
<!-- Week Number -->
|
||||
<text x="600" y="380" text-anchor="middle" font-family="'Courier New',monospace" font-size="42" font-weight="bold" fill="#00d4ff">// WEEK 11</text>
|
||||
|
||||
<!-- Week Topic -->
|
||||
<text x="600" y="440" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Structures and Functions in</text>
|
||||
<text x="600" y="478" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Embedded Systems: Debugging and Hacking</text>
|
||||
<text x="600" y="516" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">w/ IR Remote Control & NEC Protocol</text>
|
||||
|
||||
<!-- Bottom accent line -->
|
||||
<rect x="100" y="570" width="1000" height="2" fill="#00ff41" opacity="0.4"/>
|
||||
|
||||
<!-- University -->
|
||||
<text x="600" y="635" text-anchor="middle" font-family="'Courier New',monospace" font-size="36" font-weight="bold" fill="#ffaa00">George Mason University</text>
|
||||
|
||||
<!-- Bottom badge -->
|
||||
<rect x="400" y="670" width="400" height="40" rx="20" fill="none" stroke="#00ff41" stroke-width="1.5" opacity="0.5"/>
|
||||
<text x="600" y="697" text-anchor="middle" font-family="'Courier New',monospace" font-size="20" fill="#00ff41" opacity="0.7">RP2350 // ARM Cortex-M33</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,70 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">C Structures (Structs)</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Grouping Related Data Together</text>
|
||||
|
||||
<!-- What is a Struct -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="150">What is a Struct?</text>
|
||||
<text class="txt" x="50" y="185">A user-defined type that groups</text>
|
||||
<text class="txt" x="50" y="215">related variables under one name</text>
|
||||
<text class="dim" x="50" y="250">Like a form with multiple fields</text>
|
||||
<text class="dim" x="50" y="275">-- each field holds different data</text>
|
||||
|
||||
<!-- Struct Definition -->
|
||||
<rect class="pnl" x="30" y="330" width="555" height="300" rx="8"/>
|
||||
<text class="sub" x="50" y="370">Struct Definition</text>
|
||||
<rect x="50" y="385" width="515" height="230" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="413">typedef struct {</text>
|
||||
<text class="txt" x="100" y="441">uint8_t led1_pin;</text>
|
||||
<text class="txt" x="100" y="469">uint8_t led2_pin;</text>
|
||||
<text class="txt" x="100" y="497">uint8_t led3_pin;</text>
|
||||
<text class="txt" x="100" y="525">bool led1_state;</text>
|
||||
<text class="txt" x="100" y="553">bool led2_state;</text>
|
||||
<text class="txt" x="100" y="581">bool led3_state;</text>
|
||||
<text class="cyn" x="70" y="607">} simple_led_ctrl_t;</text>
|
||||
|
||||
<!-- Why Use Structs -->
|
||||
<rect class="pnl" x="615" y="330" width="555" height="300" rx="8"/>
|
||||
<text class="sub" x="635" y="370">Why Use Structs?</text>
|
||||
<text class="grn" x="635" y="410">1.</text>
|
||||
<text class="txt" x="680" y="410">Organization</text>
|
||||
<text class="dim" x="680" y="435">Related data stays together</text>
|
||||
<text class="grn" x="635" y="470">2.</text>
|
||||
<text class="txt" x="680" y="470">Readability</text>
|
||||
<text class="dim" x="680" y="495">Code easier to understand</text>
|
||||
<text class="grn" x="635" y="530">3.</text>
|
||||
<text class="txt" x="680" y="530">Scalability</text>
|
||||
<text class="dim" x="680" y="555">Easy to add more features</text>
|
||||
<text class="grn" x="635" y="590">4.</text>
|
||||
<text class="txt" x="680" y="590">Pass to Functions</text>
|
||||
|
||||
<!-- Struct Container Visualization -->
|
||||
<rect class="pnl" x="30" y="650" width="1140" height="110" rx="8"/>
|
||||
<text class="sub" x="50" y="682">simple_led_ctrl_t leds</text>
|
||||
<rect x="50" y="695" width="170" height="45" rx="6" fill="#0a0a0f" stroke="#00ff41"/>
|
||||
<text class="grn" x="65" y="724">pin1: 16</text>
|
||||
<rect x="240" y="695" width="170" height="45" rx="6" fill="#0a0a0f" stroke="#00ff41"/>
|
||||
<text class="grn" x="255" y="724">pin2: 17</text>
|
||||
<rect x="430" y="695" width="170" height="45" rx="6" fill="#0a0a0f" stroke="#00ff41"/>
|
||||
<text class="grn" x="445" y="724">pin3: 18</text>
|
||||
<rect x="630" y="695" width="160" height="45" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="dim" x="645" y="722">state1: 0</text>
|
||||
<rect x="810" y="695" width="160" height="45" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="dim" x="825" y="722">state2: 0</text>
|
||||
<rect x="990" y="695" width="160" height="45" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="dim" x="1005" y="722">state3: 0</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,85 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Struct Memory Layout</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">How Structs Are Stored and Accessed</text>
|
||||
|
||||
<!-- Memory Layout Table -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="280" rx="8"/>
|
||||
<text class="sub" x="50" y="150">Memory Layout (6 bytes total)</text>
|
||||
|
||||
<text class="amb" x="50" y="190">Address</text>
|
||||
<text class="amb" x="230" y="190">Member</text>
|
||||
<text class="amb" x="500" y="190">Size</text>
|
||||
<text class="amb" x="650" y="190">Value</text>
|
||||
<line x1="50" y1="200" x2="1140" y2="200" stroke="#1a1a2e" stroke-width="1"/>
|
||||
|
||||
<text class="cyn" x="50" y="230">0x20000000</text>
|
||||
<text class="txt" x="250" y="230">led1_pin</text>
|
||||
<text class="dim" x="500" y="230">1 byte</text>
|
||||
<text class="grn" x="680" y="230">16 (0x10)</text>
|
||||
|
||||
<text class="cyn" x="50" y="260">0x20000001</text>
|
||||
<text class="txt" x="250" y="260">led2_pin</text>
|
||||
<text class="dim" x="500" y="260">1 byte</text>
|
||||
<text class="grn" x="680" y="260">17 (0x11)</text>
|
||||
|
||||
<text class="cyn" x="50" y="290">0x20000002</text>
|
||||
<text class="txt" x="250" y="290">led3_pin</text>
|
||||
<text class="dim" x="500" y="290">1 byte</text>
|
||||
<text class="grn" x="680" y="290">18 (0x12)</text>
|
||||
|
||||
<text class="cyn" x="50" y="320">0x20000003</text>
|
||||
<text class="txt" x="250" y="320">led1_state</text>
|
||||
<text class="dim" x="500" y="320">1 byte</text>
|
||||
<text class="txt" x="680" y="320">0 (false)</text>
|
||||
|
||||
<text class="cyn" x="50" y="350">0x20000004</text>
|
||||
<text class="txt" x="250" y="350">led2_state</text>
|
||||
<text class="dim" x="500" y="350">1 byte</text>
|
||||
<text class="txt" x="680" y="350">0 (false)</text>
|
||||
|
||||
<text class="cyn" x="50" y="380">0x20000005</text>
|
||||
<text class="txt" x="250" y="380">led3_state</text>
|
||||
<text class="dim" x="500" y="380">1 byte</text>
|
||||
<text class="txt" x="680" y="380">0 (false)</text>
|
||||
|
||||
<!-- Dot Operator -->
|
||||
<rect class="pnl" x="30" y="410" width="555" height="170" rx="8"/>
|
||||
<text class="sub" x="50" y="450">Dot Operator ( . )</text>
|
||||
<text class="dim" x="50" y="478">Use with struct variable</text>
|
||||
<rect x="50" y="492" width="515" height="70" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="txt" x="70" y="520">leds.led1_pin = 16;</text>
|
||||
<text class="txt" x="70" y="548">leds.led1_state = true;</text>
|
||||
|
||||
<!-- Arrow Operator -->
|
||||
<rect class="pnl" x="615" y="410" width="555" height="170" rx="8"/>
|
||||
<text class="sub" x="635" y="450">Arrow Operator ( -> )</text>
|
||||
<text class="dim" x="635" y="478">Use with pointer to struct</text>
|
||||
<rect x="635" y="492" width="515" height="70" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="txt" x="655" y="520">ptr->led1_pin = 16;</text>
|
||||
<text class="dim" x="655" y="548">// same as (*ptr).led1_pin</text>
|
||||
|
||||
<!-- Designated Initializer -->
|
||||
<rect class="pnl" x="30" y="600" width="1140" height="160" rx="8"/>
|
||||
<text class="sub" x="50" y="640">Designated Initializers</text>
|
||||
<rect x="50" y="655" width="740" height="85" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="683">simple_led_ctrl_t leds = {</text>
|
||||
<text class="grn" x="100" y="713">.led1_pin = 16, .led2_pin = 17, .led3_pin = 18</text>
|
||||
<text class="cyn" x="70" y="730">};</text>
|
||||
<text class="dim" x="820" y="690">Clear which value goes</text>
|
||||
<text class="dim" x="820" y="715">to which member</text>
|
||||
<text class="dim" x="820" y="740">Order doesn't matter</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,88 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">NEC IR Protocol</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Infrared Remote Control Communication</text>
|
||||
|
||||
<!-- How IR Works -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="140" rx="8"/>
|
||||
<text class="sub" x="50" y="150">How IR Works</text>
|
||||
<text class="txt" x="50" y="185">Remote sends invisible light pulses</text>
|
||||
<text class="txt" x="50" y="215">IR receiver on GPIO 5 reads signal</text>
|
||||
<text class="dim" x="600" y="185">IR LED flashes in specific patterns</text>
|
||||
<text class="dim" x="600" y="215">Each pattern = different button</text>
|
||||
|
||||
<!-- NEC Frame -->
|
||||
<rect class="pnl" x="30" y="270" width="1140" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="310">NEC Protocol Frame (32 bits)</text>
|
||||
|
||||
<rect x="50" y="330" width="180" height="50" rx="6" fill="#0a0a0f" stroke="#ffaa00"/>
|
||||
<text class="amb" x="80" y="362">Leader</text>
|
||||
<rect x="240" y="330" width="180" height="50" rx="6" fill="#0a0a0f" stroke="#00d4ff"/>
|
||||
<text class="cyn" x="268" y="362">Address</text>
|
||||
<rect x="430" y="330" width="180" height="50" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="txt" x="455" y="362">Addr Inv</text>
|
||||
<rect x="620" y="330" width="180" height="50" rx="6" fill="#0a0a0f" stroke="#00ff41"/>
|
||||
<text class="grn" x="648" y="362">Command</text>
|
||||
<rect x="810" y="330" width="180" height="50" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="txt" x="840" y="362">Cmd Inv</text>
|
||||
<rect x="1000" y="330" width="130" height="50" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="dim" x="1030" y="362">Stop</text>
|
||||
|
||||
<text class="dim" x="80" y="410">9ms+4.5ms</text>
|
||||
<text class="dim" x="280" y="410">8-bit</text>
|
||||
<text class="dim" x="460" y="410">8-bit check</text>
|
||||
<text class="dim" x="660" y="410">8-bit</text>
|
||||
<text class="dim" x="850" y="410">8-bit check</text>
|
||||
|
||||
<text class="dim" x="50" y="450">Leader says "attention!", address identifies device, command is the button pressed</text>
|
||||
|
||||
<!-- Command Code Table -->
|
||||
<rect class="pnl" x="30" y="490" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="530">NEC Command Codes</text>
|
||||
|
||||
<text class="amb" x="50" y="570">Button</text>
|
||||
<text class="amb" x="200" y="570">NEC Code</text>
|
||||
<text class="amb" x="380" y="570">LED</text>
|
||||
<line x1="50" y1="580" x2="565" y2="580" stroke="#1a1a2e" stroke-width="1"/>
|
||||
|
||||
<text class="txt" x="50" y="610">1</text>
|
||||
<text class="grn" x="200" y="610">0x0C</text>
|
||||
<text class="red" x="380" y="610">Red (GP16)</text>
|
||||
|
||||
<text class="txt" x="50" y="640">2</text>
|
||||
<text class="grn" x="200" y="640">0x18</text>
|
||||
<text class="grn" x="380" y="640">Green (GP17)</text>
|
||||
|
||||
<text class="txt" x="50" y="670">3</text>
|
||||
<text class="grn" x="200" y="670">0x5E</text>
|
||||
<text class="amb" x="380" y="670">Yellow (GP18)</text>
|
||||
|
||||
<!-- Wiring -->
|
||||
<rect class="pnl" x="615" y="490" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="635" y="530">Hardware Wiring</text>
|
||||
<text class="cyn" x="635" y="565">GPIO 5</text>
|
||||
<text class="txt" x="800" y="565">IR Receiver (VS1838B)</text>
|
||||
<text class="cyn" x="635" y="595">GPIO 16</text>
|
||||
<text class="txt" x="800" y="595">Red LED + 220 ohm</text>
|
||||
<text class="cyn" x="635" y="625">GPIO 17</text>
|
||||
<text class="txt" x="800" y="625">Green LED + 220 ohm</text>
|
||||
<text class="cyn" x="635" y="655">GPIO 18</text>
|
||||
<text class="txt" x="800" y="655">Yellow LED + 220 ohm</text>
|
||||
|
||||
<!-- Bottom -->
|
||||
<rect class="pnl" x="30" y="710" width="1140" height="50" rx="8"/>
|
||||
<text class="dim" x="50" y="742">Projects: 0x0023_structures and 0x0026_functions</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,91 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Functions in C</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Reusable Blocks of Code</text>
|
||||
|
||||
<!-- Function Anatomy -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="195" rx="8"/>
|
||||
<text class="sub" x="50" y="150">Anatomy of a Function</text>
|
||||
<rect x="50" y="168" width="1100" height="50" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="200">int ir_to_led_number(int ir_command) {</text>
|
||||
|
||||
<text class="amb" x="70" y="235">^^^</text>
|
||||
<text class="amb" x="128" y="235">^^^^^^^^^^^^^^^^</text>
|
||||
<text class="amb" x="372" y="235">^^^^^^^^^^^^^^</text>
|
||||
<text class="dim" x="70" y="258">ret</text>
|
||||
<text class="dim" x="128" y="258">function name</text>
|
||||
<text class="dim" x="372" y="258">parameter</text>
|
||||
|
||||
<rect x="50" y="270" width="1100" height="35" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="grn" x="70" y="295">if (ir_command == 0x0C) return 1;</text>
|
||||
<text class="dim" x="600" y="295">// body + return value</text>
|
||||
|
||||
<!-- Function Types Table -->
|
||||
<rect class="pnl" x="30" y="325" width="555" height="245" rx="8"/>
|
||||
<text class="sub" x="50" y="365">Function Types</text>
|
||||
|
||||
<text class="amb" x="50" y="400">Type</text>
|
||||
<text class="amb" x="330" y="400">Example</text>
|
||||
<line x1="50" y1="410" x2="565" y2="410" stroke="#1a1a2e" stroke-width="1"/>
|
||||
|
||||
<text class="txt" x="50" y="440">No params, no ret</text>
|
||||
<text class="dim" x="330" y="440">leds_all_off()</text>
|
||||
|
||||
<text class="txt" x="50" y="470">Params, no return</text>
|
||||
<text class="dim" x="330" y="470">blink_led(..)</text>
|
||||
|
||||
<text class="txt" x="50" y="500">No params, return</text>
|
||||
<text class="dim" x="330" y="500">ir_getkey()</text>
|
||||
|
||||
<text class="txt" x="50" y="530">Params + return</text>
|
||||
<text class="dim" x="330" y="530">ir_to_led_num()</text>
|
||||
|
||||
<text class="txt" x="50" y="560">Struct pointer</text>
|
||||
<text class="dim" x="330" y="560">get_led_pin()</text>
|
||||
|
||||
<!-- Key Functions -->
|
||||
<rect class="pnl" x="615" y="325" width="555" height="245" rx="8"/>
|
||||
<text class="sub" x="635" y="365">Key Functions</text>
|
||||
|
||||
<text class="grn" x="635" y="400">ir_to_led_number(cmd)</text>
|
||||
<text class="dim" x="635" y="425">Maps NEC code to LED 1/2/3</text>
|
||||
|
||||
<text class="grn" x="635" y="460">get_led_pin(leds, num)</text>
|
||||
<text class="dim" x="635" y="485">Returns GPIO pin for LED</text>
|
||||
|
||||
<text class="grn" x="635" y="520">blink_led(pin, cnt, ms)</text>
|
||||
<text class="dim" x="635" y="545">Blinks LED cnt times</text>
|
||||
|
||||
<!-- Call Chain - Vertical Flow -->
|
||||
<rect class="pnl" x="30" y="590" width="1140" height="170" rx="8"/>
|
||||
<text class="sub" x="50" y="630">Function Call Chain</text>
|
||||
|
||||
<text class="cyn" x="50" y="665">main()</text>
|
||||
<text class="dim" x="200" y="665">--></text>
|
||||
<text class="amb" x="250" y="665">process_ir_led_command()</text>
|
||||
|
||||
<text class="txt" x="100" y="695">1. leds_all_off()</text>
|
||||
<text class="dim" x="400" y="695">Turn all LEDs off</text>
|
||||
|
||||
<text class="txt" x="100" y="725">2. ir_to_led_number()</text>
|
||||
<text class="dim" x="400" y="725">Map NEC to LED</text>
|
||||
|
||||
<text class="txt" x="700" y="695">3. get_led_pin()</text>
|
||||
<text class="dim" x="950" y="695">Get GPIO pin</text>
|
||||
|
||||
<text class="txt" x="700" y="725">4. blink_led()</text>
|
||||
<text class="dim" x="950" y="725">Blink + stay on</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -0,0 +1,66 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Struct Pointers in Functions</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Passing Data Efficiently</text>
|
||||
|
||||
<!-- Why Pointers -->
|
||||
<rect class="pnl" x="30" y="110" width="555" height="160" rx="8"/>
|
||||
<text class="sub" x="50" y="150">Why Pass by Pointer?</text>
|
||||
<text class="grn" x="50" y="185">Efficient</text>
|
||||
<text class="dim" x="250" y="185">4 bytes (address) not 6</text>
|
||||
<text class="grn" x="50" y="215">Modifiable</text>
|
||||
<text class="dim" x="250" y="215">Function can change original</text>
|
||||
<text class="grn" x="50" y="245">Standard</text>
|
||||
<text class="dim" x="250" y="245">Embedded systems practice</text>
|
||||
|
||||
<!-- Arrow Operator -->
|
||||
<rect class="pnl" x="615" y="110" width="555" height="160" rx="8"/>
|
||||
<text class="sub" x="635" y="150">Arrow Operator</text>
|
||||
<text class="txt" x="635" y="185">leds->led1_pin</text>
|
||||
<text class="dim" x="635" y="215">Same as (*leds).led1_pin</text>
|
||||
<text class="dim" x="635" y="245">Use -> when leds is a pointer</text>
|
||||
|
||||
<!-- leds_all_off -->
|
||||
<rect class="pnl" x="30" y="290" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="330">leds_all_off()</text>
|
||||
<rect x="50" y="348" width="515" height="125" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="378">void leds_all_off(</text>
|
||||
<text class="cyn" x="100" y="408">simple_led_ctrl_t *leds) {</text>
|
||||
<text class="txt" x="100" y="438">gpio_put(leds->led1_pin, 0);</text>
|
||||
<text class="txt" x="100" y="463">gpio_put(leds->led2_pin, 0);</text>
|
||||
|
||||
<!-- blink_led -->
|
||||
<rect class="pnl" x="615" y="290" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="635" y="330">blink_led()</text>
|
||||
<rect x="635" y="348" width="515" height="125" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="655" y="378">void blink_led(uint8_t pin,</text>
|
||||
<text class="cyn" x="685" y="408">uint8_t count, uint32_t ms){</text>
|
||||
<text class="txt" x="685" y="438">gpio_put(pin, true);</text>
|
||||
<text class="txt" x="685" y="463">sleep_ms(ms);</text>
|
||||
|
||||
<!-- process_ir_led_command -->
|
||||
<rect class="pnl" x="30" y="510" width="1140" height="250" rx="8"/>
|
||||
<text class="sub" x="50" y="550">process_ir_led_command() -- Main Command Processor</text>
|
||||
<rect x="50" y="568" width="1100" height="170" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="598">int process_ir_led_command(int cmd,</text>
|
||||
<text class="cyn" x="100" y="628">simple_led_ctrl_t *leds, uint8_t blink_count) {</text>
|
||||
<text class="txt" x="100" y="660">leds_all_off(leds);</text>
|
||||
<text class="dim" x="600" y="660">// turn all off first</text>
|
||||
<text class="txt" x="100" y="690">int num = ir_to_led_number(cmd);</text>
|
||||
<text class="dim" x="600" y="690">// map NEC to LED</text>
|
||||
<text class="txt" x="100" y="720">blink_led(get_led_pin(leds, num),</text>
|
||||
<text class="dim" x="600" y="720">// blink then stay on</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,57 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Structures Source Code</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">0x0023_structures.c</text>
|
||||
|
||||
<!-- Source Code -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="520" rx="8"/>
|
||||
<text class="sub" x="50" y="150">Full Source</text>
|
||||
<rect x="50" y="168" width="1100" height="445" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
|
||||
<text class="dim" x="70" y="198">#include <stdio.h></text>
|
||||
<text class="dim" x="70" y="225">#include "pico/stdlib.h"</text>
|
||||
<text class="dim" x="70" y="252">#include "ir.h"</text>
|
||||
|
||||
<text class="cyn" x="70" y="285">typedef struct {</text>
|
||||
<text class="txt" x="100" y="312">uint8_t led1_pin, led2_pin, led3_pin;</text>
|
||||
<text class="txt" x="100" y="339">bool led1_state, led2_state, led3_state;</text>
|
||||
<text class="cyn" x="70" y="366">} simple_led_ctrl_t;</text>
|
||||
|
||||
<text class="cyn" x="70" y="400">int main(void) {</text>
|
||||
<text class="txt" x="100" y="427">stdio_init_all();</text>
|
||||
<text class="amb" x="100" y="454">simple_led_ctrl_t leds = {</text>
|
||||
<text class="grn" x="130" y="481">.led1_pin=16, .led2_pin=17, .led3_pin=18</text>
|
||||
<text class="amb" x="100" y="508">};</text>
|
||||
|
||||
<text class="txt" x="100" y="540">gpio_init(leds.led1_pin);</text>
|
||||
<text class="dim" x="500" y="540">// init 16, 17, 18</text>
|
||||
<text class="txt" x="100" y="567">ir_init(5);</text>
|
||||
<text class="dim" x="500" y="567">// IR on GPIO 5</text>
|
||||
<text class="txt" x="100" y="594">while (true) {</text>
|
||||
<text class="dim" x="500" y="594">// main loop</text>
|
||||
|
||||
<!-- Program Flow -->
|
||||
<rect class="pnl" x="30" y="650" width="1140" height="110" rx="8"/>
|
||||
<text class="sub" x="50" y="685">Main Loop Flow</text>
|
||||
<text class="txt" x="50" y="715">ir_getkey()</text>
|
||||
<text class="dim" x="230" y="715">--></text>
|
||||
<text class="txt" x="270" y="715">check NEC code</text>
|
||||
<text class="dim" x="490" y="715">--></text>
|
||||
<text class="txt" x="530" y="715">set state</text>
|
||||
<text class="dim" x="680" y="715">--></text>
|
||||
<text class="txt" x="720" y="715">gpio_put()</text>
|
||||
<text class="dim" x="50" y="740">0x0C=LED1(red) 0x18=LED2(green) 0x5E=LED3(yellow)</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,73 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Struct Flattening</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">How Compilers Transform Structs</text>
|
||||
|
||||
<!-- C Level -->
|
||||
<rect class="pnl" x="30" y="110" width="555" height="220" rx="8"/>
|
||||
<text class="sub" x="50" y="150">C Code (High Level)</text>
|
||||
<rect x="50" y="168" width="515" height="140" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="cyn" x="70" y="198">gpio_init(leds.led1_pin);</text>
|
||||
<text class="dim" x="70" y="225">// leds.led1_pin = 16</text>
|
||||
<text class="cyn" x="70" y="258">gpio_init(leds.led2_pin);</text>
|
||||
<text class="dim" x="70" y="285">// leds.led2_pin = 17</text>
|
||||
|
||||
<!-- Assembly Level -->
|
||||
<rect class="pnl" x="615" y="110" width="555" height="220" rx="8"/>
|
||||
<text class="sub" x="635" y="150">Assembly (Flattened)</text>
|
||||
<rect x="635" y="168" width="515" height="140" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text class="grn" x="655" y="198">movs r0, #0x10</text>
|
||||
<text class="dim" x="900" y="198">// 16</text>
|
||||
<text class="txt" x="655" y="225">bl gpio_init</text>
|
||||
<text class="grn" x="655" y="258">movs r0, #0x11</text>
|
||||
<text class="dim" x="900" y="258">// 17</text>
|
||||
<text class="txt" x="655" y="285">bl gpio_init</text>
|
||||
|
||||
<!-- The Key Insight -->
|
||||
<rect class="pnl" x="30" y="350" width="1140" height="130" rx="8"/>
|
||||
<text class="sub" x="50" y="390">The Key Insight</text>
|
||||
<text class="red" x="50" y="425">Struct abstraction DISAPPEARS</text>
|
||||
<text class="txt" x="520" y="425">at assembly level</text>
|
||||
<text class="dim" x="50" y="455">You see individual values (16, 17, 18) not struct names</text>
|
||||
|
||||
<!-- Struct Member Mapping -->
|
||||
<rect class="pnl" x="30" y="500" width="1140" height="260" rx="8"/>
|
||||
<text class="sub" x="50" y="540">Struct Member Mapping</text>
|
||||
|
||||
<text class="amb" x="50" y="575">Assembly</text>
|
||||
<text class="amb" x="280" y="575">Struct Member</text>
|
||||
<text class="amb" x="560" y="575">Physical</text>
|
||||
<text class="amb" x="800" y="575">NEC Code</text>
|
||||
<line x1="50" y1="585" x2="1140" y2="585" stroke="#1a1a2e" stroke-width="1"/>
|
||||
|
||||
<text class="grn" x="50" y="615">0x10 (16)</text>
|
||||
<text class="txt" x="280" y="615">led1_pin</text>
|
||||
<text class="red" x="560" y="615">Red LED</text>
|
||||
<text class="cyn" x="800" y="615">0x0C</text>
|
||||
|
||||
<text class="grn" x="50" y="645">0x11 (17)</text>
|
||||
<text class="txt" x="280" y="645">led2_pin</text>
|
||||
<text class="grn" x="560" y="645">Green LED</text>
|
||||
<text class="cyn" x="800" y="645">0x18</text>
|
||||
|
||||
<text class="grn" x="50" y="675">0x12 (18)</text>
|
||||
<text class="txt" x="280" y="675">led3_pin</text>
|
||||
<text class="amb" x="560" y="675">Yellow LED</text>
|
||||
<text class="cyn" x="800" y="675">0x5E</text>
|
||||
|
||||
<text class="dim" x="50" y="710">Sequential values (16,17,18) reveal the struct pattern</text>
|
||||
<text class="dim" x="50" y="735">Recognize patterns to reconstruct original structs in Ghidra</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,77 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Hacking Structures</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Swapping GPIO Pin Assignments</text>
|
||||
|
||||
<!-- The Hack -->
|
||||
<rect class="pnl" x="30" y="110" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="150">Swap LED 1 and LED 2</text>
|
||||
<text class="txt" x="50" y="185">Find gpio_init values:</text>
|
||||
<text class="red" x="50" y="220">0x10 (16)</text>
|
||||
<text class="amb" x="230" y="220">--></text>
|
||||
<text class="grn" x="290" y="220">0x11 (17)</text>
|
||||
<text class="red" x="50" y="255">0x11 (17)</text>
|
||||
<text class="amb" x="230" y="255">--></text>
|
||||
<text class="grn" x="290" y="255">0x10 (16)</text>
|
||||
<text class="dim" x="50" y="290">Swap the two byte values</text>
|
||||
|
||||
<!-- Result -->
|
||||
<rect class="pnl" x="615" y="110" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="635" y="150">Result After Hack</text>
|
||||
|
||||
<text class="amb" x="635" y="185">Before:</text>
|
||||
<text class="txt" x="635" y="215">Btn 1 --> GPIO 16 --> Red</text>
|
||||
<text class="txt" x="635" y="245">Btn 2 --> GPIO 17 --> Green</text>
|
||||
|
||||
<text class="amb" x="635" y="275">After:</text>
|
||||
<text class="grn" x="790" y="275">SWAPPED!</text>
|
||||
|
||||
<!-- Before/After Detail -->
|
||||
<rect class="pnl" x="30" y="330" width="555" height="150" rx="8"/>
|
||||
<text class="sub" x="50" y="370">Before (Normal)</text>
|
||||
<text class="txt" x="50" y="405">Btn 1 (0x0C) --> GPIO 16</text>
|
||||
<text class="red" x="450" y="405">Red</text>
|
||||
<text class="txt" x="50" y="435">Btn 2 (0x18) --> GPIO 17</text>
|
||||
<text class="grn" x="450" y="435">Green</text>
|
||||
<text class="dim" x="50" y="465">Log and LED match correctly</text>
|
||||
|
||||
<rect class="pnl" x="615" y="330" width="555" height="150" rx="8"/>
|
||||
<text class="sub" x="635" y="370">After (Hacked)</text>
|
||||
<text class="txt" x="635" y="405">Btn 1 (0x0C) --> GPIO 17</text>
|
||||
<text class="grn" x="1035" y="405">Green!</text>
|
||||
<text class="txt" x="635" y="435">Btn 2 (0x18) --> GPIO 16</text>
|
||||
<text class="red" x="1035" y="435">Red!</text>
|
||||
<text class="dim" x="635" y="465">Log says RED but GREEN lights</text>
|
||||
|
||||
<!-- Log Desynchronization -->
|
||||
<rect class="pnl" x="30" y="500" width="1140" height="180" rx="8"/>
|
||||
<text class="sub" x="50" y="540">Log Desynchronization</text>
|
||||
|
||||
<text class="amb" x="50" y="575">Terminal Log:</text>
|
||||
<text class="txt" x="300" y="575">NEC command: 0x0C</text>
|
||||
<text class="dim" x="600" y="575">(expects Red)</text>
|
||||
|
||||
<text class="amb" x="50" y="610">Physical LED:</text>
|
||||
<text class="grn" x="300" y="610">GREEN LED on</text>
|
||||
<text class="red" x="600" y="610">MISMATCH!</text>
|
||||
|
||||
<text class="dim" x="50" y="645">Operator sees correct logs but WRONG behavior</text>
|
||||
|
||||
<!-- Stuxnet Reference -->
|
||||
<rect class="pnl" x="30" y="700" width="1140" height="60" rx="8"/>
|
||||
<text class="sub" x="50" y="735">Stuxnet:</text>
|
||||
<text class="dim" x="250" y="735">False "normal" data to operators, equipment destroyed</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,73 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">.ELF vs .BIN Analysis</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Ghidra Analysis of 0x0026_functions</text>
|
||||
|
||||
<!-- Comparison Table -->
|
||||
<rect class="pnl" x="30" y="110" width="1140" height="220" rx="8"/>
|
||||
<text class="sub" x="50" y="150">.ELF vs .BIN Comparison</text>
|
||||
|
||||
<text class="amb" x="50" y="190">Feature</text>
|
||||
<text class="amb" x="350" y="190">.BIN File</text>
|
||||
<text class="amb" x="700" y="190">.ELF File</text>
|
||||
<line x1="50" y1="200" x2="1140" y2="200" stroke="#1a1a2e" stroke-width="1"/>
|
||||
|
||||
<text class="txt" x="50" y="230">Symbols</text>
|
||||
<text class="red" x="350" y="230">None</text>
|
||||
<text class="grn" x="700" y="230">Function names</text>
|
||||
|
||||
<text class="txt" x="50" y="260">Sections</text>
|
||||
<text class="red" x="350" y="260">Raw bytes only</text>
|
||||
<text class="grn" x="700" y="260">.text .data .rodata</text>
|
||||
|
||||
<text class="txt" x="50" y="290">Debug info</text>
|
||||
<text class="red" x="350" y="290">None</text>
|
||||
<text class="grn" x="700" y="290">May include debug</text>
|
||||
|
||||
<text class="txt" x="50" y="320">Use case</text>
|
||||
<text class="txt" x="350" y="320">Flash to device</text>
|
||||
<text class="txt" x="700" y="320">Analysis + debug</text>
|
||||
|
||||
<!-- Ghidra Import -->
|
||||
<rect class="pnl" x="30" y="350" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="50" y="390">Importing .BIN</text>
|
||||
<text class="txt" x="50" y="425">Manual setup required:</text>
|
||||
<text class="dim" x="50" y="450">ARM Cortex 32 little endian</text>
|
||||
<text class="dim" x="50" y="480">Block: .text</text>
|
||||
<text class="dim" x="50" y="505">Base: 10000000</text>
|
||||
<text class="dim" x="50" y="530">No function names</text>
|
||||
|
||||
<rect class="pnl" x="615" y="350" width="555" height="200" rx="8"/>
|
||||
<text class="sub" x="635" y="390">Importing .ELF</text>
|
||||
<text class="txt" x="635" y="425">Auto-detected by Ghidra:</text>
|
||||
<text class="grn" x="635" y="450">ARM format recognized</text>
|
||||
<text class="grn" x="635" y="480">Sections auto-loaded</text>
|
||||
<text class="grn" x="635" y="505">Symbol tree populated</text>
|
||||
<text class="grn" x="635" y="530">Named functions visible</text>
|
||||
|
||||
<!-- Important Note -->
|
||||
<rect class="pnl" x="30" y="570" width="1140" height="100" rx="8"/>
|
||||
<text class="sub" x="50" y="610">Important Rule</text>
|
||||
<text class="red" x="50" y="645">Analyze the .ELF</text>
|
||||
<text class="dim" x="350" y="645">for symbol information</text>
|
||||
<text class="grn" x="650" y="645">Patch the .BIN</text>
|
||||
<text class="dim" x="900" y="645">for flashing</text>
|
||||
|
||||
<!-- Workflow -->
|
||||
<rect class="pnl" x="30" y="690" width="1140" height="70" rx="8"/>
|
||||
<text class="sub" x="50" y="722">Export Workflow</text>
|
||||
<text class="dim" x="50" y="742">Patch .bin in Ghidra --> uf2conv.py --> flash to Pico 2</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,85 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<style>
|
||||
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
||||
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
||||
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
||||
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
||||
.dim{font:20px 'Courier New',monospace;fill:#888}
|
||||
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
||||
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
||||
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
||||
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
||||
.badge{stroke:#00ff41;rx:14}
|
||||
</style>
|
||||
<rect class="bg" width="1200" height="800"/>
|
||||
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
||||
<text class="title" x="600" y="52" text-anchor="middle">Structs & IR Protocol</text>
|
||||
<text class="dim" x="600" y="88" text-anchor="middle">Structs, Functions, IR, and Hacking</text>
|
||||
|
||||
<!-- Structs -->
|
||||
<rect class="pnl" x="30" y="110" width="555" height="180" rx="8"/>
|
||||
<text class="sub" x="50" y="150">C Structures</text>
|
||||
<text class="txt" x="50" y="185">Group related data together</text>
|
||||
<text class="dim" x="50" y="210">Dot (.) for variables</text>
|
||||
<text class="dim" x="50" y="235">Arrow (->) for pointers</text>
|
||||
<text class="dim" x="50" y="260">Designated init: .pin = 16</text>
|
||||
|
||||
<!-- NEC Protocol -->
|
||||
<rect class="pnl" x="615" y="110" width="555" height="180" rx="8"/>
|
||||
<text class="sub" x="635" y="150">NEC IR Protocol</text>
|
||||
<text class="txt" x="635" y="185">32-bit frame: addr + cmd</text>
|
||||
<text class="cyn" x="635" y="215">0x0C</text>
|
||||
<text class="dim" x="750" y="215">Button 1</text>
|
||||
<text class="cyn" x="635" y="245">0x18</text>
|
||||
<text class="dim" x="750" y="245">Button 2</text>
|
||||
<text class="cyn" x="635" y="275">0x5E</text>
|
||||
<text class="dim" x="750" y="275">Button 3</text>
|
||||
|
||||
<!-- Functions -->
|
||||
<rect class="pnl" x="30" y="310" width="555" height="160" rx="8"/>
|
||||
<text class="sub" x="50" y="350">Functions</text>
|
||||
<text class="txt" x="50" y="385">Reusable blocks, one job each</text>
|
||||
<text class="dim" x="50" y="410">ir_to_led_number()</text>
|
||||
<text class="dim" x="50" y="435">get_led_pin() / blink_led()</text>
|
||||
<text class="dim" x="50" y="460">process_ir_led_command()</text>
|
||||
|
||||
<!-- Struct Flattening -->
|
||||
<rect class="pnl" x="615" y="310" width="555" height="160" rx="8"/>
|
||||
<text class="sub" x="635" y="350">Assembly Flattening</text>
|
||||
<text class="txt" x="635" y="385">Structs vanish in assembly</text>
|
||||
<text class="dim" x="635" y="410">Only see values: 0x10 0x11 0x12</text>
|
||||
<text class="dim" x="635" y="435">Pattern recognition is key</text>
|
||||
<text class="dim" x="635" y="460">.ELF has symbols, .BIN doesn't</text>
|
||||
|
||||
<!-- Key Addresses -->
|
||||
<rect class="pnl" x="30" y="490" width="555" height="150" rx="8"/>
|
||||
<text class="sub" x="50" y="530">Key Values</text>
|
||||
<text class="cyn" x="50" y="565">0x10000234</text>
|
||||
<text class="dim" x="250" y="565">main()</text>
|
||||
<text class="cyn" x="50" y="595">GPIO 5</text>
|
||||
<text class="dim" x="250" y="595">IR receiver</text>
|
||||
<text class="cyn" x="50" y="625">GPIO 16/17/18</text>
|
||||
<text class="dim" x="250" y="625">Red/Green/Yellow</text>
|
||||
|
||||
<!-- Hacking -->
|
||||
<rect class="pnl" x="615" y="490" width="555" height="150" rx="8"/>
|
||||
<text class="sub" x="635" y="530">Hacking Techniques</text>
|
||||
<text class="amb" x="635" y="565">GPIO swap</text>
|
||||
<text class="dim" x="850" y="565">0x10 <--> 0x11</text>
|
||||
<text class="amb" x="635" y="595">Log desync</text>
|
||||
<text class="dim" x="850" y="595">Logs lie!</text>
|
||||
<text class="amb" x="635" y="625">Stuxnet</text>
|
||||
<text class="dim" x="850" y="625">Same concept</text>
|
||||
|
||||
<!-- Projects -->
|
||||
<rect class="pnl" x="30" y="660" width="555" height="100" rx="8"/>
|
||||
<text class="sub" x="50" y="695">Projects</text>
|
||||
<text class="dim" x="50" y="722">0x0023_structures</text>
|
||||
<text class="dim" x="50" y="744">0x0026_functions</text>
|
||||
|
||||
<!-- Takeaway -->
|
||||
<rect class="pnl" x="615" y="660" width="555" height="100" rx="8"/>
|
||||
<text class="sub" x="635" y="695">Key Takeaway</text>
|
||||
<text class="dim" x="635" y="722">Patch bytes, mislead logs</text>
|
||||
<text class="dim" x="635" y="744">hardware does what YOU say</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |