mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-10-22 15:28:24 +02:00
Initial commit
This commit is contained in:
commit
e9cb70b51b
741 files changed
+436922
No files matched your search
@@ -0,0 +1,12 @@
|
||||
*.c linguist-detectable=true
|
||||
*.cmake linguist-detectable=false
|
||||
*.py linguist-detectable=false
|
||||
*.txt linguist-detectable=false
|
||||
*.json linguist-detectable=false
|
||||
*.ps1 linguist-detectable=false
|
||||
|
||||
# Line endings: store LF in the repository; check out LF everywhere except the
|
||||
# Windows PowerShell scripts, which stay CRLF. Prevents CRLF<->LF churn.
|
||||
* text=auto eol=lf
|
||||
*.ps1 text eol=crlf
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
*.rep
|
||||
*.gpr
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# Build output
|
||||
build/
|
||||
target/
|
||||
|
||||
# Node.js and PDF generation script
|
||||
node_modules/
|
||||
package-lock.json
|
||||
package.json
|
||||
svg-to-pdf.ps1
|
||||
|
||||
# Operating System Files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Logs written by the Binary Ninja console helpers (build / flash / OpenOCD)
|
||||
openocd.log
|
||||
flash.log
|
||||
build.log
|
||||
build-flash.log
|
||||
|
||||
# Nested repositories
|
||||
eCTF/
|
||||
|
||||
# Whitelist course binaries in WEEK folders
|
||||
!WEEK*/**/build/
|
||||
!WEEK*/**/build/**
|
||||
!WEEK*/**/*.elf
|
||||
!WEEK*/**/*.hex
|
||||
!WEEK*/**/*.bin
|
||||
!WEEK*/**/*.uf2
|
||||
!WEEK*/**/*.map
|
||||
!WEEK*/**/*.dis
|
||||
!WEEK*/**/*.bndb
|
||||
!WEEK*/**/*.a
|
||||
!WEEK*/**/*.ld
|
||||
!WEEK*/**/*.h
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: embedded-c-standard
|
||||
description: Use ONLY when writing, editing, or reviewing C firmware in a picokit project (firmware/src, firmware/include, firmware/tests). Enforces the strict C standard: no function over 8 executable lines, no blank lines inside a function body, a Doxygen block with @brief/@param/@return on every function, a fixed module layout and naming scheme, and a ban on em/en dashes. Run the bundled audit_c_standard.py before every commit.
|
||||
---
|
||||
|
||||
# Embedded C standard (picokit)
|
||||
|
||||
This is non-negotiable and identical in every project in the series. There is
|
||||
no variation between projects. If a rule is inconvenient, refactor; do not
|
||||
exempt.
|
||||
|
||||
## Rules
|
||||
|
||||
1. No function longer than 8 executable lines. The audit counts every
|
||||
non-blank, non-comment, non-brace line in the body, including continuation
|
||||
lines of a wrapped statement. Split the work into a `static` helper.
|
||||
2. No blank lines inside a function body. Separate logical steps with a
|
||||
comment, never with a blank line.
|
||||
3. Documentation lives in the header. Every function declaration in a `.h`
|
||||
carries a Doxygen block with `@brief`, a `@param` for each parameter
|
||||
(`@param void No parameters.` when there are none), and an `@return`. A
|
||||
`static` function, which has no declaration, carries its Doxygen block in
|
||||
the `.c`. Never duplicate the block in the `.c` for an exported function.
|
||||
4. No U+2013 (en dash) or U+2014 (em dash) anywhere. Use the hyphen-minus `-`.
|
||||
5. Every source file opens with the MIT header block: `Copyright (c) 2026 Kevin
|
||||
Thomas`, `Author`, `Email`, `GitHub`, `File`, `Desc`, `Created`.
|
||||
6. Every header uses an include guard `#ifndef <MODULE>_H` / `#define
|
||||
<MODULE>_H` / `#endif // <MODULE>_H`.
|
||||
7. Naming: files and modules `snake_case`; functions `module_action`; macros
|
||||
`UPPER_SNAKE`; types `name_t`; file-scope statics `g_name`.
|
||||
8. One responsibility per file: `src/<module>.c` with `include/<module>.h`.
|
||||
All hardware access goes through a HAL seam so the host tests can substitute
|
||||
mocks.
|
||||
9. 79-column lines, four-space indent, no tabs.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
firmware/
|
||||
src/ <module>.c
|
||||
include/ <module>.h
|
||||
tests/ host unit tests, mock/, harness/
|
||||
CMakeLists.txt
|
||||
scripts/ run_tests.py check_coverage.py build.sh
|
||||
```
|
||||
|
||||
## Verify
|
||||
|
||||
Run the bundled audit from the repository root. Exit 0 is clean; any output is
|
||||
a failure and must be fixed before the change is complete.
|
||||
|
||||
```bash
|
||||
python3 .opencode/skill/embedded-c-standard/audit_c_standard.py
|
||||
```
|
||||
@@ -0,0 +1,989 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Audit owned C files against the strict embedded C standard.
|
||||
|
||||
Checks the no-blank-line-in-function-body rule, the eight-executable-line
|
||||
function limit, the em/en dash ban, and the documentation placement rules:
|
||||
a C file documents its static helpers but never its exported definitions,
|
||||
while a header documents every prototype. Run from the repository root;
|
||||
exit zero means the tree is clean.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
EXCLUDED_PARTS = (
|
||||
".opencode",
|
||||
"build",
|
||||
"build/",
|
||||
"generated/",
|
||||
".venv/",
|
||||
"node_modules/",
|
||||
"packet_artifact.h",
|
||||
"third_party/",
|
||||
"test/unity",
|
||||
"unity.c",
|
||||
"unity_internals.h",
|
||||
"ghidra/",
|
||||
)
|
||||
|
||||
EN_DASH = "\u2013"
|
||||
EM_DASH = "\u2014"
|
||||
MAX_EXEC_LINES = 8
|
||||
|
||||
|
||||
def _owned_files() -> list[Path]:
|
||||
"""
|
||||
Find owned C and header files.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
None
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[pathlib.Path]
|
||||
Owned non-generated C and header paths.
|
||||
"""
|
||||
paths = Path(".").glob("**/*")
|
||||
return sorted(path for path in paths if _is_owned(path))
|
||||
|
||||
|
||||
def _is_owned(path: Path) -> bool:
|
||||
"""
|
||||
Determine whether a path is in the audit scope.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
Candidate source path.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the path is an owned C or header file.
|
||||
"""
|
||||
name = str(path)
|
||||
if any(part in name for part in EXCLUDED_PARTS):
|
||||
return False
|
||||
return path.suffix in {".c", ".h"}
|
||||
|
||||
|
||||
def _next_is(line: str, index: int, mark: str) -> bool:
|
||||
"""
|
||||
Test the character following an index against a marker.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
mark : str
|
||||
Single-character marker to compare.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the next character equals the marker.
|
||||
"""
|
||||
return line[index + 1:index + 2] == mark
|
||||
|
||||
|
||||
def _is_comment_open(line: str, index: int) -> bool:
|
||||
"""
|
||||
Test whether a slash begins a line or block comment.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when a comment opens at the index.
|
||||
"""
|
||||
return line[index] == "/" and line[index + 1:index + 2] in ("*", "/")
|
||||
|
||||
|
||||
def _comment_open(line: str, index: int) -> tuple[int, str]:
|
||||
"""
|
||||
Advance past a comment opening at the index.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Index of the opening slash.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[int, str]
|
||||
Next index and the resulting scanner mode.
|
||||
"""
|
||||
if _next_is(line, index, "/"):
|
||||
return len(line), "normal"
|
||||
return index + 2, "block"
|
||||
|
||||
|
||||
def _literal_mode(char: str) -> str:
|
||||
"""
|
||||
Select the scanner mode for a quote character.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
char : str
|
||||
Quote character.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
Scanner mode name for the literal.
|
||||
"""
|
||||
return "string" if char == '"' else "char"
|
||||
|
||||
|
||||
def _literal_close(mode: str) -> str:
|
||||
"""
|
||||
Return the closing quote for a literal mode.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
mode : str
|
||||
Scanner mode name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
Matching closing quote character.
|
||||
"""
|
||||
return '"' if mode == "string" else "'"
|
||||
|
||||
|
||||
def _on_normal(out: list, line: str, index: int) -> tuple[int, str]:
|
||||
"""
|
||||
Consume one character of ordinary code.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
out : list
|
||||
Mutable code accumulator.
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[int, str]
|
||||
Next index and the resulting scanner mode.
|
||||
"""
|
||||
char = line[index]
|
||||
if _is_comment_open(line, index):
|
||||
return _comment_open(line, index)
|
||||
if char in "\"'":
|
||||
return index + 1, _literal_mode(char)
|
||||
out.append(char)
|
||||
return index + 1, "normal"
|
||||
|
||||
|
||||
def _on_block(out: list, line: str, index: int) -> tuple[int, str]:
|
||||
"""
|
||||
Consume one character inside a block comment.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
out : list
|
||||
Mutable code accumulator.
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[int, str]
|
||||
Next index and the resulting scanner mode.
|
||||
"""
|
||||
if line[index] == "*" and _next_is(line, index, "/"):
|
||||
return index + 2, "normal"
|
||||
return index + 1, "block"
|
||||
|
||||
|
||||
def _on_literal(out: list, line: str, index: int,
|
||||
mode: str) -> tuple[int, str]:
|
||||
"""
|
||||
Consume one character inside a string or character literal.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
out : list
|
||||
Mutable code accumulator.
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
mode : str
|
||||
Current literal scanner mode.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[int, str]
|
||||
Next index and the resulting scanner mode.
|
||||
"""
|
||||
char = line[index]
|
||||
if char == "\\":
|
||||
return index + 2, mode
|
||||
if char == _literal_close(mode):
|
||||
return index + 1, "normal"
|
||||
return index + 1, mode
|
||||
|
||||
|
||||
def _advance(out: list, line: str, index: int, mode: str) -> tuple[int, str]:
|
||||
"""
|
||||
Dispatch one character to its scanner handler.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
out : list
|
||||
Mutable code accumulator.
|
||||
line : str
|
||||
Source line.
|
||||
index : int
|
||||
Current character index.
|
||||
mode : str
|
||||
Current scanner mode.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[int, str]
|
||||
Next index and the resulting scanner mode.
|
||||
"""
|
||||
if mode == "normal":
|
||||
return _on_normal(out, line, index)
|
||||
if mode == "block":
|
||||
return _on_block(out, line, index)
|
||||
return _on_literal(out, line, index, mode)
|
||||
|
||||
|
||||
def _strip_line(line: str, in_block: bool) -> tuple[str, bool]:
|
||||
"""
|
||||
Remove comments and literals from one source line.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
line : str
|
||||
Source line.
|
||||
in_block : bool
|
||||
Whether a block comment is already open.
|
||||
|
||||
Returns
|
||||
-------
|
||||
tuple[str, bool]
|
||||
Code-only text and the updated block-comment state.
|
||||
"""
|
||||
out = []
|
||||
index = 0
|
||||
mode = "block" if in_block else "normal"
|
||||
while index < len(line):
|
||||
index, mode = _advance(out, line, index, mode)
|
||||
return "".join(out), mode == "block"
|
||||
|
||||
|
||||
def _func_name(code: str) -> str:
|
||||
"""
|
||||
Extract the function identifier from a signature head.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
code : str
|
||||
Comment-free signature line.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
Trailing identifier before the opening parenthesis.
|
||||
"""
|
||||
head = code.split("(")[0].strip()
|
||||
return head.split()[-1] if head else ""
|
||||
|
||||
|
||||
def _scan_state(path: Path) -> dict:
|
||||
"""
|
||||
Build the mutable scanner state for one file.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Scanner accumulation state.
|
||||
"""
|
||||
lines = path.read_text(encoding="utf-8").splitlines()
|
||||
state = {"lines": lines, "records": [], "protos": []}
|
||||
state.update(depth=0, in_block=False, cont=False, start=None)
|
||||
state.update(name="", static=False, sig=0, opened=0, body=[])
|
||||
return state
|
||||
|
||||
|
||||
def _scan_line(state: dict, line: str, number: int) -> None:
|
||||
"""
|
||||
Apply one source line to the scanner state.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
line : str
|
||||
Raw source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
code, state["in_block"] = _strip_line(line, state["in_block"])
|
||||
_scan_open(state, code, number)
|
||||
active = state["start"] is not None
|
||||
if active and number not in (state["start"], state["opened"]):
|
||||
_collect(code, number, state["body"])
|
||||
state["depth"] += code.count("{") - code.count("}")
|
||||
_scan_close(state, number)
|
||||
state["cont"] = line.rstrip().endswith("\\")
|
||||
|
||||
|
||||
def _scan_open(state: dict, code: str, number: int) -> None:
|
||||
"""
|
||||
Open a signature, body, or prototype when one begins.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
code : str
|
||||
Comment-free source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
if state["cont"] or state["start"] is not None:
|
||||
return
|
||||
if state["depth"] != 0:
|
||||
return
|
||||
_pending(state, code, number)
|
||||
|
||||
|
||||
def _pending(state: dict, code: str, number: int) -> None:
|
||||
"""
|
||||
Resolve a file-scope signature fragment into a record.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
code : str
|
||||
Comment-free source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
if state["sig"] == 0 and _proto_line(code):
|
||||
_add_proto(state, code, number)
|
||||
elif state["sig"] == 0 and _sig_start(code):
|
||||
_start_sig(state, code, number)
|
||||
elif state["sig"] and "{" in code:
|
||||
_start_body(state, number)
|
||||
elif state["sig"] and ";" in code:
|
||||
_finish_proto(state)
|
||||
|
||||
|
||||
def _add_proto(state: dict, code: str, number: int) -> None:
|
||||
"""
|
||||
Record a single-line function prototype.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
code : str
|
||||
Comment-free source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
state["protos"].append({"name": _func_name(code), "start": number})
|
||||
|
||||
|
||||
def _start_sig(state: dict, code: str, number: int) -> None:
|
||||
"""
|
||||
Begin a multi-line signature or same-line definition.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
code : str
|
||||
Comment-free source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
state["sig"] = number
|
||||
state["name"] = _func_name(code)
|
||||
state["static"] = code.lstrip().startswith("static")
|
||||
if "{" in code:
|
||||
_start_body(state, number)
|
||||
|
||||
|
||||
def _finish_proto(state: dict) -> None:
|
||||
"""
|
||||
Record a wrapped prototype at its terminating semicolon.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
state["protos"].append({"name": state["name"], "start": state["sig"]})
|
||||
state["sig"] = 0
|
||||
state["name"] = ""
|
||||
state["static"] = False
|
||||
|
||||
|
||||
def _start_body(state: dict, number: int) -> None:
|
||||
"""
|
||||
Open a new function body at the given line.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
number : int
|
||||
One-based opening line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
state["start"] = state["sig"]
|
||||
state["opened"] = number
|
||||
state["body"] = []
|
||||
state["sig"] = 0
|
||||
|
||||
|
||||
def _scan_close(state: dict, number: int) -> None:
|
||||
"""
|
||||
Close the current function body when its depth returns to zero.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
number : int
|
||||
One-based line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
if state["start"] is None or state["depth"] > 0:
|
||||
return
|
||||
if number <= state["start"]:
|
||||
return
|
||||
state["records"].append(_record(state, number))
|
||||
_reset(state)
|
||||
|
||||
|
||||
def _reset(state: dict) -> None:
|
||||
"""
|
||||
Clear the active-function fields of the scanner state.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
state["start"] = None
|
||||
state["name"] = ""
|
||||
state["sig"] = 0
|
||||
state["opened"] = 0
|
||||
state["static"] = False
|
||||
|
||||
|
||||
def _sig_start(code: str) -> bool:
|
||||
"""
|
||||
Detect the first line of a function definition signature.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
code : str
|
||||
Comment-free source line.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the line begins a function definition signature.
|
||||
"""
|
||||
text = code.strip()
|
||||
if not text or text.startswith("#") or text.startswith("}"):
|
||||
return False
|
||||
if "(" not in text or text.endswith(";"):
|
||||
return False
|
||||
return "=" not in text.split("(")[0]
|
||||
|
||||
|
||||
def _proto_line(code: str) -> bool:
|
||||
"""
|
||||
Detect a complete single-line function prototype.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
code : str
|
||||
Comment-free source line.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the line is a function prototype.
|
||||
"""
|
||||
text = code.strip()
|
||||
if not text or text.startswith("#") or "(" not in text:
|
||||
return False
|
||||
if not text.endswith(";") or "=" in text.split("(")[0]:
|
||||
return False
|
||||
return text.split()[0] not in {"typedef", "return"}
|
||||
|
||||
|
||||
def _collect(code: str, number: int, body: list) -> None:
|
||||
"""
|
||||
Append one executable or declaration line to the body list.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
code : str
|
||||
Comment-free source line.
|
||||
number : int
|
||||
One-based line number.
|
||||
body : list
|
||||
Mutable body accumulator.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
text = code.strip()
|
||||
if not text or text in {"{", "}"} or text.startswith("}"):
|
||||
return
|
||||
body.append((number, text))
|
||||
|
||||
|
||||
def _record(state: dict, end: int) -> dict:
|
||||
"""
|
||||
Build a function record from the scanner state.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
state : dict
|
||||
Scanner accumulation state.
|
||||
end : int
|
||||
Closing brace line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Function record.
|
||||
"""
|
||||
return {"name": state["name"], "start": state["start"], "end": end,
|
||||
"count": len(state["body"]), "static": state["static"]}
|
||||
|
||||
|
||||
def _scan(path: Path) -> dict:
|
||||
"""
|
||||
Scan one file into records and prototypes.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
|
||||
Returns
|
||||
-------
|
||||
dict
|
||||
Scanner state with records and prototypes.
|
||||
"""
|
||||
state = _scan_state(path)
|
||||
for number, line in enumerate(state["lines"], 1):
|
||||
_scan_line(state, line, number)
|
||||
return state
|
||||
|
||||
|
||||
def _blank_lines(path: Path, records: list) -> list[int]:
|
||||
"""
|
||||
Find blank lines inside function bodies.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
records : list
|
||||
Function records for the file.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[int]
|
||||
One-based blank-line numbers.
|
||||
"""
|
||||
lines = path.read_text(encoding="utf-8").splitlines()
|
||||
spans = [(r["start"], r["end"]) for r in records]
|
||||
return [number for number, line in enumerate(lines, 1)
|
||||
if not line.strip() and _inside(number, spans)]
|
||||
|
||||
|
||||
def _inside(number: int, spans: list) -> bool:
|
||||
"""
|
||||
Check whether a line lies inside a function span.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
number : int
|
||||
One-based source line number.
|
||||
spans : list
|
||||
Function start and end line pairs.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the line is inside a function body.
|
||||
"""
|
||||
return any(start < number < end for start, end in spans)
|
||||
|
||||
|
||||
def _block_end(lines: list, start: int) -> int | None:
|
||||
"""
|
||||
Locate the closing line of the doc block above a signature.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lines : list
|
||||
Source lines.
|
||||
start : int
|
||||
One-based signature line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
int or None
|
||||
Zero-based closing `*/` index, or None when absent.
|
||||
"""
|
||||
index = start - 2
|
||||
while index >= 0 and not lines[index].strip():
|
||||
index -= 1
|
||||
if index < 0 or "*/" not in lines[index]:
|
||||
return None
|
||||
return index
|
||||
|
||||
|
||||
def _block_lines(lines: list, index: int) -> list:
|
||||
"""
|
||||
Collect the Doxygen block lines ending at an index.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lines : list
|
||||
Source lines.
|
||||
index : int
|
||||
Zero-based closing `*/` index.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list
|
||||
Block lines from opening `/**` through closing `*/`.
|
||||
"""
|
||||
block = []
|
||||
while index >= 0:
|
||||
block.append(lines[index])
|
||||
if "/*" in lines[index]:
|
||||
break
|
||||
index -= 1
|
||||
block.reverse()
|
||||
return block
|
||||
|
||||
|
||||
def _is_doxygen(block: list) -> bool:
|
||||
"""
|
||||
Test whether a comment block is a Doxygen block with a brief.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
block : list
|
||||
Comment block lines from opener through closer.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when the block opens with `/**` and carries `@brief`.
|
||||
"""
|
||||
opener = block[0] if block else ""
|
||||
return "/**" in opener and "@brief" in "\n".join(block)
|
||||
|
||||
|
||||
def _doc_block(lines: list, start: int) -> list | None:
|
||||
"""
|
||||
Return the Doxygen block immediately above a signature.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lines : list
|
||||
Source lines.
|
||||
start : int
|
||||
One-based signature line number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list or None
|
||||
Block lines, or None when no Doxygen block precedes the signature.
|
||||
"""
|
||||
index = _block_end(lines, start)
|
||||
if index is None:
|
||||
return None
|
||||
block = _block_lines(lines, index)
|
||||
if not _is_doxygen(block):
|
||||
return None
|
||||
return block
|
||||
|
||||
|
||||
def _full_doc(block: list | None) -> bool:
|
||||
"""
|
||||
Check a static-function block for all required tags.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
block : list or None
|
||||
Doxygen block lines.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when @brief, @param, and @return are all present.
|
||||
"""
|
||||
if block is None:
|
||||
return False
|
||||
text = "\n".join(block)
|
||||
return all(tag in text for tag in ("@brief", "@param", "@return"))
|
||||
|
||||
|
||||
def _brief_doc(block: list | None) -> bool:
|
||||
"""
|
||||
Check a prototype block for a brief tag.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
block : list or None
|
||||
Doxygen block lines.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True when a @brief tag is present.
|
||||
"""
|
||||
return block is not None and "@brief" in "\n".join(block)
|
||||
|
||||
|
||||
def _c_doc_errors(path: Path, lines: list, records: list) -> list[str]:
|
||||
"""
|
||||
Find documentation-placement errors in a C source file.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C source path.
|
||||
lines : list
|
||||
Source lines.
|
||||
records : list
|
||||
Function records for the file.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[str]
|
||||
Human-readable documentation errors.
|
||||
"""
|
||||
errors = []
|
||||
for record in records:
|
||||
block = _doc_block(lines, record["start"])
|
||||
if record["static"] and not _full_doc(block):
|
||||
errors.append(f"{path}: {record['name']} static needs full doc")
|
||||
if not record["static"] and block is not None:
|
||||
errors.append(f"{path}: {record['name']} exported has doc block")
|
||||
return errors
|
||||
|
||||
|
||||
def _h_doc_errors(path: Path, lines: list, protos: list) -> list[str]:
|
||||
"""
|
||||
Find prototypes missing a @brief block in a header.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
Header path.
|
||||
lines : list
|
||||
Source lines.
|
||||
protos : list
|
||||
Prototype records for the file.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[str]
|
||||
Human-readable documentation errors.
|
||||
"""
|
||||
errors = []
|
||||
for proto in protos:
|
||||
if not _brief_doc(_doc_block(lines, proto["start"])):
|
||||
errors.append(f"{path}: {proto['name']} missing @brief")
|
||||
return errors
|
||||
|
||||
|
||||
def _doc_errors(path: Path, state: dict) -> list[str]:
|
||||
"""
|
||||
Apply the suffix-specific documentation rules.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
state : dict
|
||||
Scanner state with records and prototypes.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[str]
|
||||
Human-readable documentation errors.
|
||||
"""
|
||||
lines = state["lines"]
|
||||
if path.suffix == ".c":
|
||||
return _c_doc_errors(path, lines, state["records"])
|
||||
return _h_doc_errors(path, lines, state["protos"])
|
||||
|
||||
|
||||
def _dash_errors(path: Path) -> list[str]:
|
||||
"""
|
||||
Find em/en dashes in one file.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[str]
|
||||
Dash diagnostics.
|
||||
"""
|
||||
text = path.read_text(encoding="utf-8")
|
||||
errors = []
|
||||
if EN_DASH in text:
|
||||
errors.append(f"{path}: en dash U+2013 present")
|
||||
if EM_DASH in text:
|
||||
errors.append(f"{path}: em dash U+2014 present")
|
||||
return errors
|
||||
|
||||
|
||||
def _audit_file(path: Path) -> int:
|
||||
"""
|
||||
Audit one file and print its violations.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
|
||||
Returns
|
||||
-------
|
||||
int
|
||||
One when any violation was found, otherwise zero.
|
||||
"""
|
||||
state = _scan(path)
|
||||
blank = _blank_lines(path, state["records"])
|
||||
long = [r for r in state["records"] if r["count"] > MAX_EXEC_LINES]
|
||||
docs = _doc_errors(path, state)
|
||||
dashes = _dash_errors(path)
|
||||
_report(path, blank, long, docs, dashes)
|
||||
return int(bool(blank) or bool(long) or bool(docs) or bool(dashes))
|
||||
|
||||
|
||||
def _report(path: Path, blank: list, long: list, docs: list,
|
||||
dashes: list) -> None:
|
||||
"""
|
||||
Print one file's audit findings.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
path : pathlib.Path
|
||||
C or header source path.
|
||||
blank : list
|
||||
Blank line numbers inside bodies.
|
||||
long : list
|
||||
Functions over the executable-line limit.
|
||||
docs : list
|
||||
Documentation errors.
|
||||
dashes : list
|
||||
Dash errors.
|
||||
|
||||
Returns
|
||||
-------
|
||||
None
|
||||
"""
|
||||
if blank:
|
||||
print(f"{path}: blank lines in body {blank}")
|
||||
for record in long:
|
||||
print(f"{path}: {record['name']} has {record['count']} exec lines")
|
||||
for error in docs:
|
||||
print(error)
|
||||
for error in dashes:
|
||||
print(error)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
"""
|
||||
Audit all owned C and header files.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
None
|
||||
|
||||
Returns
|
||||
-------
|
||||
int
|
||||
Zero for a clean audit, otherwise one.
|
||||
"""
|
||||
failures = 0
|
||||
for path in _owned_files():
|
||||
failures += _audit_file(path)
|
||||
return int(bool(failures))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.2 MiB |
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,9 @@
|
||||
build/CMakeFiles/
|
||||
build/pico_sdk/
|
||||
build/pico-sdk/
|
||||
build/generated/
|
||||
build/_deps/
|
||||
build/*.o
|
||||
build/*.d
|
||||
build/*.obj
|
||||
!.vscode/*
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/src/common/pico_base_headers/include/pico.h",
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/14_2_Rel1/bin/arm-none-eabi-gcc.exe",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"cmake.showSystemKits": false,
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": false,
|
||||
"cmake.automaticReconfigure": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v3.31.5/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": true,
|
||||
"raspberry-pi-pico.useCmakeTools": false,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"files.associations": {
|
||||
"stdlib.h": "c"
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.2.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify reset exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Rescue Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getChip}-rescue.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; reset halt; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Risc-V Reset (RP2350)",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-c",
|
||||
"set USE_CORE { rv0 rv1 cm0 cm1 }",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/rp2350.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; init;",
|
||||
"-c",
|
||||
"write_memory 0x40120158 8 { 0x3 }; echo [format \"Info : ARCHSEL 0x%02x\" [read_memory 0x40120158 8 1]];",
|
||||
"-c",
|
||||
"reset halt; targets rp2350.rv0; echo [format \"Info : ARCHSEL_STATUS 0x%02x\" [read_memory 0x4012015C 8 1]]; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
|
||||
while (true)
|
||||
printf("hello, world\r\n");
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.2.0)
|
||||
set(toolchainVersion 14_2_Rel1)
|
||||
set(picotoolVersion 2.2.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico2 CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(0x0001_hello-world C CXX ASM)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(0x0001_hello-world 0x0001_hello-world.c )
|
||||
|
||||
pico_set_program_name(0x0001_hello-world "0x0001_hello-world")
|
||||
pico_set_program_version(0x0001_hello-world "0.1")
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(0x0001_hello-world 1)
|
||||
pico_enable_stdio_usb(0x0001_hello-world 0)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(0x0001_hello-world
|
||||
pico_stdlib)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(0x0001_hello-world PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(0x0001_hello-world)
|
||||
|
||||
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,469 @@
|
||||
:020000041000EA
|
||||
:10000000002008205D0100101B0100101D010010E0
|
||||
:100010001101001011010010110100101101001058
|
||||
:100020001901001019010010190100101F01001022
|
||||
:10003000110100101901001021010010230100100E
|
||||
:100040001101001011010010110100101101001028
|
||||
:100050001101001011010010110100101101001018
|
||||
:100060001101001011010010110100101101001008
|
||||
:1000700011010010110100101101001011010010F8
|
||||
:1000800011010010110100101101001011010010E8
|
||||
:1000900011010010110100101101001011010010D8
|
||||
:1000A00011010010110100101101001011010010C8
|
||||
:1000B00011010010110100101101001011010010B8
|
||||
:1000C00011010010110100101101001011010010A8
|
||||
:1000D0001101001011010010110100101101001098
|
||||
:1000E0001101001011010010110100101101001088
|
||||
:1000F0001101001011010010110100101101001078
|
||||
:100100001101001011010010110100101101001067
|
||||
:10011000EFF30580103800BE00BE00BE00BE00BE7A
|
||||
:1001200000BE00BEF2EB8871201B00104C1B0010BB
|
||||
:10013000A001001090A31AE7D3DEFFFF42012110B7
|
||||
:10014000FF010000B01B0000793512AB4FF000003A
|
||||
:100150001E49086006C881F3088810474FF05040D8
|
||||
:10016000006810B14FF00000F2E70DA40ECC00299A
|
||||
:1001700002D000F012F8F9E71549164A002000E015
|
||||
:1001800001C19142FCD11449884714498847144958
|
||||
:10019000884700BEFDE701C901C29A42FBD3704700
|
||||
:1001A0004C1B001010010020AC020020E81C0010C5
|
||||
:1001B0000000082000000820E81C001000100820A3
|
||||
:1001C00000100820000000007047000008ED00E06B
|
||||
:1001D000AC020020D80400207D130010350200106E
|
||||
:1001E00075130010F8B500BF064B0749C91A8910EE
|
||||
:1001F00048BF0131491003D0044B0BB101481847E7
|
||||
:10020000704700BFAC020020AC02002000000000DC
|
||||
:1002100008B5054B1BB105490548AFF30080BDE8A3
|
||||
:100220000840FFF7E1BF00BF00000000900400207D
|
||||
:10023000CC19001008B501F099F9024801F0DEF977
|
||||
:10024000FBE700BFCC19001010B44FF480740C4BC6
|
||||
:1002500053F8202003EB8003C00082F0400200F13D
|
||||
:10026000804003F5805C02F0C00200F5203003F509
|
||||
:100270004053CCF8002041601C605DF8044B70478F
|
||||
:10028000048003400FB400B583B0049C074801F01C
|
||||
:10029000B5F93CB105A92046019101F051F8044897
|
||||
:1002A00001F0ACF9012001F063F800BFDC19001087
|
||||
:1002B000EC19001070B58646EFF3108572B6124C3B
|
||||
:1002C000D4E8CF6F0120002EFAD1C4E8460F002EEB
|
||||
:1002D000F6D1BFF35F8F4FF0010CC80801F00703A0
|
||||
:1002E0000CFA03F31EF800C01CEA030608D14CEA1E
|
||||
:1002F000030C0EF800C0C4E88F6F85F3108870BD42
|
||||
:100300001046FFF7BFFF00BF3B040020044A1078EF
|
||||
:10031000431CDBB2182B28BF10231370704700BF9B
|
||||
:10032000280200204FF0E022936843F000539360CE
|
||||
:10033000704700BF0021044B03F12002C3E88F1F68
|
||||
:1003400001339342FAD17047300400204FF0E0238C
|
||||
:100350004FF08032C3F80024C3F80424C3F8082403
|
||||
:10036000C3F80C24C3F81024C3F81424C3F81824C9
|
||||
:10037000C3F81C24C3F82024C3F82424C3F8282479
|
||||
:10038000C3F82C24C3F8302462B67047012300F070
|
||||
:100390001F029340400941B1800000F1604000F528
|
||||
:1003A0006140C0F8803103607047024A203042F853
|
||||
:1003B0002030704700E100E0F8B50D46EFF31087FC
|
||||
:1003C00072B6124ED6E8CF2F0123002AFAD1C6E822
|
||||
:1003D000423F002AF6D1BFF35F8F0D4B00F11004AE
|
||||
:1003E0009B680C4A53F82430934203D0994201D0C1
|
||||
:1003F00000F08EFE064B9B6843F82450BFF35F8FDE
|
||||
:100400000023C6E88F3F87F31088F8BD3904002029
|
||||
:1004100000ED00E0110100102DE9F04F83B0EFF383
|
||||
:10042000108A72B6714ED6E8CF2F0123002AFAD176
|
||||
:10043000C6E8423F002AF6D1BFF35F8F6C4B00F154
|
||||
:1004400010089B686B4A53F82850954245D08D425E
|
||||
:100450000C4650D0684FEB1B2F2B3ED801214FEAA2
|
||||
:1004600050194FEA890909F1604909F5614900F01D
|
||||
:100470001F0301FA03F0D9F80030C9F8800000EA40
|
||||
:10048000030BBFF35F8FEFF30581C9B2002934D0AE
|
||||
:10049000884505D0CDE9001000F03AFEDDE90010F6
|
||||
:1004A00025F0010EDEF808C0644505D189E0D3F8D7
|
||||
:1004B00008C0644531D09E469EF9062002EB4203F7
|
||||
:1004C000002A07EB8303F2DA644561D0BBF1000F29
|
||||
:1004D00020D0C9F88001C9F80000454B9B6843F85B
|
||||
:1004E0002850BFF35F8F0023C6E88F3F8AF3108840
|
||||
:1004F00003B0BDE8F08F1546EFE725F0010EDEF8FA
|
||||
:1005000008C06445D8D19EF906407346002C08DA2D
|
||||
:10051000154646E0C9F88000DFE793F90640002C55
|
||||
:1005200037DB04EB440C07EB8C0C9CF80710DCF871
|
||||
:100530000820D9719A609CF906206100002A9A71FE
|
||||
:100540003DDBBCF804E05FEA4E5E05D50EF5FF1E0C
|
||||
:100550000EF5FF5E0EF11F0E6FF0070C0A194FEA41
|
||||
:100560006E5E920002EB4E0208323A44ACEB030C92
|
||||
:100570006244C2F34A026FEAC2426FEAD2429A80F0
|
||||
:100580001E4B21441A7807EB81011C708A719DE78C
|
||||
:100590007346D9B9FF228EF806204BF60152AEF809
|
||||
:1005A0000420164C4AF6AA2294F800C01946C91B2A
|
||||
:1005B00049414A43120D83F806C0227086E7104A6B
|
||||
:1005C000DDE79EF906407346002CAADA0D4A0E4C70
|
||||
:1005D000D21A083AC2F30A316FEA01516FEA115197
|
||||
:1005E00044EA5202DA80998070E700BF39040020A3
|
||||
:1005F00000ED00E0110100102C020020D4040020C6
|
||||
:1006000001BDFFFF6602002000F8FFFFF0B5EFF329
|
||||
:100610000585EDB2EFF3108C72B62649D1E8CF2FE5
|
||||
:100620000123002AFAD1C1E8423F002AF6D1BFF3E4
|
||||
:100630005F8F214E40F0010EB4684AF6AA2354F8A9
|
||||
:1006400025701E4A0446A41A644163431B0D774576
|
||||
:100650005BB21BD092F906409C421CD092F912402A
|
||||
:100660009C4223D092F91E409C4221D092F92A400C
|
||||
:100670009C4208BF03240FD0114A00241578137040
|
||||
:100680008571C1E88F4F8CF31088F0BDB2680D4CB6
|
||||
:1006900042F82540F0E7002404EB440402EB840216
|
||||
:1006A000FF2494714BF601549480E5E70124F3E7AD
|
||||
:1006B0000224F1E73904002000ED00E02C020020C4
|
||||
:1006C000D404002011010010014B0B44036070475B
|
||||
:1006D0003004002070B5104C104DAC420ED2FF26F5
|
||||
:1006E000236863B1FFF712FE01462046FFF7ECFFD7
|
||||
:1006F000A680BFF35F8F0834AC42F1D370BDFFF723
|
||||
:1007000005FE01462046FFF7DFFF2671BFF35F8F2E
|
||||
:100710000834AC42E4D370BDA4020020AC02002037
|
||||
:100720000D4B1A68EFF3108172B6D2E8CFCF0120DB
|
||||
:10073000BCF1000FF9D1C2E84C0FBCF1000FF4D1AD
|
||||
:10074000BFF35F8F00221B68C3E88F2F81F31088EF
|
||||
:1007500040BF002000217047C804002000000000B6
|
||||
:100760002DE9F04F2DED028B85B0EFF30583DBB261
|
||||
:10077000103B9A0818BF01224FF0010103F0030B50
|
||||
:1007800018BFAF4DAF4B08BFAF4D0BEB820253F814
|
||||
:10079000226001FA0BF205F541539FEDA78B019200
|
||||
:1007A0005A602FE0B3881C0440F19380B379002B8A
|
||||
:1007B00040F0DD80B6F90820002AC0F21E8173697E
|
||||
:1007C00002EB420203EBC203D3E90247B7F1FF3F5A
|
||||
:1007D00008BFB4F1FF3F0ED005EB8B01AB6A0A698D
|
||||
:1007E000D21AE31A934205D301232A6A03FA0BF3C0
|
||||
:1007F000134200D10C61284600F0CAFAA042B94168
|
||||
:10080000C0F2FB80B6F90830019A002B0093EA632E
|
||||
:10081000C8DBD6F8148003EB4309284608EBC90768
|
||||
:10082000D7E9024A00F0B4FAA04271EB0A01B9DB41
|
||||
:10083000BAF1000FC0F2C380D7E90431834A934272
|
||||
:1008400000F0ED807A88B6F9080092B242EA0040E2
|
||||
:10085000984702460B4652EA030100F0B080002B95
|
||||
:1008600080F2D180B4EB020E6AEB030A38F939301A
|
||||
:10087000C7E902EA002B95DB716903EB430201EB48
|
||||
:10088000C202D2E90270BE457AEB000C4FEA430285
|
||||
:1008900088DBB4462CF8083F06E003EB430001EB8D
|
||||
:1008A000C0005A00D0E90270BE451A447AEB00003D
|
||||
:1008B00001EBC20404DB31F93230A446002BECDA40
|
||||
:1008C00028F83930009BACF80030B3881C043FF5A1
|
||||
:1008D0006DAF3369EFF3108272B6D3E8CF0F012109
|
||||
:1008E0000028FAD1C3E8401F0028F6D1BFF35F8F7C
|
||||
:1008F0004FF6FF74B0880023316900B2B480C1E8BC
|
||||
:100900008F3F82F310889842FFF650AF0746A94602
|
||||
:10091000746906F1080807EB470E04EBCE03D3E930
|
||||
:100920000250B6F90830C446002B13DBB2460097DC
|
||||
:1009300004E034F936309446002B09DB03EB430620
|
||||
:1009400004EBC602D2E90271BD4270EB0101F0DA9C
|
||||
:100950005646009FACF8007034F93E7024F83E30E3
|
||||
:10096000002FD8DAB3794D46002B3FF423AF002394
|
||||
:10097000B371B6F9083006F10808581C3DD01A4684
|
||||
:10098000776903E08046591C3FF416AF03EB43013F
|
||||
:1009900007EBC100B0F802C01C461CF4004F9E4695
|
||||
:1009A00037F93130EED0944280ED028B05D0A8F8B3
|
||||
:1009B0000030328927F8312034817246E3E738F875
|
||||
:1009C000393033813369EFF3108272B6D3E8CF0F39
|
||||
:1009D00001210028FAD1C3E8401F0028F6D1BFF357
|
||||
:1009E0005F8F7388316928F83930009B738000234A
|
||||
:1009F000C1E88F3F82F31088D4E640BF05B0BDEC5C
|
||||
:100A0000028BBDE8F08F2846CDE9022300F0C0F943
|
||||
:100A1000029A039B10EB020E43EB010A26E70846FD
|
||||
:100A20000B69029198470028C9D00299D1E90023A7
|
||||
:100A300011E700BFAFF30080FFFFFFFFFFFFFFFFE5
|
||||
:100A400000800B40A804002000000B40610700104C
|
||||
:100A50002DE9F84F364C25692DB1BDE8F84F0A2134
|
||||
:100A60003448FFF731BEDFF8E4800321404600F050
|
||||
:100A70007DF90326C4F80C80FFF748FC4FF0504C7A
|
||||
:100A80002D4B267003442361DCF800300F21637086
|
||||
:100A9000636961801D834FF00405A3F878504FF01F
|
||||
:100AA0000505A3F890504FF00605A3F8A8504FF0A5
|
||||
:100AB00007050E214FF6FF7208274FF00A0EA3F824
|
||||
:100AC000C0504FF001094FF00C0C4FF0020B4FF0EB
|
||||
:100AD000090A0D204FF00B05A3F868111749A280F1
|
||||
:100AE000A3F808E1A160A3F848B0A3F8F0A0A3F828
|
||||
:100AF0002051A3F838C1A3F85001A3F83090A3F80F
|
||||
:100B00006060A3F8D8701A800D4B3046C8F820708A
|
||||
:100B10000C49DC60FFF750FC49463046FFF736FCD5
|
||||
:100B2000094B0A211F640348BDE8F84FFFF7CCBD0D
|
||||
:100B300074020020C804002030040020FFFF1000D1
|
||||
:100B4000A80400206107001000200B4000000B40AB
|
||||
:100B50000146F0B50069EFF3108772B6D0E8CF5FB9
|
||||
:100B60000124002DFAD1C0E8454F002DF6D1BFF386
|
||||
:100B70005F8FB1F902E04C690EEB4E0CBEF1000F35
|
||||
:100B80004FEACC05086904EBCC0C3CDB665B4E807D
|
||||
:100B90000026C0E88F6F87F31088BCF80200CCE90C
|
||||
:100BA00002230130C0F30E00012838BF0120059B4D
|
||||
:100BB000ACF80200CCF81030069B40EA0E40CCF8AE
|
||||
:100BC00014300B69EFF3108272B6D3E8CFCF012750
|
||||
:100BD000BCF1000FF9D1C3E84C7FBCF1000FF4D198
|
||||
:100BE000BFF35F8F8B886353A1F804E00B69C3E800
|
||||
:100BF0008F6F82F310880122CB68097803F50153C7
|
||||
:100C00008A405A60F0BD0023C0E88F3F87F3108808
|
||||
:100C10004FF0FF30F0BD00BF03464089B0EB214FDD
|
||||
:100C200037DD58690A1402EB420210B500EBC2002E
|
||||
:100C30001C69EFF3108C72B6D4E8CFEF0122BEF13D
|
||||
:100C4000000FF9D1C4E84E2FBEF1000FF4D1BFF36D
|
||||
:100C50005F8F428889B292B28A4207D000221B6914
|
||||
:100C6000C3E88F2F8CF31088002010BD42F400429F
|
||||
:100C700042800121002218699971C0E88F2F8CF3FE
|
||||
:100C800010881C78DA68084602F50153A1405960C3
|
||||
:100C900010BD0020704700BF2DE9F04306460D4609
|
||||
:100CA00083B0EFF30584E4B23CB12D4B5A6AAA42FB
|
||||
:100CB0001CD2002003B0BDE8F0832A4FD7F80C9077
|
||||
:100CC00097F80080484600F063F808F1040859F8E6
|
||||
:100CD00028301B1A301A65EB0101984271F10001AE
|
||||
:100CE00010DB20BF1E4B5A6AAA42E2D314BF012474
|
||||
:100CF00000249B6AB34234BF204644F0010003B095
|
||||
:100D0000BDE8F08300F04CF8864265EB0101002954
|
||||
:100D100014DB154B3846CDE9003432462B46FFF73D
|
||||
:100D200017FF011E0ADD0E4B5A6AAA4216D39B6AB0
|
||||
:100D3000B34211D30B48FFF76FFFB6E7084B5C6A6D
|
||||
:100D4000AC42B6D3641B18BF01249B6AB34234BFC4
|
||||
:100D5000204644F00100ADE7AA42EBD120BFE9E70D
|
||||
:100D600000000B40740200202107001010B4054B56
|
||||
:100D7000054C064AA04214BF1846581C5DF8044BA7
|
||||
:100D8000FFF798BA5804002000800B40F0190010BB
|
||||
:100D90000346416A0A46986A596A8A42FAD17047FC
|
||||
:100DA000034B596A0A46986A596A9142FAD17047C8
|
||||
:100DB00000000B4030B4154A536A9C46946A536A4B
|
||||
:100DC0006345FAD1021959414FF0000528BF0125AA
|
||||
:100DD0000E4B5B6AB5B15A1C08BF1A4608D04FF0DB
|
||||
:100DE000FF310A460948436A8B42FCD38B4207D144
|
||||
:100DF000064902E0486A984202D1886A9042F9D3D3
|
||||
:100E000030BC70479942EDD8F0E700BF00000B40BE
|
||||
:100E1000F8B5054606200E4600F0E4F8002842D05A
|
||||
:100E2000354A3648954214BF4FF080624FF0006259
|
||||
:100E3000334B344902601A608C6832EA0404FBD1F7
|
||||
:100E40002D4B4FF48071EB1AB3FA83F32E4A5B09F2
|
||||
:100E5000062022F8131000F0C5F8C300B3FBF6F328
|
||||
:100E60000133DA0920D1402601216962AA622F6B81
|
||||
:100E7000FB0722D42B46002253F82C1F062003F533
|
||||
:100E8000805422602F6300F0ADF840F2013103225C
|
||||
:100E90008000B0FBF6F0EB6A83F0700303F07E0392
|
||||
:100EA00023602963AA64F8BD4FF6FE718A421BD9FC
|
||||
:100EB00022464FF6FF71154ED7E740F2013205F595
|
||||
:100EC00040531A636B6AAC6A062004EB831400F08B
|
||||
:100ED00089F80F4BA402A3FB0023DB0A0021B4FB1B
|
||||
:100EE000F3F0FFF767FFC5E7C3F34503114603EBD4
|
||||
:100EF00082161A46B9E700BF008007400020024072
|
||||
:100F00000030024000000240CC040020C0FF3F003F
|
||||
:100F1000757B2B8F00EB400C4FEA8C0C0CF1804C56
|
||||
:100F20000CF5803CF0B51646DCF80420051FB2F540
|
||||
:100F3000803F38BF4FF48032EDB238BFCCF8042088
|
||||
:100F4000012D2AD94FF40067254C0CF5405217604B
|
||||
:100F500054F82020B2B9DCF80020012D82EA4612B4
|
||||
:100F600002F0E0020CF5805632602AD94FF400619D
|
||||
:100F700044F820304FF480330CF500521160CCF867
|
||||
:100F80000430F0BD6769B7FBF2FE0EF1010E0EEB07
|
||||
:100F90004E0EBEF1030EFCD2DDE70129D2D10324AF
|
||||
:100FA0000CF540521460DCF80820D207FBD5DCF8C1
|
||||
:100FB00000200B4C82EA461202F0E0020CF580564B
|
||||
:100FC00032600122DCF800504D4005F00305356029
|
||||
:100FD00002FA01F1DCF808200A42FBD0C6E700BFA4
|
||||
:100FE0005C040020014B53F8200070475C04002093
|
||||
:100FF00070B4039D04682D0345EA03451B4B002C88
|
||||
:10100000B3FBF1F3B2FBF3F61FDB194A194B904225
|
||||
:1010100014BF4FF480424FF40042174C1A6003F59E
|
||||
:1010200080531A60A36832EA0303FBD1212200F542
|
||||
:1010300040530433016086601A600268002AFCDABB
|
||||
:101040000822C5601A6070BC7047036803F03F0354
|
||||
:101050008B42DAD18368C3F30B03B342D5D1C368A3
|
||||
:1010600003F4EE23AB42D0D1EDE700BF001BB70085
|
||||
:10107000008005400020024000000240012300EBF8
|
||||
:101080004000800000F1804000F584104160036062
|
||||
:10109000704700BF0023DB8A002242E800F25202C0
|
||||
:1010A00001D4102118470421184700BF034AD2F881
|
||||
:1010B0002838002BFBD0BFF35F8F704700000E4035
|
||||
:1010C0000021044B044ABFF35F8F43F8041B934293
|
||||
:1010D000F9D170470C080E402C080E4010B44FF4A4
|
||||
:1010E0008D704FF42A64064A064B07491460D0609D
|
||||
:1010F00019605368002BFCDA5DF8044B704700BFA1
|
||||
:101100000080044000A0044000B0FA00704700BF17
|
||||
:1011100008B50148FFF7B6F8141A001038B5054CA9
|
||||
:10112000054DAC4204D254F8043B9847AC42FAD384
|
||||
:1011300038BD00BF88190010C819001010B4074846
|
||||
:10114000074C084B084A094904601A608B6832EA68
|
||||
:101150000303FBD15DF8044B704700BF0020024041
|
||||
:101160007F3BEFEF00300240F6FFF3030000024048
|
||||
:10117000044BDB6CB3F5004F03D14FF48022024BDC
|
||||
:10118000DA64704700001150002011504FF0E02247
|
||||
:10119000044BD2F8881D0B43C2F8883D10EE300492
|
||||
:1011A000704700BF030330006FF06041044B054AF5
|
||||
:1011B00019609368DB4333F06043FAD1704700BF96
|
||||
:1011C000003002400000024010B545F25320FFF706
|
||||
:1011D00061FFBDE8104003460420184710B545F2F2
|
||||
:1011E0005320FFF757FFBDE8104003460120184782
|
||||
:1011F000FFF7A0B81449154B70B55C1AA610442E21
|
||||
:10120000324628BF4422124D9200284600F00EFBC1
|
||||
:10121000B4F5867F13D80F4AC6F1440012D02B19BB
|
||||
:10122000410803EBC101C3E9002208338B42FAD124
|
||||
:10123000C30704D520F00100304445F82020064BB8
|
||||
:101240009D6070BD4320F8E7000000101001001001
|
||||
:10125000000000201101001000ED00E0002370B537
|
||||
:101260002B4C82B0C4F88430FFF738FF0122294BA1
|
||||
:10127000DA63636C012BFCD10321264A244B1163F2
|
||||
:101280009C6B012CFCD10226052521460523224A10
|
||||
:1012900022480096FFF7ACFE21462B46204A214803
|
||||
:1012A0000095FFF7A5FE0022042031461E4BFFF7F4
|
||||
:1012B00031FE2146284600221C4BFFF72BFE002260
|
||||
:1012C000082011461A4BFFF725FE0022092011467F
|
||||
:1012D000174BFFF71FFE002206201146134BFFF7A6
|
||||
:1012E00019FE0022114B07201146FFF713FE0420C0
|
||||
:1012F000FFF778FE00240F4BA3FB0035AD0CE0B2E6
|
||||
:1013000029460134FFF7BAFE062CF8D102B070BDB1
|
||||
:101310000000014000300140002F685900000540E6
|
||||
:10132000008C864700800540001BB70080D1F00884
|
||||
:10133000006CDC0283DE1B4300B9704700F01CB96F
|
||||
:1013400010B5094B84B01C684CB1034600914FF0B6
|
||||
:10135000FF3203A90548A047012004B010BD00F0EA
|
||||
:101360004DF9204604B010BD8C0400203913001044
|
||||
:1013700000BEFDE708B5FFF7FBFF00BF38B5064C20
|
||||
:10138000064DFFF7CBFEAC4204D254F8043B98471D
|
||||
:10139000AC42FAD338BD00BFC8190010CC190010F8
|
||||
:1013A00003680846114618472DE9F0411546427D6D
|
||||
:1013B00007468846002A46D0002D1DDD0B780A2BF3
|
||||
:1013C00023D0012D4FF0000C18D04646012416F80A
|
||||
:1013D000012F21460A2A04F1010422D0A542F6D1A8
|
||||
:1013E00065450BDC08EB050313F8013CA3F10D0385
|
||||
:1013F000B3FA83F35B093B75BDE8F0813B68A5EB6D
|
||||
:101400000C0108EB0C009847ECE7037D002BD8D1CA
|
||||
:10141000036802210F489847012DE3D04FF0010CDB
|
||||
:10142000D3E716F8013C0D2BD8D08C4508EB0C0007
|
||||
:10143000A1EB0C0101DA3B689847022105483B68A3
|
||||
:101440009847A446CAE7294640463B68BDE8F041B4
|
||||
:10145000184700BFF81A00102DE9F04782B00D467A
|
||||
:1014600091461C460646FFF79BFC4FF0FF3C6FF091
|
||||
:1014700000472E4A821841F10003944577EB03019F
|
||||
:101480003CBF62463B462A4800F07AFA6B1C804615
|
||||
:1014900040D00CB3274F284B1C68B4B1B9F1000FF2
|
||||
:1014A0001CD1DFF89C9001E0246974B12368002B03
|
||||
:1014B000FAD0D9F800300BB19C42F5D120462A462B
|
||||
:1014C0003146B8472469002CF0D1B8F1000F26D17D
|
||||
:1014D000284602B0BDE8F087184FDCE74FF00A0A53
|
||||
:1014E000DFF85C9002E02469002CEED02368002B2A
|
||||
:1014F000F9D0D9F800300BB1A342F4D12A463146D5
|
||||
:101500002046B847012220460DF107018DF807A0BB
|
||||
:10151000B847E8E7304600F0FFF90546B9E7044868
|
||||
:1015200000F02AFA284602B0BDE8F08740420F00DA
|
||||
:10153000A4020020A913001084040020A1130010AD
|
||||
:1015400088040020084A136823B90AE003F1100256
|
||||
:101550001B6933B18342F9D129B918691060196147
|
||||
:10156000704701B1106070478404002008B500F096
|
||||
:1015700033F9012008BD00BFF0B583B006468DF8F1
|
||||
:101580000700FFF70DFC4FF0FF356FF00044174ADE
|
||||
:10159000821841F10003954274EB03013CBF2346DE
|
||||
:1015A0002A46134800F0ECF9124B07461C689CB120
|
||||
:1015B000114D01E024697CB12368002BFAD02B681F
|
||||
:1015C0000BB19C42F6D1204601220DF10701FFF735
|
||||
:1015D000EBFE2469002CEFD117B9304603B0F0BD03
|
||||
:1015E000034800F0C9F9304603B0F0BD40420F0097
|
||||
:1015F000A4020020840400208804002038B504469A
|
||||
:1016000000F08AF9012305461A4620462946FFF7CD
|
||||
:1016100023FF084B1C682CB163682BB198472469E1
|
||||
:10162000002CF9D1284638BD2469002CF4D1284675
|
||||
:1016300038BD00BF84040020B1F1000C1DDD0F4A4D
|
||||
:101640000F4B126830B5D31AB3FA83F30D240D4D46
|
||||
:101650005B09411E35F913E08C4411F8010F8645F2
|
||||
:1016600006D093699B06FCD461451060F5D130BD6E
|
||||
:1016700093699D06FCD41460F3E77047D004002002
|
||||
:1016800000800740CC040020224BB1F1000C10B4C4
|
||||
:101690001C682EDD034600201F4A591E12689369FC
|
||||
:1016A000DB0617D401309369DB06FCD4136884454C
|
||||
:1016B00001F8013FF3D14CB150211346916353F827
|
||||
:1016C000342F02F0380203F580531A6060465DF84B
|
||||
:1016D000044B70474CB150211346916353F8342F9B
|
||||
:1016E00002F0380203F580531A6078B15DF8044BBC
|
||||
:1016F00070475CB1084B50211A681346916353F848
|
||||
:10170000342F02F0380203F580531A606FF00200A4
|
||||
:10171000DDE700BF50040020D0040020054B1B680B
|
||||
:1017200033B10021044A05481268006891631847E4
|
||||
:10173000704700BF50040020D00400205404002053
|
||||
:10174000024B1A6893691B07FCD47047D004002031
|
||||
:10175000F8B51C4F1C4D3A681C4EAA4214BF2125F7
|
||||
:1017600022250446D6F800C018B1BCF1000F10D0F5
|
||||
:10177000F8BDBCF1000FFBD0014690632846FEF790
|
||||
:1017800005FE28461249FEF747FE124B34601C60E6
|
||||
:10179000F8BD0B460F4A0E49306028461360FEF72D
|
||||
:1017A0000BFE01212846FEF7F1FD3A685021134651
|
||||
:1017B000916353F8342F02F0380203F580531A6016
|
||||
:1017C000F8BD00BFD0040020008007405004002076
|
||||
:1017D0001D1700105404002010B50E490E4C0F4880
|
||||
:1017E0000F4A104B007821600020022112781B78EC
|
||||
:1017F000FEF72AFD02210120FEF726FD4FF4E1311C
|
||||
:101800002068FFF705FBBDE8104001210648FFF7FF
|
||||
:1018100099BE00BF00000740D0040020481B001004
|
||||
:10182000441B0010401B00108C020020844641EA3B
|
||||
:10183000000313F0030349D1403A23D30B6803603C
|
||||
:101840004B6843608B688360CB68C3600B6903613E
|
||||
:101850004B6943618B698361CB69C3610B6A036226
|
||||
:101860004B6A43628B6A8362CB6AC3620B6B03630E
|
||||
:101870004B6B43638B6B8363CB6BC36340304031F3
|
||||
:10188000403ADBD230320BD30B6803604B684360C5
|
||||
:101890008B688360CB68C36010301031103AF3D28C
|
||||
:1018A0000C3205D351F8043B40F8043B043AF9D21A
|
||||
:1018B000043208D0D2071CBF11F8013B00F8013BED
|
||||
:1018C00001D30B8803806046704700BF082A13D3FA
|
||||
:1018D0008B07B1D010F00303AED0C3F10403D21ACA
|
||||
:1018E000DB071CBF11F8013B00F8013BA4D331F822
|
||||
:1018F000023B20F8023B9FE7043AD9D3013A11F8A2
|
||||
:10190000013B00F8013BF9D20B7803704B78437030
|
||||
:101910008B7883706046704720F0030110F003005D
|
||||
:10192000C0F1000051F8043B00F1040C4FEACC0C6C
|
||||
:101930006FF000021CBF22FA0CF213434FF0010CAF
|
||||
:101940004CEA0C2C4CEA0C4CA3EB0C0222EA0302EE
|
||||
:1019500012EACC1204BF51F8043B0430F4D0C2F1B7
|
||||
:10196000000102EA0102B2FA82F2C2F11F0200EBA8
|
||||
:10197000D2007047F8B500BF5FF800F0E501002025
|
||||
:101980005FF800F07D010020C91100103D1100102A
|
||||
:10199000711100105D120010A9110010C11000108B
|
||||
:1019A000F1110010AD100010D5060010F511001057
|
||||
:1019B000510A00100D110010DD1100108D110010E2
|
||||
:0C19C000250300104D0300101102001060
|
||||
:1019CC0068656C6C6F2C20776F726C640D00000076
|
||||
:1019DC000A2A2A2A2050414E4943202A2A2A0A0040
|
||||
:1019EC000A000000486172647761726520616C6165
|
||||
:1019FC00726D20256420616C726561647920636C62
|
||||
:101A0C0061696D65640000004861726420617373E4
|
||||
:101A1C006572740052656C6561736500626F6F74FA
|
||||
:101A2C00325F77323571303830000000302E3100A3
|
||||
:101A3C00322E322E300000007069636F32000000CD
|
||||
:101A4C003078303030315F68656C6C6F2D776F7229
|
||||
:101A5C006C6400004F637420313720323032360012
|
||||
:101A6C005541525420737464696E000055415254B0
|
||||
:101A7C00207374646F7574005541525420737464F0
|
||||
:101A8C00696E202F207374646F75740006005250B9
|
||||
:101A9C00D3F07542201A001006005250E182887F64
|
||||
:101AAC00281A0010060052503ABCA911381A00101E
|
||||
:101ABC0006005250ABB360533C1A00100600525053
|
||||
:101ACC00BBFF3CB6441A001006005250861C0302A1
|
||||
:101ADC004C1A0010060052505422A29D601A00109D
|
||||
:101AEC0005005250DE65F468FC1C00100D0A000065
|
||||
:101AFC000600525053B4F4A1841A0010080052503E
|
||||
:0C1B0C001200000008005250921000006F
|
||||
:081B180014FDFF7F0100000035
|
||||
:101B2000981A0010A41A0010B01A0010BC1A001065
|
||||
:101B3000C81A0010D41A0010E01A0010EC1A001095
|
||||
:0C1B4000101B0010081B0010FC1A001005
|
||||
:101B4C004FF050412DE9F0410027044616461D4642
|
||||
:101B5C00D1F8008008E0C1E88F7F8CF31088304604
|
||||
:101B6C00294600F075F8E8B92168EFF3108C72B6CD
|
||||
:101B7C00D1E8CF2F0123002AFAD1C1E8423F002A35
|
||||
:101B8C00F6D1BFF35F8F94F904302168002BE2DAB1
|
||||
:101B9C00002384F80480C1E88F3F8CF31088012067
|
||||
:101BAC00BDE8F0810020BDE8F08100BF30B50468CD
|
||||
:101BBC00EFF3108C72B6D4E8CFEF0125BEF1000F15
|
||||
:101BCC00F9D1C4E84E5FBEF1000FF4D1BFF35F8FC3
|
||||
:101BDC0090F904400568002C10DB0021C5E88F1F2C
|
||||
:101BEC008CF310884FF0504595F90050A54201D167
|
||||
:101BFC00084630BDBDE83040FFF7A2BF4FF0504261
|
||||
:101C0C00126800230271C5E88F3F8CF31088012005
|
||||
:101C1C0030BD00BF0368EFF3108272B6D3E8CFCFAC
|
||||
:101C2C000121BCF1000FF9D1C3E84C1FBCF1000F2E
|
||||
:101C3C00F4D1BFF35F8F4FF0FF0C0023016880F8E5
|
||||
:101C4C0004C0C1E88F3F82F3108840BF704700BFCB
|
||||
:101C5C005FF800F0990C001010000000000000006C
|
||||
:101C6C000000010000000000000000000000020065
|
||||
:101C7C000000000000000000000003000000000055
|
||||
:101C8C00000000000000FF000000000001B54868E3
|
||||
:101C9C0001318E460047704609380149884701BD1D
|
||||
:101CAC000D06001000000000000000000000000005
|
||||
:101CBC000000000000000000B002002039160010E7
|
||||
:101CCC004117001089160010511700100000000079
|
||||
:0C1CDC00000100000000000000000000FB
|
||||
:101CE800D3DEFFFFFE010000FF01000050E4FFFF0C
|
||||
:041CF800793512AB7D
|
||||
:040000051000014D99
|
||||
:00000001FF
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = (4 * 1024 * 1024)
|
||||
@@ -0,0 +1,121 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
# following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
# disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
else ()
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
@@ -0,0 +1,9 @@
|
||||
build/CMakeFiles/
|
||||
build/pico_sdk/
|
||||
build/pico-sdk/
|
||||
build/generated/
|
||||
build/_deps/
|
||||
build/*.o
|
||||
build/*.d
|
||||
build/*.obj
|
||||
!.vscode/*
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.3.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h",
|
||||
"${userHome}/.pico-sdk/sdk/2.3.0/src/common/pico_base_headers/include/pico.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/15_2_Rel1/bin/arm-none-eabi-gcc.exe",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"debuggerArgs": ["-ex", "set debug-file-directory /debug"],
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.3.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"debuggerArgs": ["-ex", "set debug-file-directory /debug"],
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.3.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"cmake.showSystemKits": false,
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"variant": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"buildTarget": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": false,
|
||||
"cmake.automaticReconfigure": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v4.3.4/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.3.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/15_2_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/15_2_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.3.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v4.3.4/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.13.2;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.3.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/15_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/15_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.3.0/picotool:${env:HOME}/.pico-sdk/cmake/v4.3.4/bin:${env:HOME}/.pico-sdk/ninja/v1.13.2:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.3.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/15_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/15_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.3.0/picotool:${env:HOME}/.pico-sdk/cmake/v4.3.4/bin:${env:HOME}/.pico-sdk/ninja/v1.13.2:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": true,
|
||||
"raspberry-pi-pico.useCmakeTools": false,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v4.3.4/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.13.2/ninja"
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.13.2/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.13.2/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.3.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.3.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify reset exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Rescue Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getChip}-rescue.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; reset halt; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "RISC-V Reset (RP2350)",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-c",
|
||||
"set USE_CORE { rv0 rv1 cm0 cm1 }",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/rp2350.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; init;",
|
||||
"-c",
|
||||
"write_memory 0x40120158 8 { 0x3 }; echo [format \"Info : ARCHSEL 0x%02x\" [read_memory 0x40120158 8 1]];",
|
||||
"-c",
|
||||
"reset halt; targets rp2350.rv0; echo [format \"Info : ARCHSEL_STATUS 0x%02x\" [read_memory 0x4012015C 8 1]]; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
stdio_init_all();
|
||||
|
||||
while (true) {
|
||||
__asm volatile(
|
||||
// Save a low register and the link register.
|
||||
"push {r4, lr}\n"
|
||||
// Intentionally unordered: the encoded list is still r2, r3, r6.
|
||||
"push {r3, r2, r6}\n"
|
||||
// Thumb PUSH cannot encode high registers r8-r12.
|
||||
"stmdb sp!, {r9, r10}\n"
|
||||
// Restore each group in reverse order to return SP to its start.
|
||||
"ldmia sp!, {r9, r10}\n"
|
||||
"pop {r2, r3, r6}\n"
|
||||
"pop {r4, lr}\n"
|
||||
::: "memory");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.3.0)
|
||||
set(toolchainVersion 15_2_Rel1)
|
||||
set(picotoolVersion 2.3.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico2 CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(0x0001a_stack C CXX ASM)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(0x0001a_stack 0x0001a_stack.c )
|
||||
|
||||
pico_set_program_name(0x0001a_stack "0x0001a_stack")
|
||||
pico_set_program_version(0x0001a_stack "0.1")
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(0x0001a_stack 1)
|
||||
pico_enable_stdio_usb(0x0001a_stack 0)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(0x0001a_stack
|
||||
pico_stdlib)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(0x0001a_stack PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(0x0001a_stack)
|
||||
|
||||
Executable
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Executable
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,478 @@
|
||||
:020000041000EA
|
||||
:10000000002008205B0100101B0100101D010010E2
|
||||
:100010001101001011010010110100101101001058
|
||||
:100020001901001019010010190100101F01001022
|
||||
:10003000110100101901001021010010230100100E
|
||||
:100040001101001011010010110100101101001028
|
||||
:100050001101001011010010110100101101001018
|
||||
:100060001101001011010010110100101101001008
|
||||
:1000700011010010110100101101001011010010F8
|
||||
:1000800011010010110100101101001011010010E8
|
||||
:1000900011010010110100101101001011010010D8
|
||||
:1000A00011010010110100101101001011010010C8
|
||||
:1000B00011010010110100101101001011010010B8
|
||||
:1000C00011010010110100101101001011010010A8
|
||||
:1000D0001101001011010010110100101101001098
|
||||
:1000E0001101001011010010110100101101001088
|
||||
:1000F0001101001011010010110100101101001078
|
||||
:100100001101001011010010110100101101001067
|
||||
:10011000EFF30580103800BE00BE00BE00BE00BE7A
|
||||
:1001200000BE00BEF2EB8871601A00108C1A00103D
|
||||
:100130009C01001090A31AE7D3DEFFFF42012110BB
|
||||
:10014000FF0100003C1C0000793512AB00201E4965
|
||||
:10015000086006C881F3088810474FF050400068D7
|
||||
:1001600008B10020F3E70DA40ECC002902D000F066
|
||||
:1001700012F8F9E71549164A002000E001C1914242
|
||||
:10018000FCD114498847144988471449884700BE60
|
||||
:10019000FDE701C901C29A42FBD370478C1A0010D7
|
||||
:1001A00010010020F8030020741D0010000008203A
|
||||
:1001B00000000820741D0010001008200010082006
|
||||
:1001C000000000007047000008ED00E0F803002088
|
||||
:1001D0000806002095130010E10100108D13001097
|
||||
:1001E00008B501F0D7F910B54CB42DE90006BDE80B
|
||||
:1001F00000064CBCBDE81040F5E700BF4FF4807C22
|
||||
:100200000C4B00B553F8202003EB8003C00082F0B4
|
||||
:10021000400200F1804003F5805E02F0C00200F56C
|
||||
:10022000203003F54053CEF800204160C3F800C0F1
|
||||
:1002300000BD00BF048003400FB400B5084883B080
|
||||
:1002400001F0F0F9049B3BB105A91846019101F0BA
|
||||
:1002500081F8044801F0E6F9012001F093F800BFAD
|
||||
:10026000201900103019001070B51646EFF31084F5
|
||||
:1002700072B6DFF848E0DEE8CF2F0123002AFAD17A
|
||||
:10028000CEE8423F002AF6D1BFF35F8F012301F091
|
||||
:10029000070CCA0803FA0CF310F802C01CEA0305A5
|
||||
:1002A00008D14CEA030C00F802C0CEE88F5F84F35B
|
||||
:1002B000108870BD3046FFF7BFFF00BF83050020E8
|
||||
:1002C000044A1078431CDBB2182B28BF102313708C
|
||||
:1002D000704700BF680300204FF0E022936843F0AE
|
||||
:1002E00000539360704700BF0021044B03F12002CC
|
||||
:1002F000C3E88F1F01339342FAD17047780500207D
|
||||
:100300004FF0E0234FF08032C3F80024C3F80424F8
|
||||
:10031000C3F80824C3F80C24C3F81024C3F8142429
|
||||
:10032000C3F81824C3F81C24C3F82024C3F82424D9
|
||||
:10033000C3F82824C3F82C24C3F8302462B67047CD
|
||||
:10034000012300F01F029340400941B1800000F1F9
|
||||
:10035000604000F56140C0F8803103607047024A98
|
||||
:10036000203042F82030704700E100E008B5EFF39C
|
||||
:10037000108E72B6134BD3E8CFCF0122BCF1000F21
|
||||
:10038000F9D1C3E84C2FBCF1000FF4D1BFF35F8F5C
|
||||
:100390000D4A10309268DFF834C052F820206245D0
|
||||
:1003A00001D091420BD1084A926842F82010BFF365
|
||||
:1003B0005F8F0022C3E88F2F8EF3108808BD00F0F6
|
||||
:1003C000B5FE00BF8105002000ED00E01101001026
|
||||
:1003D0002DE9F04782B0EFF3108572B6DFF8A8C1BF
|
||||
:1003E000DCE8CF2F0123002AFAD1CCE8423F002AD3
|
||||
:1003F000F6D1BFF35F8F5E4B00F110049B6853F89A
|
||||
:1004000024205C4B9A423DD08A4249D0DFF87CE1FF
|
||||
:10041000A2EB0E032F2B35D8012743099B0000F0D8
|
||||
:100420001F0003F1604303F5614387401E689A464D
|
||||
:10043000B946C3F88070BFF35F8FEFF30583DBB27B
|
||||
:100440001F467BBB0123834022F0010003EA06081C
|
||||
:100450008668B14208D181E003EB43030EEB8303CE
|
||||
:100460009E68B14225D0184690F90630002BF3DA89
|
||||
:10047000B1424ED05346B8F1000F17D0C3F8809167
|
||||
:10048000C3F800903A4B9B6843F82420BFF35F8F7A
|
||||
:100490000023CCE88F3F85F3108802B0BDE8F087D9
|
||||
:1004A0001A46EFE79C42CDD000F040FEC3F88090A2
|
||||
:1004B000E8E793F90660002E2CDB06EB46000EEB16
|
||||
:1004C000800180000190C8798F68D87191F9060089
|
||||
:1004D0009F60002898714FEA46072EDB89880198B3
|
||||
:1004E00041F30A0100EB41016FF00700083171444C
|
||||
:1004F000C01A0144C1F34A016FEAC1416FEAD14118
|
||||
:1005000099801D49BB1908780EEB83030E70987112
|
||||
:10051000B0E703469FB9FF2181714BF601518180FD
|
||||
:10052000154E184637784AF6AA219F717346C01AAD
|
||||
:1005300040414143090D31709CE71049E0E7104903
|
||||
:10054000104EC91A0839C1F30A306FEA00506FEA39
|
||||
:10055000105046EA5101D98098808BE790F90660E7
|
||||
:100560000346002EA9DA002FE9D1024AD8E700BFDE
|
||||
:1005700000ED00E0110100100406002001BDFFFFA6
|
||||
:10058000A603002000F8FFFF810500206C03002077
|
||||
:100590002DE9F041EFF30583DBB29E46EFF31085C2
|
||||
:1005A00072B62949D1E8CF2F0123002AFAD1C1E838
|
||||
:1005B000423F002AF6D1BFF35F8FDFF89C8040F006
|
||||
:1005C0000106D8F808704AF6AA2357F82E70044698
|
||||
:1005D0001E4AA41A644163431B0DB7425BB21ED08E
|
||||
:1005E00092F906409C4220D092F912409C4227D0BA
|
||||
:1005F00092F91E409C4225D092F92A409C4208BFA5
|
||||
:10060000032413D0124A002492F800C0137080F81B
|
||||
:1006100006C0C1E88F4F85F31088BDE8F081D8F897
|
||||
:1006200008200C4C42F82E40ECE7002404EB440474
|
||||
:1006300002EB8402FF2494714BF601549480E1E7AD
|
||||
:100640000124F3E70224F1E7810500206C03002078
|
||||
:10065000040600201101001000ED00E0014B0B44E6
|
||||
:10066000036070477805002070B5104C104DAC4207
|
||||
:100670000ED2FF26236863B1FFF722FE0146204613
|
||||
:10068000FFF7ECFFA680BFF35F8F0834AC42F1D3D5
|
||||
:1006900070BDFFF715FE01462046FFF7DFFF26710C
|
||||
:1006A000BFF35F8F0834AC42E4D370BDF003002089
|
||||
:1006B000F803002010490B68EFF3108072B6D3E8FE
|
||||
:1006C000CFCF0122BCF1000FF9D1C3E84C2FBCF110
|
||||
:1006D000000FF4D1BFF35F8F084A4FF0000C13787E
|
||||
:1006E000096801331370C1E88FCF80F3108840BFD1
|
||||
:1006F00000200021704700BFF805002005060020FB
|
||||
:100700002DE9F04F2DED028B85B0EFF30583DBB2C1
|
||||
:10071000103B9A0818BF01224FF0010103F0030BB0
|
||||
:1007200018BFA94CA94B08BFA94C0BEB820253F888
|
||||
:10073000225001FA0BF204F541539FEDA18B029276
|
||||
:100740005A602FE0AB88190440F19480AB79002BFC
|
||||
:1007500040F0DE80B5F90860002EC0F21C816B69A4
|
||||
:1007600006EB460603EBC603D3E90267B7F1FF3F8A
|
||||
:1007700008BFB6F1FF3F0ED004EB8B01A36A0A69F4
|
||||
:10078000D21AF31A934205D30123226A03FA0BF318
|
||||
:10079000134200D10E61204600F0FAFAB042B9418E
|
||||
:1007A000C0F2F980B5F90860029B002EE363C9DB53
|
||||
:1007B000D5F8149006EB460A09EBCA07BB68204639
|
||||
:1007C000D7F80C80019300F0E3FA019B984271EB9B
|
||||
:1007D0000801B7DBB8F1000FC0F2C080D7E90431DF
|
||||
:1007E0007C4A934200F0F8807A88B5F9080092B20A
|
||||
:1007F00042EA0040984702460B4652EA030100F0E5
|
||||
:10080000AD80002B80F2CD800199B1EB020E68EB38
|
||||
:10081000030839F93A30C7E902E8002B92DB68692E
|
||||
:1008200003EB430200EBC202D2E90271BE4578EB52
|
||||
:10083000010C4FEA430285DBAC462CF8083F06E08A
|
||||
:1008400003EB430100EBC1015A00D1E90271BE453F
|
||||
:1008500078EB01011A4405DB30F9323000EBC20CB1
|
||||
:10086000002BEDDA29F83A30ACF80060AB881904B7
|
||||
:100870003FF56CAF2B69EFF3108272B6D3E8CF0F60
|
||||
:1008800001210028FAD1C3E8401F0028F6D1BFF3A8
|
||||
:100890005F8F4FF6FF76A8880023296900B2AE80EB
|
||||
:1008A000C1E88F3F82F310889842FFF64FAF0746AA
|
||||
:1008B000A1466E6905F10808B5F9083007EB470E47
|
||||
:1008C000002BC44606EBCE0215DBD2E90240AA4655
|
||||
:1008D000019704E036F935309446002B09DB03EB31
|
||||
:1008E000430506EBC502D2E90271BC4270EB01017F
|
||||
:1008F000F0DA5546019FACF8007036F93E7026F8E4
|
||||
:100900003E30002FD8DAAB794C46002B3FF422AFB3
|
||||
:100910000023AB71B5F90860721C33463BD068699F
|
||||
:1009200005F1080E03E08E465A1C3FF415AF03EBA9
|
||||
:10093000430200EBC2014F889C463F0430F932303D
|
||||
:10094000F1D5664581ED028BEED0AEF800302989F5
|
||||
:10095000664620F83210A5F808C0E5E739F83A30C5
|
||||
:100960002B812B69EFF3108272B6D3E8CF0F0121F0
|
||||
:100970000028FAD1C3E8401F0028F6D1BFF35F8FEB
|
||||
:100980006B88296929F83A3000236E80C1E88F3FCF
|
||||
:1009900082F31088D6E640BF05B0BDEC028BBDE8FF
|
||||
:1009A000F08F20460393019200F0F2F9019A039B25
|
||||
:1009B00010EB020E43EB01082BE700BFAFF3008002
|
||||
:1009C000FFFFFFFFFFFFFFFF00800B40D805002067
|
||||
:1009D00000000B400107001008460B69039198477F
|
||||
:1009E0000028BBD00399D1E9002306E738B5384B7E
|
||||
:1009F0001C692CB1BDE838400A213648FFF72EBEED
|
||||
:100A00000321354800F0B2F9334D314BDD60FFF77B
|
||||
:100A100057FC324A4FF0504E024403202C4B4FF00B
|
||||
:100A20000F0C18701A61DEF800204FF6FF715A7033
|
||||
:100A30005A69A3F802C014834FF00204A2F8484098
|
||||
:100A40004FF00404A2F878404FF00504A2F890405B
|
||||
:100A50004FF00604A2F8A8404FF00704A2F8C040E7
|
||||
:100A60004FF00904A2F8F0404FF00A04A2F8084140
|
||||
:100A70004FF00B04A2F820414FF00C04A2F83841CB
|
||||
:100A80004FF0010414864FF00804A2F8D840144C2B
|
||||
:100A90004FF00D0E4FF00E0C9C6008249980A2F8C8
|
||||
:100AA00050E1A2F868C1A2F8600011800D4A2C62E2
|
||||
:100AB0000D49D360FFF75AFC01210320FFF740FCEA
|
||||
:100AC0000A4B0A211C640348BDE83840FFF7C6BD45
|
||||
:100AD000C0030020F805002000000B40780500202E
|
||||
:100AE000FFFF1000D80500200107001000200B4078
|
||||
:100AF000F0B516461F4602690346EFF3108072B642
|
||||
:100B0000D2E8CF4F0121002CFAD1C2E8441F002CBB
|
||||
:100B1000F6D1BFF35F8FB3F902101D69002945DBE1
|
||||
:100B2000D3F814E001EB41023EF832400EEBC20C68
|
||||
:100B30005C800024C5E88F4F80F310880598354607
|
||||
:100B4000CCF8100006983E46CCF81400BCF8020021
|
||||
:100B5000CCE902560130C0F30E00012838BF012055
|
||||
:100B6000ACF8020040EA0140D3F810C0EFF3108562
|
||||
:100B700072B6DCE8CF7F0126002FFAD1CCE8476FB0
|
||||
:100B8000002FF6D1BFF35F8FB3F804C02EF832C048
|
||||
:100B900099801A69C2E88F4F85F3108801211C786B
|
||||
:100BA000DA68A14002F501535960F0BD0023C5E8A1
|
||||
:100BB0008F3F80F310884FF0FF30F0BD034640892F
|
||||
:100BC000B0EB214F3ADD58690A1402EB420210B52E
|
||||
:100BD000D3F810C000EBC200EFF3108E72B6DCE861
|
||||
:100BE000CF4F0122002CFAD1CCE8442F002CF6D1B3
|
||||
:100BF000BFF35F8F428889B292B28A4207D0002247
|
||||
:100C00001B69C3E88F2F8EF31088002010BD6FEA98
|
||||
:100C100042426FEA524242800121002218699971D2
|
||||
:100C2000C0E88F2F8EF3108893F800C0DA6808466A
|
||||
:100C300002F5015301FA0CF1596010BD0020704714
|
||||
:100C4000F0B5024685B0EFF30585EDB2002D61D118
|
||||
:100C50000B46424CD4E90001994208BF90424AD069
|
||||
:100C6000CDE902233E4BDF681E78384600F090F84D
|
||||
:100C700006F1040C57F82CC0029A039BACEB000C55
|
||||
:100C8000101A63EB0101604571F1000133DACDE91F
|
||||
:100C9000022300F085F8029A039B824263EB010174
|
||||
:100CA000002949DB2F492E4800910195CDE90232F8
|
||||
:100CB000FFF71EFFDDE90232011E3DDD2A48C4E9CF
|
||||
:100CC0000023446A9C4246D3806A904241D3244820
|
||||
:100CD000CDE90232FFF772FF2349029B486A98422E
|
||||
:100CE0001CD314BF012000208B6A039A934228BFB3
|
||||
:100CF00040F001000CE020BF1B49486A98420DD328
|
||||
:100D000014BF012000208B6A934228BF40F00100ED
|
||||
:100D100005B0F0BD1448436A8B4202D2002005B0F2
|
||||
:100D2000F0BD14BF01230023816A914234BF1846ED
|
||||
:100D300043F0010005B0F0BD0B49486A9842EDD37D
|
||||
:100D4000C01A18BF01208B6A934228BF40F00100EF
|
||||
:100D5000DEE79C42BBD120BFB9E700BFB80300204B
|
||||
:100D6000C0030020B506001000000B4010B4054B76
|
||||
:100D7000054C064AA04214BF1846581C10BCFFF789
|
||||
:100D800073BA00BFA005002000800B40341900108A
|
||||
:100D90000346416A0A46986A596A8A42FAD17047FC
|
||||
:100DA000034B596A0A46986A596A9142FAD17047C8
|
||||
:100DB00000000B4000B58E46154A536A9C46916A66
|
||||
:100DC000536A6345FAD1401853EB0E034FF000020B
|
||||
:100DD00028BF0122BAB10E4B5A6A531C08BF1046F5
|
||||
:100DE00008D04FF0FF33184609494A6A9A42FCD3AB
|
||||
:100DF0009A4207D1064B02E0596A914202D1996AA0
|
||||
:100E00008142F9D300BD024A526A9342ECD8EFE71F
|
||||
:100E100000000B4070B5044682B006200E4600F07C
|
||||
:100E2000EFF8002844D0384A3848944214BF4FF0B5
|
||||
:100E300080624FF00062364B364902601A608D685E
|
||||
:100E400032EA0505FBD1304A4FF48070A21AB2FA9B
|
||||
:100E500082F23149520921F81200062000F0D0F840
|
||||
:100E6000C200B2FBF6F20132D10923D140260123A0
|
||||
:100E70006362A162256BEB0725D42346002153F85A
|
||||
:100E80002C2F062003F5805211602563019200F09B
|
||||
:100E9000B7F840F2013503218000B0FBF6F0E36AB9
|
||||
:100EA000019A83F0700303F07E0313602563A1644D
|
||||
:100EB00002B070BD4FF6FE7081421DD929464FF633
|
||||
:100EC000FF73164ED4E740F2013204F540531A6323
|
||||
:100ED000636AA26A062002EB8312019200F090F886
|
||||
:100EE0000F4B019AA3FB00139002DB0AB0FBF3F057
|
||||
:100EF0000021FFF75FFFC0E7C2F345020B4602EB9C
|
||||
:100F000081161146B4E700BF008007400020024070
|
||||
:100F10000030024000000240FC050020C0FF3F00FE
|
||||
:100F2000757B2B8F00EB400C4FEA8C0C0CF1804C46
|
||||
:100F30000CF5803C70B51E46DCF80430041FB3F598
|
||||
:100F4000803F38BF4FF48033E4B238BFCCF8043070
|
||||
:100F5000012C2ED94FF40065284B0CF5405ECEF8DD
|
||||
:100F6000005053F820E0BEF1000F17D1DCF800E08C
|
||||
:100F7000012C8EEA421202F0E0020CF5805ECEF8FF
|
||||
:100F800000202BD94FF4006143F820604FF48033E8
|
||||
:100F90000CF500521160CCF8043070BD5D69B5FBF2
|
||||
:100FA000FEFE0EF1010E0EEB4E0EBEF1030EFCD254
|
||||
:100FB000DCE70129CED103240CF540531C60DCF89A
|
||||
:100FC0000830DB07FBD5DCF800300CF5805E83EAE7
|
||||
:100FD000421303F0E003CEF80030084B0122DCF8A6
|
||||
:100FE00000404C4004F00304CEF8004002FA01F146
|
||||
:100FF000DCF808200A42FBD0C4E700BFA4050020AB
|
||||
:10100000014B53F820007047A405002010B5029C46
|
||||
:101010008E464FEA043C4CEA034C1C4BB3FBF1F305
|
||||
:101020000168B2FBF3F4002920DB194A194B904206
|
||||
:1010300014BF4FF480424FF4004217491A6003F581
|
||||
:1010400080531A608B6832EA0303FBD1212200F53A
|
||||
:1010500040530433C0F800E084601A600268002A3C
|
||||
:10106000FCDA0822C0F80CC01A6010BD036803F057
|
||||
:101070003F037345D9D18368C3F30B03A342D4D193
|
||||
:10108000C36803F4EE236345CFD110BD001BB70046
|
||||
:10109000008005400020024000000240012300EBD8
|
||||
:1010A0004000800000F1804000F584104160036042
|
||||
:1010B000704700BF0023DB8A002242E800F25202A0
|
||||
:1010C00001D4102118470421184700BF034AD2F861
|
||||
:1010D0002838002BFBD0BFF35F8F704700000E4015
|
||||
:1010E0000021044B044ABFF35F8F43F8041B934273
|
||||
:1010F000F9D170470C080E402C080E404FF42A6CB2
|
||||
:101100004FF48D70054A064B0649C2F800C0D06006
|
||||
:1011100019605368002BFCDA704700BF0080044060
|
||||
:1011200000A0044000B0FA00704700BF08B50148B5
|
||||
:10113000FFF782F85819001038B5054C054DAC4240
|
||||
:1011400004D254F8043B9847AC42FAD338BD00BFF0
|
||||
:10115000E0180010201900100648DFF828C0064BE0
|
||||
:10116000064A0749C0F800C01A608B6832EA0303D8
|
||||
:10117000FBD170470020024000300240F6FFF3032D
|
||||
:10118000000002407F3BEFEF044BDB6CB3F5004FF8
|
||||
:1011900003D14FF48022024BDA64704700001150F3
|
||||
:1011A000002011504FF0E022044BD2F8881D0B4371
|
||||
:1011B000C2F8883D10EE3004704700BF03033000D2
|
||||
:1011C0006FF06041044B054A19609368DB4333F0CC
|
||||
:1011D0006043FAD1704700BF003002400000024077
|
||||
:1011E00010B545F25320FFF765FFBDE810400346F8
|
||||
:1011F0000420184710B545F25320FFF75BFFBDE808
|
||||
:101200001040034601201847FFF76EB81349144BEE
|
||||
:1012100070B55C1AA508442D2A4628BF4422114EF9
|
||||
:101220009200304600F058FB432D13D80E4A0FD0E1
|
||||
:10123000C5F144003319410803EBC101C3E90022A1
|
||||
:1012400008338B42FAD1C30704D520F001000544CE
|
||||
:1012500046F82520054B9E6070BD00BF00000010C1
|
||||
:1012600010010010000000201101001000ED00E04E
|
||||
:10127000002370B52B4C82B0C4F88430FFF73EFFDA
|
||||
:101280000122294BDA63636C012BFCD10321264A2E
|
||||
:10129000244B11639C6B012CFCD1022605252146B1
|
||||
:1012A0000523224A22480096FFF7B0FE21462B462E
|
||||
:1012B000204A21480095FFF7A9FE0022042031466C
|
||||
:1012C0001E4BFFF72FFE2146284600221C4BFFF73E
|
||||
:1012D00029FE0022082011461A4BFFF723FE0022A8
|
||||
:1012E00009201146174BFFF71DFE0022062011466C
|
||||
:1012F000134BFFF717FE0022114B07201146FFF793
|
||||
:1013000011FE0420FFF77CFE00240F4BA3FB0035E9
|
||||
:10131000AD0CE0B229460134FFF7C0FE062CF8D12F
|
||||
:1013200002B070BD0000014000300140002F68593C
|
||||
:1013300000000540008C864700800540001BB70078
|
||||
:1013400080D1F008006CDC0283DE1B4300B97047DB
|
||||
:1013500000F026B910B5094A84B014684CB10346B0
|
||||
:1013600000914FF0FF3203A90548A047012004B0C7
|
||||
:1013700010BD00F057F9204604B010BDD405002080
|
||||
:101380004D13001000BEFDE7704700BF08B5FFF722
|
||||
:10139000F9FF00BF38B5064C064DFFF7CDFEAC4255
|
||||
:1013A00004D254F8043B9847AC42FAD338BD00BF8E
|
||||
:1013B000201900102019001003680846114618472C
|
||||
:1013C00070B505460846697D82B000294FD0002AD5
|
||||
:1013D00025DD037814460A2B064622D0012C4FF057
|
||||
:1013E000000E0DD03246012312F801CF1946BCF190
|
||||
:1013F0000A0F03F1010320D09C42F5D1744505DDAD
|
||||
:101400002B68A4EB0E0106EB0E009847311911F87A
|
||||
:10141000013CA3F10D03B3FA83F35B092B7502B012
|
||||
:1014200070BD2B7D002BD9D102212B681348984722
|
||||
:10143000012CEBD04FF0010ED4E712F8010C0D286F
|
||||
:10144000DAD08E4506EB0E00A1EB0E0105DACDE9F0
|
||||
:1014500000322B689847DDE90032CDE900320221E5
|
||||
:101460002B6806489847009B019A9E46C4E71146A0
|
||||
:101470002B6802B0BDE87040184700BF381A001052
|
||||
:101480002DE9F04782B090461C460D460746FFF70F
|
||||
:1014900087FC4FF0FF3C6FF000462E4A821841F166
|
||||
:1014A0000003944576EB03013CBF624633462A486D
|
||||
:1014B00000F00AFA6B1C824640D00CB3274E284B32
|
||||
:1014C0001C68B4B1B8F1000F1CD1DFF89C8001E0BA
|
||||
:1014D000246974B12368002BFAD0D8F800300BB11E
|
||||
:1014E0009C42F5D120462A463946B0472469002C53
|
||||
:1014F000F0D1BAF1000F26D1284602B0BDE8F0873E
|
||||
:10150000184EDCE74FF00A09DFF85C8002E024693E
|
||||
:10151000002CEED02368002BF9D0D8F800300BB1A6
|
||||
:10152000A342F4D12A4639462046B047012220463C
|
||||
:101530000DF107018DF80790B047E8E7384600F055
|
||||
:1015400095F90546B9E7044800F0C2F9284602B00B
|
||||
:10155000BDE8F08740420F00F0030020C1130010E7
|
||||
:10156000CC050020B9130010D0050020084A1368EC
|
||||
:1015700023B90AE003F110021B6933B18342F9D1A8
|
||||
:1015800029B9186910601961704701B1106070477E
|
||||
:10159000CC05002008B500F03FF9012008BD00BFD0
|
||||
:1015A000F0B583B006468DF80700FFF7F9FB4FF062
|
||||
:1015B000FF356FF00044174A821841F1000395424D
|
||||
:1015C00074EB03013CBF23462A46134800F07CF924
|
||||
:1015D000124B07461C689CB1114D01E024697CB197
|
||||
:1015E0002368002BFAD02B680BB19C42F6D1204621
|
||||
:1015F00001220DF10701FFF7E3FE2469002CEFD172
|
||||
:1016000017B9304603B0F0BD034800F061F9304629
|
||||
:1016100003B0F0BD40420F00F0030020CC050020D5
|
||||
:10162000D005002038B5044600F020F90123054616
|
||||
:101630001A4620462946FFF723FF084B1C682CB1A9
|
||||
:1016400063682BB198472469002CF9D1284638BD2E
|
||||
:101650002469002CF4D1284638BD00BFCC050020F9
|
||||
:10166000B1F1000C1EDD104A104B126810B5D31AF0
|
||||
:10167000B3FA83F30D24DFF838E05B09411E3EF92D
|
||||
:1016800013E08C4411F8010F864506D093699B0640
|
||||
:10169000FCD461451060F5D110BD93699B06FCD464
|
||||
:1016A0001460F3E7704700BF000600200080074089
|
||||
:1016B000FC050020244BB1F1000C00B5D3F800E08C
|
||||
:1016C0002FDD0021214B01381A689369DB0618D4FD
|
||||
:1016D00001319369DB06FCD413688C4500F8013FA7
|
||||
:1016E000F3D1BEF1000F09D050211346916353F896
|
||||
:1016F000342F02F0380203F580531A606146084621
|
||||
:1017000000BDBEF1000F09D050201346906353F87E
|
||||
:10171000342F02F0380203F580531A6081B1084675
|
||||
:1017200000BDBEF1000F0BD0084B50211A681346C4
|
||||
:10173000916353F8342F02F0380203F580531A6096
|
||||
:101740006FF00201DBE700BF9805002000060020D3
|
||||
:10175000054B1B6833B10021044A05481268006834
|
||||
:1017600091631847704700BF9805002000060020CD
|
||||
:101770009C050020024B1A6893691B07FCD4704734
|
||||
:101780000006002030B51F4D1F4AD5F800C01F4C81
|
||||
:101790008E46944514BF21222222216883B010B1C5
|
||||
:1017A000A9B103B030BD0029FBD0CCF83800014608
|
||||
:1017B000019010460092FEF7C3FD15490098FEF710
|
||||
:1017C00007FE019B134A2360136003B030BD114B29
|
||||
:1017D00020600F4910460092C3F800E0FEF7C6FDF6
|
||||
:1017E00001210098FEF7ACFD2A6850211346916351
|
||||
:1017F00053F8342F02F0380203F580531A6003B017
|
||||
:1018000030BD00BF00060020008007409805002082
|
||||
:10181000511700109C05002010B50E490E4C0F48C2
|
||||
:101820000F4A104B007821600020022112781B78AB
|
||||
:10183000FEF7E4FC02210120FEF7E0FC4FF4E13169
|
||||
:101840002068FFF7E7FABDE8104001210648FFF7DE
|
||||
:101850008DBE00BF0000074000060020881A00105F
|
||||
:10186000841A0010801A0010D803002020F0030111
|
||||
:1018700010F00300C0F1000051F8043B00F1040C2B
|
||||
:101880004FEACC0C6FF000021CBF22FA0CF213439B
|
||||
:101890004FF0010C4CEA0C2C4CEA0C4CA3EB0C0264
|
||||
:1018A00022EA030212EACC1204BF51F8043B0430CE
|
||||
:1018B000F4D0C2F1000102EA0102B2FA82F2C2F1EE
|
||||
:1018C0001F0200EBD20070475FF800F0F10100202A
|
||||
:1018D0005FF800F0290200205FF800F0710200209C
|
||||
:1018E000E11100105911001089110010711200103F
|
||||
:1018F000C1110010E110001009120010CD100010ED
|
||||
:10190000690600100D120010ED09001029110010D9
|
||||
:10191000F5110010A5110010D902001001030010EC
|
||||
:101920000A2A2A2A2050414E4943202A2A2A0A00FC
|
||||
:1019300000000000486172647761726520616C612B
|
||||
:10194000726D20256420616C726561647920636C1E
|
||||
:1019500061696D65640000004861726420617373A1
|
||||
:101960006572740052656C6561736500626F6F74B7
|
||||
:10197000325F77323571303830000000302E310060
|
||||
:10198000322E332E300000007069636F3200000089
|
||||
:10199000307830303031615F737461636B00000008
|
||||
:1019A0004F63742031372032303236005541525463
|
||||
:1019B00020737464696E000055415254207374643E
|
||||
:1019C0006F7574005541525420737464696E202FF2
|
||||
:1019D000207374646F75740006005250D3F0754222
|
||||
:1019E0006419001006005250E182887F6C190010C3
|
||||
:1019F000060052503ABCA9117C1900100600525042
|
||||
:101A0000ABB360538019001006005250BBFF3CB6C8
|
||||
:101A10008819001006005250861C0302901900100D
|
||||
:101A2000060052505422A29DA019001005005250E9
|
||||
:101A3000DE65F468881D00100D0A00000600525093
|
||||
:101A400053B4F4A1C4190010080052501200000051
|
||||
:081A5000080052509210000042
|
||||
:081A580018E8FF0F0100000077
|
||||
:101A6000D8190010E4190010F0190010FC1900102A
|
||||
:101A7000081A0010141A0010201A00102C1A001056
|
||||
:0C1A8000501A0010481A00103C1A001008
|
||||
:101A8C00034600B50268EFF3108C72B6D2E8CFEFC4
|
||||
:101A9C000120BEF1000FF9D1C2E84E0FBEF1000FCC
|
||||
:101AAC00F4D1BFF35F8F93F90420002A09DB01B155
|
||||
:101ABC000A60002000221B68C3E88F2F8CF310886B
|
||||
:101ACC0000BD4FF05042126801201A71F2E700BFBE
|
||||
:101ADC004FF050412DE9F8431F460B68044616465B
|
||||
:101AEC0000259946DFF874802368EFF3108272B6F4
|
||||
:101AFC00D3E8CF0F01210028FAD1C3E8401F0028FA
|
||||
:101B0C00F6D1BFF35F8F94F904302168002B1BDBF7
|
||||
:101B1C0098F80030DBB2C1E88F5F82F3108898F838
|
||||
:101B2C0000209A4208D03046394600F0D1F80028FF
|
||||
:101B3C00DAD00020BDE8F88320BF3046394600F0EB
|
||||
:101B4C00C7F80028D0D0F4E7002384F80490C1E84B
|
||||
:101B5C008F3F82F310880120BDE8F8830506002032
|
||||
:101B6C0070B582B001A9064614461D46FFF788FFE2
|
||||
:101B7C0038B94FF050439DF9042093F900309A4244
|
||||
:101B8C0001D102B070BD22462B46304602B0BDE8F2
|
||||
:101B9C007040FFF79DBF00BF0368EFF3108172B672
|
||||
:101BAC00D3E8CFCF0122BCF1000FF9D1C3E84C2F01
|
||||
:101BBC00BCF1000FF4D1BFF35F8F4FF0FF0C074A5D
|
||||
:101BCC0080F804C013780133137000230268C2E854
|
||||
:101BDC008F3F81F3108840BF704700BF050600207F
|
||||
:101BEC00844641EA000313F0030349D1403A23D35E
|
||||
:101BFC000B6803604B6843608B688360CB68C36081
|
||||
:101C0C000B6903614B6943618B698361CB69C36168
|
||||
:101C1C000B6A03624B6A43628B6A8362CB6AC36250
|
||||
:101C2C000B6B03634B6B43638B6B8363CB6BC36338
|
||||
:101C3C0040304031403ADBD230320BD30B6803607A
|
||||
:101C4C004B6843608B688360CB68C3601030103185
|
||||
:101C5C00103AF3D20C3205D351F8043B40F8043B54
|
||||
:101C6C00043AF9D2043208D0D2071CBF11F8013B58
|
||||
:101C7C0000F8013B01D30B8803806046704700BF1E
|
||||
:101C8C00082A13D38B07B1D010F00303AED0C3F1E5
|
||||
:101C9C000403D21ADB071CBF11F8013B00F8013B0F
|
||||
:101CAC00A4D331F8023B20F8023B9FE7043AD9D386
|
||||
:101CBC00013A11F8013B00F8013BF9D20B780370A3
|
||||
:101CCC004B7843708B78837060467047000000003F
|
||||
:101CDC005FF800F0410C0010100000000000000044
|
||||
:101CEC0000000100000000000000000000000200E5
|
||||
:101CFC0000000000000000000000030000000000D5
|
||||
:101D0C00000000000000FF000000000001B5486862
|
||||
:101D1C0001318E460047704609380149884701BD9C
|
||||
:101D2C009105001000000000FFFFFFFFFFFFFF7F89
|
||||
:101D3C000000000000000000000000000000000097
|
||||
:101D4C0000000000F8030020611600107517001049
|
||||
:101D5C00B5160010851700100000000000010000EF
|
||||
:081D6C0000000000000000006F
|
||||
:101D7400D3DEFFFFFE010000FF010000C4E3FFFF0C
|
||||
:041D8400793512ABF0
|
||||
:040000051000014D99
|
||||
:00000001FF
|
||||
Binary file not shown.
@@ -0,0 +1,121 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
# following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
# disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
else ()
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
Binary file not shown.
@@ -0,0 +1,755 @@
|
||||
# Week 1: Introduction and Overview of Embedded Reverse Engineering: Ethics, Scoping, and Basic Concepts
|
||||
|
||||
***
|
||||
**LEGAL DISCLAIMER:**
|
||||
The information, tools, and code provided in this repository and course are strictly for educational, research, and defensive purposes only.
|
||||
|
||||
You are explicitly prohibited from using any materials contained herein to access, test, modify, or exploit any device, network, or system that you do not own 100% or for which you do not have explicit, documented, and legally binding authorization to interact with.
|
||||
|
||||
By using this repository and course, you acknowledge and agree that:
|
||||
|
||||
1. Any illegal, unauthorized, or malicious use of this information is solely your responsibility.
|
||||
2. The author(s) and contributor(s) of this repository and course shall not be held liable for any damages, legal repercussions, criminal charges, or unauthorized actions resulting from the use, misuse, or abuse of the contents herein.
|
||||
3. You will comply with all applicable local, state, national, and international laws regarding cybersecurity and computer fraud.
|
||||
|
||||
**IF YOU DO NOT AGREE WITH THESE TERMS, DO NOT USE THIS REPOSITORY AND COURSE.**
|
||||
|
||||
***
|
||||
|
||||
## What You'll Learn This Week
|
||||
|
||||
By the end of this week, you will be able to:
|
||||
|
||||
- Understand what a microcontroller is and how it works
|
||||
- Know the basic registers of the ARM Cortex-M33 processor
|
||||
- Understand memory layout (Flash vs RAM) and why it matters
|
||||
- Understand how the stack works in embedded systems
|
||||
- Set up and connect GDB to your Pico 2 for debugging
|
||||
- Use Ghidra for static analysis of your binary
|
||||
- Read basic ARM assembly instructions and understand what they do
|
||||
|
||||
---
|
||||
|
||||
## Part 1: Understanding the Basics
|
||||
|
||||
### What is a Microcontroller?
|
||||
|
||||
Think of a microcontroller as a tiny computer on a single chip. Just like your laptop has a processor, memory, and storage, a microcontroller has all of these packed into one small chip. The **RP2350** is the microcontroller chip that powers the **Raspberry Pi Pico 2**.
|
||||
|
||||
### What is the ARM Cortex-M33?
|
||||
|
||||
The RP2350 has two "brains" inside it - we call these **cores**. One brain uses ARM Cortex-M33 instructions, and the other can use RISC-V instructions. In this course, we'll focus on the **ARM Cortex-M33** core because it's more commonly used in the industry.
|
||||
|
||||
### What is Reverse Engineering?
|
||||
|
||||
Reverse engineering is like being a detective for code. Instead of writing code and compiling it, we take compiled code (the 1s and 0s that the computer actually runs) and figure out what it does. This is useful for:
|
||||
|
||||
- Understanding how things work
|
||||
- Finding bugs or security issues
|
||||
- Learning how software interacts with hardware
|
||||
|
||||
---
|
||||
|
||||
## Part 2: Understanding Processor Registers
|
||||
|
||||
### What is a Register?
|
||||
|
||||
A **register** is like a tiny, super-fast storage box inside the processor. The processor uses registers to hold numbers while it's doing calculations. Think of them like the short-term memory your brain uses when doing math in your head.
|
||||
|
||||
### The ARM Cortex-M33 Registers
|
||||
|
||||
The ARM Cortex-M33 has several important registers:
|
||||
|
||||
| Register | Also Called | Purpose |
|
||||
| ------------ | -------------------- | ------------------------------------------- |
|
||||
| `r0` - `r12` | General Purpose | Store numbers, pass data between functions |
|
||||
| `r13` | SP (Stack Pointer) | Keeps track of where we are in the stack |
|
||||
| `r14` | LR (Link Register) | Remembers where to go back after a function |
|
||||
| `r15` | PC (Program Counter) | Points to the next instruction to run |
|
||||
|
||||
##### General Purpose Registers (`r0` - `r12`)
|
||||
|
||||
These 13 registers are your "scratch paper." When the processor needs to add two numbers, subtract, or do any calculation, it uses these registers to hold the values.
|
||||
|
||||
**Example:** If you want to add 5 + 3:
|
||||
|
||||
1. Put 5 in `r0`
|
||||
2. Put 3 in `r1`
|
||||
3. Add them and store the result (8) in `r2`
|
||||
|
||||
##### The Stack Pointer (`r13` / SP)
|
||||
|
||||
The **stack** is a special area of memory that works like a stack of plates:
|
||||
|
||||
- When you add something, you put it on top (called a **PUSH**)
|
||||
- When you remove something, you take it from the top (called a **POP**)
|
||||
|
||||
The Stack Pointer always points to the top of this stack. On ARM systems, the stack **grows downward** in memory. This means when you push something onto the stack, the address number gets smaller!
|
||||
|
||||
The two Arm ABI documents we verified give the formal proof for these rules. In AAPCS32, page 17 defines the core register roles used by the base procedure call standard: `r13` is `SP`, `r14` is `LR`, `r15` is `PC`, `r0`-`r3` are argument and scratch registers, and `r4`-`r11` are the longer-lived variable registers. In Advisory Note 132, page 7 states that `SP` must be aligned to a multiple of 8 at every conforming call site and must already be 8-byte aligned when control first enters conforming code. That is why compiler-generated prologues often push an even number of registers, such as `push {r3, lr}`, to preserve both saved state and the required ABI stack alignment.
|
||||
|
||||
```
|
||||
Higher Memory Address (0x20082000)
|
||||
+------------------+
|
||||
| | ← Stack starts here (empty)
|
||||
+------------------+
|
||||
| Pushed Item 1 | ← SP points here after 1 push
|
||||
+------------------+
|
||||
| Pushed Item 2 | ← SP points here after 2 pushes
|
||||
+------------------+
|
||||
Lower Memory Address (0x20081FF8)
|
||||
```
|
||||
|
||||
##### The Link Register (`r14` / LR)
|
||||
|
||||
When you call a function, the processor needs to remember where to come back to. The Link Register stores this "return address."
|
||||
|
||||
**Example:**
|
||||
```
|
||||
main() calls print_hello()
|
||||
↓
|
||||
LR = address right after the call in main()
|
||||
↓
|
||||
print_hello() runs
|
||||
↓
|
||||
print_hello() finishes, looks at LR
|
||||
↓
|
||||
Jumps back to main() at the address stored in LR
|
||||
```
|
||||
|
||||
##### The Program Counter (`r15` / PC)
|
||||
|
||||
The Program Counter always points to the **next instruction** the processor will execute. It's like your finger following along as you read a book - it always points to where you are.
|
||||
|
||||
---
|
||||
|
||||
## Part 3: Understanding Memory Layout
|
||||
|
||||
### XIP - Execute In Place
|
||||
|
||||
The RP2350 uses something called **XIP (Execute In Place)**. This means the processor can run code directly from the flash memory (where your program is stored) without copying it to RAM first.
|
||||
|
||||
**Key Memory Address:** `0x10000000`
|
||||
|
||||
This is where your program code starts in flash memory. Remember this address - we'll use it a lot!
|
||||
|
||||
### Memory Map Overview
|
||||
|
||||
```
|
||||
+-------------------------------------+
|
||||
| Flash Memory (XIP) |
|
||||
| Starts at: 0x10000000 |
|
||||
| Contains: Your program code |
|
||||
+-------------------------------------+
|
||||
| RAM |
|
||||
| Starts at: 0x20000000 |
|
||||
| Contains: Stack, Heap, Variables |
|
||||
+-------------------------------------+
|
||||
```
|
||||
|
||||
### Stack vs Heap
|
||||
|
||||
| Stack | Heap |
|
||||
| ---------------------------------------- | ---------------------------------- |
|
||||
| Automatic memory management | Manual memory management |
|
||||
| Fast | Slower |
|
||||
| Limited size | More flexible size |
|
||||
| Used for function calls, local variables | Used for dynamic memory allocation |
|
||||
| Grows downward | Grows upward |
|
||||
|
||||
---
|
||||
|
||||
## Part 3.5: Reviewing Our Hello World Code
|
||||
|
||||
Before we start debugging, let's understand the code we'll be working with. Here's our `0x0001_hello-world.c` program:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
|
||||
while (true)
|
||||
printf("hello, world\r\n");
|
||||
}
|
||||
```
|
||||
|
||||
### Breaking Down the Code
|
||||
|
||||
##### The Includes
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
```
|
||||
|
||||
- **`<stdio.h>`** - This is the standard input/output library. It gives us access to the `printf()` function that lets us print text.
|
||||
- **`"pico/stdlib.h"`** - This is the Pico SDK's standard library. It provides essential functions for working with the Raspberry Pi Pico hardware.
|
||||
|
||||
##### The Main Function
|
||||
|
||||
```c
|
||||
int main(void) {
|
||||
```
|
||||
|
||||
Every C program starts running from the `main()` function. The `void` means it takes no arguments, and `int` means it returns an integer (though our program never actually returns).
|
||||
|
||||
##### Initializing Standard I/O
|
||||
|
||||
```c
|
||||
stdio_init_all();
|
||||
```
|
||||
|
||||
This function initializes all the standard I/O (input/output) for the Pico. It sets up:
|
||||
|
||||
- **USB CDC** (so you can see output when connected to a computer via USB)
|
||||
- **UART** (serial communication pins)
|
||||
|
||||
Without this line, `printf()` wouldn't have anywhere to send its output!
|
||||
|
||||
##### The Infinite Loop
|
||||
|
||||
```c
|
||||
while (true)
|
||||
printf("hello, world\r\n");
|
||||
```
|
||||
|
||||
- **`while (true)`** - This creates an infinite loop. The program will keep running forever (or until you reset/power off the Pico).
|
||||
- **`printf("hello, world\r\n")`** - This prints the text "hello, world" followed by a carriage return (`\r`) and newline (`\n`).
|
||||
|
||||
> Tip: **Why `\r\n` instead of just `\n`?**
|
||||
>
|
||||
> In embedded systems, we often use both carriage return (`\r`) and newline (`\n`) together. The `\r` moves the cursor back to the beginning of the line, and `\n` moves to the next line. This ensures proper display across different terminal programs.
|
||||
|
||||
### What Happens When This Runs?
|
||||
|
||||
1. **Power on** - The Pico boots up and starts executing code from flash memory
|
||||
2. **`stdio_init_all()`** - Sets up USB and/or UART for communication
|
||||
3. **Infinite loop begins** - The program enters the `while(true)` loop
|
||||
4. **Print forever** - "hello, world" is sent over and over as fast as possible
|
||||
|
||||
### Why This Code is Perfect for Learning
|
||||
|
||||
This simple program is ideal for reverse engineering practice because:
|
||||
|
||||
- It has a clear, recognizable function call (`printf`)
|
||||
- It has an infinite loop we can observe
|
||||
- It's small enough to understand completely
|
||||
- It demonstrates real hardware interaction (USB/UART output)
|
||||
|
||||
When we debug this code, we'll be able to see how the C code translates to ARM assembly instructions!
|
||||
|
||||
### Compiling and Flashing to the Pico 2
|
||||
|
||||
Now that we understand the code, let's get it running on our hardware:
|
||||
|
||||
##### Step 1: Compile the Code
|
||||
|
||||
In VS Code, look for the **Compile** button in the status bar at the bottom of the window. This is provided by the Raspberry Pi Pico extension. Click it to compile your project.
|
||||
|
||||
The extension will run CMake and build your code, creating a `.uf2` file that can be loaded onto the Pico 2.
|
||||
|
||||
##### Step 2: Put the Pico 2 in Flash Loading Mode
|
||||
|
||||
To flash new code to your Pico 2, you need to put it into **BOOTSEL mode**:
|
||||
|
||||
1. **Press and hold** the right-most button on your breadboard (the BOOTSEL button)
|
||||
2. **While holding BOOTSEL**, press the white **Reset** button
|
||||
3. **Release the Reset button** first
|
||||
4. **Then release the BOOTSEL button**
|
||||
|
||||
When done correctly, your Pico 2 will appear as a USB mass storage device (like a flash drive) on your computer. This means it's ready to receive new firmware!
|
||||
|
||||
> Tip: **Tip:** You'll see a drive called "RP2350" appear in your file explorer when the Pico 2 is in flash loading mode.
|
||||
|
||||
##### Step 3: Flash and Run
|
||||
|
||||
Back in VS Code, click the **Run** button in the status bar. The extension will:
|
||||
|
||||
1. Copy the compiled `.uf2` file to the Pico 2
|
||||
2. The Pico 2 will automatically reboot and start running your code
|
||||
|
||||
Once flashed, your Pico 2 will immediately start executing the hello-world program, printing "hello, world" continuously when we open PuTTY!
|
||||
|
||||
---
|
||||
|
||||
## Part 4: Dynamic Analysis with GDB
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before we start, make sure you have:
|
||||
|
||||
1. A Raspberry Pi Pico 2 board
|
||||
2. GDB (GNU Debugger) installed
|
||||
3. OpenOCD or another debug probe connection
|
||||
4. The sample "hello-world" binary loaded on your Pico 2
|
||||
|
||||
### Connecting to Your Pico 2 with OpenOCD
|
||||
|
||||
Open a terminal and start OpenOCD:
|
||||
|
||||
```powershell
|
||||
openocd -s "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"
|
||||
```
|
||||
|
||||
### Connecting to Your Pico 2 with GDB
|
||||
|
||||
Open another terminal and start GDB with your binary:
|
||||
|
||||
```cmd
|
||||
arm-none-eabi-gdb build\0x0001_hello-world.elf
|
||||
```
|
||||
|
||||
Connect to your target:
|
||||
|
||||
```cmd
|
||||
(gdb) target extended-remote :3333
|
||||
(gdb) monitor reset halt
|
||||
```
|
||||
|
||||
### Basic GDB Commands: Your First Steps
|
||||
|
||||
Now that we're connected, let's learn three essential GDB commands that you'll use constantly in embedded reverse engineering.
|
||||
|
||||
##### Setting a Breakpoint with `b main`
|
||||
|
||||
A **breakpoint** tells the debugger to pause execution when it reaches a specific point. Let's set one at our `main` function:
|
||||
|
||||
```gdb
|
||||
(gdb) b main
|
||||
Breakpoint 1 at 0x10000234: file ../0x0001_hello-world.c, line 5.
|
||||
```
|
||||
|
||||
**What this tells us:**
|
||||
|
||||
- GDB found our `main` function
|
||||
- It's located at address `0x10000234` in flash memory
|
||||
- The source file and line number are shown (because we have debug symbols)
|
||||
|
||||
Now let's run to that breakpoint:
|
||||
|
||||
```gdb
|
||||
(gdb) c
|
||||
Continuing.
|
||||
|
||||
Breakpoint 1, main () at ../0x0001_hello-world.c:5
|
||||
5 stdio_init_all();
|
||||
```
|
||||
|
||||
The program has stopped right at the beginning of `main`!
|
||||
|
||||
##### Disassembling with `disas`
|
||||
|
||||
The `disas` (disassemble) command shows us the assembly instructions for the current function:
|
||||
|
||||
```gdb
|
||||
(gdb) disas
|
||||
Dump of assembler code for function main:
|
||||
=> 0x10000234 <+0>: push {r3, lr}
|
||||
0x10000236 <+2>: bl 0x1000156c <stdio_init_all>
|
||||
0x1000023a <+6>: ldr r0, [pc, #8] @ (0x10000244 <main+16>)
|
||||
0x1000023c <+8>: bl 0x100015fc <__wrap_puts>
|
||||
0x10000240 <+12>: b.n 0x1000023a <main+6>
|
||||
0x10000242 <+14>: nop
|
||||
0x10000244 <+16>: adds r4, r1, r7
|
||||
0x10000246 <+18>: asrs r0, r0, #32
|
||||
End of assembler dump.
|
||||
```
|
||||
|
||||
**Understanding the output:**
|
||||
|
||||
- The `=>` arrow shows where we're currently stopped
|
||||
- Each line shows: `address <offset>: instruction operands`
|
||||
- We can see the calls to `stdio_init_all` and `__wrap_puts` (printf was optimized to puts)
|
||||
- The `b.n 0x1000023a` at the end is our infinite loop - it jumps back to reload the string!
|
||||
|
||||
##### Viewing ELF Sections with `info files` and `maintenance info sections`
|
||||
|
||||
To see how the ELF is laid out in memory, use:
|
||||
|
||||
```gdb
|
||||
(gdb) info files
|
||||
Symbols from "C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0001_hello-world\build\0x0001_hello-world.elf".
|
||||
Extended remote target using gdb-specific protocol:
|
||||
`C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0001_hello-world\build\0x0001_hello-world.elf', file type elf32-littlearm.
|
||||
Entry point: 0x1000014c
|
||||
0x10000000 - 0x100019cc is .text
|
||||
0x100019cc - 0x10001b18 is .rodata
|
||||
0x10001b18 - 0x10001b20 is .ARM.exidx
|
||||
0x10001b20 - 0x10001b4c is .binary_info
|
||||
0x20000000 - 0x20000110 is .ram_vector_table
|
||||
0x20000110 - 0x200002ac is .data
|
||||
0x200002ac - 0x200002ac is .tdata
|
||||
0x200002ac - 0x200002ac is .tbss
|
||||
0x200002b0 - 0x200004d8 is .bss
|
||||
0x200004d8 - 0x20000cd8 is .heap
|
||||
0x20081000 - 0x20081800 is .stack_dummy
|
||||
0x10001ce8 - 0x10001cfc is .flash_end
|
||||
While running this, GDB does not access memory from...
|
||||
Local exec file:
|
||||
`C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0001_hello-world\build\0x0001_hello-world.elf', file type elf32-littlearm.
|
||||
Entry point: 0x1000014c
|
||||
0x10000000 - 0x100019cc is .text
|
||||
0x100019cc - 0x10001b18 is .rodata
|
||||
0x10001b18 - 0x10001b20 is .ARM.exidx
|
||||
0x10001b20 - 0x10001b4c is .binary_info
|
||||
0x20000000 - 0x20000110 is .ram_vector_table
|
||||
0x20000110 - 0x200002ac is .data
|
||||
0x200002ac - 0x200002ac is .tdata
|
||||
0x200002ac - 0x200002ac is .tbss
|
||||
0x200002b0 - 0x200004d8 is .bss
|
||||
0x200004d8 - 0x20000cd8 is .heap
|
||||
0x20081000 - 0x20081800 is .stack_dummy
|
||||
0x10001ce8 - 0x10001cfc is .flash_end
|
||||
(gdb) maintenance info sections
|
||||
Exec file: `C:\Users\flare-vm\Desktop\Embedded-Hacking-main\0x0001_hello-world\build\0x0001_hello-world.elf', file type elf32-littlearm.
|
||||
[0] 0x10000000->0x100019cc at 0x00001000: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
|
||||
[1] 0x100019cc->0x10001b18 at 0x000029cc: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
|
||||
[2] 0x10001b18->0x10001b20 at 0x00002b18: .ARM.exidx ALLOC LOAD READONLY DATA HAS_CONTENTS
|
||||
[3] 0x10001b20->0x10001b4c at 0x00002b20: .binary_info ALLOC LOAD READONLY DATA HAS_CONTENTS
|
||||
[4] 0x20000000->0x20000110 at 0x00004000: .ram_vector_table ALLOC
|
||||
[5] 0x20000110->0x20000110 at 0x00003cfc: .uninitialized_data HAS_CONTENTS
|
||||
[6] 0x20000110->0x200002ac at 0x00003110: .data ALLOC LOAD READONLY CODE HAS_CONTENTS
|
||||
[7] 0x200002ac->0x200002ac at 0x00003cfc: .tdata ALLOC LOAD DATA HAS_CONTENTS
|
||||
[8] 0x200002ac->0x200002ac at 0x00000000: .tbss ALLOC
|
||||
[9] 0x200002b0->0x200004d8 at 0x000042b0: .bss ALLOC
|
||||
[10] 0x200004d8->0x20000cd8 at 0x000044d8: .heap ALLOC READONLY
|
||||
[11] 0x20080000->0x20080000 at 0x00003cfc: .scratch_x HAS_CONTENTS
|
||||
[12] 0x20081000->0x20081000 at 0x00003cfc: .scratch_y HAS_CONTENTS
|
||||
[13] 0x20081000->0x20081800 at 0x00004000: .stack_dummy ALLOC READONLY
|
||||
[14] 0x10001ce8->0x10001cfc at 0x00003ce8: .flash_end ALLOC LOAD READONLY DATA HAS_CONTENTS
|
||||
[15] 0x0000->0x0034 at 0x00003cfc: .ARM.attributes READONLY HAS_CONTENTS
|
||||
[16] 0x0000->0x0045 at 0x00003d30: .comment READONLY HAS_CONTENTS
|
||||
[17] 0x0000->0x2069a at 0x00003d75: .debug_info READONLY HAS_CONTENTS
|
||||
[18] 0x0000->0x54ff at 0x0002440f: .debug_abbrev READONLY HAS_CONTENTS
|
||||
[19] 0x0000->0x0af0 at 0x00029910: .debug_aranges READONLY HAS_CONTENTS
|
||||
[20] 0x0000->0x2f86 at 0x0002a400: .debug_rnglists READONLY HAS_CONTENTS
|
||||
[21] 0x0000->0x15526 at 0x0002d386: .debug_line READONLY HAS_CONTENTS
|
||||
[22] 0x0000->0x56a7 at 0x000428ac: .debug_str READONLY HAS_CONTENTS
|
||||
[23] 0x0000->0x1ed4 at 0x00047f54: .debug_frame READONLY HAS_CONTENTS
|
||||
[24] 0x0000->0xffd1 at 0x00049e28: .debug_loclists READONLY HAS_CONTENTS
|
||||
[25] 0x0000->0x0178 at 0x00059df9: .debug_line_str READONLY HAS_CONTENTS
|
||||
```
|
||||
|
||||
**What each section means:**
|
||||
|
||||
| Section | Purpose |
|
||||
| ------- | ------- |
|
||||
| `.text` | Executable machine code (your functions/instructions). |
|
||||
| `.rodata` | Read-only constants (strings like `"hello, world"`, lookup tables, const data). |
|
||||
| `.ARM.exidx` | ARM exception unwind index used for stack unwinding/backtraces. |
|
||||
| `.binary_info` | Pico metadata used by tools (program identity/build information). |
|
||||
| `.ram_vector_table` | Interrupt vector table copied/placed in RAM for runtime use. |
|
||||
| `.uninitialized_data` | Deliberately non-zeroed RAM region that can survive certain reset paths. |
|
||||
| `.data` | Initialized global/static variables in RAM (initial values come from flash). |
|
||||
| `.tdata` | Initialized thread-local storage data (often empty in simple bare-metal apps). |
|
||||
| `.tbss` | Zero-initialized thread-local storage (often empty). |
|
||||
| `.bss` | Zero-initialized global/static variables in RAM. |
|
||||
| `.heap` | Heap allocation region (`malloc/new`) reserved in RAM. |
|
||||
| `.scratch_x` | RP2 scratch RAM bank X section (core-local/low-contention placement). |
|
||||
| `.scratch_y` | RP2 scratch RAM bank Y section (core-local/low-contention placement). |
|
||||
| `.stack_dummy` | Linker-reserved stack range marker used to size/place the stack. |
|
||||
| `.flash_end` | Marker/metadata near the logical end of flash image region. |
|
||||
| `.ARM.attributes` | ARM build attributes (ABI/architecture metadata for tools/linkers). |
|
||||
| `.comment` | Compiler/build comment strings (toolchain identification). |
|
||||
| `.debug_info` | Main DWARF debug database (types, variables, symbols, scopes). |
|
||||
| `.debug_abbrev` | Abbreviation table referenced by `.debug_info`. |
|
||||
| `.debug_aranges` | Address-to-compilation-unit lookup acceleration data. |
|
||||
| `.debug_rnglists` | DWARF range lists for non-contiguous code/data ranges. |
|
||||
| `.debug_line` | Address-to-source-line mapping used for stepping/breakpoints. |
|
||||
| `.debug_str` | Shared string pool used by DWARF debug sections. |
|
||||
| `.debug_frame` | Call frame information used for unwinding stack frames. |
|
||||
| `.debug_loclists` | Variable location lists (where variables live over PC ranges). |
|
||||
| `.debug_line_str` | Extra string pool used by `.debug_line` data. |
|
||||
|
||||
> Tip: **Practical rule:** For reverse engineering runtime behavior, focus first on `.text`, `.rodata`, `.data`, `.bss`, heap/stack regions, and the vector table. Debug sections are for source-level mapping and symbol intelligence.
|
||||
|
||||
**Fast interpretation checklist (use this every time):**
|
||||
|
||||
1. **Find where code executes**: Verify `.text` starts at `0x10000000` (XIP flash) and note its end.
|
||||
2. **Find immutable constants**: Use `.rodata` for strings/tables; cross-reference these addresses in disassembly.
|
||||
3. **Find initialized RAM state**: `.data` lives in RAM at runtime, but its initial bytes come from flash.
|
||||
4. **Find zeroed runtime state**: `.bss` is RAM that startup code clears to zero before `main`.
|
||||
5. **Find interrupt control point**: Confirm `.ram_vector_table` location for exception/IRQ handler mapping.
|
||||
6. **Bound dynamic memory**: Note `.heap` range so you can classify allocator activity vs static data.
|
||||
7. **Bound call-stack activity**: Use `.stack_dummy` as linker stack reservation, then track live stack with `$sp`.
|
||||
8. **Separate runtime vs debug-only sections**: `.debug_*`, `.comment`, and `.ARM.attributes` help tooling, not execution.
|
||||
9. **Correlate any suspicious address quickly**: Flash/XIP (`0x100...`) usually code/const; SRAM (`0x200...`) usually data/stack/heap.
|
||||
10. **Validate in memory**: After identifying a section, inspect it with `x` in GDB to confirm actual bytes/instructions.
|
||||
|
||||
##### Viewing Registers with `i r`
|
||||
|
||||
The `i r` (info registers) command shows the current state of all CPU registers:
|
||||
|
||||
```gdb
|
||||
(gdb) i r
|
||||
r0 0x0 0
|
||||
r1 0x10000235 268436021
|
||||
r2 0x80808080 -2139062144
|
||||
r3 0xe000ed08 -536810232
|
||||
r4 0x100001d0 268435920
|
||||
r5 0x88526891 -2007865199
|
||||
r6 0x4f54710 83183376
|
||||
r7 0x400e0014 1074659348
|
||||
r8 0x43280035 1126694965
|
||||
r9 0x0 0
|
||||
r10 0x10000000 268435456
|
||||
r11 0x62707361 1651536737
|
||||
r12 0xed07f600 -318245376
|
||||
sp 0x20082000 0x20082000
|
||||
lr 0x1000018f 268435855
|
||||
pc 0x10000234 0x10000234 <main>
|
||||
xpsr 0x69000000 1761607680
|
||||
```
|
||||
|
||||
**Key registers to watch:**
|
||||
|
||||
| Register | Value | Meaning |
|
||||
| -------- | ------------ | ----------------------------------------------- |
|
||||
| `pc` | `0x10000234` | Program Counter - we're at the start of `main` |
|
||||
| `sp` | `0x20081fc8` | Stack Pointer - top of our stack in RAM |
|
||||
| `lr` | `0x100002d5` | Link Register - where we return after `main` |
|
||||
| `r0-r3` | Various | Will hold function arguments and return values |
|
||||
|
||||
> Tip: **Tip:** You can also use `i r pc sp lr` to show only specific registers you care about.
|
||||
|
||||
### Quick Reference: Essential GDB Commands
|
||||
|
||||
| Command | Short Form | What It Does |
|
||||
| --------------------- | ---------- | ------------------------------------ |
|
||||
| `break main` | `b main` | Set a breakpoint at main |
|
||||
| `continue` | `c` | Continue execution until breakpoint |
|
||||
| `disassemble` | `disas` | Show assembly for current function |
|
||||
| `info registers` | `i r` | Show all register values |
|
||||
| `stepi` | `si` | Execute one assembly instruction |
|
||||
| `nexti` | `ni` | Execute one instruction (skip calls) |
|
||||
| `x/10i $pc` | | Examine 10 instructions at PC |
|
||||
| `monitor reset halt` | | Reset the target and halt |
|
||||
|
||||
### Watching the Stack Change After `push {r3, lr}`
|
||||
|
||||
The first instruction in `main` is `push {r3, lr}`. Before we step it, `SP` is `0x20082000`. After a single `si`, `SP` becomes `0x20081ff8`, which tells us the processor reserved 8 bytes on the stack for two 32-bit values. The first word at the new top of stack is `0xe000ed08`, which is the old value of `r3`, and the second word is `0x1000018f`, which is the saved `lr` return address. This matches the ABI rule we discussed earlier: the compiler pushes an even number of registers so the stack stays 8-byte aligned at the next call site before `stdio_init_all()` runs.
|
||||
|
||||
Notice the difference between inspecting memory at `$sp` and inspecting `$lr`. `x/4x $sp` is enough here to show the relevant stack words in RAM, while `x/x $lr` shows the instruction word stored at the flash address held in the link register. In other words, `$sp` points to saved data on the stack, but `$lr` points to code that execution will return to later.
|
||||
|
||||
```gdb
|
||||
(gdb) x/x $sp
|
||||
0x20082000: 0x00000000
|
||||
(gdb) si
|
||||
0x10000236 5 stdio_init_all();
|
||||
|
||||
(gdb) x/x $sp
|
||||
0x20081ff8: 0xe000ed08
|
||||
(gdb) x/4x $sp
|
||||
0x20081ff8: 0xe000ed08 0x1000018f 0x00000000 0x00000000
|
||||
(gdb) x/x $lr
|
||||
0x1000018f <platform_entry+8>: 0x00478849
|
||||
```
|
||||
|
||||
> Tip: **What's Next?** In Week 2, we'll put these GDB commands to work with hands-on debugging exercises! We'll step through code, examine the stack, watch registers change, and ultimately use these skills to modify a running program. The commands you learned here are the foundation for everything that follows.
|
||||
|
||||
---
|
||||
|
||||
## Part 5: Static Analysis with Ghidra
|
||||
|
||||
### Setting Up Your First Ghidra Project
|
||||
|
||||
Before we dive into GDB debugging, let's set up Ghidra to analyze our hello-world binary. Ghidra is a powerful reverse engineering tool that will help us visualize the disassembly and decompiled code.
|
||||
|
||||
##### Step 1: Create a New Project
|
||||
|
||||
1. Launch Ghidra
|
||||
2. A window will appear - select **File -> New Project**
|
||||
3. Choose **Non-Shared Project** and click **Next**
|
||||
4. Enter the Project Name: `0x0001_hello-world`
|
||||
5. Click **Finish**
|
||||
|
||||
##### Step 2: Import the Binary
|
||||
|
||||
1. Open your file explorer and navigate to the `Embedded-Hacking` folder
|
||||
2. **Drag and drop** the `0x0001_hello-world.elf` file into the folder panel within the Ghidra application
|
||||
|
||||
##### Step 3: Understand the Import Dialog
|
||||
|
||||
In the small window that appears, you will see the file identified as an **ELF** (Executable and Linkable Format).
|
||||
|
||||
> Tip: **What is an ELF file?**
|
||||
>
|
||||
> ELF stands for **Executable and Linkable Format**. This format includes **symbols** - human-readable names for functions and variables. These symbols make reverse engineering much easier because you can see function names like `main` and `printf` instead of just memory addresses.
|
||||
>
|
||||
> In future weeks, we will work with **stripped binaries** (`.bin` files) that do not contain these symbols. This is more realistic for real-world reverse engineering scenarios where symbols have been removed to make analysis harder.
|
||||
|
||||
3. Click **Ok** to import the file
|
||||
4. **Double-click** on the file within the project window to open it in the CodeBrowser
|
||||
|
||||
##### Step 4: Auto-Analyze the Binary
|
||||
|
||||
When prompted, click **Yes** to auto-analyze the binary. Accept the default analysis options and click **Analyze**.
|
||||
|
||||
Ghidra will now process the binary, identifying functions, strings, and cross-references. This may take a moment.
|
||||
|
||||
### Reviewing the Main Function in Ghidra
|
||||
|
||||
Once analysis is complete, let's find our `main` function:
|
||||
|
||||
1. In the **Symbol Tree** panel on the left, expand **Functions**
|
||||
2. Look for `main` in the list (you can also use **Search -> For Address or Label** and type "main")
|
||||
3. Click on `main` to navigate to it
|
||||
|
||||
##### What You'll See
|
||||
|
||||
Ghidra shows you two views of the code:
|
||||
|
||||
**Listing View (Center Panel)** - The disassembled ARM assembly:
|
||||
```
|
||||
*************************************************************
|
||||
* FUNCTION
|
||||
*************************************************************
|
||||
int main (void )
|
||||
assume LRset = 0x0
|
||||
assume TMode = 0x1
|
||||
int r0:4 <RETURN>
|
||||
main XREF[3]: Entry Point (*) ,
|
||||
_reset_handler:1000018c (c) ,
|
||||
.debug_frame::00000018 (*)
|
||||
0x0001_hello-world.c:4 (2)
|
||||
0x0001_hello-world.c:5 (2)
|
||||
10000234 08 b5 push {r3,lr}
|
||||
0x0001_hello-world.c:5 (4)
|
||||
10000236 01 f0 99 f9 bl stdio_init_all _Bool stdio_init_all(void)
|
||||
LAB_1000023a XREF[1]: 10000240 (j)
|
||||
0x0001_hello-world.c:7 (6)
|
||||
0x0001_hello-world.c:8 (6)
|
||||
1000023a 02 48 ldr r0=>__EH_FRAME_BEGIN__ ,[DAT_10000244 ] = "hello, world\r"
|
||||
= 100019CCh
|
||||
1000023c 01 f0 de f9 bl __wrap_puts int __wrap_puts(char * s)
|
||||
0x0001_hello-world.c:7 (8)
|
||||
10000240 fb e7 b LAB_1000023a
|
||||
10000242 00 ?? 00h
|
||||
10000243 bf ?? BFh
|
||||
DAT_10000244 XREF[1]: main:1000023a (R)
|
||||
10000244 cc 19 00 10 undefine 100019CCh ? -> 100019cc
|
||||
|
||||
```
|
||||
|
||||
**Decompile View (Right Panel)** - The reconstructed C code:
|
||||
```c
|
||||
int main(void)
|
||||
|
||||
{
|
||||
stdio_init_all();
|
||||
do {
|
||||
__wrap_puts("hello, world\r");
|
||||
} while( true );
|
||||
}
|
||||
```
|
||||
|
||||
> **Notice how Ghidra reconstructed our original C code!** The decompiler recognized the infinite loop and the `puts` call (the compiler optimized `printf` to `puts` since we're just printing a simple string).
|
||||
|
||||
##### Why We Start with .elf Files
|
||||
|
||||
We're using the `.elf` file because it contains symbols that help us learn:
|
||||
|
||||
- Function names are visible (`main`, `stdio_init_all`, `puts`)
|
||||
- Variable names may be preserved
|
||||
- The structure of the code is easier to understand
|
||||
|
||||
In future weeks, we'll work with `.bin` files that have been stripped of symbols. This will teach you how to identify functions and understand code when you don't have these helpful hints!
|
||||
|
||||
---
|
||||
|
||||
## Part 6: Summary and Review
|
||||
|
||||
### What We Learned
|
||||
|
||||
1. **Registers**: The ARM Cortex-M33 has 13 general-purpose registers (`r0`-`r12`), plus special registers for the stack pointer (`r13`/SP), link register (`r14`/LR), and program counter (`r15`/PC).
|
||||
|
||||
2. **The Stack**:
|
||||
- Grows downward in memory
|
||||
- PUSH adds items (SP decreases)
|
||||
- POP removes items (SP increases)
|
||||
- Used to save return addresses and register values
|
||||
|
||||
3. **Memory Layout**:
|
||||
- Code lives in flash memory starting at `0x10000000`
|
||||
- Stack lives in RAM around `0x20080000`
|
||||
|
||||
4. **GDB Basics**: We learned the essential commands for connecting to hardware and examining code:
|
||||
|
||||
| Command | What It Does |
|
||||
| --------------------- | -------------------------------------- |
|
||||
| `target extended-remote :3333` | Connect to OpenOCD debug server |
|
||||
| `monitor reset halt` | Reset and halt the processor |
|
||||
| `b main` | Set breakpoint at main function |
|
||||
| `c` | Continue running until breakpoint |
|
||||
| `disas` | Disassemble current function |
|
||||
| `i r` | Show all register values |
|
||||
|
||||
5. **Ghidra Static Analysis**: We set up a Ghidra project and analyzed our binary:
|
||||
- Imported the ELF file with symbols
|
||||
- Found the `main` function
|
||||
- Saw the decompiled C code
|
||||
- Understood how assembly maps to C
|
||||
|
||||
6. **Little-Endian**: The RP2350 stores multi-byte values with the least significant byte at the lowest address, making them appear "backwards" when viewed as a single value.
|
||||
|
||||
### The Program Flow
|
||||
|
||||
```
|
||||
+-----------------------------------------------------+
|
||||
| 1. push {r3, lr} |
|
||||
| Save registers to stack |
|
||||
+-----------------------------------------------------+
|
||||
| 2. bl stdio_init_all |
|
||||
| Initialize standard I/O |
|
||||
+-----------------------------------------------------+
|
||||
| 3. ldr r0, [pc, #8] ----------------+ |
|
||||
| Load address of "hello, world" into r0| |
|
||||
+-----------------------------------------------------+
|
||||
| 4. bl __wrap_puts | |
|
||||
| Print the string | |
|
||||
+-----------------------------------------------------+
|
||||
| 5. b.n (back to step 3) ----------------+ |
|
||||
| Infinite loop! |
|
||||
+-----------------------------------------------------+
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
> **Note:** The detailed hands-on GDB debugging (stepping through code, watching the stack, examining memory) will be covered in Week 2!
|
||||
|
||||
---
|
||||
|
||||
## Key Takeaways
|
||||
|
||||
1. **Reverse engineering combines static and dynamic analysis** - we look at the code (static with Ghidra) and run it to see what happens (dynamic with GDB).
|
||||
|
||||
2. **The stack is fundamental** - understanding how push/pop work is essential for following function calls.
|
||||
|
||||
3. **GDB and Ghidra work together** - Ghidra helps you understand the big picture, GDB lets you watch it happen live.
|
||||
|
||||
4. **Assembly isn't scary** - each instruction does one simple thing. Put them together and you understand the whole program!
|
||||
|
||||
5. **Everything is just numbers** - whether it's code, data, or addresses, it's all stored as numbers in memory.
|
||||
|
||||
---
|
||||
|
||||
## Glossary
|
||||
|
||||
| Term | Definition |
|
||||
| ------------------- | --------------------------------------------------------- |
|
||||
| **Assembly** | Human-readable representation of machine code |
|
||||
| **Breakpoint** | A marker that tells the debugger to pause execution |
|
||||
| **GDB** | GNU Debugger - a tool for examining running programs |
|
||||
| **Hex/Hexadecimal** | Base-16 number system (0-9, A-F) |
|
||||
| **Little-Endian** | Storing the least significant byte at the lowest address |
|
||||
| **Microcontroller** | A small computer on a single chip |
|
||||
| **Program Counter** | Register that points to the next instruction |
|
||||
| **Register** | Fast storage inside the processor |
|
||||
| **Stack** | Memory region for temporary storage during function calls |
|
||||
| **Stack Pointer** | Register that points to the top of the stack |
|
||||
| **XIP** | Execute In Place - running code directly from flash |
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,718 @@
|
||||
# Week 1a: Understanding the ARM Stack: Inline Assembly and Live Debugging
|
||||
|
||||
***
|
||||
**LEGAL DISCLAIMER:**
|
||||
The information, tools, and code provided in this repository and course are strictly for educational, research, and defensive purposes only.
|
||||
|
||||
You are explicitly prohibited from using any materials contained herein to access, test, modify, or exploit any device, network, or system that you do not own 100% or for which you do not have explicit, documented, and legally binding authorization to interact with.
|
||||
|
||||
By using this repository and course, you acknowledge and agree that:
|
||||
|
||||
1. Any illegal, unauthorized, or malicious use of this information is solely your responsibility.
|
||||
2. The author(s) and contributor(s) of this repository and course shall not be held liable for any damages, legal repercussions, criminal charges, or unauthorized actions resulting from the use, misuse, or abuse of the contents herein.
|
||||
3. You will comply with all applicable local, state, national, and international laws regarding cybersecurity and computer fraud.
|
||||
|
||||
**IF YOU DO NOT AGREE WITH THESE TERMS, DO NOT USE THIS REPOSITORY AND COURSE.**
|
||||
|
||||
***
|
||||
|
||||
## What You'll Learn This Week
|
||||
|
||||
By the end of this week, you will be able to:
|
||||
|
||||
- Understand how the RP2350 Cortex-M33 stack grows in SRAM.
|
||||
- Identify the ARM registers used by this stack experiment.
|
||||
- Build and flash a Pico 2 ELF through a Debug Probe.
|
||||
- Connect OpenOCD and GDB to live hardware.
|
||||
- Step one assembly instruction at a time with `si`.
|
||||
- Examine the exact stack words written by each multi-register instruction.
|
||||
- Prove that an ARM register list is ordered by register number, not source-list spelling.
|
||||
|
||||
---
|
||||
|
||||
## Part 1: Understanding the Basics
|
||||
|
||||
### What is a Microcontroller?
|
||||
|
||||
A microcontroller is a complete small computer on one chip. It contains processor cores, memory controllers, peripherals, and interfaces for hardware such as GPIO, UART, timers, and SPI. The Raspberry Pi Pico 2 uses the **RP2350** microcontroller.
|
||||
|
||||
### What is the ARM Cortex-M33?
|
||||
|
||||
The RP2350 can run Arm Cortex-M33 cores. The program in this folder is built for that Arm target. We will use the Debug Probe, OpenOCD, and GDB to stop a core and inspect its registers and memory while it executes the program.
|
||||
|
||||
### What is Dynamic Analysis?
|
||||
|
||||
Dynamic analysis means observing a program while it runs on real hardware. In this lesson we will:
|
||||
|
||||
- Stop the processor at `main`.
|
||||
- View the instructions produced by the compiler.
|
||||
- Execute one instruction with `si`.
|
||||
- Read the stack pointer and the memory it points to.
|
||||
|
||||
---
|
||||
|
||||
## Part 2: Understanding Processor Registers
|
||||
|
||||
### What is a Register?
|
||||
|
||||
A register is very fast storage inside the CPU. Instructions use registers for values, addresses, temporary results, and control flow.
|
||||
|
||||
### The ARM Cortex-M33 Registers
|
||||
|
||||
| Register | Also Called | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `r0` - `r12` | General purpose | Hold values and addresses while instructions run. |
|
||||
| `r13` | SP | Points to the current top of the stack. |
|
||||
| `r14` | LR | Holds the return address after a function call. |
|
||||
| `r15` | PC | Points to the next instruction to execute. |
|
||||
|
||||
##### General-Purpose Registers (`r0` - `r12`)
|
||||
|
||||
This lesson uses `r2`, `r3`, `r4`, `r6`, `r9`, and `r10`. The assembly saves their current values to SRAM, then restores them before the loop repeats.
|
||||
|
||||
##### The Stack Pointer (`r13` / SP)
|
||||
|
||||
The stack is a region of SRAM used for temporary values, saved registers, return addresses, and local variables. On Cortex-M, the standard stack grows toward lower addresses.
|
||||
|
||||
- A `push` lowers `sp` and writes values below the old stack pointer.
|
||||
- A `pop` reads values at `sp` and raises `sp`.
|
||||
- Each saved register occupies 4 bytes.
|
||||
|
||||
```text
|
||||
Higher addresses
|
||||
+------------------+
|
||||
| Old SP location |
|
||||
+------------------+
|
||||
| Saved value |
|
||||
+------------------+
|
||||
| Saved value | <- SP after a multi-register push
|
||||
+------------------+
|
||||
Lower addresses
|
||||
```
|
||||
|
||||
##### The Link Register (`r14` / LR)
|
||||
|
||||
A `bl` instruction calls a function and stores the return address in `lr`. The compiler-generated prologue for `main` saves `lr` on the stack before calling `stdio_init_all`.
|
||||
|
||||
##### The Program Counter (`r15` / PC)
|
||||
|
||||
The Program Counter identifies the next instruction. In GDB, the `=>` marker in `disas main` points to the instruction that will run when you type `si`.
|
||||
|
||||
---
|
||||
|
||||
## Part 3: Understanding Memory Layout
|
||||
|
||||
### XIP - Execute In Place
|
||||
|
||||
The Pico 2 executes this firmware directly from external flash through XIP. The executable code normally begins at `0x10000000`.
|
||||
|
||||
### Memory Map Overview
|
||||
|
||||
```text
|
||||
+-------------------------------------+
|
||||
| Flash Memory (XIP) |
|
||||
| Starts at: 0x10000000 |
|
||||
| Contains: program instructions |
|
||||
+-------------------------------------+
|
||||
| SRAM |
|
||||
| Starts at: 0x20000000 |
|
||||
| Contains: stack, heap, variables |
|
||||
+-------------------------------------+
|
||||
```
|
||||
|
||||
### Why the Stack Is in SRAM
|
||||
|
||||
The stack changes on every function call and return, so it must be writable. When GDB displays `$sp`, it should show an address in the `0x200...` SRAM range. `x/wx $sp` reads the 32-bit value currently at the top of that stack.
|
||||
|
||||
---
|
||||
|
||||
## Part 3.5: Reviewing Our Stack Code
|
||||
|
||||
The file `0x0001a_stack.c` initializes standard I/O, then repeats this assembly block forever:
|
||||
|
||||
```c
|
||||
__asm volatile(
|
||||
"push {r4, lr}\n"
|
||||
"push {r3, r2, r6}\n"
|
||||
"stmdb sp!, {r9, r10}\n"
|
||||
"ldmia sp!, {r9, r10}\n"
|
||||
"pop {r2, r3, r6}\n"
|
||||
"pop {r4, lr}\n"
|
||||
::: "memory");
|
||||
```
|
||||
|
||||
### Breaking Down the Code
|
||||
|
||||
##### First Push: `push {r4, lr}`
|
||||
|
||||
This lowers `sp` by 8 bytes. At the new stack pointer, the saved values are:
|
||||
|
||||
```text
|
||||
[sp + 4] = lr (higher address, visual top)
|
||||
[sp] = r4 (lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
##### Second Push: `push {r3, r2, r6}`
|
||||
|
||||
This is deliberately written in a confusing order. The source says `r3` first, but an ARM register list is a set of registers, not an ordered sequence of operations. The assembler encodes the same register mask as `{r2, r3, r6}` and warns that the list is not ascending.
|
||||
|
||||
After one `si`, the stack layout proves the actual rule:
|
||||
|
||||
```text
|
||||
[sp + 16] = lr (highest address, visual top)
|
||||
[sp + 12] = r4
|
||||
[sp + 8] = r6
|
||||
[sp + 4] = r3
|
||||
[sp] = r2 (lowest address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
The first three words were written by this instruction; `r4` and `lr` remain from
|
||||
the preceding `push {r4, lr}`. The lowest register number in this push is stored
|
||||
at the lowest address. Because the stack grows down, `[sp]` is the lower address
|
||||
and the older `lr` at `[sp + 16]` is the higher address at the visual top.
|
||||
|
||||
##### High Registers: `stmdb sp!, {r9, r10}`
|
||||
|
||||
The 16-bit Thumb `push` encoding cannot encode high registers `r8` through `r12`.
|
||||
`stmdb sp!` is the general full-descending stack instruction used for `r9` and
|
||||
`r10`.
|
||||
|
||||
```text
|
||||
[sp + 4] = r10 (higher address, visual top)
|
||||
[sp] = r9 (lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
##### The Restore Instructions
|
||||
|
||||
The next instructions restore the same groups in reverse stack-group order. This matters because the last group saved is at the current top of the stack:
|
||||
|
||||
```text
|
||||
ldmia sp!, {r9, r10}
|
||||
pop {r2, r3, r6}
|
||||
pop {r4, lr}
|
||||
```
|
||||
|
||||
The stack pointer ends at the same value it had before the inline assembly, so the infinite loop does not consume stack space.
|
||||
|
||||
### Compiling and Flashing to the Pico 2
|
||||
|
||||
##### Step 1: Compile the Code
|
||||
|
||||
From the project folder, build the program:
|
||||
|
||||
```powershell
|
||||
& "$env:USERPROFILE\.pico-sdk\ninja\v1.13.2\ninja.exe" -C build
|
||||
```
|
||||
|
||||
The expected artifact is `build\0x0001a_stack.elf`. The assembler reports `register range not in ascending order` for the deliberately unordered source list. That warning is expected for this experiment.
|
||||
|
||||
##### Step 2: Flash and Verify
|
||||
|
||||
Use the Debug Probe to flash the ELF and compare target flash with the built image:
|
||||
|
||||
```powershell
|
||||
& "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\openocd.exe" -s "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c 'adapter speed 5000; targets rp2350.dap.core1; cortex_m reset_config sysresetreq; targets rp2350.dap.core0; program "build/0x0001a_stack.elf" verify reset exit'
|
||||
```
|
||||
|
||||
You should see:
|
||||
|
||||
```text
|
||||
** Programming Finished **
|
||||
** Verify Started **
|
||||
** Verified OK **
|
||||
** Resetting Target **
|
||||
shutdown command invoked
|
||||
```
|
||||
|
||||
`Verified OK` proves that the programmed bytes match the ELF. `shutdown command invoked` is normal because `exit` ends OpenOCD after flashing.
|
||||
|
||||
---
|
||||
|
||||
## Part 4: Dynamic Analysis with GDB
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Before starting, you need:
|
||||
|
||||
1. A Pico 2 with the Debug Probe connected.
|
||||
2. OpenOCD from the installed Pico SDK.
|
||||
3. `arm-none-eabi-gdb`.
|
||||
4. The verified `build\0x0001a_stack.elf` on the Pico 2.
|
||||
|
||||
### Connecting to Your Pico 2 with OpenOCD
|
||||
|
||||
Open a terminal and start the debug server. Leave it running:
|
||||
|
||||
```powershell
|
||||
& "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\openocd.exe" -s "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000; init"
|
||||
```
|
||||
|
||||
OpenOCD listens for GDB connections on port `3333`.
|
||||
|
||||
##### VM Command
|
||||
|
||||
If the VM has `openocd` on its `PATH`, use the same command without the full executable path:
|
||||
|
||||
```powershell
|
||||
openocd -s "$env:USERPROFILE\.pico-sdk\openocd\0.12.0+dev\scripts" -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000; init"
|
||||
```
|
||||
|
||||
The VM needs USB access to the Debug Probe. Nothing else about the build, ELF, or GDB sequence changes.
|
||||
|
||||
### Connecting to Your Pico 2 with GDB
|
||||
|
||||
Open a second terminal in the project folder:
|
||||
|
||||
```powershell
|
||||
arm-none-eabi-gdb build\0x0001a_stack.elf
|
||||
```
|
||||
|
||||
Connect, reset, halt, and stop at `main`:
|
||||
|
||||
```gdb
|
||||
target extended-remote :3333
|
||||
monitor reset halt
|
||||
b main
|
||||
c
|
||||
disas main
|
||||
```
|
||||
|
||||
You should see this instruction pattern from the current `build\0x0001a_stack.elf`.
|
||||
The instruction addresses are determined by the ELF. The register contents shown
|
||||
later are live target state and are not determined by the ELF.
|
||||
|
||||
```text
|
||||
=> main: push {r3, lr}
|
||||
main+2: bl stdio_init_all
|
||||
main+6: push {r4, lr}
|
||||
main+8: push {r2, r3, r6}
|
||||
main+10: stmdb sp!, {r9, r10}
|
||||
main+14: ldmia.w sp!, {r9, r10}
|
||||
main+18: pop {r2, r3, r6}
|
||||
main+20: ldmia.w sp!, {r4, lr}
|
||||
main+24: b.n main+6
|
||||
```
|
||||
|
||||
Notice that GDB displays `{r2, r3, r6}`, not the source spelling `{r3, r2, r6}`. That is the encoded register set in canonical order. Some disassemblers display `r10` as its conventional alias, `sl`; `{r9, sl}` and `{r9, r10}` name the same register set.
|
||||
|
||||
### Basic GDB Commands: Your First Steps
|
||||
|
||||
| Command | Short Form | What It Does |
|
||||
| --- | --- | --- |
|
||||
| `break main` | `b main` | Set a breakpoint at `main`. |
|
||||
| `continue` | `c` | Run until a breakpoint. |
|
||||
| `disassemble` | `disas` | Show the current function's assembly. |
|
||||
| `info registers` | `i r` | Display CPU registers. |
|
||||
| `stepi` | `si` | Execute exactly one instruction. |
|
||||
| `nexti` | `ni` | Execute one instruction without entering a call. |
|
||||
| `x/wx ADDRESS` | | Examine one 32-bit hexadecimal word. |
|
||||
| `monitor reset halt` | | Ask OpenOCD to reset and halt the target. |
|
||||
|
||||
### Watching the Stack Change
|
||||
|
||||
> **Important: the instruction addresses and stack offsets below come from the
|
||||
> current ELF. The Step 4 register capture is from the live GDB session shown
|
||||
> here. Register contents and old SRAM words are target state, not constants
|
||||
> that can be recovered from the ELF. The deterministic rule is that `push
|
||||
> {r4, lr}` decreases `sp` by 8 bytes, stores `r4` at the new `[sp]`, and
|
||||
> stores `lr` at `[sp + 4]`.
|
||||
|
||||
##### Step 1: Inspect the Stack Before the Compiler Prologue
|
||||
|
||||
At the breakpoint, GDB is paused before `push {r3, lr}`. Inspect the current stack pointer and the two words below it:
|
||||
|
||||
```gdb
|
||||
(gdb) p/x $sp
|
||||
$1 = 0x20082000
|
||||
(gdb) x/2wx $sp-8
|
||||
0x20081ff8: 0x88526891 0x10000187
|
||||
```
|
||||
|
||||
The stack pointer is at `0x20082000`. The two words below it contain previous values (before the prologue).
|
||||
|
||||
##### Step 2: Execute One Instruction
|
||||
|
||||
Execute the compiler prologue `push {r3, lr}`:
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001e2 7 stdio_init_all();
|
||||
(gdb) p/x $sp
|
||||
$2 = 0x20081ff8
|
||||
(gdb) p/x $r3
|
||||
$3 = 0xe000ed08
|
||||
(gdb) x/wx $sp
|
||||
0x20081ff8: 0xe000ed08
|
||||
(gdb) p/x $lr
|
||||
$4 = 0x1000018b
|
||||
(gdb) x/wx $sp+4
|
||||
0x20081ffc: 0x1000018b
|
||||
```
|
||||
|
||||
The prologue saved two values to the stack:
|
||||
```text
|
||||
[sp + 4] = 0x1000018b (lr, higher address, visual top)
|
||||
[sp] = 0xe000ed08 (r3, lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
**Stack layout after prologue** (memory grows downward; **higher hex addresses = deeper in stack = older data**):
|
||||
|
||||
```text
|
||||
Address Pointer Value Label
|
||||
0x20082000 ---------- ---------- (previous data — HIGHEST address, visual top)
|
||||
0x20081ffc ---------- 0x1000018b (lr, higher address)
|
||||
0x20081ff8 <- [sp] 0xe000ed08 (r3, lowest address) <- SP <- TOP OF STACK
|
||||
|
||||
MEMORY ORDER: 0x20081ff8 < 0x20081ffc < 0x20082000
|
||||
(visual bottom) (visual top)
|
||||
```
|
||||
|
||||
**Memory address explanation for newcomers:**
|
||||
- Hex address `0x20081ffc` is **LARGER** than `0x20081ff8` (compare the last hex digits: `ffc` > `ff8`)
|
||||
- **Larger addresses = higher in memory = deeper in the stack**
|
||||
- When we PUSH, sp **DECREASES** (goes to a smaller address, moving DOWN on the page)
|
||||
- When we POP, sp **INCREASES** (goes to a larger address, moving UP on the page)
|
||||
|
||||
The stack pointer dropped 8 bytes: from `0x20082000` to `0x20081ff8` (it went DOWN, to a smaller/lower address).
|
||||
|
||||
##### Step 3: Step Over `stdio_init_all`
|
||||
|
||||
Do not step into the library initialization code. Use `ni` to execute it and return:
|
||||
|
||||
```gdb
|
||||
(gdb) ni
|
||||
0x100001e6 15 __asm volatile(
|
||||
(gdb) disas main
|
||||
Dump of assembler code for function main:
|
||||
0x100001e0 <+0>: push {r3, lr}
|
||||
0x100001e2 <+2>: bl 0x10001594 <stdio_init_all>
|
||||
=> 0x100001e6 <+6>: push {r4, lr}
|
||||
0x100001e8 <+8>: push {r2, r3, r6}
|
||||
...
|
||||
```
|
||||
|
||||
The arrow now points at `push {r4, lr}`, the first inline assembly instruction.
|
||||
|
||||
##### Step 4: Prove the First Inline Push
|
||||
|
||||
Read the registers and stack pointer before the first inline push:
|
||||
|
||||
```gdb
|
||||
(gdb) p/x $r4
|
||||
$3 = 0x100001cc
|
||||
(gdb) p/x $lr
|
||||
$4 = 0x1000159b
|
||||
(gdb) p/x $sp
|
||||
$5 = 0x20081ff8
|
||||
```
|
||||
|
||||
Now execute the first inline push:
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001e8 16 "push {r4, lr}\n"
|
||||
(gdb) p/x $sp
|
||||
$6 = 0x20081ff0
|
||||
(gdb) x/wx $sp
|
||||
0x20081ff0: 0x100001cc
|
||||
(gdb) x/wx $sp+4
|
||||
0x20081ff4: 0x1000159b
|
||||
```
|
||||
|
||||
**After first inline push `push {r4, lr}`:**
|
||||
- SP = `0x20081ff0` (**new TOP of stack, sp decreased**)
|
||||
- `r4` = `0x100001cc` (now saved on stack)
|
||||
- `lr` = `0x1000159b` (now saved on stack)
|
||||
|
||||
The first push saved:
|
||||
```text
|
||||
[sp + 4] = 0x1000159b (lr, higher address, visual top)
|
||||
[sp] = 0x100001cc (r4, lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
**Stack layout after first inline push**:
|
||||
|
||||
```text
|
||||
Address Pointer Value Label
|
||||
0x20081ffc ---------- 0x1000018b (lr from prologue — highest address, visual top)
|
||||
0x20081ff8 ---------- 0xe000ed08 (r3 from prologue — higher address)
|
||||
0x20081ff4 ---------- 0x1000159b (lr — higher address)
|
||||
0x20081ff0 <- [sp] 0x100001cc (r4, lowest address) <- SP <- TOP OF STACK
|
||||
|
||||
MEMORY ORDER: 0x20081ff0 < 0x20081ff4 < 0x20081ff8 < 0x20081ffc
|
||||
(visual bottom) (visual top)
|
||||
Most recent Least recent
|
||||
```
|
||||
|
||||
**The stack pointer dropped from `0x20081ff8` to `0x20081ff0` — that's 8 bytes down (toward lower addresses).**
|
||||
**The value at `[sp]` (the TOP) is now `0x100001cc` (r4).**
|
||||
**Address `0x20081ff0` is SMALLER than `0x20081ff8`, so sp moved DOWN.**
|
||||
|
||||
|
||||
##### Step 5: Prove Register-List Ordering
|
||||
|
||||
Read the three registers before executing the deliberately unordered list `push {r3, r2, r6}`:
|
||||
|
||||
```gdb
|
||||
(gdb) p/x $r2
|
||||
$18 = 0x200005cc
|
||||
(gdb) p/x $r3
|
||||
$19 = 0xe000ed08
|
||||
(gdb) p/x $r6
|
||||
$20 = 0x04f54710
|
||||
(gdb) p/x $sp
|
||||
$21 = 0x20081ff0
|
||||
```
|
||||
|
||||
Now execute the second inline push:
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001ea <+10>: stmdb sp!, {r9, sl}
|
||||
(gdb) p/x $sp
|
||||
$22 = 0x20081fe4
|
||||
(gdb) x/wx $sp
|
||||
0x20081fe4: 0x200005cc
|
||||
(gdb) x/wx $sp+4
|
||||
0x20081fe8: 0xe000ed08
|
||||
(gdb) x/wx $sp+8
|
||||
0x20081fec: 0x04f54710
|
||||
```
|
||||
|
||||
The second push saved three registers in **numeric order** despite the source spelling `{r3, r2, r6}`:
|
||||
```text
|
||||
[sp + 8] = 0x04f54710 (r6, higher address, visual top)
|
||||
[sp + 4] = 0xe000ed08 (r3, higher address)
|
||||
[sp] = 0x200005cc (r2, lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
**Stack layout after second inline push** (**lower hex addresses = most recent = TOP**):
|
||||
|
||||
```text
|
||||
Address Pointer Value Label
|
||||
0x20081ffc ---------- 0x1000018b (lr — HIGHEST address, OLDEST data, visual top)
|
||||
0x20081ff8 ---------- 0xe000ed08 (r3 — higher address)
|
||||
0x20081ff4 ---------- 0x1000159b (lr — higher address)
|
||||
0x20081ff0 ---------- 0x100001cc (r4 — higher address)
|
||||
0x20081fec ---------- 0x04f54710 (r6 — higher address)
|
||||
0x20081fe8 ---------- 0xe000ed08 (r3 — higher address)
|
||||
0x20081fe4 <- [sp] 0x200005cc (r2, lowest address) <- SP <- TOP OF STACK
|
||||
|
||||
ADDRESS ORDERING: 0x20081fe4 < 0x20081fe8 < ... < 0x20081ffc
|
||||
(visual bottom) (visual top)
|
||||
Hex comparison: fe4 < fe8 < fec < ff0 < ff4 < ff8 < ffc
|
||||
Most recent data at the visual bottom
|
||||
```
|
||||
|
||||
**The stack pointer dropped from `0x20081ff0` to `0x20081fe4` — that's 12 bytes down (three 4-byte registers).**
|
||||
**When comparing hex: `0x20081fe4` is SMALLER than `0x20081ff0`, so sp moved to a LOWER address.**
|
||||
**The value at `[sp]` (the TOP) is now `0x200005cc` (r2).**
|
||||
|
||||
Notice: the source wrote `r3` first, but the CPU pushed `r2` first because `r2` has a lower register number. The encoded register mask is `{r2, r3, r6}`, and the stack layout proves it.
|
||||
|
||||
##### Step 6: Prove the High-Register Save
|
||||
|
||||
Read the high registers before the `stmdb sp!, {r9, r10}` instruction:
|
||||
|
||||
```gdb
|
||||
(gdb) p/x $r9
|
||||
$23 = 0x00000000
|
||||
(gdb) p/x $r10
|
||||
$24 = 0x10000000
|
||||
(gdb) p/x $sp
|
||||
$25 = 0x20081fe4
|
||||
```
|
||||
|
||||
Execute the high-register save:
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001ee <+14>: ldmia.w sp!, {r9, sl}
|
||||
(gdb) p/x $sp
|
||||
$26 = 0x20081fdc
|
||||
(gdb) p/x $r9
|
||||
$27 = 0x00000000
|
||||
(gdb) p/x $r10
|
||||
$28 = 0x10000000
|
||||
(gdb) x/wx $sp
|
||||
0x20081fdc: 0x00000000
|
||||
(gdb) x/wx $sp+4
|
||||
0x20081fe0: 0x10000000
|
||||
(gdb) x/wx $sp+8
|
||||
0x20081fe4: 0x200005cc
|
||||
(gdb) x/wx $sp+12
|
||||
0x20081fe8: 0xe000ed08
|
||||
(gdb) x/wx $sp+16
|
||||
0x20081fec: 0x04f54710
|
||||
(gdb) x/wx $sp+20
|
||||
0x20081ff0: 0x100001cc
|
||||
(gdb) x/wx $sp+24
|
||||
0x20081ff4: 0x1000159b
|
||||
(gdb) x/wx $sp+28
|
||||
0x20081ff8: 0xe000ed08
|
||||
```
|
||||
|
||||
**After high-register save `stmdb sp!, {r9, r10}`:**
|
||||
- SP = `0x20081fdc` (**new TOP of stack, sp decreased further**)
|
||||
- `r9` = `0x00000000` (now saved on stack)
|
||||
- `r10` = `0x10000000` (now saved on stack)
|
||||
|
||||
The `stmdb sp!, {r9, r10}` instruction saved:
|
||||
```text
|
||||
[sp + 4] = 0x10000000 (r10, higher address, visual top)
|
||||
[sp] = 0x00000000 (r9, lower address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
**The stack pointer dropped from `0x20081fe4` to `0x20081fdc` — that's 8 more bytes down.**
|
||||
**The value at `[sp]` (the TOP) is now `0x00000000` (r9).**
|
||||
**This is the DEEPEST point of the stack during inline assembly.**
|
||||
|
||||
```text
|
||||
Address Pointer Value Label
|
||||
0x20081ff8 ---------- 0xe000ed08 (saved prologue r3, highest address, visual top)
|
||||
0x20081ff4 ---------- 0x1000159b (lr, higher address)
|
||||
0x20081ff0 ---------- 0x100001cc (r4, higher address)
|
||||
0x20081fec ---------- 0x04f54710 (r6, higher address)
|
||||
0x20081fe8 ---------- 0xe000ed08 (r3, higher address)
|
||||
0x20081fe4 ---------- 0x200005cc (r2, higher address)
|
||||
0x20081fe0 ---------- 0x10000000 (r10, higher address)
|
||||
0x20081fdc <- [sp] 0x00000000 (r9, lowest address) <- SP <- TOP OF STACK
|
||||
```
|
||||
|
||||
##### Step 7: Watch the Restores
|
||||
|
||||
At this point, the stack is at maximum depth. Now execute the restore instructions one by one:
|
||||
|
||||
**Restore 1: ldmia sp!, {r9, r10}**
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001f2 <+18>: pop {r2, r3, r6}
|
||||
(gdb) p/x $sp
|
||||
$29 = 0x20081fe4
|
||||
(gdb) p/x $r9
|
||||
$30 = 0x00000000
|
||||
(gdb) p/x $r10
|
||||
$31 = 0x10000000
|
||||
```
|
||||
|
||||
`ldmia sp!` restored `r9` and `r10` from the stack and raised `sp` by 8 bytes (from `0x20081fdc` to `0x20081fe4`).
|
||||
**SP is now `0x20081fe4`; `[sp]` contains r2, so `SP <- TOP OF STACK` at the next group.**
|
||||
|
||||
**Restore 2: pop {r2, r3, r6}**
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001f4 <+20>: ldmia.w sp!, {r4, lr}
|
||||
(gdb) p/x $sp
|
||||
$32 = 0x20081ff0
|
||||
(gdb) p/x $r2
|
||||
$33 = 0x200005cc
|
||||
(gdb) p/x $r3
|
||||
$34 = 0xe000ed08
|
||||
(gdb) p/x $r6
|
||||
$35 = 0x04f54710
|
||||
```
|
||||
|
||||
`pop {r2, r3, r6}` restored the three registers from SRAM and raised `sp` by 12 bytes (from `0x20081fe4` to `0x20081ff0`).
|
||||
**SP is now `0x20081ff0`; `[sp]` contains r4, so `SP <- TOP OF STACK` at the final group.**
|
||||
|
||||
**Restore 3: ldmia.w sp!, {r4, lr}**
|
||||
|
||||
```gdb
|
||||
(gdb) si
|
||||
0x100001f8 <+24>: b.n 0x100001e6 <main+6>
|
||||
(gdb) p/x $sp
|
||||
$36 = 0x20081ff8
|
||||
(gdb) p/x $r4
|
||||
$37 = 0x100001cc
|
||||
(gdb) p/x $lr
|
||||
$38 = 0x1000159b
|
||||
```
|
||||
|
||||
`ldmia.w sp!, {r4, lr}` restored `r4` and `lr` from SRAM and raised `sp` by 8 bytes (from `0x20081ff0` to `0x20081ff8`).
|
||||
**SP is now `0x20081ff8`; `[sp]` contains the saved prologue r3, so `SP <- TOP OF STACK` for the remaining prologue stack data.**
|
||||
|
||||
**Result:** After all three restore instructions, `sp` is back at `0x20081ff8`, exactly where it was before the inline assembly block started. The loop branches back to `push {r4, lr}` at address `0x100001e6` and repeats forever without consuming stack space.
|
||||
|
||||
### Understanding the Stack Diagram
|
||||
|
||||
At the deepest point, after `stmdb sp!, {r9, r10}`, the inline assembly has saved 28 bytes. The `old SP` below is the stack pointer after the separate compiler prologue, not the stack pointer at entry to `main`:
|
||||
|
||||
```text
|
||||
Before inline assembly: At maximum inline stack depth:
|
||||
|
||||
old SP <- SP old SP
|
||||
[old SP - 4] lr
|
||||
[old SP - 8] r4
|
||||
[old SP - 12] r6
|
||||
[old SP - 16] r3
|
||||
[old SP - 20] r2
|
||||
[old SP - 24] r10
|
||||
[old SP - 28] r9 <- SP
|
||||
```
|
||||
|
||||
The restoration sequence removes the top group first: `r9/r10`, then `r2/r3/r6`, then `r4/lr`.
|
||||
|
||||
---
|
||||
|
||||
## Part 5: Summary and Review
|
||||
|
||||
### What We Learned
|
||||
|
||||
1. **Registers**: `sp`, `lr`, and `pc` control stack location, returns, and the next instruction.
|
||||
2. **The stack**: It grows down in SRAM. Pushes decrease `sp`; pops increase it.
|
||||
3. **Multi-register instructions**: Register-list source order is not the stack-memory order. ARM stores lower register numbers at lower addresses.
|
||||
4. **OpenOCD and GDB**: OpenOCD connects to the Debug Probe; GDB connects to OpenOCD on port `3333`.
|
||||
5. **Live evidence**: `si` executes one instruction, and `x/wx $sp` shows the exact 32-bit word that instruction placed at the stack pointer.
|
||||
|
||||
### The Program Flow
|
||||
|
||||
```text
|
||||
+-----------------------------------------------------+
|
||||
| 1. push {r3, lr} |
|
||||
| Compiler saves its prologue registers |
|
||||
+-----------------------------------------------------+
|
||||
| 2. bl stdio_init_all |
|
||||
| Initialize standard I/O |
|
||||
+-----------------------------------------------------+
|
||||
| 3. push {r4, lr} |
|
||||
| Save the first inline group |
|
||||
+-----------------------------------------------------+
|
||||
| 4. push {r3, r2, r6} |
|
||||
| Source order differs from stack-memory order |
|
||||
+-----------------------------------------------------+
|
||||
| 5. stmdb / ldmia / pop / pop |
|
||||
| Save and restore all groups |
|
||||
+-----------------------------------------------------+
|
||||
| 6. b.n main+6 |
|
||||
| Repeat with the original stack pointer |
|
||||
+-----------------------------------------------------+
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Takeaways
|
||||
|
||||
1. **The stack grows downward**: a push decreases the numeric value in `sp`.
|
||||
2. **A register list is not a sequence**: `{r3, r2, r6}` and `{r2, r3, r6}` encode the same register set.
|
||||
3. **Memory is the proof**: after `si`, inspect `[sp]`, `[sp+4]`, and `[sp+8]` with GDB.
|
||||
4. **The restore order matters**: always restore the most recently saved group first.
|
||||
5. **Balanced stack operations are required**: the loop returns `sp` to its starting value on every iteration.
|
||||
|
||||
---
|
||||
|
||||
## Glossary
|
||||
|
||||
| Term | Definition |
|
||||
| --- | --- |
|
||||
| **Assembly** | Human-readable form of processor instructions. |
|
||||
| **Breakpoint** | A debugger stop point. |
|
||||
| **Debug Probe** | Hardware interface that lets OpenOCD communicate with the target over SWD. |
|
||||
| **GDB** | GNU Debugger, used to inspect and control the running target. |
|
||||
| **LR** | Link Register, holding a function return address. |
|
||||
| **OpenOCD** | Debug server that bridges GDB and the Debug Probe. |
|
||||
| **PC** | Program Counter, pointing to the next instruction. |
|
||||
| **SP** | Stack Pointer, pointing to the top of the stack. |
|
||||
| **SRAM** | Writable memory used for runtime data and the stack. |
|
||||
| **XIP** | Execute In Place, executing program code directly from flash. |
|
||||
Binary file not shown.
@@ -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 01</text>
|
||||
|
||||
<!-- Week Topic -->
|
||||
<text x="600" y="440" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Introduction and Overview of</text>
|
||||
<text x="600" y="478" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Embedded Reverse Engineering:</text>
|
||||
<text x="600" y="516" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Ethics, Scoping, and Basic Concepts</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.4 KiB |
@@ -0,0 +1,112 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">ARM Cortex-M33 Regs</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">ARM Architecture & Registers</text>
|
||||
|
||||
<!-- Left Panel -->
|
||||
<rect x="30" y="105" width="520" height="675" class="pnl" rx="8"/>
|
||||
<text x="290" y="148" text-anchor="middle" class="sub">Key Registers</text>
|
||||
<line x1="50" y1="163" x2="530" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- r0 -->
|
||||
<rect x="55" y="182" width="190" height="50" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="150" y="215" text-anchor="middle" class="grn">r0</text>
|
||||
<text x="260" y="215" class="amb">Arg 1 / Return</text>
|
||||
|
||||
<!-- r1 -->
|
||||
<rect x="55" y="246" width="190" height="50" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="150" y="279" text-anchor="middle" class="grn">r1</text>
|
||||
<text x="260" y="279" class="amb">Arg 2</text>
|
||||
|
||||
<!-- r2 -->
|
||||
<rect x="55" y="310" width="190" height="50" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="150" y="343" text-anchor="middle" class="grn">r2</text>
|
||||
<text x="260" y="343" class="amb">Arg 3</text>
|
||||
|
||||
<!-- r3 -->
|
||||
<rect x="55" y="374" width="190" height="50" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="150" y="407" text-anchor="middle" class="grn">r3</text>
|
||||
<text x="260" y="407" class="amb">Arg 4</text>
|
||||
|
||||
<!-- Divider -->
|
||||
<line x1="55" y1="444" x2="530" y2="444" stroke="#ffaa00" stroke-width="2" stroke-dasharray="8"/>
|
||||
<text x="55" y="473" class="dim" style="fill:#ffaa00">r0-r3 Caller-saved</text>
|
||||
<text x="55" y="500" class="dim" style="fill:#00d4ff">r4-r11 Callee-saved</text>
|
||||
|
||||
<!-- SP -->
|
||||
<rect x="55" y="525" width="475" height="50" rx="6" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="75" y="558" class="red">SP (r13)</text>
|
||||
<text x="310" y="558" class="txt">Stack Ptr</text>
|
||||
|
||||
<!-- LR -->
|
||||
<rect x="55" y="590" width="475" height="50" rx="6" fill="#0f1a1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="75" y="623" class="cyn">LR (r14)</text>
|
||||
<text x="310" y="623" class="txt">Return Addr</text>
|
||||
|
||||
<!-- PC -->
|
||||
<rect x="55" y="655" width="475" height="50" rx="6" fill="#0f1a1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="75" y="688" class="cyn">PC (r15)</text>
|
||||
<text x="310" y="688" class="txt">Next Instr</text>
|
||||
|
||||
<!-- xPSR -->
|
||||
<rect x="55" y="720" width="475" height="50" rx="6" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="75" y="753" class="amb">xPSR</text>
|
||||
<text x="310" y="753" class="txt">Status Flags</text>
|
||||
|
||||
<!-- Right Panel -->
|
||||
<rect x="580" y="105" width="590" height="675" class="pnl" rx="8"/>
|
||||
<text x="875" y="148" text-anchor="middle" class="sub">Function Call Flow</text>
|
||||
<line x1="600" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- main box -->
|
||||
<rect x="640" y="205" width="190" height="70" rx="10" fill="#12121a" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="735" y="250" text-anchor="middle" class="grn">main()</text>
|
||||
|
||||
<!-- BL arrow -->
|
||||
<line x1="830" y1="240" x2="920" y2="240" stroke="#ffaa00" stroke-width="4"/>
|
||||
<polygon points="920,231 940,240 920,249" fill="#ffaa00"/>
|
||||
<text x="875" y="225" text-anchor="middle" class="dim" style="fill:#ffaa00">BL</text>
|
||||
|
||||
<!-- func box -->
|
||||
<rect x="945" y="205" width="190" height="70" rx="10" fill="#12121a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="1040" y="250" text-anchor="middle" class="cyn">func()</text>
|
||||
|
||||
<!-- Return arrow -->
|
||||
<line x1="945" y1="310" x2="830" y2="310" stroke="#ff0040" stroke-width="4"/>
|
||||
<polygon points="830,301 810,310 830,319" fill="#ff0040"/>
|
||||
<text x="888" y="345" text-anchor="middle" class="dim" style="fill:#ff0040">BX LR</text>
|
||||
|
||||
<!-- Separator -->
|
||||
<line x1="600" y1="380" x2="1150" y2="380" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Facts -->
|
||||
<text x="620" y="420" class="sub">How It Works</text>
|
||||
|
||||
<text x="620" y="455" class="amb">r0 = first argument</text>
|
||||
<text x="620" y="487" class="txt">puts(r0) passes the</text>
|
||||
<text x="620" y="519" class="txt">string address in r0</text>
|
||||
|
||||
<line x1="600" y1="562" x2="1150" y2="562" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="620" y="600" class="cyn">LR saves return addr</text>
|
||||
<text x="620" y="635" class="txt">BL: PC+4 stored in LR</text>
|
||||
<text x="620" y="670" class="txt">BX LR: jump back</text>
|
||||
|
||||
<line x1="600" y1="707" x2="1150" y2="707" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="620" y="745" class="dim">All registers: 32 bits wide</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,101 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Stack Growth Direction</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">ARM Stack Mechanics</text>
|
||||
|
||||
<!-- Left Panel: BEFORE PUSH -->
|
||||
<rect x="30" y="105" width="350" height="675" class="pnl" rx="8"/>
|
||||
<text x="205" y="148" text-anchor="middle" class="sub">Before PUSH</text>
|
||||
<line x1="50" y1="163" x2="360" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="amb">0x20082000</text>
|
||||
<text x="55" y="237" class="red">SP here</text>
|
||||
|
||||
<rect x="60" y="260" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="295" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<rect x="60" y="325" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="360" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<rect x="60" y="390" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="425" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<rect x="60" y="455" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="490" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<text x="55" y="555" class="amb">0x20080000</text>
|
||||
|
||||
<!-- Down arrow -->
|
||||
<text x="187" y="650" text-anchor="middle" class="red">Grows DOWN</text>
|
||||
<line x1="187" y1="665" x2="187" y2="725" stroke="#ff0040" stroke-width="4"/>
|
||||
<polygon points="175,725 187,750 199,725" fill="#ff0040"/>
|
||||
|
||||
<!-- Middle Panel: AFTER PUSH -->
|
||||
<rect x="410" y="105" width="370" height="675" class="pnl" rx="8"/>
|
||||
<text x="595" y="148" text-anchor="middle" class="sub">After PUSH</text>
|
||||
<line x1="430" y1="163" x2="760" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="435" y="205" class="amb">0x20082000</text>
|
||||
|
||||
<rect x="440" y="260" width="255" height="55" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="567" y="295" text-anchor="middle" class="cyn">LR value</text>
|
||||
|
||||
<rect x="440" y="325" width="255" height="55" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="567" y="360" text-anchor="middle" class="grn">r3 value</text>
|
||||
|
||||
<rect x="440" y="390" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="567" y="425" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<rect x="440" y="455" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="567" y="490" text-anchor="middle" class="dim">(empty)</text>
|
||||
|
||||
<text x="435" y="545" class="red">SP here now = 0x20081FF8</text>
|
||||
|
||||
<text x="435" y="620" class="dim" style="fill:#ff0040">SP moved down</text>
|
||||
<text x="435" y="650" class="dim" style="fill:#ff0040">by 8 bytes</text>
|
||||
|
||||
<text x="435" y="720" class="amb">0x20080000</text>
|
||||
|
||||
<!-- Right Panel: Key Concepts -->
|
||||
<rect x="810" y="105" width="360" height="675" class="pnl" rx="8"/>
|
||||
<text x="990" y="148" text-anchor="middle" class="sub">Key Concepts</text>
|
||||
<line x1="830" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="210" class="grn">Full Descending</text>
|
||||
<text x="835" y="248" class="txt">SP points to the</text>
|
||||
<text x="835" y="280" class="txt">last pushed item</text>
|
||||
|
||||
<line x1="830" y1="308" x2="1150" y2="308" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="348" class="red">PUSH: SP -= 4</text>
|
||||
<text x="835" y="386" class="txt">Each 32-bit val</text>
|
||||
<text x="835" y="418" class="txt">drops SP by 4</text>
|
||||
<text x="835" y="450" class="txt">Two vals = -8</text>
|
||||
|
||||
<line x1="830" y1="478" x2="1150" y2="478" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="518" class="cyn">POP: SP += 4</text>
|
||||
<text x="835" y="556" class="txt">Restores values</text>
|
||||
<text x="835" y="588" class="txt">SP moves back up</text>
|
||||
|
||||
<line x1="830" y1="616" x2="1150" y2="616" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="656" class="amb">Initial SP</text>
|
||||
<text x="835" y="694" class="txt">Set by vector</text>
|
||||
<text x="835" y="726" class="txt">table at 0x00</text>
|
||||
<text x="835" y="758" class="dim">StackTop=0x20082000</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,98 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">RP2350 Memory Map</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">RP2350 Address Space</text>
|
||||
|
||||
<!-- Left Panel: Memory Map -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">Address Space</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- ROM: block x=55 to x=540, address INSIDE block -->
|
||||
<rect x="55" y="178" width="485" height="50" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="70" y="210" class="red">ROM Boot</text>
|
||||
<text x="525" y="210" text-anchor="end" class="dim">0x0000_0000</text>
|
||||
|
||||
<!-- XIP Flash -->
|
||||
<rect x="55" y="243" width="485" height="70" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="70" y="276" class="grn">XIP Flash</text>
|
||||
<text x="70" y="303" class="dim">16MB max</text>
|
||||
<text x="525" y="276" text-anchor="end" class="dim">0x1000_0000</text>
|
||||
|
||||
<!-- SRAM -->
|
||||
<rect x="55" y="328" width="485" height="90" rx="4" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="70" y="361" class="cyn">SRAM</text>
|
||||
<text x="70" y="391" class="dim">520KB total</text>
|
||||
<text x="525" y="361" text-anchor="end" class="dim">0x2000_0000</text>
|
||||
|
||||
<!-- APB Peripherals -->
|
||||
<rect x="55" y="433" width="485" height="55" rx="4" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="70" y="468" class="amb">APB Periph</text>
|
||||
<text x="525" y="468" text-anchor="end" class="dim">0x4000_0000</text>
|
||||
|
||||
<!-- AHB Peripherals -->
|
||||
<rect x="55" y="503" width="485" height="55" rx="4" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="70" y="538" class="amb">AHB Periph</text>
|
||||
<text x="525" y="538" text-anchor="end" class="dim">0x5000_0000</text>
|
||||
|
||||
<!-- SIO -->
|
||||
<rect x="55" y="573" width="485" height="55" rx="4" fill="#1a0f1a" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="70" y="608" class="red">SIO</text>
|
||||
<text x="525" y="608" text-anchor="end" class="dim">0xD000_0000</text>
|
||||
|
||||
<!-- PPB -->
|
||||
<rect x="55" y="643" width="485" height="55" rx="4" fill="#1a0f1a" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="70" y="678" class="red">PPB Cortex</text>
|
||||
<text x="525" y="678" text-anchor="end" class="dim">0xE000_0000</text>
|
||||
|
||||
<!-- Grow arrow in panel margin -->
|
||||
<text x="548" y="730" text-anchor="end" class="dim">addr+</text>
|
||||
|
||||
<!-- Right Panel: Key Details -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Key Details</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- XIP Flash detail -->
|
||||
<text x="625" y="205" class="grn">XIP Flash</text>
|
||||
<text x="625" y="240" class="txt">Code runs directly</text>
|
||||
<text x="625" y="272" class="txt">from flash via cache</text>
|
||||
<text x="625" y="304" class="dim">Execute-In-Place</text>
|
||||
|
||||
<line x1="620" y1="328" x2="1150" y2="328" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- SRAM detail -->
|
||||
<text x="625" y="368" class="cyn">SRAM Banks</text>
|
||||
<text x="625" y="403" class="txt">SRAM0-7: 8x64KB</text>
|
||||
<text x="625" y="435" class="txt">SRAM8-9: 2x4KB</text>
|
||||
<text x="625" y="467" class="txt">Stack + Heap here</text>
|
||||
|
||||
<line x1="620" y1="491" x2="1150" y2="491" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Peripheral detail -->
|
||||
<text x="625" y="531" class="amb">Peripherals</text>
|
||||
<text x="625" y="566" class="txt">GPIO, UART, SPI</text>
|
||||
<text x="625" y="598" class="txt">I2C, PWM, ADC</text>
|
||||
<text x="625" y="630" class="dim">Memory-mapped I/O</text>
|
||||
|
||||
<line x1="620" y1="654" x2="1150" y2="654" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- SIO/PPB detail -->
|
||||
<text x="625" y="694" class="red">SIO + PPB</text>
|
||||
<text x="625" y="729" class="txt">Single-cycle I/O</text>
|
||||
<text x="625" y="761" class="txt">Debug + NVIC</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,90 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Stack vs Heap in RAM</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">RP2350 SRAM: Data, BSS, Heap, Stack</text>
|
||||
|
||||
<!-- Left Panel: RAM Layout Diagram -->
|
||||
<rect x="30" y="105" width="400" height="675" class="pnl" rx="8"/>
|
||||
<text x="230" y="148" text-anchor="middle" class="sub">SRAM Layout</text>
|
||||
<line x1="50" y1="163" x2="410" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- High address label -->
|
||||
<text x="55" y="195" class="dim">0x2008_2000 (top)</text>
|
||||
|
||||
<!-- Stack region -->
|
||||
<rect x="55" y="210" width="345" height="150" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="227" y="255" text-anchor="middle" class="red">STACK</text>
|
||||
<text x="227" y="290" text-anchor="middle" class="txt">Grows DOWN</text>
|
||||
<text x="227" y="322" text-anchor="middle" class="dim">SP = top of stack</text>
|
||||
|
||||
<!-- Down arrow from stack -->
|
||||
<polygon points="215,370 227,395 239,370" fill="#ff0040"/>
|
||||
<line x1="227" y1="360" x2="227" y2="370" stroke="#ff0040" stroke-width="3"/>
|
||||
|
||||
<!-- Free space -->
|
||||
<rect x="55" y="400" width="345" height="80" rx="4" fill="#0a0a0f" stroke="#888888" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="227" y="448" text-anchor="middle" class="dim">FREE SPACE</text>
|
||||
|
||||
<!-- Up arrow from heap -->
|
||||
<line x1="227" y1="510" x2="227" y2="495" stroke="#00ff41" stroke-width="3"/>
|
||||
<polygon points="215,510 227,485 239,510" fill="#00ff41"/>
|
||||
|
||||
<!-- Heap region -->
|
||||
<rect x="55" y="515" width="345" height="120" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="227" y="560" text-anchor="middle" class="grn">HEAP</text>
|
||||
<text x="227" y="592" text-anchor="middle" class="txt">Grows UP</text>
|
||||
<text x="227" y="620" text-anchor="middle" class="dim">heap_base = __end__</text>
|
||||
|
||||
<!-- Data + BSS -->
|
||||
<rect x="55" y="650" width="345" height="50" rx="4" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="227" y="683" text-anchor="middle" class="cyn">.data + .bss</text>
|
||||
|
||||
<!-- Low address label -->
|
||||
<text x="55" y="725" class="dim">0x2000_0000 (base)</text>
|
||||
|
||||
<!-- Right Panel: Details -->
|
||||
<rect x="460" y="105" width="710" height="675" class="pnl" rx="8"/>
|
||||
<text x="815" y="148" text-anchor="middle" class="sub">How To Read Sizes Quickly</text>
|
||||
<line x1="480" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Short formulas -->
|
||||
<text x="485" y="220" class="cyn">1) .data size</text>
|
||||
<text x="485" y="258" class="txt">__data_end__ - __data_start__</text>
|
||||
<text x="780" y="220" class="dim">init non-zero globals/statics</text>
|
||||
|
||||
<line x1="480" y1="288" x2="1150" y2="288" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="485" y="338" class="cyn">2) .bss size</text>
|
||||
<text x="485" y="376" class="txt">__bss_end__ - __bss_start__</text>
|
||||
<text x="780" y="338" class="dim">zero/uninit globals/statics</text>
|
||||
|
||||
<line x1="480" y1="406" x2="1150" y2="406" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="485" y="456" class="grn">3) Heap starts at</text>
|
||||
<text x="485" y="494" class="txt">__end__ (aka __HeapBase)</text>
|
||||
|
||||
<line x1="480" y1="524" x2="1150" y2="524" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="485" y="574" class="red">4) Stack starts at</text>
|
||||
<text x="485" y="612" class="txt">vector_table[0] (initial SP)</text>
|
||||
<text x="485" y="644" class="dim">typical: 0x20082000 on RP2350</text>
|
||||
|
||||
<line x1="480" y1="674" x2="1150" y2="674" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="485" y="724" class="amb">5) Safety rule</text>
|
||||
<text x="485" y="762" class="txt">Heap must never collide with stack</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,86 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Link Register & Return</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">ARM Function Calls</text>
|
||||
|
||||
<!-- Left Panel: Call Flow - full width boxes, no floating text -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">BL Call Flow</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Step 1: main calls BL add -->
|
||||
<text x="55" y="200" class="dim">Step 1: caller</text>
|
||||
<rect x="55" y="215" width="490" height="55" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="300" y="250" text-anchor="middle" class="grn">main: BL add</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="270" x2="300" y2="310" stroke="#00d4ff" stroke-width="3"/>
|
||||
<polygon points="288,310 300,335 312,310" fill="#00d4ff"/>
|
||||
|
||||
<!-- Step 2: LR gets saved -->
|
||||
<text x="55" y="355" class="dim">Step 2: hardware saves LR</text>
|
||||
<rect x="55" y="370" width="490" height="55" rx="6" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="300" y="405" text-anchor="middle" class="cyn">LR = return addr</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="425" x2="300" y2="460" stroke="#ffaa00" stroke-width="3"/>
|
||||
<polygon points="288,460 300,485 312,460" fill="#ffaa00"/>
|
||||
|
||||
<!-- Step 3: execute function -->
|
||||
<text x="55" y="505" class="dim">Step 3: run function</text>
|
||||
<rect x="55" y="520" width="490" height="55" rx="6" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="300" y="555" text-anchor="middle" class="amb">add: ADD r0, r1</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="300" y1="575" x2="300" y2="610" stroke="#ff0040" stroke-width="3"/>
|
||||
<polygon points="288,610 300,635 312,610" fill="#ff0040"/>
|
||||
|
||||
<!-- Step 4: return -->
|
||||
<text x="55" y="655" class="dim">Step 4: return to caller</text>
|
||||
<rect x="55" y="670" width="490" height="55" rx="6" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="300" y="705" text-anchor="middle" class="red">BX LR (jump back)</text>
|
||||
|
||||
<!-- Right Panel: Key Concepts -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Key Concepts</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="cyn">BL instruction</text>
|
||||
<text x="625" y="240" class="txt">Branch with Link</text>
|
||||
<text x="625" y="272" class="txt">Saves return addr</text>
|
||||
<text x="625" y="304" class="txt">in LR (r14)</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="red">BX LR</text>
|
||||
<text x="625" y="407" class="txt">Branch to addr</text>
|
||||
<text x="625" y="439" class="txt">stored in LR</text>
|
||||
<text x="625" y="471" class="txt">Returns to caller</text>
|
||||
|
||||
<line x1="620" y1="499" x2="1150" y2="499" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="539" class="amb">Nested Calls</text>
|
||||
<text x="625" y="574" class="txt">Must PUSH LR first</text>
|
||||
<text x="625" y="606" class="txt">PUSH {r3, lr}</text>
|
||||
<text x="625" y="638" class="txt">POP {r3, pc}</text>
|
||||
<text x="625" y="670" class="dim">POP into PC = return</text>
|
||||
|
||||
<line x1="620" y1="698" x2="1150" y2="698" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="738" class="grn">r14 = LR</text>
|
||||
<text x="625" y="773" class="dim">Always check LR in GDB</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,101 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Program Counter Flow</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Instruction Execution</text>
|
||||
|
||||
<!-- Left Panel: PC stepping through instructions -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">PC Execution</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Instruction list -->
|
||||
<text x="55" y="205" class="dim">ADDR</text>
|
||||
<text x="220" y="205" class="dim">INSTRUCTION</text>
|
||||
|
||||
<!-- Line 1 -->
|
||||
<rect x="55" y="220" width="490" height="45" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="70" y="250" class="amb">0x1000</text>
|
||||
<text x="230" y="250" class="grn">MOV r0, #5</text>
|
||||
<text x="490" y="250" text-anchor="end" class="red">PC</text>
|
||||
|
||||
<!-- Line 2 -->
|
||||
<rect x="55" y="275" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="305" class="amb">0x1002</text>
|
||||
<text x="230" y="305" class="txt">MOV r1, #3</text>
|
||||
|
||||
<!-- Line 3 -->
|
||||
<rect x="55" y="330" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="360" class="amb">0x1004</text>
|
||||
<text x="230" y="360" class="txt">ADD r0, r1</text>
|
||||
|
||||
<!-- Line 4 -->
|
||||
<rect x="55" y="385" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="415" class="amb">0x1006</text>
|
||||
<text x="230" y="415" class="txt">BL func</text>
|
||||
|
||||
<!-- Line 5: branch target -->
|
||||
<rect x="55" y="440" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="470" class="amb">0x1010</text>
|
||||
<text x="230" y="470" class="txt">func: PUSH {lr}</text>
|
||||
|
||||
<!-- Line 6 -->
|
||||
<rect x="55" y="495" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="525" class="amb">0x1012</text>
|
||||
<text x="230" y="525" class="txt">SUB r0, #1</text>
|
||||
|
||||
<!-- Line 7 -->
|
||||
<rect x="55" y="550" width="490" height="45" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="580" class="amb">0x1014</text>
|
||||
<text x="230" y="580" class="txt">POP {pc}</text>
|
||||
|
||||
<!-- Arrow showing jump -->
|
||||
<line x1="520" y1="407" x2="520" y2="462" stroke="#ff0040" stroke-width="2" stroke-dasharray="6"/>
|
||||
<polygon points="510,462 520,480 530,462" fill="#ff0040"/>
|
||||
<text x="340" y="640" text-anchor="middle" class="dim">BL = jump to function target</text>
|
||||
<text x="340" y="670" text-anchor="middle" class="dim">POP {pc} = return to caller</text>
|
||||
|
||||
<!-- Right Panel: Key Concepts -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Key Concepts</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="cyn">r15 = PC</text>
|
||||
<text x="625" y="240" class="txt">Points to current</text>
|
||||
<text x="625" y="272" class="txt">instruction + 4</text>
|
||||
<text x="625" y="304" class="dim">Prefetch pipeline</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="grn">Sequential</text>
|
||||
<text x="625" y="407" class="txt">Thumb next = +2 or +4</text>
|
||||
<text x="625" y="439" class="dim">depends on instruction encoding</text>
|
||||
<text x="625" y="471" class="dim">Cortex-M33 executes Thumb only</text>
|
||||
|
||||
<line x1="620" y1="499" x2="1150" y2="499" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="539" class="red">Branch</text>
|
||||
<text x="625" y="574" class="txt">B = unconditional</text>
|
||||
<text x="625" y="606" class="txt">BL = save LR, jump</text>
|
||||
<text x="625" y="638" class="txt">BX = branch reg</text>
|
||||
<text x="625" y="670" class="txt">BEQ = branch if Z=1</text>
|
||||
<text x="900" y="606" class="dim">not linear +2 stepping</text>
|
||||
|
||||
<line x1="620" y1="698" x2="1150" y2="698" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="738" class="amb">GDB tip</text>
|
||||
<text x="625" y="770" class="dim">stepi = step 1 instr</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,110 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Little-Endian Bytes</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Byte Ordering</text>
|
||||
|
||||
<!-- Left Panel: Visual Example -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">Byte Ordering</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- The value -->
|
||||
<text x="300" y="210" text-anchor="middle" class="grn">0xDEADBEEF</text>
|
||||
|
||||
<!-- Big Endian section -->
|
||||
<text x="55" y="260" class="red">Big-Endian</text>
|
||||
<text x="300" y="260" class="dim">MSB first</text>
|
||||
|
||||
<rect x="55" y="280" width="110" height="55" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="110" y="315" text-anchor="middle" class="txt">DE</text>
|
||||
|
||||
<rect x="175" y="280" width="110" height="55" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="230" y="315" text-anchor="middle" class="txt">AD</text>
|
||||
|
||||
<rect x="295" y="280" width="110" height="55" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="350" y="315" text-anchor="middle" class="txt">BE</text>
|
||||
|
||||
<rect x="415" y="280" width="110" height="55" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="470" y="315" text-anchor="middle" class="txt">EF</text>
|
||||
|
||||
<!-- Address labels -->
|
||||
<text x="110" y="360" text-anchor="middle" class="dim">+0</text>
|
||||
<text x="230" y="360" text-anchor="middle" class="dim">+1</text>
|
||||
<text x="350" y="360" text-anchor="middle" class="dim">+2</text>
|
||||
<text x="470" y="360" text-anchor="middle" class="dim">+3</text>
|
||||
|
||||
<!-- Spacer -->
|
||||
<text x="300" y="420" text-anchor="middle" class="amb">vs</text>
|
||||
|
||||
<!-- Little Endian section -->
|
||||
<text x="55" y="470" class="grn">Little-Endian</text>
|
||||
<text x="300" y="470" class="dim">LSB first</text>
|
||||
|
||||
<rect x="55" y="490" width="110" height="55" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="110" y="525" text-anchor="middle" class="txt">EF</text>
|
||||
|
||||
<rect x="175" y="490" width="110" height="55" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="230" y="525" text-anchor="middle" class="txt">BE</text>
|
||||
|
||||
<rect x="295" y="490" width="110" height="55" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="350" y="525" text-anchor="middle" class="txt">AD</text>
|
||||
|
||||
<rect x="415" y="490" width="110" height="55" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="470" y="525" text-anchor="middle" class="txt">DE</text>
|
||||
|
||||
<!-- Address labels -->
|
||||
<text x="110" y="570" text-anchor="middle" class="dim">+0</text>
|
||||
<text x="230" y="570" text-anchor="middle" class="dim">+1</text>
|
||||
<text x="350" y="570" text-anchor="middle" class="dim">+2</text>
|
||||
<text x="470" y="570" text-anchor="middle" class="dim">+3</text>
|
||||
|
||||
<!-- Summary text below -->
|
||||
<text x="300" y="630" text-anchor="middle" class="amb">Bytes are reversed!</text>
|
||||
<text x="300" y="670" text-anchor="middle" class="txt">Lowest address holds</text>
|
||||
<text x="300" y="710" text-anchor="middle" class="txt">least significant byte</text>
|
||||
<text x="300" y="750" text-anchor="middle" class="dim">ARM uses little-endian</text>
|
||||
|
||||
<!-- Right Panel: Key Concepts -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Key Concepts</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="cyn">ARM = Little-Endian</text>
|
||||
<text x="625" y="240" class="txt">Cortex-M33 uses LE</text>
|
||||
<text x="625" y="272" class="txt">by default</text>
|
||||
<text x="625" y="304" class="dim">Also: x86, RISC-V</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="red">Why It Matters</text>
|
||||
<text x="625" y="407" class="txt">Memory dumps show</text>
|
||||
<text x="625" y="439" class="txt">raw byte order</text>
|
||||
<text x="625" y="471" class="txt">Must mentally flip</text>
|
||||
<text x="625" y="503" class="txt">to get true value</text>
|
||||
|
||||
<line x1="620" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="571" class="amb">GDB Example</text>
|
||||
<text x="625" y="606" class="txt">x/4xb 0x2000</text>
|
||||
<text x="625" y="638" class="grn">EF BE AD DE</text>
|
||||
<text x="625" y="670" class="dim">= 0xDEADBEEF</text>
|
||||
|
||||
<line x1="620" y1="708" x2="1150" y2="708" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="748" class="cyn">x/xw = word view</text>
|
||||
<text x="625" y="773" class="dim">GDB auto-corrects</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,90 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">XIP Flash Model</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Execute-in-Place</text>
|
||||
|
||||
<!-- Left Panel: Flow Diagram -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">Execute-In-Place</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- External Flash chip -->
|
||||
<rect x="120" y="190" width="300" height="65" rx="6" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="270" y="223" text-anchor="middle" class="amb">QSPI Flash</text>
|
||||
<text x="270" y="245" text-anchor="middle" class="dim">External 16MB</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="270" y1="255" x2="270" y2="300" stroke="#ffaa00" stroke-width="3"/>
|
||||
<polygon points="258,300 270,325 282,300" fill="#ffaa00"/>
|
||||
|
||||
<!-- QSPI Controller -->
|
||||
<rect x="120" y="330" width="300" height="55" rx="6" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="270" y="362" text-anchor="middle" class="cyn">QSPI Controller</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="270" y1="385" x2="270" y2="420" stroke="#00d4ff" stroke-width="3"/>
|
||||
<polygon points="258,420 270,445 282,420" fill="#00d4ff"/>
|
||||
|
||||
<!-- XIP Cache -->
|
||||
<rect x="120" y="450" width="300" height="65" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="270" y="483" text-anchor="middle" class="grn">XIP Cache</text>
|
||||
<text x="270" y="505" text-anchor="middle" class="dim">16KB cache</text>
|
||||
|
||||
<!-- Arrow down -->
|
||||
<line x1="270" y1="515" x2="270" y2="555" stroke="#00ff41" stroke-width="3"/>
|
||||
<polygon points="258,555 270,580 282,555" fill="#00ff41"/>
|
||||
|
||||
<!-- CPU -->
|
||||
<rect x="120" y="585" width="300" height="65" rx="6" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="270" y="618" text-anchor="middle" class="red">Cortex-M33 CPU</text>
|
||||
<text x="270" y="640" text-anchor="middle" class="dim">Fetches via PC</text>
|
||||
|
||||
<!-- Mapped address note -->
|
||||
<text x="300" y="710" text-anchor="middle" class="txt">Mapped at</text>
|
||||
<text x="300" y="745" text-anchor="middle" class="amb">0x1000_0000</text>
|
||||
|
||||
<!-- Right Panel: Details -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Key Details</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="grn">What is XIP?</text>
|
||||
<text x="625" y="240" class="txt">Code stays in flash</text>
|
||||
<text x="625" y="272" class="txt">CPU reads it as if</text>
|
||||
<text x="625" y="304" class="txt">it were normal memory</text>
|
||||
<text x="625" y="336" class="dim">No copy to SRAM needed</text>
|
||||
|
||||
<line x1="620" y1="364" x2="1150" y2="364" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="404" class="cyn">QSPI Interface</text>
|
||||
<text x="625" y="439" class="txt">4 data lines</text>
|
||||
<text x="625" y="471" class="txt">Fast serial flash</text>
|
||||
<text x="625" y="503" class="dim">CLK, CS, IO0-IO3</text>
|
||||
|
||||
<line x1="620" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="571" class="amb">Cache Behavior</text>
|
||||
<text x="625" y="603" class="txt">Used for XIP flash reads</text>
|
||||
<text x="625" y="633" class="dim">(code + const data at 0x1000....)</text>
|
||||
<text x="625" y="663" class="txt">Not used for SRAM/peripherals</text>
|
||||
<text x="625" y="693" class="dim">or during flash program/erase</text>
|
||||
|
||||
<line x1="620" y1="698" x2="1150" y2="698" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="738" class="red">RE Insight</text>
|
||||
<text x="625" y="773" class="dim">Dump flash via SWD</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,92 @@
|
||||
<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}
|
||||
.mid{dominant-baseline:middle}
|
||||
.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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">ELF File Structure</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Binary Format</text>
|
||||
|
||||
<!-- Left Panel: ELF Layout -->
|
||||
<rect x="30" y="105" width="440" height="675" class="pnl" rx="8"/>
|
||||
<text x="250" y="148" text-anchor="middle" class="sub">ELF File Layout (Offsets)</text>
|
||||
<line x1="50" y1="163" x2="450" y2="163" stroke="#1a1a2e"/>
|
||||
<text x="55" y="173" class="dim">Higher file offsets</text>
|
||||
|
||||
<!-- Section Headers (higher offsets) -->
|
||||
<rect x="55" y="180" width="385" height="50" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="247" y="205" text-anchor="middle" class="red mid">Section Headers</text>
|
||||
|
||||
<!-- .symtab -->
|
||||
<rect x="55" y="245" width="385" height="55" rx="4" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="247" y="272.5" text-anchor="middle" class="cyn mid">.symtab</text>
|
||||
|
||||
<!-- .bss section -->
|
||||
<rect x="55" y="315" width="385" height="55" rx="4" fill="#0a0a0f" stroke="#888888" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="247" y="342.5" text-anchor="middle" class="txt mid">.bss</text>
|
||||
|
||||
<!-- .data section -->
|
||||
<rect x="55" y="385" width="385" height="55" rx="4" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="247" y="412.5" text-anchor="middle" class="amb mid">.data</text>
|
||||
|
||||
<!-- .rodata section -->
|
||||
<rect x="55" y="455" width="385" height="55" rx="4" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="247" y="482.5" text-anchor="middle" class="amb mid">.rodata</text>
|
||||
|
||||
<!-- .text section -->
|
||||
<rect x="55" y="525" width="385" height="75" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="247" y="552" text-anchor="middle" class="grn mid">.text</text>
|
||||
<text x="247" y="576" text-anchor="middle" class="dim mid">Machine code</text>
|
||||
|
||||
<!-- Program Headers -->
|
||||
<rect x="55" y="615" width="385" height="55" rx="4" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="247" y="642.5" text-anchor="middle" class="cyn mid">Program Headers</text>
|
||||
|
||||
<!-- ELF Header (offset 0x0000) -->
|
||||
<rect x="55" y="685" width="385" height="60" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="247" y="710" text-anchor="middle" class="red mid">ELF Header</text>
|
||||
<text x="247" y="730" text-anchor="middle" class="dim mid">Magic: 7f 45 4c 46 (off 0x0000)</text>
|
||||
|
||||
<!-- Right Panel: Details -->
|
||||
<rect x="500" y="105" width="670" height="675" class="pnl" rx="8"/>
|
||||
<text x="835" y="148" text-anchor="middle" class="sub">Section Details + Mapping</text>
|
||||
<line x1="520" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="525" y="205" class="red">ELF Header</text>
|
||||
<text x="525" y="240" class="txt">Arch: ARM 32-bit</text>
|
||||
<text x="525" y="272" class="txt">Entry point addr</text>
|
||||
<text x="525" y="304" class="dim">Type: executable</text>
|
||||
|
||||
<line x1="520" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="525" y="372" class="grn">.text = code</text>
|
||||
<text x="525" y="407" class="txt">All instructions</text>
|
||||
<text x="525" y="439" class="txt">Maps to XIP flash</text>
|
||||
<text x="525" y="471" class="dim">Disassemble this!</text>
|
||||
|
||||
<line x1="520" y1="499" x2="1150" y2="499" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="525" y="539" class="amb">.data / .rodata</text>
|
||||
<text x="525" y="574" class="txt">.data = initialized</text>
|
||||
<text x="525" y="606" class="txt">.rodata = constants</text>
|
||||
<text x="525" y="638" class="txt">.bss = zeroed vars</text>
|
||||
|
||||
<line x1="520" y1="666" x2="1150" y2="666" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="525" y="706" class="cyn">.symtab = symbols</text>
|
||||
<text x="525" y="741" class="txt">Function names</text>
|
||||
<text x="780" y="706" class="dim">ELF header is file metadata</text>
|
||||
<text x="780" y="734" class="dim">not runtime address 0x1000....</text>
|
||||
<text x="780" y="762" class="dim">Use section VMA/LMA for memory map</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,94 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">GDB-OpenOCD Chain</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Debug Toolchain</text>
|
||||
|
||||
<!-- Top Panel: Debug Chain Flow -->
|
||||
<rect x="30" y="105" width="1140" height="280" class="pnl" rx="8"/>
|
||||
<text x="600" y="148" text-anchor="middle" class="sub">Debug Toolchain</text>
|
||||
<line x1="50" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- GDB box -->
|
||||
<rect x="55" y="190" width="220" height="80" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="165" y="225" text-anchor="middle" class="grn">GDB</text>
|
||||
<text x="165" y="255" text-anchor="middle" class="dim">Client</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="275" y1="230" x2="340" y2="230" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="340,220 365,230 340,240" fill="#888888"/>
|
||||
<text x="310" y="290" text-anchor="middle" class="dim">TCP</text>
|
||||
<text x="310" y="315" text-anchor="middle" class="dim">:3333</text>
|
||||
|
||||
<!-- OpenOCD box -->
|
||||
<rect x="370" y="190" width="250" height="80" rx="6" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="495" y="225" text-anchor="middle" class="cyn">OpenOCD</text>
|
||||
<text x="495" y="255" text-anchor="middle" class="dim">Server</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="620" y1="230" x2="685" y2="230" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="685,220 710,230 685,240" fill="#888888"/>
|
||||
<text x="655" y="290" text-anchor="middle" class="dim">USB</text>
|
||||
|
||||
<!-- Debug Probe box -->
|
||||
<rect x="715" y="190" width="220" height="80" rx="6" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="825" y="225" text-anchor="middle" class="amb">CMSIS-DAP</text>
|
||||
<text x="825" y="255" text-anchor="middle" class="dim">Probe</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="935" y1="230" x2="1000" y2="230" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="1000,220 1025,230 1000,240" fill="#888888"/>
|
||||
<text x="975" y="290" text-anchor="middle" class="dim">SWD</text>
|
||||
|
||||
<!-- Target box -->
|
||||
<rect x="1030" y="190" width="130" height="80" rx="6" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="1095" y="225" text-anchor="middle" class="red">RP2350</text>
|
||||
<text x="1095" y="255" text-anchor="middle" class="dim">Target</text>
|
||||
|
||||
<!-- Bottom Left: GDB Commands -->
|
||||
<rect x="30" y="405" width="560" height="375" class="pnl" rx="8"/>
|
||||
<text x="310" y="448" text-anchor="middle" class="sub">GDB Commands</text>
|
||||
<line x1="50" y1="463" x2="570" y2="463" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="500" class="grn">target remote :3333</text>
|
||||
<text x="55" y="532" class="dim">Connect to OpenOCD</text>
|
||||
|
||||
<text x="55" y="572" class="grn">monitor reset halt</text>
|
||||
<text x="55" y="604" class="dim">Reset + stop at entry</text>
|
||||
|
||||
<text x="55" y="644" class="grn">break main</text>
|
||||
<text x="55" y="676" class="dim">Set breakpoint</text>
|
||||
|
||||
<text x="55" y="716" class="grn">info registers</text>
|
||||
<text x="55" y="748" class="dim">Dump all regs</text>
|
||||
|
||||
<!-- Bottom Right: SWD Details -->
|
||||
<rect x="620" y="405" width="550" height="375" class="pnl" rx="8"/>
|
||||
<text x="895" y="448" text-anchor="middle" class="sub">SWD Protocol</text>
|
||||
<line x1="640" y1="463" x2="1150" y2="463" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="505" class="amb">2 wires only</text>
|
||||
<text x="645" y="540" class="txt">SWCLK = clock</text>
|
||||
<text x="645" y="572" class="txt">SWDIO = data</text>
|
||||
|
||||
<line x1="640" y1="600" x2="1150" y2="600" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="640" class="red">Capabilities</text>
|
||||
<text x="645" y="675" class="txt">Read/write memory</text>
|
||||
<text x="645" y="707" class="txt">Read/write regs</text>
|
||||
<text x="645" y="739" class="txt">Set breakpoints</text>
|
||||
<text x="645" y="771" class="dim">Full chip control</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,9 @@
|
||||
build/CMakeFiles/
|
||||
build/pico_sdk/
|
||||
build/pico-sdk/
|
||||
build/generated/
|
||||
build/_deps/
|
||||
build/*.o
|
||||
build/*.d
|
||||
build/*.obj
|
||||
!.vscode/*
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/src/common/pico_base_headers/include/pico.h",
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/14_2_Rel1/bin/arm-none-eabi-gcc.exe",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"cmake.showSystemKits": false,
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": false,
|
||||
"cmake.automaticReconfigure": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v3.31.5/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": true,
|
||||
"raspberry-pi-pico.useCmakeTools": false,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"files.associations": {
|
||||
"stdlib.h": "c"
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.2.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify reset exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Rescue Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getChip}-rescue.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; reset halt; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Risc-V Reset (RP2350)",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-c",
|
||||
"set USE_CORE { rv0 rv1 cm0 cm1 }",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/rp2350.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; init;",
|
||||
"-c",
|
||||
"write_memory 0x40120158 8 { 0x3 }; echo [format \"Info : ARCHSEL 0x%02x\" [read_memory 0x40120158 8 1]];",
|
||||
"-c",
|
||||
"reset halt; targets rp2350.rv0; echo [format \"Info : ARCHSEL_STATUS 0x%02x\" [read_memory 0x4012015C 8 1]]; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
|
||||
while (true)
|
||||
printf("hello, world\r\n");
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.2.0)
|
||||
set(toolchainVersion 14_2_Rel1)
|
||||
set(picotoolVersion 2.2.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico2 CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(0x0001_hello-world C CXX ASM)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(0x0001_hello-world 0x0001_hello-world.c )
|
||||
|
||||
pico_set_program_name(0x0001_hello-world "0x0001_hello-world")
|
||||
pico_set_program_version(0x0001_hello-world "0.1")
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(0x0001_hello-world 1)
|
||||
pico_enable_stdio_usb(0x0001_hello-world 0)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(0x0001_hello-world
|
||||
pico_stdlib)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(0x0001_hello-world PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(0x0001_hello-world)
|
||||
|
||||
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,469 @@
|
||||
:020000041000EA
|
||||
:10000000002008205D0100101B0100101D010010E0
|
||||
:100010001101001011010010110100101101001058
|
||||
:100020001901001019010010190100101F01001022
|
||||
:10003000110100101901001021010010230100100E
|
||||
:100040001101001011010010110100101101001028
|
||||
:100050001101001011010010110100101101001018
|
||||
:100060001101001011010010110100101101001008
|
||||
:1000700011010010110100101101001011010010F8
|
||||
:1000800011010010110100101101001011010010E8
|
||||
:1000900011010010110100101101001011010010D8
|
||||
:1000A00011010010110100101101001011010010C8
|
||||
:1000B00011010010110100101101001011010010B8
|
||||
:1000C00011010010110100101101001011010010A8
|
||||
:1000D0001101001011010010110100101101001098
|
||||
:1000E0001101001011010010110100101101001088
|
||||
:1000F0001101001011010010110100101101001078
|
||||
:100100001101001011010010110100101101001067
|
||||
:10011000EFF30580103800BE00BE00BE00BE00BE7A
|
||||
:1001200000BE00BEF2EB8871201B00104C1B0010BB
|
||||
:10013000A001001090A31AE7D3DEFFFF42012110B7
|
||||
:10014000FF010000B01B0000793512AB4FF000003A
|
||||
:100150001E49086006C881F3088810474FF05040D8
|
||||
:10016000006810B14FF00000F2E70DA40ECC00299A
|
||||
:1001700002D000F012F8F9E71549164A002000E015
|
||||
:1001800001C19142FCD11449884714498847144958
|
||||
:10019000884700BEFDE701C901C29A42FBD3704700
|
||||
:1001A0004C1B001010010020AC020020E81C0010C5
|
||||
:1001B0000000082000000820E81C001000100820A3
|
||||
:1001C00000100820000000007047000008ED00E06B
|
||||
:1001D000AC020020D80400207D130010350200106E
|
||||
:1001E00075130010F8B500BF064B0749C91A8910EE
|
||||
:1001F00048BF0131491003D0044B0BB101481847E7
|
||||
:10020000704700BFAC020020AC02002000000000DC
|
||||
:1002100008B5054B1BB105490548AFF30080BDE8A3
|
||||
:100220000840FFF7E1BF00BF00000000900400207D
|
||||
:10023000CC19001008B501F099F9024801F0DEF977
|
||||
:10024000FBE700BFCC19001010B44FF480740C4BC6
|
||||
:1002500053F8202003EB8003C00082F0400200F13D
|
||||
:10026000804003F5805C02F0C00200F5203003F509
|
||||
:100270004053CCF8002041601C605DF8044B70478F
|
||||
:10028000048003400FB400B583B0049C074801F01C
|
||||
:10029000B5F93CB105A92046019101F051F8044897
|
||||
:1002A00001F0ACF9012001F063F800BFDC19001087
|
||||
:1002B000EC19001070B58646EFF3108572B6124C3B
|
||||
:1002C000D4E8CF6F0120002EFAD1C4E8460F002EEB
|
||||
:1002D000F6D1BFF35F8F4FF0010CC80801F00703A0
|
||||
:1002E0000CFA03F31EF800C01CEA030608D14CEA1E
|
||||
:1002F000030C0EF800C0C4E88F6F85F3108870BD42
|
||||
:100300001046FFF7BFFF00BF3B040020044A1078EF
|
||||
:10031000431CDBB2182B28BF10231370704700BF9B
|
||||
:10032000280200204FF0E022936843F000539360CE
|
||||
:10033000704700BF0021044B03F12002C3E88F1F68
|
||||
:1003400001339342FAD17047300400204FF0E0238C
|
||||
:100350004FF08032C3F80024C3F80424C3F8082403
|
||||
:10036000C3F80C24C3F81024C3F81424C3F81824C9
|
||||
:10037000C3F81C24C3F82024C3F82424C3F8282479
|
||||
:10038000C3F82C24C3F8302462B67047012300F070
|
||||
:100390001F029340400941B1800000F1604000F528
|
||||
:1003A0006140C0F8803103607047024A203042F853
|
||||
:1003B0002030704700E100E0F8B50D46EFF31087FC
|
||||
:1003C00072B6124ED6E8CF2F0123002AFAD1C6E822
|
||||
:1003D000423F002AF6D1BFF35F8F0D4B00F11004AE
|
||||
:1003E0009B680C4A53F82430934203D0994201D0C1
|
||||
:1003F00000F08EFE064B9B6843F82450BFF35F8FDE
|
||||
:100400000023C6E88F3F87F31088F8BD3904002029
|
||||
:1004100000ED00E0110100102DE9F04F83B0EFF383
|
||||
:10042000108A72B6714ED6E8CF2F0123002AFAD176
|
||||
:10043000C6E8423F002AF6D1BFF35F8F6C4B00F154
|
||||
:1004400010089B686B4A53F82850954245D08D425E
|
||||
:100450000C4650D0684FEB1B2F2B3ED801214FEAA2
|
||||
:1004600050194FEA890909F1604909F5614900F01D
|
||||
:100470001F0301FA03F0D9F80030C9F8800000EA40
|
||||
:10048000030BBFF35F8FEFF30581C9B2002934D0AE
|
||||
:10049000884505D0CDE9001000F03AFEDDE90010F6
|
||||
:1004A00025F0010EDEF808C0644505D189E0D3F8D7
|
||||
:1004B00008C0644531D09E469EF9062002EB4203F7
|
||||
:1004C000002A07EB8303F2DA644561D0BBF1000F29
|
||||
:1004D00020D0C9F88001C9F80000454B9B6843F85B
|
||||
:1004E0002850BFF35F8F0023C6E88F3F8AF3108840
|
||||
:1004F00003B0BDE8F08F1546EFE725F0010EDEF8FA
|
||||
:1005000008C06445D8D19EF906407346002C08DA2D
|
||||
:10051000154646E0C9F88000DFE793F90640002C55
|
||||
:1005200037DB04EB440C07EB8C0C9CF80710DCF871
|
||||
:100530000820D9719A609CF906206100002A9A71FE
|
||||
:100540003DDBBCF804E05FEA4E5E05D50EF5FF1E0C
|
||||
:100550000EF5FF5E0EF11F0E6FF0070C0A194FEA41
|
||||
:100560006E5E920002EB4E0208323A44ACEB030C92
|
||||
:100570006244C2F34A026FEAC2426FEAD2429A80F0
|
||||
:100580001E4B21441A7807EB81011C708A719DE78C
|
||||
:100590007346D9B9FF228EF806204BF60152AEF809
|
||||
:1005A0000420164C4AF6AA2294F800C01946C91B2A
|
||||
:1005B00049414A43120D83F806C0227086E7104A6B
|
||||
:1005C000DDE79EF906407346002CAADA0D4A0E4C70
|
||||
:1005D000D21A083AC2F30A316FEA01516FEA115197
|
||||
:1005E00044EA5202DA80998070E700BF39040020A3
|
||||
:1005F00000ED00E0110100102C020020D4040020C6
|
||||
:1006000001BDFFFF6602002000F8FFFFF0B5EFF329
|
||||
:100610000585EDB2EFF3108C72B62649D1E8CF2FE5
|
||||
:100620000123002AFAD1C1E8423F002AF6D1BFF3E4
|
||||
:100630005F8F214E40F0010EB4684AF6AA2354F8A9
|
||||
:1006400025701E4A0446A41A644163431B0D774576
|
||||
:100650005BB21BD092F906409C421CD092F912402A
|
||||
:100660009C4223D092F91E409C4221D092F92A400C
|
||||
:100670009C4208BF03240FD0114A00241578137040
|
||||
:100680008571C1E88F4F8CF31088F0BDB2680D4CB6
|
||||
:1006900042F82540F0E7002404EB440402EB840216
|
||||
:1006A000FF2494714BF601549480E5E70124F3E7AD
|
||||
:1006B0000224F1E73904002000ED00E02C020020C4
|
||||
:1006C000D404002011010010014B0B44036070475B
|
||||
:1006D0003004002070B5104C104DAC420ED2FF26F5
|
||||
:1006E000236863B1FFF712FE01462046FFF7ECFFD7
|
||||
:1006F000A680BFF35F8F0834AC42F1D370BDFFF723
|
||||
:1007000005FE01462046FFF7DFFF2671BFF35F8F2E
|
||||
:100710000834AC42E4D370BDA4020020AC02002037
|
||||
:100720000D4B1A68EFF3108172B6D2E8CFCF0120DB
|
||||
:10073000BCF1000FF9D1C2E84C0FBCF1000FF4D1AD
|
||||
:10074000BFF35F8F00221B68C3E88F2F81F31088EF
|
||||
:1007500040BF002000217047C804002000000000B6
|
||||
:100760002DE9F04F2DED028B85B0EFF30583DBB261
|
||||
:10077000103B9A0818BF01224FF0010103F0030B50
|
||||
:1007800018BFAF4DAF4B08BFAF4D0BEB820253F814
|
||||
:10079000226001FA0BF205F541539FEDA78B019200
|
||||
:1007A0005A602FE0B3881C0440F19380B379002B8A
|
||||
:1007B00040F0DD80B6F90820002AC0F21E8173697E
|
||||
:1007C00002EB420203EBC203D3E90247B7F1FF3F5A
|
||||
:1007D00008BFB4F1FF3F0ED005EB8B01AB6A0A698D
|
||||
:1007E000D21AE31A934205D301232A6A03FA0BF3C0
|
||||
:1007F000134200D10C61284600F0CAFAA042B94168
|
||||
:10080000C0F2FB80B6F90830019A002B0093EA632E
|
||||
:10081000C8DBD6F8148003EB4309284608EBC90768
|
||||
:10082000D7E9024A00F0B4FAA04271EB0A01B9DB41
|
||||
:10083000BAF1000FC0F2C380D7E90431834A934272
|
||||
:1008400000F0ED807A88B6F9080092B242EA0040E2
|
||||
:10085000984702460B4652EA030100F0B080002B95
|
||||
:1008600080F2D180B4EB020E6AEB030A38F939301A
|
||||
:10087000C7E902EA002B95DB716903EB430201EB48
|
||||
:10088000C202D2E90270BE457AEB000C4FEA430285
|
||||
:1008900088DBB4462CF8083F06E003EB430001EB8D
|
||||
:1008A000C0005A00D0E90270BE451A447AEB00003D
|
||||
:1008B00001EBC20404DB31F93230A446002BECDA40
|
||||
:1008C00028F83930009BACF80030B3881C043FF5A1
|
||||
:1008D0006DAF3369EFF3108272B6D3E8CF0F012109
|
||||
:1008E0000028FAD1C3E8401F0028F6D1BFF35F8F7C
|
||||
:1008F0004FF6FF74B0880023316900B2B480C1E8BC
|
||||
:100900008F3F82F310889842FFF650AF0746A94602
|
||||
:10091000746906F1080807EB470E04EBCE03D3E930
|
||||
:100920000250B6F90830C446002B13DBB2460097DC
|
||||
:1009300004E034F936309446002B09DB03EB430620
|
||||
:1009400004EBC602D2E90271BD4270EB0101F0DA9C
|
||||
:100950005646009FACF8007034F93E7024F83E30E3
|
||||
:10096000002FD8DAB3794D46002B3FF423AF002394
|
||||
:10097000B371B6F9083006F10808581C3DD01A4684
|
||||
:10098000776903E08046591C3FF416AF03EB43013F
|
||||
:1009900007EBC100B0F802C01C461CF4004F9E4695
|
||||
:1009A00037F93130EED0944280ED028B05D0A8F8B3
|
||||
:1009B0000030328927F8312034817246E3E738F875
|
||||
:1009C000393033813369EFF3108272B6D3E8CF0F39
|
||||
:1009D00001210028FAD1C3E8401F0028F6D1BFF357
|
||||
:1009E0005F8F7388316928F83930009B738000234A
|
||||
:1009F000C1E88F3F82F31088D4E640BF05B0BDEC5C
|
||||
:100A0000028BBDE8F08F2846CDE9022300F0C0F943
|
||||
:100A1000029A039B10EB020E43EB010A26E70846FD
|
||||
:100A20000B69029198470028C9D00299D1E90023A7
|
||||
:100A300011E700BFAFF30080FFFFFFFFFFFFFFFFE5
|
||||
:100A400000800B40A804002000000B40610700104C
|
||||
:100A50002DE9F84F364C25692DB1BDE8F84F0A2134
|
||||
:100A60003448FFF731BEDFF8E4800321404600F050
|
||||
:100A70007DF90326C4F80C80FFF748FC4FF0504C7A
|
||||
:100A80002D4B267003442361DCF800300F21637086
|
||||
:100A9000636961801D834FF00405A3F878504FF01F
|
||||
:100AA0000505A3F890504FF00605A3F8A8504FF0A5
|
||||
:100AB00007050E214FF6FF7208274FF00A0EA3F824
|
||||
:100AC000C0504FF001094FF00C0C4FF0020B4FF0EB
|
||||
:100AD000090A0D204FF00B05A3F868111749A280F1
|
||||
:100AE000A3F808E1A160A3F848B0A3F8F0A0A3F828
|
||||
:100AF0002051A3F838C1A3F85001A3F83090A3F80F
|
||||
:100B00006060A3F8D8701A800D4B3046C8F820708A
|
||||
:100B10000C49DC60FFF750FC49463046FFF736FCD5
|
||||
:100B2000094B0A211F640348BDE8F84FFFF7CCBD0D
|
||||
:100B300074020020C804002030040020FFFF1000D1
|
||||
:100B4000A80400206107001000200B4000000B40AB
|
||||
:100B50000146F0B50069EFF3108772B6D0E8CF5FB9
|
||||
:100B60000124002DFAD1C0E8454F002DF6D1BFF386
|
||||
:100B70005F8FB1F902E04C690EEB4E0CBEF1000F35
|
||||
:100B80004FEACC05086904EBCC0C3CDB665B4E807D
|
||||
:100B90000026C0E88F6F87F31088BCF80200CCE90C
|
||||
:100BA00002230130C0F30E00012838BF0120059B4D
|
||||
:100BB000ACF80200CCF81030069B40EA0E40CCF8AE
|
||||
:100BC00014300B69EFF3108272B6D3E8CFCF012750
|
||||
:100BD000BCF1000FF9D1C3E84C7FBCF1000FF4D198
|
||||
:100BE000BFF35F8F8B886353A1F804E00B69C3E800
|
||||
:100BF0008F6F82F310880122CB68097803F50153C7
|
||||
:100C00008A405A60F0BD0023C0E88F3F87F3108808
|
||||
:100C10004FF0FF30F0BD00BF03464089B0EB214FDD
|
||||
:100C200037DD58690A1402EB420210B500EBC2002E
|
||||
:100C30001C69EFF3108C72B6D4E8CFEF0122BEF13D
|
||||
:100C4000000FF9D1C4E84E2FBEF1000FF4D1BFF36D
|
||||
:100C50005F8F428889B292B28A4207D000221B6914
|
||||
:100C6000C3E88F2F8CF31088002010BD42F400429F
|
||||
:100C700042800121002218699971C0E88F2F8CF3FE
|
||||
:100C800010881C78DA68084602F50153A1405960C3
|
||||
:100C900010BD0020704700BF2DE9F04306460D4609
|
||||
:100CA00083B0EFF30584E4B23CB12D4B5A6AAA42FB
|
||||
:100CB0001CD2002003B0BDE8F0832A4FD7F80C9077
|
||||
:100CC00097F80080484600F063F808F1040859F8E6
|
||||
:100CD00028301B1A301A65EB0101984271F10001AE
|
||||
:100CE00010DB20BF1E4B5A6AAA42E2D314BF012474
|
||||
:100CF00000249B6AB34234BF204644F0010003B095
|
||||
:100D0000BDE8F08300F04CF8864265EB0101002954
|
||||
:100D100014DB154B3846CDE9003432462B46FFF73D
|
||||
:100D200017FF011E0ADD0E4B5A6AAA4216D39B6AB0
|
||||
:100D3000B34211D30B48FFF76FFFB6E7084B5C6A6D
|
||||
:100D4000AC42B6D3641B18BF01249B6AB34234BFC4
|
||||
:100D5000204644F00100ADE7AA42EBD120BFE9E70D
|
||||
:100D600000000B40740200202107001010B4054B56
|
||||
:100D7000054C064AA04214BF1846581C5DF8044BA7
|
||||
:100D8000FFF798BA5804002000800B40F0190010BB
|
||||
:100D90000346416A0A46986A596A8A42FAD17047FC
|
||||
:100DA000034B596A0A46986A596A9142FAD17047C8
|
||||
:100DB00000000B4030B4154A536A9C46946A536A4B
|
||||
:100DC0006345FAD1021959414FF0000528BF0125AA
|
||||
:100DD0000E4B5B6AB5B15A1C08BF1A4608D04FF0DB
|
||||
:100DE000FF310A460948436A8B42FCD38B4207D144
|
||||
:100DF000064902E0486A984202D1886A9042F9D3D3
|
||||
:100E000030BC70479942EDD8F0E700BF00000B40BE
|
||||
:100E1000F8B5054606200E4600F0E4F8002842D05A
|
||||
:100E2000354A3648954214BF4FF080624FF0006259
|
||||
:100E3000334B344902601A608C6832EA0404FBD1F7
|
||||
:100E40002D4B4FF48071EB1AB3FA83F32E4A5B09F2
|
||||
:100E5000062022F8131000F0C5F8C300B3FBF6F328
|
||||
:100E60000133DA0920D1402601216962AA622F6B81
|
||||
:100E7000FB0722D42B46002253F82C1F062003F533
|
||||
:100E8000805422602F6300F0ADF840F2013103225C
|
||||
:100E90008000B0FBF6F0EB6A83F0700303F07E0392
|
||||
:100EA00023602963AA64F8BD4FF6FE718A421BD9FC
|
||||
:100EB00022464FF6FF71154ED7E740F2013205F595
|
||||
:100EC00040531A636B6AAC6A062004EB831400F08B
|
||||
:100ED00089F80F4BA402A3FB0023DB0A0021B4FB1B
|
||||
:100EE000F3F0FFF767FFC5E7C3F34503114603EBD4
|
||||
:100EF00082161A46B9E700BF008007400020024072
|
||||
:100F00000030024000000240CC040020C0FF3F003F
|
||||
:100F1000757B2B8F00EB400C4FEA8C0C0CF1804C56
|
||||
:100F20000CF5803CF0B51646DCF80420051FB2F540
|
||||
:100F3000803F38BF4FF48032EDB238BFCCF8042088
|
||||
:100F4000012D2AD94FF40067254C0CF5405217604B
|
||||
:100F500054F82020B2B9DCF80020012D82EA4612B4
|
||||
:100F600002F0E0020CF5805632602AD94FF400619D
|
||||
:100F700044F820304FF480330CF500521160CCF867
|
||||
:100F80000430F0BD6769B7FBF2FE0EF1010E0EEB07
|
||||
:100F90004E0EBEF1030EFCD2DDE70129D2D10324AF
|
||||
:100FA0000CF540521460DCF80820D207FBD5DCF8C1
|
||||
:100FB00000200B4C82EA461202F0E0020CF580564B
|
||||
:100FC00032600122DCF800504D4005F00305356029
|
||||
:100FD00002FA01F1DCF808200A42FBD0C6E700BFA4
|
||||
:100FE0005C040020014B53F8200070475C04002093
|
||||
:100FF00070B4039D04682D0345EA03451B4B002C88
|
||||
:10100000B3FBF1F3B2FBF3F61FDB194A194B904225
|
||||
:1010100014BF4FF480424FF40042174C1A6003F59E
|
||||
:1010200080531A60A36832EA0303FBD1212200F542
|
||||
:1010300040530433016086601A600268002AFCDABB
|
||||
:101040000822C5601A6070BC7047036803F03F0354
|
||||
:101050008B42DAD18368C3F30B03B342D5D1C368A3
|
||||
:1010600003F4EE23AB42D0D1EDE700BF001BB70085
|
||||
:10107000008005400020024000000240012300EBF8
|
||||
:101080004000800000F1804000F584104160036062
|
||||
:10109000704700BF0023DB8A002242E800F25202C0
|
||||
:1010A00001D4102118470421184700BF034AD2F881
|
||||
:1010B0002838002BFBD0BFF35F8F704700000E4035
|
||||
:1010C0000021044B044ABFF35F8F43F8041B934293
|
||||
:1010D000F9D170470C080E402C080E4010B44FF4A4
|
||||
:1010E0008D704FF42A64064A064B07491460D0609D
|
||||
:1010F00019605368002BFCDA5DF8044B704700BFA1
|
||||
:101100000080044000A0044000B0FA00704700BF17
|
||||
:1011100008B50148FFF7B6F8141A001038B5054CA9
|
||||
:10112000054DAC4204D254F8043B9847AC42FAD384
|
||||
:1011300038BD00BF88190010C819001010B4074846
|
||||
:10114000074C084B084A094904601A608B6832EA68
|
||||
:101150000303FBD15DF8044B704700BF0020024041
|
||||
:101160007F3BEFEF00300240F6FFF3030000024048
|
||||
:10117000044BDB6CB3F5004F03D14FF48022024BDC
|
||||
:10118000DA64704700001150002011504FF0E02247
|
||||
:10119000044BD2F8881D0B43C2F8883D10EE300492
|
||||
:1011A000704700BF030330006FF06041044B054AF5
|
||||
:1011B00019609368DB4333F06043FAD1704700BF96
|
||||
:1011C000003002400000024010B545F25320FFF706
|
||||
:1011D00061FFBDE8104003460420184710B545F2F2
|
||||
:1011E0005320FFF757FFBDE8104003460120184782
|
||||
:1011F000FFF7A0B81449154B70B55C1AA610442E21
|
||||
:10120000324628BF4422124D9200284600F00EFBC1
|
||||
:10121000B4F5867F13D80F4AC6F1440012D02B19BB
|
||||
:10122000410803EBC101C3E9002208338B42FAD124
|
||||
:10123000C30704D520F00100304445F82020064BB8
|
||||
:101240009D6070BD4320F8E7000000101001001001
|
||||
:10125000000000201101001000ED00E0002370B537
|
||||
:101260002B4C82B0C4F88430FFF738FF0122294BA1
|
||||
:10127000DA63636C012BFCD10321264A244B1163F2
|
||||
:101280009C6B012CFCD10226052521460523224A10
|
||||
:1012900022480096FFF7ACFE21462B46204A214803
|
||||
:1012A0000095FFF7A5FE0022042031461E4BFFF7F4
|
||||
:1012B00031FE2146284600221C4BFFF72BFE002260
|
||||
:1012C000082011461A4BFFF725FE0022092011467F
|
||||
:1012D000174BFFF71FFE002206201146134BFFF7A6
|
||||
:1012E00019FE0022114B07201146FFF713FE0420C0
|
||||
:1012F000FFF778FE00240F4BA3FB0035AD0CE0B2E6
|
||||
:1013000029460134FFF7BAFE062CF8D102B070BDB1
|
||||
:101310000000014000300140002F685900000540E6
|
||||
:10132000008C864700800540001BB70080D1F00884
|
||||
:10133000006CDC0283DE1B4300B9704700F01CB96F
|
||||
:1013400010B5094B84B01C684CB1034600914FF0B6
|
||||
:10135000FF3203A90548A047012004B010BD00F0EA
|
||||
:101360004DF9204604B010BD8C0400203913001044
|
||||
:1013700000BEFDE708B5FFF7FBFF00BF38B5064C20
|
||||
:10138000064DFFF7CBFEAC4204D254F8043B98471D
|
||||
:10139000AC42FAD338BD00BFC8190010CC190010F8
|
||||
:1013A00003680846114618472DE9F0411546427D6D
|
||||
:1013B00007468846002A46D0002D1DDD0B780A2BF3
|
||||
:1013C00023D0012D4FF0000C18D04646012416F80A
|
||||
:1013D000012F21460A2A04F1010422D0A542F6D1A8
|
||||
:1013E00065450BDC08EB050313F8013CA3F10D0385
|
||||
:1013F000B3FA83F35B093B75BDE8F0813B68A5EB6D
|
||||
:101400000C0108EB0C009847ECE7037D002BD8D1CA
|
||||
:10141000036802210F489847012DE3D04FF0010CDB
|
||||
:10142000D3E716F8013C0D2BD8D08C4508EB0C0007
|
||||
:10143000A1EB0C0101DA3B689847022105483B68A3
|
||||
:101440009847A446CAE7294640463B68BDE8F041B4
|
||||
:10145000184700BFF81A00102DE9F04782B00D467A
|
||||
:1014600091461C460646FFF79BFC4FF0FF3C6FF091
|
||||
:1014700000472E4A821841F10003944577EB03019F
|
||||
:101480003CBF62463B462A4800F07AFA6B1C804615
|
||||
:1014900040D00CB3274F284B1C68B4B1B9F1000FF2
|
||||
:1014A0001CD1DFF89C9001E0246974B12368002B03
|
||||
:1014B000FAD0D9F800300BB19C42F5D120462A462B
|
||||
:1014C0003146B8472469002CF0D1B8F1000F26D17D
|
||||
:1014D000284602B0BDE8F087184FDCE74FF00A0A53
|
||||
:1014E000DFF85C9002E02469002CEED02368002B2A
|
||||
:1014F000F9D0D9F800300BB1A342F4D12A463146D5
|
||||
:101500002046B847012220460DF107018DF807A0BB
|
||||
:10151000B847E8E7304600F0FFF90546B9E7044868
|
||||
:1015200000F02AFA284602B0BDE8F08740420F00DA
|
||||
:10153000A4020020A913001084040020A1130010AD
|
||||
:1015400088040020084A136823B90AE003F1100256
|
||||
:101550001B6933B18342F9D129B918691060196147
|
||||
:10156000704701B1106070478404002008B500F096
|
||||
:1015700033F9012008BD00BFF0B583B006468DF8F1
|
||||
:101580000700FFF70DFC4FF0FF356FF00044174ADE
|
||||
:10159000821841F10003954274EB03013CBF2346DE
|
||||
:1015A0002A46134800F0ECF9124B07461C689CB120
|
||||
:1015B000114D01E024697CB12368002BFAD02B681F
|
||||
:1015C0000BB19C42F6D1204601220DF10701FFF735
|
||||
:1015D000EBFE2469002CEFD117B9304603B0F0BD03
|
||||
:1015E000034800F0C9F9304603B0F0BD40420F0097
|
||||
:1015F000A4020020840400208804002038B504469A
|
||||
:1016000000F08AF9012305461A4620462946FFF7CD
|
||||
:1016100023FF084B1C682CB163682BB198472469E1
|
||||
:10162000002CF9D1284638BD2469002CF4D1284675
|
||||
:1016300038BD00BF84040020B1F1000C1DDD0F4A4D
|
||||
:101640000F4B126830B5D31AB3FA83F30D240D4D46
|
||||
:101650005B09411E35F913E08C4411F8010F8645F2
|
||||
:1016600006D093699B06FCD461451060F5D130BD6E
|
||||
:1016700093699D06FCD41460F3E77047D004002002
|
||||
:1016800000800740CC040020224BB1F1000C10B4C4
|
||||
:101690001C682EDD034600201F4A591E12689369FC
|
||||
:1016A000DB0617D401309369DB06FCD4136884454C
|
||||
:1016B00001F8013FF3D14CB150211346916353F827
|
||||
:1016C000342F02F0380203F580531A6060465DF84B
|
||||
:1016D000044B70474CB150211346916353F8342F9B
|
||||
:1016E00002F0380203F580531A6078B15DF8044BBC
|
||||
:1016F00070475CB1084B50211A681346916353F848
|
||||
:10170000342F02F0380203F580531A606FF00200A4
|
||||
:10171000DDE700BF50040020D0040020054B1B680B
|
||||
:1017200033B10021044A05481268006891631847E4
|
||||
:10173000704700BF50040020D00400205404002053
|
||||
:10174000024B1A6893691B07FCD47047D004002031
|
||||
:10175000F8B51C4F1C4D3A681C4EAA4214BF2125F7
|
||||
:1017600022250446D6F800C018B1BCF1000F10D0F5
|
||||
:10177000F8BDBCF1000FFBD0014690632846FEF790
|
||||
:1017800005FE28461249FEF747FE124B34601C60E6
|
||||
:10179000F8BD0B460F4A0E49306028461360FEF72D
|
||||
:1017A0000BFE01212846FEF7F1FD3A685021134651
|
||||
:1017B000916353F8342F02F0380203F580531A6016
|
||||
:1017C000F8BD00BFD0040020008007405004002076
|
||||
:1017D0001D1700105404002010B50E490E4C0F4880
|
||||
:1017E0000F4A104B007821600020022112781B78EC
|
||||
:1017F000FEF72AFD02210120FEF726FD4FF4E1311C
|
||||
:101800002068FFF705FBBDE8104001210648FFF7FF
|
||||
:1018100099BE00BF00000740D0040020481B001004
|
||||
:10182000441B0010401B00108C020020844641EA3B
|
||||
:10183000000313F0030349D1403A23D30B6803603C
|
||||
:101840004B6843608B688360CB68C3600B6903613E
|
||||
:101850004B6943618B698361CB69C3610B6A036226
|
||||
:101860004B6A43628B6A8362CB6AC3620B6B03630E
|
||||
:101870004B6B43638B6B8363CB6BC36340304031F3
|
||||
:10188000403ADBD230320BD30B6803604B684360C5
|
||||
:101890008B688360CB68C36010301031103AF3D28C
|
||||
:1018A0000C3205D351F8043B40F8043B043AF9D21A
|
||||
:1018B000043208D0D2071CBF11F8013B00F8013BED
|
||||
:1018C00001D30B8803806046704700BF082A13D3FA
|
||||
:1018D0008B07B1D010F00303AED0C3F10403D21ACA
|
||||
:1018E000DB071CBF11F8013B00F8013BA4D331F822
|
||||
:1018F000023B20F8023B9FE7043AD9D3013A11F8A2
|
||||
:10190000013B00F8013BF9D20B7803704B78437030
|
||||
:101910008B7883706046704720F0030110F003005D
|
||||
:10192000C0F1000051F8043B00F1040C4FEACC0C6C
|
||||
:101930006FF000021CBF22FA0CF213434FF0010CAF
|
||||
:101940004CEA0C2C4CEA0C4CA3EB0C0222EA0302EE
|
||||
:1019500012EACC1204BF51F8043B0430F4D0C2F1B7
|
||||
:10196000000102EA0102B2FA82F2C2F11F0200EBA8
|
||||
:10197000D2007047F8B500BF5FF800F0E501002025
|
||||
:101980005FF800F07D010020C91100103D1100102A
|
||||
:10199000711100105D120010A9110010C11000108B
|
||||
:1019A000F1110010AD100010D5060010F511001057
|
||||
:1019B000510A00100D110010DD1100108D110010E2
|
||||
:0C19C000250300104D0300101102001060
|
||||
:1019CC0068656C6C6F2C20776F726C640D00000076
|
||||
:1019DC000A2A2A2A2050414E4943202A2A2A0A0040
|
||||
:1019EC000A000000486172647761726520616C6165
|
||||
:1019FC00726D20256420616C726561647920636C62
|
||||
:101A0C0061696D65640000004861726420617373E4
|
||||
:101A1C006572740052656C6561736500626F6F74FA
|
||||
:101A2C00325F77323571303830000000302E3100A3
|
||||
:101A3C00322E322E300000007069636F32000000CD
|
||||
:101A4C003078303030315F68656C6C6F2D776F7229
|
||||
:101A5C006C6400004F637420313720323032360012
|
||||
:101A6C005541525420737464696E000055415254B0
|
||||
:101A7C00207374646F7574005541525420737464F0
|
||||
:101A8C00696E202F207374646F75740006005250B9
|
||||
:101A9C00D3F07542201A001006005250E182887F64
|
||||
:101AAC00281A0010060052503ABCA911381A00101E
|
||||
:101ABC0006005250ABB360533C1A00100600525053
|
||||
:101ACC00BBFF3CB6441A001006005250861C0302A1
|
||||
:101ADC004C1A0010060052505422A29D601A00109D
|
||||
:101AEC0005005250DE65F468FC1C00100D0A000065
|
||||
:101AFC000600525053B4F4A1841A0010080052503E
|
||||
:0C1B0C001200000008005250921000006F
|
||||
:081B180014FDFF7F0100000035
|
||||
:101B2000981A0010A41A0010B01A0010BC1A001065
|
||||
:101B3000C81A0010D41A0010E01A0010EC1A001095
|
||||
:0C1B4000101B0010081B0010FC1A001005
|
||||
:101B4C004FF050412DE9F0410027044616461D4642
|
||||
:101B5C00D1F8008008E0C1E88F7F8CF31088304604
|
||||
:101B6C00294600F075F8E8B92168EFF3108C72B6CD
|
||||
:101B7C00D1E8CF2F0123002AFAD1C1E8423F002A35
|
||||
:101B8C00F6D1BFF35F8F94F904302168002BE2DAB1
|
||||
:101B9C00002384F80480C1E88F3F8CF31088012067
|
||||
:101BAC00BDE8F0810020BDE8F08100BF30B50468CD
|
||||
:101BBC00EFF3108C72B6D4E8CFEF0125BEF1000F15
|
||||
:101BCC00F9D1C4E84E5FBEF1000FF4D1BFF35F8FC3
|
||||
:101BDC0090F904400568002C10DB0021C5E88F1F2C
|
||||
:101BEC008CF310884FF0504595F90050A54201D167
|
||||
:101BFC00084630BDBDE83040FFF7A2BF4FF0504261
|
||||
:101C0C00126800230271C5E88F3F8CF31088012005
|
||||
:101C1C0030BD00BF0368EFF3108272B6D3E8CFCFAC
|
||||
:101C2C000121BCF1000FF9D1C3E84C1FBCF1000F2E
|
||||
:101C3C00F4D1BFF35F8F4FF0FF0C0023016880F8E5
|
||||
:101C4C0004C0C1E88F3F82F3108840BF704700BFCB
|
||||
:101C5C005FF800F0990C001010000000000000006C
|
||||
:101C6C000000010000000000000000000000020065
|
||||
:101C7C000000000000000000000003000000000055
|
||||
:101C8C00000000000000FF000000000001B54868E3
|
||||
:101C9C0001318E460047704609380149884701BD1D
|
||||
:101CAC000D06001000000000000000000000000005
|
||||
:101CBC000000000000000000B002002039160010E7
|
||||
:101CCC004117001089160010511700100000000079
|
||||
:0C1CDC00000100000000000000000000FB
|
||||
:101CE800D3DEFFFFFE010000FF01000050E4FFFF0C
|
||||
:041CF800793512AB7D
|
||||
:040000051000014D99
|
||||
:00000001FF
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = (4 * 1024 * 1024)
|
||||
@@ -0,0 +1,121 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
# following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
||||
# disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
|
||||
endif ()
|
||||
|
||||
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
|
||||
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
|
||||
endif()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
)
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
else ()
|
||||
FetchContent_Populate(
|
||||
pico_sdk
|
||||
QUIET
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
|
||||
|
||||
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
|
||||
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
|
||||
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
||||
Binary file not shown.
+1646
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -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 02</text>
|
||||
|
||||
<!-- Week Topic -->
|
||||
<text x="600" y="440" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Hello, World - Debugging and</text>
|
||||
<text x="600" y="478" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">Hacking Basics: Debugging and Hacking</text>
|
||||
<text x="600" y="516" text-anchor="middle" font-family="'Courier New',monospace" font-size="28" fill="#c0c0c0">a Basic Program for the Pico 2</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.4 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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Live Hacking Overview</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Introduction to Live Hacking</text>
|
||||
|
||||
<!-- Left Panel: What is live hacking -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">What Is Live Hacking?</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="txt">Modify a program</text>
|
||||
<text x="55" y="237" class="txt">WHILE it is running</text>
|
||||
<text x="55" y="269" class="txt">on real hardware</text>
|
||||
|
||||
<line x1="50" y1="297" x2="550" y2="297" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="337" class="amb">The Train Analogy</text>
|
||||
<text x="55" y="372" class="txt">Train heading to NYC</text>
|
||||
<text x="55" y="404" class="txt">Switch the tracks</text>
|
||||
<text x="55" y="436" class="txt">while it moves</text>
|
||||
<text x="55" y="468" class="red">Now it goes to LA!</text>
|
||||
|
||||
<line x1="50" y1="496" x2="550" y2="496" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="536" class="cyn">Why It Matters</text>
|
||||
<text x="55" y="571" class="txt">Security research</text>
|
||||
<text x="55" y="603" class="txt">Penetration testing</text>
|
||||
<text x="55" y="635" class="txt">Malware analysis</text>
|
||||
<text x="55" y="667" class="txt">Hardware debugging</text>
|
||||
|
||||
<text x="300" y="740" text-anchor="middle" class="dim">No recompile needed!</text>
|
||||
|
||||
<!-- Right Panel: This Week's Goal -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">This Week's Goal</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="grn">Target Program</text>
|
||||
<text x="625" y="240" class="txt">hello-world.c</text>
|
||||
<text x="625" y="272" class="txt">Prints "hello, world"</text>
|
||||
<text x="625" y="304" class="txt">in infinite loop</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="red">Our Mission</text>
|
||||
<text x="625" y="407" class="txt">Make it print</text>
|
||||
<text x="625" y="439" class="txt">something ELSE</text>
|
||||
<text x="625" y="471" class="txt">without changing</text>
|
||||
<text x="625" y="503" class="txt">the source code</text>
|
||||
|
||||
<line x1="620" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="571" class="amb">Tools Used</text>
|
||||
<text x="625" y="606" class="txt">GDB = live debug</text>
|
||||
<text x="625" y="638" class="txt">OpenOCD = HW bridge</text>
|
||||
<text x="625" y="670" class="txt">Ghidra = analysis</text>
|
||||
|
||||
<text x="885" y="745" text-anchor="middle" class="dim">Hack the running binary</text>
|
||||
</svg>
|
||||
@@ -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}
|
||||
.cmd{font:bold 18px 'Courier New',monospace}
|
||||
.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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">GDB Debug Session</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">GDB Fundamentals</text>
|
||||
|
||||
<!-- Left Panel: Connection Steps -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">Setup Steps</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Step 1 -->
|
||||
<text x="55" y="198" class="dim">Step 1: Start OpenOCD</text>
|
||||
<rect x="55" y="213" width="490" height="88" rx="5" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="300" y="233" text-anchor="middle" class="cyn cmd">openocd -s <scripts></text>
|
||||
<text x="300" y="253" text-anchor="middle" class="cyn cmd">-f interface/cmsis-dap.cfg</text>
|
||||
<text x="300" y="273" text-anchor="middle" class="cyn cmd">-f target/rp2350.cfg</text>
|
||||
<text x="300" y="293" text-anchor="middle" class="cyn cmd">-c "adapter speed 5000"</text>
|
||||
|
||||
<!-- Step 2 -->
|
||||
<text x="55" y="331" class="dim">Step 2: Launch GDB</text>
|
||||
<rect x="55" y="346" width="490" height="58" rx="5" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="300" y="369" text-anchor="middle" class="grn cmd">arm-none-eabi-gdb</text>
|
||||
<text x="300" y="391" text-anchor="middle" class="grn cmd">build\0x0001_hello-world.elf</text>
|
||||
|
||||
<!-- Step 3 -->
|
||||
<text x="55" y="434" class="dim">Step 3: Connect to target</text>
|
||||
<rect x="55" y="449" width="490" height="50" rx="5" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="300" y="481" text-anchor="middle" class="amb">target extended-remote :3333</text>
|
||||
|
||||
<!-- Step 4 -->
|
||||
<text x="55" y="529" class="dim">Step 4: Reset + halt</text>
|
||||
<rect x="55" y="544" width="490" height="50" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="300" y="576" text-anchor="middle" class="red">monitor reset halt</text>
|
||||
|
||||
<!-- Step 5 -->
|
||||
<text x="55" y="624" class="dim">Step 5: Set breakpoint</text>
|
||||
<rect x="55" y="639" width="490" height="50" rx="5" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="300" y="671" text-anchor="middle" class="grn">break main</text>
|
||||
|
||||
<text x="300" y="725" text-anchor="middle" class="dim">Then: continue (c)</text>
|
||||
|
||||
<!-- Right Panel: What Each Does -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">What Each Does</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="cyn">openocd</text>
|
||||
<text x="625" y="240" class="txt">Loads probe + chip</text>
|
||||
<text x="625" y="272" class="txt">config files</text>
|
||||
<text x="625" y="304" class="dim">Then listens on :3333</text>
|
||||
|
||||
<line x1="620" y1="337" x2="1150" y2="337" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="377" class="grn">arm-none-eabi-gdb</text>
|
||||
<text x="625" y="412" class="txt">ARM debugger from</text>
|
||||
<text x="625" y="444" class="txt">the embedded toolchain</text>
|
||||
|
||||
<line x1="620" y1="472" x2="1150" y2="472" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="512" class="amb">target extended-remote</text>
|
||||
<text x="625" y="547" class="txt">GDB connects to</text>
|
||||
<text x="625" y="579" class="txt">OpenOCD server</text>
|
||||
|
||||
<line x1="620" y1="607" x2="1150" y2="607" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="647" class="red">monitor reset halt</text>
|
||||
<text x="625" y="682" class="txt">Reset chip + stop</text>
|
||||
<text x="625" y="714" class="txt">at very first instr</text>
|
||||
<text x="625" y="746" class="dim">Clean starting state</text>
|
||||
</svg>
|
||||
@@ -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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Breakpoints</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">GDB Breakpoint Types</text>
|
||||
|
||||
<!-- Left Panel: How Breakpoints Work -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">How They Work</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Normal execution -->
|
||||
<text x="55" y="203" class="grn">Normal Execution</text>
|
||||
|
||||
<rect x="55" y="220" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="248" class="txt">MOV r0, #5</text>
|
||||
|
||||
<rect x="55" y="272" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="300" class="txt">MOV r1, #3</text>
|
||||
|
||||
<rect x="55" y="324" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="352" class="txt">BL printf</text>
|
||||
|
||||
<!-- Breakpoint set -->
|
||||
<text x="55" y="410" class="red">With Breakpoint</text>
|
||||
|
||||
<rect x="55" y="427" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="455" class="txt">MOV r0, #5</text>
|
||||
|
||||
<rect x="55" y="479" width="490" height="42" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="70" y="507" class="red">MOV r1, #3</text>
|
||||
<text x="520" y="507" text-anchor="end" class="red">STOP</text>
|
||||
|
||||
<rect x="55" y="531" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-dasharray="6"/>
|
||||
<text x="70" y="559" class="txt">BL printf</text>
|
||||
<text x="520" y="559" text-anchor="end" class="dim">paused</text>
|
||||
|
||||
<text x="300" y="620" text-anchor="middle" class="txt">CPU halts BEFORE</text>
|
||||
<text x="300" y="652" text-anchor="middle" class="txt">executing breakpoint</text>
|
||||
<text x="300" y="684" text-anchor="middle" class="txt">instruction</text>
|
||||
|
||||
<text x="300" y="740" text-anchor="middle" class="dim">Now you can inspect</text>
|
||||
|
||||
<!-- Right Panel: GDB Commands -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">GDB Breakpoints</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="grn">break main</text>
|
||||
<text x="625" y="240" class="txt">Stop at function</text>
|
||||
<text x="625" y="272" class="dim">By symbol name</text>
|
||||
|
||||
<line x1="620" y1="300" x2="1150" y2="300" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="340" class="grn">break *0x10000340</text>
|
||||
<text x="625" y="375" class="txt">Stop at exact addr</text>
|
||||
<text x="625" y="407" class="dim">By hex address</text>
|
||||
|
||||
<line x1="620" y1="435" x2="1150" y2="435" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="475" class="cyn">info break</text>
|
||||
<text x="625" y="510" class="txt">List all active</text>
|
||||
<text x="625" y="542" class="txt">breakpoints</text>
|
||||
|
||||
<line x1="620" y1="570" x2="1150" y2="570" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="610" class="amb">continue (c)</text>
|
||||
<text x="625" y="645" class="txt">Resume running</text>
|
||||
<text x="625" y="677" class="txt">until next break</text>
|
||||
|
||||
<line x1="620" y1="705" x2="1150" y2="705" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="745" class="red">delete 1</text>
|
||||
<text x="625" y="777" class="txt">Remove breakpoint #1</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,102 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Stack in Action</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Runtime Stack Analysis</text>
|
||||
|
||||
<!-- Left Panel: Before Call -->
|
||||
<rect x="30" y="105" width="350" height="675" class="pnl" rx="8"/>
|
||||
<text x="205" y="148" text-anchor="middle" class="sub">Before Call</text>
|
||||
<line x1="50" y1="163" x2="360" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="amb">0x20082000</text>
|
||||
<text x="55" y="237" class="red">SP here</text>
|
||||
|
||||
<rect x="60" y="260" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="295" text-anchor="middle" class="dim">empty (0x20081FFC)</text>
|
||||
|
||||
<rect x="60" y="325" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="360" text-anchor="middle" class="dim">empty (0x20081FF8)</text>
|
||||
|
||||
<rect x="60" y="390" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="425" text-anchor="middle" class="dim">free stack space</text>
|
||||
|
||||
<rect x="60" y="455" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="187" y="490" text-anchor="middle" class="dim">unused lower space</text>
|
||||
|
||||
<text x="55" y="555" class="amb">0x20080000</text>
|
||||
|
||||
<text x="205" y="650" text-anchor="middle" class="red">Grows DOWN</text>
|
||||
<line x1="205" y1="665" x2="205" y2="725" stroke="#ff0040" stroke-width="4"/>
|
||||
<polygon points="193,725 205,750 217,725" fill="#ff0040"/>
|
||||
|
||||
<!-- Middle Panel: After PUSH {r4, lr} -->
|
||||
<rect x="410" y="105" width="370" height="675" class="pnl" rx="8"/>
|
||||
<text x="595" y="148" text-anchor="middle" class="sub">After PUSH</text>
|
||||
<line x1="430" y1="163" x2="760" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="435" y="205" class="amb">0x20082000</text>
|
||||
<text x="435" y="237" class="red">PUSH {r4, lr}</text>
|
||||
|
||||
<rect x="440" y="260" width="255" height="55" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="567" y="295" text-anchor="middle" class="red">saved LR</text>
|
||||
|
||||
<rect x="440" y="325" width="255" height="55" rx="5" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="567" y="360" text-anchor="middle" class="amb">saved r4</text>
|
||||
|
||||
<rect x="440" y="390" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="567" y="425" text-anchor="middle" class="dim">free stack space</text>
|
||||
|
||||
<rect x="440" y="455" width="255" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1" stroke-dasharray="6"/>
|
||||
<text x="567" y="490" text-anchor="middle" class="dim">free stack space</text>
|
||||
|
||||
<text x="435" y="555" class="red">SP now = 0x20081FF8</text>
|
||||
|
||||
<text x="435" y="620" class="dim" style="fill:#ff0040">SP moved down</text>
|
||||
<text x="435" y="650" class="dim" style="fill:#ff0040">by 8 bytes</text>
|
||||
<text x="435" y="720" class="cyn">GDB: x/4xw $sp</text>
|
||||
<text x="435" y="752" class="dim">saved regs are now visible</text>
|
||||
|
||||
<!-- Right Panel: Key Points -->
|
||||
<rect x="810" y="105" width="360" height="675" class="pnl" rx="8"/>
|
||||
<text x="990" y="148" text-anchor="middle" class="sub">Key Points</text>
|
||||
<line x1="830" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="205" class="grn">PUSH saves</text>
|
||||
<text x="835" y="240" class="txt">Preserves regs</text>
|
||||
<text x="835" y="272" class="txt">before function</text>
|
||||
<text x="835" y="304" class="txt">body runs</text>
|
||||
|
||||
<line x1="830" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="372" class="red">POP restores</text>
|
||||
<text x="835" y="407" class="txt">Puts values</text>
|
||||
<text x="835" y="439" class="txt">back when func</text>
|
||||
<text x="835" y="471" class="txt">returns</text>
|
||||
|
||||
<line x1="830" y1="499" x2="1150" y2="499" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="539" class="amb">Watch in GDB</text>
|
||||
<text x="835" y="574" class="txt">x/4xw $sp</text>
|
||||
<text x="835" y="606" class="dim">See stack data</text>
|
||||
|
||||
<line x1="830" y1="634" x2="1150" y2="634" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="835" y="674" class="cyn">stepi</text>
|
||||
<text x="835" y="709" class="txt">Step 1 instr</text>
|
||||
<text x="835" y="741" class="txt">watch stack</text>
|
||||
<text x="835" y="773" class="dim">change live</text>
|
||||
</svg>
|
||||
@@ -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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">LDR Instruction</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">ARM Load Instructions</text>
|
||||
|
||||
<!-- Left Panel: LDR Flow -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">How LDR Works</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- The instruction -->
|
||||
<text x="55" y="205" class="dim">Instruction:</text>
|
||||
<rect x="55" y="220" width="490" height="50" rx="5" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="300" y="252" text-anchor="middle" class="grn">LDR r0, [pc, #12]</text>
|
||||
|
||||
<!-- Step 1 -->
|
||||
<text x="55" y="315" class="amb">Step 1: Calculate addr</text>
|
||||
<rect x="55" y="335" width="490" height="50" rx="5" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="300" y="367" text-anchor="middle" class="txt">addr = PC + 12</text>
|
||||
|
||||
<!-- Step 2 -->
|
||||
<text x="55" y="430" class="amb">Step 2: Read memory</text>
|
||||
<rect x="55" y="450" width="490" height="50" rx="5" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="300" y="482" text-anchor="middle" class="txt">value = *(addr)</text>
|
||||
|
||||
<!-- Step 3 -->
|
||||
<text x="55" y="545" class="amb">Step 3: Load into reg</text>
|
||||
<rect x="55" y="565" width="490" height="50" rx="5" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="300" y="597" text-anchor="middle" class="cyn">r0 = value</text>
|
||||
|
||||
<!-- Result -->
|
||||
<text x="300" y="670" text-anchor="middle" class="txt">r0 now holds the</text>
|
||||
<text x="300" y="702" text-anchor="middle" class="txt">address of our</text>
|
||||
<text x="300" y="734" text-anchor="middle" class="grn">"hello, world" string</text>
|
||||
|
||||
<!-- Right Panel: Why It Matters -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Why It Matters</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="grn">String Loading</text>
|
||||
<text x="625" y="240" class="txt">printf needs addr</text>
|
||||
<text x="625" y="272" class="txt">of string in r0</text>
|
||||
<text x="625" y="304" class="dim">r0 = first argument</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="cyn">PC-Relative</text>
|
||||
<text x="625" y="407" class="txt">Address computed</text>
|
||||
<text x="625" y="439" class="txt">relative to current</text>
|
||||
<text x="625" y="471" class="txt">PC position</text>
|
||||
<text x="625" y="503" class="dim">Works from any addr</text>
|
||||
|
||||
<line x1="620" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="571" class="red">The Attack Point</text>
|
||||
<text x="625" y="606" class="txt">If we change r0</text>
|
||||
<text x="625" y="638" class="txt">AFTER the LDR</text>
|
||||
<text x="625" y="670" class="txt">printf prints OUR</text>
|
||||
<text x="625" y="702" class="txt">string instead!</text>
|
||||
|
||||
<line x1="620" y1="730" x2="1150" y2="730" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="765" class="amb">This is the hack!</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,93 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">The Attack Plan</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Exploit Strategy</text>
|
||||
|
||||
<!-- Full Width: 4-Step Attack Flow -->
|
||||
<rect x="30" y="105" width="1140" height="280" class="pnl" rx="8"/>
|
||||
<text x="600" y="148" text-anchor="middle" class="sub">Attack Flow (4 Steps)</text>
|
||||
<line x1="50" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Step 1 -->
|
||||
<rect x="55" y="185" width="230" height="80" rx="6" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="170" y="220" text-anchor="middle" class="cyn">1. Break at</text>
|
||||
<text x="170" y="250" text-anchor="middle" class="cyn">printf call</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="285" y1="225" x2="330" y2="225" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="330,215 355,225 330,235" fill="#888888"/>
|
||||
|
||||
<!-- Step 2 -->
|
||||
<rect x="360" y="185" width="230" height="80" rx="6" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="475" y="220" text-anchor="middle" class="grn">2. Write new</text>
|
||||
<text x="475" y="250" text-anchor="middle" class="grn">string to SRAM</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="590" y1="225" x2="635" y2="225" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="635,215 660,225 635,235" fill="#888888"/>
|
||||
|
||||
<!-- Step 3 -->
|
||||
<rect x="665" y="185" width="230" height="80" rx="6" fill="#1a1a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="780" y="220" text-anchor="middle" class="amb">3. Set r0 to</text>
|
||||
<text x="780" y="250" text-anchor="middle" class="amb">SRAM addr</text>
|
||||
|
||||
<!-- Arrow -->
|
||||
<line x1="895" y1="225" x2="940" y2="225" stroke="#888888" stroke-width="3"/>
|
||||
<polygon points="940,215 965,225 940,235" fill="#888888"/>
|
||||
|
||||
<!-- Step 4 -->
|
||||
<rect x="970" y="185" width="180" height="80" rx="6" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="1060" y="220" text-anchor="middle" class="red">4. Continue</text>
|
||||
<text x="1060" y="250" text-anchor="middle" class="red">execution</text>
|
||||
|
||||
<text x="600" y="340" text-anchor="middle" class="txt">printf reads r0, prints "hacky, world"!</text>
|
||||
|
||||
<!-- Bottom Left: Normal Flow -->
|
||||
<rect x="30" y="405" width="560" height="375" class="pnl" rx="8"/>
|
||||
<text x="310" y="448" text-anchor="middle" class="sub">Normal Flow</text>
|
||||
<line x1="50" y1="463" x2="570" y2="463" stroke="#1a1a2e"/>
|
||||
|
||||
<rect x="55" y="485" width="500" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="513" class="txt">LDR r0, ="hello"</text>
|
||||
|
||||
<rect x="55" y="537" width="500" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="565" class="txt">BL printf</text>
|
||||
|
||||
<text x="310" y="630" text-anchor="middle" class="grn">Output:</text>
|
||||
<text x="310" y="665" text-anchor="middle" class="txt">"hello, world"</text>
|
||||
|
||||
<text x="310" y="735" text-anchor="middle" class="dim">Prints original string</text>
|
||||
|
||||
<!-- Bottom Right: Hacked Flow -->
|
||||
<rect x="620" y="405" width="550" height="375" class="pnl" rx="8"/>
|
||||
<text x="895" y="448" text-anchor="middle" class="sub">Hacked Flow</text>
|
||||
<line x1="640" y1="463" x2="1150" y2="463" stroke="#1a1a2e"/>
|
||||
|
||||
<rect x="645" y="485" width="500" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="660" y="513" class="txt">LDR r0, ="hello"</text>
|
||||
|
||||
<rect x="645" y="537" width="500" height="42" rx="4" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="660" y="565" class="red">r0 = 0x20040000</text>
|
||||
|
||||
<rect x="645" y="589" width="500" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="660" y="617" class="txt">BL printf</text>
|
||||
|
||||
<text x="895" y="682" text-anchor="middle" class="red">Output:</text>
|
||||
<text x="895" y="717" text-anchor="middle" class="txt">"hacky, world"</text>
|
||||
|
||||
<text x="895" y="755" text-anchor="middle" class="dim">Prints our string</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,80 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Failed vs Real Hack</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Attack Methodology</text>
|
||||
|
||||
<!-- Left Panel: Failed Attempt -->
|
||||
<rect x="30" y="105" width="560" height="675" class="pnl" rx="8"/>
|
||||
<text x="310" y="148" text-anchor="middle" class="sub">Failed Attempt</text>
|
||||
<line x1="50" y1="163" x2="570" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="red">The Bad Idea</text>
|
||||
<text x="55" y="240" class="txt">Set r0 to point</text>
|
||||
<text x="55" y="272" class="txt">at a string literal</text>
|
||||
<text x="55" y="304" class="txt">like "hacky"</text>
|
||||
|
||||
<line x1="50" y1="332" x2="570" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="372" class="amb">Why It Fails</text>
|
||||
<text x="55" y="407" class="txt">r0 only holds a</text>
|
||||
<text x="55" y="439" class="txt">32-bit number</text>
|
||||
<text x="55" y="471" class="txt">Not a string itself!</text>
|
||||
|
||||
<line x1="50" y1="499" x2="570" y2="499" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="539" class="red">set $r0 = "HACK"</text>
|
||||
<text x="55" y="574" class="txt">GDB interprets this</text>
|
||||
<text x="55" y="611" class="txt">as an address value</text>
|
||||
<text x="55" y="643" class="txt">pointing to garbage</text>
|
||||
|
||||
<line x1="50" y1="671" x2="570" y2="671" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="310" y="710" text-anchor="middle" class="red">Result: CRASH</text>
|
||||
<text x="310" y="745" text-anchor="middle" class="dim">or prints garbage</text>
|
||||
|
||||
<!-- Right Panel: Real Hack -->
|
||||
<rect x="620" y="105" width="550" height="675" class="pnl" rx="8"/>
|
||||
<text x="895" y="148" text-anchor="middle" class="sub">Real Hack</text>
|
||||
<line x1="640" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="205" class="grn">The Right Way</text>
|
||||
<text x="645" y="240" class="txt">1. Write string</text>
|
||||
<text x="645" y="272" class="txt"> bytes to SRAM</text>
|
||||
<text x="645" y="304" class="txt">2. Point r0 to</text>
|
||||
<text x="645" y="336" class="txt"> that SRAM addr</text>
|
||||
|
||||
<line x1="640" y1="364" x2="1150" y2="364" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="404" class="cyn">GDB Commands</text>
|
||||
|
||||
<rect x="645" y="425" width="480" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="660" y="453" class="grn">set {char[13]}0x20040000</text>
|
||||
|
||||
<rect x="645" y="477" width="480" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="660" y="505" class="grn"> = "hacky, world"</text>
|
||||
|
||||
<rect x="645" y="539" width="480" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="660" y="567" class="amb">set $r0 = 0x20040000</text>
|
||||
|
||||
<line x1="640" y1="610" x2="1150" y2="610" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="650" class="txt">String exists in</text>
|
||||
<text x="645" y="682" class="txt">writable SRAM</text>
|
||||
<text x="645" y="714" class="txt">r0 points to it</text>
|
||||
|
||||
<text x="895" y="760" text-anchor="middle" class="grn">"hacky, world" printed!</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,83 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Writing to SRAM</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Memory Manipulation</text>
|
||||
|
||||
<!-- Left Panel: Memory View -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">SRAM at 0x20040000</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<!-- Before -->
|
||||
<text x="55" y="205" class="red">Before (empty)</text>
|
||||
|
||||
<rect x="55" y="225" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="253" class="dim">00 00 00 00 00 00 00 00</text>
|
||||
|
||||
<rect x="55" y="277" width="490" height="42" rx="4" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="305" class="dim">00 00 00 00 00 00 00 00</text>
|
||||
|
||||
<!-- After -->
|
||||
<text x="55" y="370" class="grn">After writing</text>
|
||||
|
||||
<rect x="55" y="390" width="490" height="42" rx="4" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="70" y="418" class="grn">68 61 63 6b 79 2c 20 77</text>
|
||||
|
||||
<text x="55" y="470" class="dim">h a c k y , w</text>
|
||||
|
||||
<!-- The GDB command -->
|
||||
<text x="55" y="530" class="amb">GDB Command:</text>
|
||||
|
||||
<rect x="55" y="548" width="490" height="90" rx="5" fill="#0a0a0f" stroke="#ffaa00" stroke-width="2"/>
|
||||
<text x="70" y="580" class="txt">set {char[13]}</text>
|
||||
<text x="70" y="612" class="txt">0x20040000 = "hacky, world"</text>
|
||||
|
||||
<!-- Verify -->
|
||||
<text x="55" y="680" class="cyn">Verify with:</text>
|
||||
<rect x="55" y="698" width="490" height="42" rx="5" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="726" class="txt">x/s 0x20040000</text>
|
||||
|
||||
<!-- Right Panel: Why SRAM -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">Why SRAM?</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="grn">SRAM = writable</text>
|
||||
<text x="625" y="240" class="txt">RAM at 0x20000000</text>
|
||||
<text x="625" y="272" class="txt">We can write any</text>
|
||||
<text x="625" y="304" class="txt">data here via GDB</text>
|
||||
|
||||
<line x1="620" y1="332" x2="1150" y2="332" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="372" class="red">Flash = read-only</text>
|
||||
<text x="625" y="407" class="txt">XIP at 0x10000000</text>
|
||||
<text x="625" y="439" class="txt">Cannot write to it</text>
|
||||
<text x="625" y="471" class="txt">during execution</text>
|
||||
<text x="625" y="503" class="dim">That's why we use RAM</text>
|
||||
|
||||
<line x1="620" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="571" class="amb">Choosing Address</text>
|
||||
<text x="625" y="606" class="txt">0x20040000 is safe</text>
|
||||
<text x="625" y="638" class="txt">Far from stack</text>
|
||||
<text x="625" y="670" class="txt">and heap regions</text>
|
||||
|
||||
<line x1="620" y1="698" x2="1150" y2="698" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="738" class="cyn">Null terminator</text>
|
||||
<text x="625" y="773" class="dim">\0 ends the string</text>
|
||||
</svg>
|
||||
@@ -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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">Register Hijack</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Control Flow Attack</text>
|
||||
|
||||
<!-- Left Panel: Before Hijack -->
|
||||
<rect x="30" y="105" width="540" height="675" class="pnl" rx="8"/>
|
||||
<text x="300" y="148" text-anchor="middle" class="sub">Before Hijack</text>
|
||||
<line x1="50" y1="163" x2="550" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="dim">r0 loaded by LDR:</text>
|
||||
|
||||
<rect x="55" y="225" width="490" height="55" rx="5" fill="#0f0f1a" stroke="#00d4ff" stroke-width="2"/>
|
||||
<text x="70" y="260" class="cyn">r0 = 0x10001234</text>
|
||||
|
||||
<text x="55" y="320" class="dim">Points to flash:</text>
|
||||
|
||||
<rect x="55" y="340" width="490" height="55" rx="5" fill="#0a0a0f" stroke="#1a1a2e"/>
|
||||
<text x="70" y="375" class="txt">"hello, world\r\n"</text>
|
||||
|
||||
<text x="55" y="440" class="dim">printf will read r0</text>
|
||||
<text x="55" y="472" class="dim">and print that string</text>
|
||||
|
||||
<line x1="50" y1="510" x2="550" y2="510" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="555" class="grn">The Hijack Command</text>
|
||||
|
||||
<rect x="55" y="575" width="490" height="55" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="300" y="610" text-anchor="middle" class="red">set $r0 = 0x20040000</text>
|
||||
|
||||
<text x="300" y="680" text-anchor="middle" class="txt">Now r0 points to</text>
|
||||
<text x="300" y="712" text-anchor="middle" class="txt">OUR string in SRAM</text>
|
||||
<text x="300" y="744" text-anchor="middle" class="dim">instead of flash</text>
|
||||
|
||||
<!-- Right Panel: After Hijack -->
|
||||
<rect x="600" y="105" width="570" height="675" class="pnl" rx="8"/>
|
||||
<text x="885" y="148" text-anchor="middle" class="sub">After Hijack</text>
|
||||
<line x1="620" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="205" class="dim">r0 now contains:</text>
|
||||
|
||||
<rect x="625" y="225" width="520" height="55" rx="5" fill="#1a0f0f" stroke="#ff0040" stroke-width="2"/>
|
||||
<text x="640" y="260" class="red">r0 = 0x20040000</text>
|
||||
|
||||
<text x="625" y="320" class="dim">Points to SRAM:</text>
|
||||
|
||||
<rect x="625" y="340" width="520" height="55" rx="5" fill="#0f1a0f" stroke="#00ff41" stroke-width="2"/>
|
||||
<text x="640" y="375" class="grn">"hacky, world"</text>
|
||||
|
||||
<line x1="620" y1="430" x2="1150" y2="430" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="625" y="470" class="amb">Then: continue</text>
|
||||
<text x="625" y="510" class="txt">printf reads r0</text>
|
||||
<text x="625" y="542" class="txt">Follows pointer</text>
|
||||
<text x="625" y="574" class="txt">to 0x20040000</text>
|
||||
<text x="625" y="606" class="txt">Finds "hacky, world"</text>
|
||||
<text x="625" y="638" class="txt">Prints it!</text>
|
||||
|
||||
<line x1="620" y1="678" x2="1150" y2="678" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="885" y="720" text-anchor="middle" class="grn">Output changed</text>
|
||||
<text x="885" y="752" text-anchor="middle" class="grn">without touching code</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,75 @@
|
||||
<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"/>
|
||||
|
||||
<!-- Title -->
|
||||
<text x="600" y="52" text-anchor="middle" class="title">GDB vs Ghidra</text>
|
||||
<text x="600" y="88" text-anchor="middle" class="dim">Static vs Dynamic Analysis</text>
|
||||
|
||||
<!-- Left Panel: GDB -->
|
||||
<rect x="30" y="105" width="560" height="675" class="pnl" rx="8"/>
|
||||
<text x="310" y="148" text-anchor="middle" class="sub">GDB (Dynamic)</text>
|
||||
<line x1="50" y1="163" x2="570" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="205" class="grn">Live analysis</text>
|
||||
<text x="55" y="240" class="txt">Program is running</text>
|
||||
<text x="55" y="272" class="txt">on real hardware</text>
|
||||
|
||||
<line x1="50" y1="300" x2="570" y2="300" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="340" class="cyn">Capabilities</text>
|
||||
<text x="55" y="375" class="txt">Set breakpoints</text>
|
||||
<text x="55" y="407" class="txt">Read/write memory</text>
|
||||
<text x="55" y="439" class="txt">Modify registers</text>
|
||||
<text x="55" y="471" class="txt">Step instructions</text>
|
||||
<text x="55" y="503" class="txt">Watch values change</text>
|
||||
|
||||
<line x1="50" y1="531" x2="570" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="55" y="571" class="amb">Best For</text>
|
||||
<text x="55" y="606" class="txt">Live modification</text>
|
||||
<text x="55" y="638" class="txt">Runtime behavior</text>
|
||||
<text x="55" y="670" class="txt">Testing exploits</text>
|
||||
<text x="55" y="702" class="txt">Verifying attacks</text>
|
||||
|
||||
<text x="310" y="755" text-anchor="middle" class="dim">Needs running target</text>
|
||||
|
||||
<!-- Right Panel: Ghidra -->
|
||||
<rect x="620" y="105" width="550" height="675" class="pnl" rx="8"/>
|
||||
<text x="895" y="148" text-anchor="middle" class="sub">Ghidra (Static)</text>
|
||||
<line x1="640" y1="163" x2="1150" y2="163" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="205" class="red">Offline analysis</text>
|
||||
<text x="645" y="240" class="txt">Just the binary file</text>
|
||||
<text x="645" y="272" class="txt">No hardware needed</text>
|
||||
|
||||
<line x1="640" y1="300" x2="1150" y2="300" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="340" class="cyn">Capabilities</text>
|
||||
<text x="645" y="375" class="txt">Disassembly view</text>
|
||||
<text x="645" y="407" class="txt">Decompile to C</text>
|
||||
<text x="645" y="439" class="txt">Find functions</text>
|
||||
<text x="645" y="471" class="txt">Cross-references</text>
|
||||
<text x="645" y="503" class="txt">String search</text>
|
||||
|
||||
<line x1="640" y1="531" x2="1150" y2="531" stroke="#1a1a2e"/>
|
||||
|
||||
<text x="645" y="571" class="amb">Best For</text>
|
||||
<text x="645" y="606" class="txt">Planning attacks</text>
|
||||
<text x="645" y="638" class="txt">Understanding code</text>
|
||||
<text x="645" y="670" class="txt">Finding targets</text>
|
||||
<text x="645" y="702" class="txt">Mapping functions</text>
|
||||
|
||||
<text x="895" y="755" text-anchor="middle" class="dim">Works with just ELF</text>
|
||||
</svg>
|
||||
@@ -0,0 +1,9 @@
|
||||
build/CMakeFiles/
|
||||
build/pico_sdk/
|
||||
build/pico-sdk/
|
||||
build/generated/
|
||||
build/_deps/
|
||||
build/*.o
|
||||
build/*.d
|
||||
build/*.obj
|
||||
!.vscode/*
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/**"
|
||||
],
|
||||
"forcedInclude": [
|
||||
"${userHome}/.pico-sdk/sdk/2.2.0/src/common/pico_base_headers/include/pico.h",
|
||||
"${workspaceFolder}/build/generated/pico_base/pico/config_autogen.h"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "${userHome}/.pico-sdk/toolchain/14_2_Rel1/bin/arm-none-eabi-gcc.exe",
|
||||
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "linux-gcc-arm"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"name": "Pico",
|
||||
"compilers": {
|
||||
"C": "${command:raspberry-pi-pico.getCompilerPath}",
|
||||
"CXX": "${command:raspberry-pi-pico.getCxxCompilerPath}"
|
||||
},
|
||||
"environmentVariables": {
|
||||
"PATH": "${command:raspberry-pi-pico.getEnvPath};${env:PATH}"
|
||||
},
|
||||
"cmakeSettings": {
|
||||
"Python3_EXECUTABLE": "${command:raspberry-pi-pico.getPythonPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"marus25.cortex-debug",
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-vscode.vscode-serial-monitor",
|
||||
"raspberry-pi.raspberry-pi-pico"
|
||||
]
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug)",
|
||||
"cwd": "${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"serverpath": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"configFiles": [
|
||||
"interface/cmsis-dap.cfg",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg"
|
||||
],
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
],
|
||||
"openOCDLaunchCommands": [
|
||||
"adapter speed 5000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "external",
|
||||
"gdbTarget": "localhost:3333",
|
||||
"gdbPath": "${command:raspberry-pi-pico.getGDBPath}",
|
||||
"device": "${command:raspberry-pi-pico.getChipUppercase}",
|
||||
"svdFile": "${userHome}/.pico-sdk/sdk/2.2.0/src/${command:raspberry-pi-pico.getChip}/hardware_regs/${command:raspberry-pi-pico.getChipUppercase}.svd",
|
||||
"runToEntryPoint": "main",
|
||||
// Fix for no_flash binaries, where monitor reset halt doesn't do what is expected
|
||||
// Also works fine for flash binaries
|
||||
"overrideLaunchCommands": [
|
||||
"monitor reset init",
|
||||
"load \"${command:raspberry-pi-pico.launchTargetPath}\""
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"cmake.showSystemKits": false,
|
||||
"cmake.options.statusBarVisibility": "hidden",
|
||||
"cmake.options.advanced": {
|
||||
"build": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"launch": {
|
||||
"statusBarVisibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"statusBarVisibility": "hidden"
|
||||
}
|
||||
},
|
||||
"cmake.configureOnEdit": false,
|
||||
"cmake.automaticReconfigure": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"cmake.generator": "Ninja",
|
||||
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"C_Cpp.debugShortcut": false,
|
||||
"terminal.integrated.env.windows": {
|
||||
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"Path": "${env:USERPROFILE}/.pico-sdk/toolchain/14_2_Rel1/bin;${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool;${env:USERPROFILE}/.pico-sdk/cmake/v3.31.5/bin;${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1;${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"terminal.integrated.env.linux": {
|
||||
"PICO_SDK_PATH": "${env:HOME}/.pico-sdk/sdk/2.2.0",
|
||||
"PICO_TOOLCHAIN_PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1",
|
||||
"PATH": "${env:HOME}/.pico-sdk/toolchain/14_2_Rel1/bin:${env:HOME}/.pico-sdk/picotool/2.2.0/picotool:${env:HOME}/.pico-sdk/cmake/v3.31.5/bin:${env:HOME}/.pico-sdk/ninja/v1.12.1:${env:PATH}"
|
||||
},
|
||||
"raspberry-pi-pico.cmakeAutoConfigure": true,
|
||||
"raspberry-pi-pico.useCmakeTools": false,
|
||||
"raspberry-pi-pico.cmakePath": "${HOME}/.pico-sdk/cmake/v3.31.5/bin/cmake",
|
||||
"raspberry-pi-pico.ninjaPath": "${HOME}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"files.associations": {
|
||||
"stdlib.h": "c"
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Compile Project",
|
||||
"type": "process",
|
||||
"isBuildCommand": true,
|
||||
"command": "${userHome}/.pico-sdk/ninja/v1.12.1/ninja",
|
||||
"args": ["-C", "${workspaceFolder}/build"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": "$gcc",
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/ninja/v1.12.1/ninja.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Run Project",
|
||||
"type": "process",
|
||||
"command": "${env:HOME}/.pico-sdk/picotool/2.2.0/picotool/picotool",
|
||||
"args": [
|
||||
"load",
|
||||
"${command:raspberry-pi-pico.launchTargetPath}",
|
||||
"-fx"
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/picotool/2.2.0/picotool/picotool.exe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getTarget}.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; program \"${command:raspberry-pi-pico.launchTargetPath}\" verify reset exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Rescue Reset",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/${command:raspberry-pi-pico.getChip}-rescue.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; reset halt; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Risc-V Reset (RP2350)",
|
||||
"type": "process",
|
||||
"command": "${userHome}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
"args": [
|
||||
"-s",
|
||||
"${userHome}/.pico-sdk/openocd/0.12.0+dev/scripts",
|
||||
"-c",
|
||||
"set USE_CORE { rv0 rv1 cm0 cm1 }",
|
||||
"-f",
|
||||
"interface/cmsis-dap.cfg",
|
||||
"-f",
|
||||
"target/rp2350.cfg",
|
||||
"-c",
|
||||
"adapter speed 5000; init;",
|
||||
"-c",
|
||||
"write_memory 0x40120158 8 { 0x3 }; echo [format \"Info : ARCHSEL 0x%02x\" [read_memory 0x40120158 8 1]];",
|
||||
"-c",
|
||||
"reset halt; targets rp2350.rv0; echo [format \"Info : ARCHSEL_STATUS 0x%02x\" [read_memory 0x4012015C 8 1]]; exit"
|
||||
],
|
||||
"problemMatcher": [],
|
||||
"windows": {
|
||||
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main(void) {
|
||||
stdio_init_all();
|
||||
|
||||
while (true)
|
||||
printf("hello, world\r\n");
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# Generated Cmake Pico project file
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Initialise pico_sdk from installed location
|
||||
# (note this can come from environment, CMake cache etc)
|
||||
|
||||
# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==
|
||||
if(WIN32)
|
||||
set(USERHOME $ENV{USERPROFILE})
|
||||
else()
|
||||
set(USERHOME $ENV{HOME})
|
||||
endif()
|
||||
set(sdkVersion 2.2.0)
|
||||
set(toolchainVersion 14_2_Rel1)
|
||||
set(picotoolVersion 2.2.0)
|
||||
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
|
||||
if (EXISTS ${picoVscode})
|
||||
include(${picoVscode})
|
||||
endif()
|
||||
# ====================================================================================
|
||||
set(PICO_BOARD pico2 CACHE STRING "Board type")
|
||||
|
||||
# Pull in Raspberry Pi Pico SDK (must be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(0x0001_hello-world C CXX ASM)
|
||||
|
||||
# Initialise the Raspberry Pi Pico SDK
|
||||
pico_sdk_init()
|
||||
|
||||
# Add executable. Default name is the project name, version 0.1
|
||||
|
||||
add_executable(0x0001_hello-world 0x0001_hello-world.c )
|
||||
|
||||
pico_set_program_name(0x0001_hello-world "0x0001_hello-world")
|
||||
pico_set_program_version(0x0001_hello-world "0.1")
|
||||
|
||||
# Modify the below lines to enable/disable output over UART/USB
|
||||
pico_enable_stdio_uart(0x0001_hello-world 1)
|
||||
pico_enable_stdio_usb(0x0001_hello-world 0)
|
||||
|
||||
# Add the standard library to the build
|
||||
target_link_libraries(0x0001_hello-world
|
||||
pico_stdlib)
|
||||
|
||||
# Add the standard include files to the build
|
||||
target_include_directories(0x0001_hello-world PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(0x0001_hello-world)
|
||||
|
||||
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Loaded 100 of 741 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user