mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-28 16:25:33 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97639138a1 | |||
| dd26e3528b | |||
| 74ec86da8f | |||
| cc463a34be | |||
| 355be5cde3 | |||
| 1bbb892fcc |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "user-apps/doom/doomgeneric"]
|
|
||||||
path = user-apps/doom/doomgeneric
|
|
||||||
url = https://github.com/ozkl/doomgeneric
|
|
||||||
179
Cargo.lock
generated
179
Cargo.lock
generated
@@ -19,6 +19,7 @@ dependencies = [
|
|||||||
"abi_sys",
|
"abi_sys",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
|
"main_proc_macro",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.3",
|
||||||
]
|
]
|
||||||
@@ -133,26 +134,6 @@ version = "0.13.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bindgen"
|
|
||||||
version = "0.71.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.9.4",
|
|
||||||
"cexpr",
|
|
||||||
"clang-sys",
|
|
||||||
"itertools 0.10.5",
|
|
||||||
"log",
|
|
||||||
"prettyplease",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"regex",
|
|
||||||
"rustc-hash",
|
|
||||||
"shlex",
|
|
||||||
"syn 2.0.104",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-set"
|
name = "bit-set"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
@@ -295,42 +276,12 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.2.43"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2"
|
|
||||||
dependencies = [
|
|
||||||
"find-msvc-tools",
|
|
||||||
"shlex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cexpr"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
||||||
dependencies = [
|
|
||||||
"nom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clang-sys"
|
|
||||||
version = "1.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
||||||
dependencies = [
|
|
||||||
"glob",
|
|
||||||
"libc",
|
|
||||||
"libloading",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.2.25"
|
version = "3.2.25"
|
||||||
@@ -400,7 +351,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -497,7 +448,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim 0.11.1",
|
"strsim 0.11.1",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -508,7 +459,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -546,7 +497,7 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -614,16 +565,6 @@ dependencies = [
|
|||||||
"litrs",
|
"litrs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "doom"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"abi",
|
|
||||||
"bindgen",
|
|
||||||
"cc",
|
|
||||||
"embedded-graphics",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
@@ -705,7 +646,7 @@ dependencies = [
|
|||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1079,7 +1020,7 @@ checksum = "4f6e621fe4c7e05b695274b722dc0a60bacd1c8696b58191baa0154713d52400"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1167,12 +1108,6 @@ version = "2.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "find-msvc-tools"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixed"
|
name = "fixed"
|
||||||
version = "1.29.0"
|
version = "1.29.0"
|
||||||
@@ -1278,7 +1213,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1358,12 +1293,6 @@ dependencies = [
|
|||||||
"tinygif",
|
"tinygif",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glob"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "goblin"
|
name = "goblin"
|
||||||
version = "0.10.2"
|
version = "0.10.2"
|
||||||
@@ -1676,16 +1605,6 @@ version = "0.2.174"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libloading"
|
|
||||||
version = "0.8.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"windows-link",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@@ -1730,6 +1649,14 @@ version = "0.4.27"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "main_proc_macro"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.108",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.5"
|
version = "2.7.5"
|
||||||
@@ -1742,12 +1669,6 @@ version = "2.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815"
|
checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "minimal-lexical"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
@@ -1769,16 +1690,6 @@ version = "1.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nom"
|
|
||||||
version = "7.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
"minimal-lexical",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.19"
|
||||||
@@ -1826,7 +1737,7 @@ checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2018,7 +1929,7 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2042,16 +1953,6 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "prettyplease"
|
|
||||||
version = "0.2.36"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"syn 2.0.104",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error"
|
name = "proc-macro-error"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -2095,7 +1996,7 @@ dependencies = [
|
|||||||
"proc-macro-error-attr2",
|
"proc-macro-error-attr2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2109,9 +2010,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.40"
|
version = "1.0.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -2244,12 +2145,6 @@ dependencies = [
|
|||||||
"crc-any",
|
"crc-any",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc-hash"
|
|
||||||
version = "2.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@@ -2347,7 +2242,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2379,12 +2274,6 @@ dependencies = [
|
|||||||
"keccak",
|
"keccak",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shlex"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@@ -2520,7 +2409,7 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2549,9 +2438,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.104"
|
version = "2.0.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2648,7 +2537,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2659,7 +2548,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2727,7 +2616,7 @@ dependencies = [
|
|||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2886,7 +2775,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2908,7 +2797,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@@ -2953,12 +2842,6 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-link"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.59.0"
|
version = "0.59.0"
|
||||||
@@ -3064,5 +2947,5 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ members = [
|
|||||||
"user-apps/snake",
|
"user-apps/snake",
|
||||||
"user-apps/gallery",
|
"user-apps/gallery",
|
||||||
"user-apps/gif",
|
"user-apps/gif",
|
||||||
"user-apps/doom",
|
"main_proc_macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embedded-sdmmc = { version = "0.9.0", default-features = false }
|
|
||||||
embedded-graphics = "0.8.1"
|
|
||||||
abi_sys = { path = "../abi_sys" }
|
abi_sys = { path = "../abi_sys" }
|
||||||
|
main_proc_macro = { path = "../main_proc_macro" }
|
||||||
|
embedded-sdmmc = { version = "0.9", default-features = false }
|
||||||
|
embedded-graphics = "0.8.1"
|
||||||
once_cell = { version = "1", default-features = false }
|
once_cell = { version = "1", default-features = false }
|
||||||
rand_core = "0.9.3"
|
rand_core = "0.9.3"
|
||||||
|
|||||||
@@ -5,10 +5,20 @@ extern crate alloc;
|
|||||||
|
|
||||||
pub use abi_sys::{self, keyboard};
|
pub use abi_sys::{self, keyboard};
|
||||||
use abi_sys::{RngRequest, alloc, dealloc, keyboard::KeyEvent};
|
use abi_sys::{RngRequest, alloc, dealloc, keyboard::KeyEvent};
|
||||||
pub use alloc::format;
|
use alloc::format;
|
||||||
use core::alloc::{GlobalAlloc, Layout};
|
use core::{
|
||||||
|
alloc::{GlobalAlloc, Layout},
|
||||||
|
panic::PanicInfo,
|
||||||
|
};
|
||||||
|
pub use main_proc_macro::main;
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
|
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
|
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: Alloc = Alloc;
|
static ALLOC: Alloc = Alloc;
|
||||||
|
|
||||||
@@ -27,7 +37,7 @@ unsafe impl GlobalAlloc for Alloc {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
let s = $crate::format!($($arg)*);
|
let s = format!($($arg)*);
|
||||||
$crate::abi_sys::print(s.as_ptr(), s.len());
|
$crate::abi_sys::print(s.as_ptr(), s.len());
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|||||||
1
justfile
1
justfile
@@ -17,4 +17,3 @@ userapps: cbindgen
|
|||||||
just userapp snake
|
just userapp snake
|
||||||
just userapp gallery
|
just userapp gallery
|
||||||
just userapp gif
|
just userapp gif
|
||||||
just userapp doom
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pub async fn display_handler(mut display: DISPLAY) {
|
|||||||
FRAMEBUFFER
|
FRAMEBUFFER
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.safe_draw(&mut display)
|
.partial_draw(&mut display)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use crate::display::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
use crate::display::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||||
use core::sync::atomic::{AtomicBool, Ordering};
|
use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
use embassy_sync::lazy_lock::LazyLock;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
draw_target::DrawTarget,
|
draw_target::DrawTarget,
|
||||||
pixelcolor::{
|
pixelcolor::{
|
||||||
@@ -14,32 +13,33 @@ use embedded_hal_2::digital::OutputPin;
|
|||||||
use embedded_hal_async::{delay::DelayNs, spi::SpiDevice};
|
use embedded_hal_async::{delay::DelayNs, spi::SpiDevice};
|
||||||
use st7365p_lcd::ST7365P;
|
use st7365p_lcd::ST7365P;
|
||||||
|
|
||||||
pub const TILE_SIZE: usize = 16; // 16x16 tile
|
const TILE_SIZE: usize = 16; // 16x16 tile
|
||||||
pub const TILE_COUNT: usize = (SCREEN_WIDTH / TILE_SIZE) * (SCREEN_HEIGHT / TILE_SIZE); // 400 tiles
|
const TILE_COUNT: usize = (SCREEN_WIDTH / TILE_SIZE) * (SCREEN_HEIGHT / TILE_SIZE); // 400 tiles
|
||||||
|
const NUM_TILE_ROWS: usize = SCREEN_WIDTH / TILE_SIZE;
|
||||||
|
const NUM_TILE_COLS: usize = SCREEN_WIDTH / TILE_SIZE;
|
||||||
|
|
||||||
// Group of tiles for batching
|
const MAX_BATCH_TILES: usize = (SCREEN_WIDTH / TILE_SIZE) * 2;
|
||||||
pub const MAX_META_TILES: usize = (SCREEN_WIDTH / TILE_SIZE) * 2; // max number of meta tiles in buffer
|
type BatchTileBuf = [u16; MAX_BATCH_TILES * TILE_SIZE * TILE_SIZE];
|
||||||
type MetaTileVec = heapless::Vec<Rectangle, { TILE_COUNT / MAX_META_TILES }>;
|
|
||||||
|
|
||||||
pub const SIZE: usize = SCREEN_HEIGHT * SCREEN_WIDTH;
|
pub const SIZE: usize = SCREEN_HEIGHT * SCREEN_WIDTH;
|
||||||
|
|
||||||
pub static FB_PAUSED: AtomicBool = AtomicBool::new(false);
|
pub static FB_PAUSED: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
static mut DIRTY_TILES: LazyLock<heapless::Vec<AtomicBool, TILE_COUNT>> = LazyLock::new(|| {
|
|
||||||
let mut tiles = heapless::Vec::new();
|
|
||||||
for _ in 0..TILE_COUNT {
|
|
||||||
tiles.push(AtomicBool::new(true)).unwrap();
|
|
||||||
}
|
|
||||||
tiles
|
|
||||||
});
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct AtomicFrameBuffer<'a>(&'a mut [u16]);
|
pub struct AtomicFrameBuffer<'a> {
|
||||||
|
fb: &'a mut [u16],
|
||||||
|
dirty_tiles: [AtomicBool; TILE_COUNT],
|
||||||
|
batch_tile_buf: BatchTileBuf,
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> AtomicFrameBuffer<'a> {
|
impl<'a> AtomicFrameBuffer<'a> {
|
||||||
pub fn new(buffer: &'a mut [u16]) -> Self {
|
pub fn new(buffer: &'a mut [u16]) -> Self {
|
||||||
assert!(buffer.len() == SIZE);
|
assert!(buffer.len() == SIZE);
|
||||||
Self(buffer)
|
Self {
|
||||||
|
fb: buffer,
|
||||||
|
dirty_tiles: core::array::from_fn(|_| AtomicBool::new(true)),
|
||||||
|
batch_tile_buf: [0; MAX_BATCH_TILES * TILE_SIZE * TILE_SIZE],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mark_tiles_dirty(&mut self, rect: Rectangle) {
|
fn mark_tiles_dirty(&mut self, rect: Rectangle) {
|
||||||
@@ -52,7 +52,7 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
for ty in start_ty..=end_ty {
|
for ty in start_ty..=end_ty {
|
||||||
for tx in start_tx..=end_tx {
|
for tx in start_tx..=end_tx {
|
||||||
let tile_idx = ty * tiles_x + tx;
|
let tile_idx = ty * tiles_x + tx;
|
||||||
unsafe { DIRTY_TILES.get_mut()[tile_idx].store(true, Ordering::Release) };
|
self.dirty_tiles[tile_idx].store(true, Ordering::Release);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
for y in sy..=ey {
|
for y in sy..=ey {
|
||||||
for x in sx..=ex {
|
for x in sx..=ex {
|
||||||
if let Some(color) = color_iter.next() {
|
if let Some(color) = color_iter.next() {
|
||||||
self.0[(y as usize * SCREEN_WIDTH) + x as usize] = color;
|
self.fb[(y as usize * SCREEN_WIDTH) + x as usize] = color;
|
||||||
} else {
|
} else {
|
||||||
return Err(()); // Not enough data
|
return Err(()); // Not enough data
|
||||||
}
|
}
|
||||||
@@ -93,60 +93,17 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk the dirty tiles and mark groups of tiles(meta-tiles) for batched updates
|
// Checks if a full draw would be faster than individual tile batches
|
||||||
fn find_meta_tiles(&mut self, tiles_x: usize, tiles_y: usize) -> MetaTileVec {
|
fn should_full_draw(&self) -> bool {
|
||||||
let mut meta_tiles: MetaTileVec = heapless::Vec::new();
|
let threshold_pixels = SIZE * 80 / 100;
|
||||||
|
let mut dirty_pixels = 0;
|
||||||
|
|
||||||
for ty in 0..tiles_y {
|
self.dirty_tiles.iter().any(|tile| {
|
||||||
let mut tx = 0;
|
if tile.load(Ordering::Acquire) {
|
||||||
while tx < tiles_x {
|
dirty_pixels += TILE_SIZE * TILE_SIZE;
|
||||||
let idx = ty * tiles_x + tx;
|
|
||||||
if !unsafe { DIRTY_TILES.get()[idx].load(Ordering::Acquire) } {
|
|
||||||
tx += 1;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
dirty_pixels >= threshold_pixels
|
||||||
// Start meta-tile at this tile
|
})
|
||||||
let mut width_tiles = 1;
|
|
||||||
let height_tiles = 1;
|
|
||||||
|
|
||||||
// Grow horizontally, but keep under MAX_TILES_PER_METATILE
|
|
||||||
while tx + width_tiles < tiles_x
|
|
||||||
&& unsafe {
|
|
||||||
DIRTY_TILES.get()[ty * tiles_x + tx + width_tiles].load(Ordering::Acquire)
|
|
||||||
}
|
|
||||||
&& (width_tiles + height_tiles) <= MAX_META_TILES
|
|
||||||
{
|
|
||||||
width_tiles += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: for simplicity, skipped vertical growth
|
|
||||||
|
|
||||||
for x_off in 0..width_tiles {
|
|
||||||
unsafe {
|
|
||||||
DIRTY_TILES.get()[ty * tiles_x + tx + x_off]
|
|
||||||
.store(false, Ordering::Release);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// new meta-tile pos
|
|
||||||
let rect = Rectangle::new(
|
|
||||||
Point::new((tx * TILE_SIZE) as i32, (ty * TILE_SIZE) as i32),
|
|
||||||
Size::new(
|
|
||||||
(width_tiles * TILE_SIZE) as u32,
|
|
||||||
(height_tiles * TILE_SIZE) as u32,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if meta_tiles.push(rect).is_err() {
|
|
||||||
return meta_tiles;
|
|
||||||
};
|
|
||||||
|
|
||||||
tx += width_tiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_tiles
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends the entire framebuffer to the display
|
/// Sends the entire framebuffer to the display
|
||||||
@@ -165,71 +122,40 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
0,
|
0,
|
||||||
self.size().width as u16 - 1,
|
self.size().width as u16 - 1,
|
||||||
self.size().height as u16 - 1,
|
self.size().height as u16 - 1,
|
||||||
&self.0[..],
|
&self.fb[..],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
unsafe {
|
for tile in self.dirty_tiles.iter() {
|
||||||
for tile in DIRTY_TILES.get_mut().iter() {
|
|
||||||
tile.store(false, Ordering::Release);
|
tile.store(false, Ordering::Release);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn safe_draw<SPI, DC, RST, DELAY>(
|
// copy N tiles horizontally to the right into batch tile buf
|
||||||
|
fn append_tiles_to_batch(
|
||||||
&mut self,
|
&mut self,
|
||||||
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
tile_x: u16,
|
||||||
) -> Result<(), ()>
|
tile_y: u16,
|
||||||
where
|
total_tiles: u16, // number of tiles being written to buf
|
||||||
SPI: SpiDevice,
|
) {
|
||||||
DC: OutputPin,
|
debug_assert!(total_tiles as usize <= NUM_TILE_COLS);
|
||||||
RST: OutputPin,
|
for batch_row_num in 0..TILE_SIZE {
|
||||||
DELAY: DelayNs,
|
let batch_row_offset = batch_row_num * total_tiles as usize * TILE_SIZE;
|
||||||
{
|
let batch_row = &mut self.batch_tile_buf
|
||||||
let tiles_x = SCREEN_WIDTH / TILE_SIZE;
|
[batch_row_offset..batch_row_offset + (total_tiles as usize * TILE_SIZE)];
|
||||||
let _tiles_y = SCREEN_HEIGHT / TILE_SIZE;
|
|
||||||
|
|
||||||
let tiles = unsafe { DIRTY_TILES.get_mut() };
|
let fb_row_offset = (tile_y as usize * TILE_SIZE + batch_row_num) * SCREEN_WIDTH
|
||||||
let mut pixel_buffer: heapless::Vec<u16, { TILE_SIZE * TILE_SIZE }> = heapless::Vec::new();
|
+ tile_x as usize * TILE_SIZE;
|
||||||
|
let fb_row =
|
||||||
|
&self.fb[fb_row_offset..fb_row_offset + (total_tiles as usize * TILE_SIZE)];
|
||||||
|
|
||||||
for tile_idx in 0..TILE_COUNT {
|
batch_row.copy_from_slice(fb_row);
|
||||||
if tiles[tile_idx].swap(false, Ordering::AcqRel) {
|
|
||||||
let tx = tile_idx % tiles_x;
|
|
||||||
let ty = tile_idx / tiles_x;
|
|
||||||
|
|
||||||
let x_start = tx * TILE_SIZE;
|
|
||||||
let y_start = ty * TILE_SIZE;
|
|
||||||
|
|
||||||
let x_end = (x_start + TILE_SIZE).min(SCREEN_WIDTH);
|
|
||||||
let y_end = (y_start + TILE_SIZE).min(SCREEN_HEIGHT);
|
|
||||||
|
|
||||||
pixel_buffer.clear();
|
|
||||||
|
|
||||||
for y in y_start..y_end {
|
|
||||||
let start = y * SCREEN_WIDTH + x_start;
|
|
||||||
let end = y * SCREEN_WIDTH + x_end;
|
|
||||||
pixel_buffer.extend_from_slice(&self.0[start..end]).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
display
|
|
||||||
.set_pixels_buffered(
|
|
||||||
x_start as u16,
|
|
||||||
y_start as u16,
|
|
||||||
(x_end - 1) as u16,
|
|
||||||
(y_end - 1) as u16,
|
|
||||||
&pixel_buffer,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
// Pushes tiles to the display in batches to avoid full frame pushes (unless needed)
|
||||||
}
|
|
||||||
|
|
||||||
/// Sends only dirty tiles (16x16px) in batches to the display
|
|
||||||
pub async fn partial_draw<SPI, DC, RST, DELAY>(
|
pub async fn partial_draw<SPI, DC, RST, DELAY>(
|
||||||
&mut self,
|
&mut self,
|
||||||
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
||||||
@@ -240,55 +166,53 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
RST: OutputPin,
|
RST: OutputPin,
|
||||||
DELAY: DelayNs,
|
DELAY: DelayNs,
|
||||||
{
|
{
|
||||||
if unsafe { DIRTY_TILES.get().iter().any(|p| p.load(Ordering::Acquire)) } {
|
if self.should_full_draw() {
|
||||||
let tiles_x = (SCREEN_WIDTH + TILE_SIZE - 1) / TILE_SIZE;
|
return self.draw(display).await;
|
||||||
let tiles_y = (SCREEN_HEIGHT + TILE_SIZE - 1) / TILE_SIZE;
|
|
||||||
|
|
||||||
let meta_tiles = self.find_meta_tiles(tiles_x, tiles_y);
|
|
||||||
|
|
||||||
// buffer for copying meta tiles before sending to display
|
|
||||||
let mut pixel_buffer: heapless::Vec<u16, { MAX_META_TILES * TILE_SIZE * TILE_SIZE }> =
|
|
||||||
heapless::Vec::new();
|
|
||||||
|
|
||||||
for rect in meta_tiles {
|
|
||||||
let rect_width = rect.size.width as usize;
|
|
||||||
let rect_height = rect.size.height as usize;
|
|
||||||
let rect_x = rect.top_left.x as usize;
|
|
||||||
let rect_y = rect.top_left.y as usize;
|
|
||||||
|
|
||||||
pixel_buffer.clear();
|
|
||||||
|
|
||||||
for row in 0..rect_height {
|
|
||||||
let y = rect_y + row;
|
|
||||||
let start = y * SCREEN_WIDTH + rect_x;
|
|
||||||
let end = start + rect_width;
|
|
||||||
|
|
||||||
// Safe: we guarantee buffer will not exceed MAX_META_TILE_PIXELS
|
|
||||||
pixel_buffer.extend_from_slice(&self.0[start..end]).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for tile_row in 0..NUM_TILE_ROWS {
|
||||||
|
let row_start_idx = tile_row * NUM_TILE_COLS;
|
||||||
|
let mut col = 0;
|
||||||
|
|
||||||
|
while col < NUM_TILE_COLS {
|
||||||
|
// Check for dirty tile
|
||||||
|
if self.dirty_tiles[row_start_idx + col].swap(false, Ordering::Acquire) {
|
||||||
|
let run_start = col;
|
||||||
|
let mut run_len = 1;
|
||||||
|
|
||||||
|
// Extend run while contiguous dirty tiles and within MAX_BATCH_TILES
|
||||||
|
while col + 1 < NUM_TILE_COLS
|
||||||
|
&& self.dirty_tiles[row_start_idx + col + 1].load(Ordering::Acquire)
|
||||||
|
&& run_len < MAX_BATCH_TILES
|
||||||
|
{
|
||||||
|
col += 1;
|
||||||
|
run_len += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the whole horizontal run into the batch buffer in one call
|
||||||
|
let tile_x = run_start;
|
||||||
|
let tile_y = tile_row;
|
||||||
|
self.append_tiles_to_batch(tile_x as u16, tile_y as u16, run_len as u16);
|
||||||
|
|
||||||
|
// Compute coordinates for display write
|
||||||
|
let start_x = tile_x * TILE_SIZE;
|
||||||
|
let end_x = start_x + run_len * TILE_SIZE - 1;
|
||||||
|
let start_y = tile_y * TILE_SIZE;
|
||||||
|
let end_y = start_y + TILE_SIZE - 1;
|
||||||
|
|
||||||
|
// Send batch to display
|
||||||
display
|
display
|
||||||
.set_pixels_buffered(
|
.set_pixels_buffered(
|
||||||
rect_x as u16,
|
start_x as u16,
|
||||||
rect_y as u16,
|
start_y as u16,
|
||||||
(rect_x + rect_width - 1) as u16,
|
end_x as u16,
|
||||||
(rect_y + rect_height - 1) as u16,
|
end_y as u16,
|
||||||
&pixel_buffer,
|
&self.batch_tile_buf[..run_len * TILE_SIZE * TILE_SIZE],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// walk the meta-tile and set as clean
|
|
||||||
let start_tx = rect_x / TILE_SIZE;
|
|
||||||
let start_ty = rect_y / TILE_SIZE;
|
|
||||||
let end_tx = (rect_x + rect_width - 1) / TILE_SIZE;
|
|
||||||
let end_ty = (rect_y + rect_height - 1) / TILE_SIZE;
|
|
||||||
|
|
||||||
for ty in start_ty..=end_ty {
|
|
||||||
for tx in start_tx..=end_tx {
|
|
||||||
let tile_idx = ty * tiles_x + tx;
|
|
||||||
unsafe { DIRTY_TILES.get_mut()[tile_idx].store(false, Ordering::Release) };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
col += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,14 +233,14 @@ impl<'a> DrawTarget for AtomicFrameBuffer<'a> {
|
|||||||
|
|
||||||
for Pixel(coord, color) in pixels {
|
for Pixel(coord, color) in pixels {
|
||||||
if coord.x >= 0 && coord.y >= 0 {
|
if coord.x >= 0 && coord.y >= 0 {
|
||||||
let x = coord.x as i32;
|
let x = coord.x;
|
||||||
let y = coord.y as i32;
|
let y = coord.y;
|
||||||
|
|
||||||
if (x as usize) < SCREEN_WIDTH && (y as usize) < SCREEN_HEIGHT {
|
if (x as usize) < SCREEN_WIDTH && (y as usize) < SCREEN_HEIGHT {
|
||||||
let idx = (y as usize) * SCREEN_WIDTH + (x as usize);
|
let idx = (y as usize) * SCREEN_WIDTH + (x as usize);
|
||||||
let raw_color = RawU16::from(color).into_inner();
|
let raw_color = RawU16::from(color).into_inner();
|
||||||
if self.0[idx] != raw_color {
|
if self.fb[idx] != raw_color {
|
||||||
self.0[idx] = raw_color;
|
self.fb[idx] = raw_color;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,8 +289,8 @@ impl<'a> DrawTarget for AtomicFrameBuffer<'a> {
|
|||||||
if let Some(color) = colors.next() {
|
if let Some(color) = colors.next() {
|
||||||
let idx = (p.y as usize * SCREEN_WIDTH) + (p.x as usize);
|
let idx = (p.y as usize * SCREEN_WIDTH) + (p.x as usize);
|
||||||
let raw_color = RawU16::from(color).into_inner();
|
let raw_color = RawU16::from(color).into_inner();
|
||||||
if self.0[idx] != raw_color {
|
if self.fb[idx] != raw_color {
|
||||||
self.0[idx] = raw_color;
|
self.fb[idx] = raw_color;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -404,7 +328,7 @@ impl<'a> DrawTarget for AtomicFrameBuffer<'a> {
|
|||||||
.take((self.size().width * self.size().height) as usize),
|
.take((self.size().width * self.size().height) as usize),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
for tile in unsafe { DIRTY_TILES.get_mut() }.iter() {
|
for tile in self.dirty_tiles.iter() {
|
||||||
tile.store(true, Ordering::Release);
|
tile.store(true, Ordering::Release);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ mod abi;
|
|||||||
mod display;
|
mod display;
|
||||||
mod elf;
|
mod elf;
|
||||||
mod framebuffer;
|
mod framebuffer;
|
||||||
|
#[allow(unused)]
|
||||||
mod heap;
|
mod heap;
|
||||||
mod peripherals;
|
mod peripherals;
|
||||||
|
#[allow(unused)]
|
||||||
mod psram;
|
mod psram;
|
||||||
mod scsi;
|
mod scsi;
|
||||||
mod storage;
|
mod storage;
|
||||||
@@ -225,6 +227,7 @@ struct Sd {
|
|||||||
cs: Peri<'static, PIN_17>,
|
cs: Peri<'static, PIN_17>,
|
||||||
det: Peri<'static, PIN_22>,
|
det: Peri<'static, PIN_22>,
|
||||||
}
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
struct Psram {
|
struct Psram {
|
||||||
pio: Peri<'static, PIO0>,
|
pio: Peri<'static, PIO0>,
|
||||||
sclk: Peri<'static, PIN_21>,
|
sclk: Peri<'static, PIN_21>,
|
||||||
@@ -318,7 +321,7 @@ async fn kernel_task(
|
|||||||
watchdog: Peri<'static, WATCHDOG>,
|
watchdog: Peri<'static, WATCHDOG>,
|
||||||
display: Display,
|
display: Display,
|
||||||
sd: Sd,
|
sd: Sd,
|
||||||
psram: Psram,
|
_psram: Psram,
|
||||||
mcu: Mcu,
|
mcu: Mcu,
|
||||||
usb: Peri<'static, USB>,
|
usb: Peri<'static, USB>,
|
||||||
) {
|
) {
|
||||||
@@ -328,10 +331,14 @@ async fn kernel_task(
|
|||||||
|
|
||||||
setup_mcu(mcu).await;
|
setup_mcu(mcu).await;
|
||||||
|
|
||||||
|
defmt::info!("setting up psram");
|
||||||
|
Timer::after_millis(100).await;
|
||||||
|
|
||||||
// setup_psram(psram).await;
|
// setup_psram(psram).await;
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "pimoroni2w")]
|
||||||
setup_qmi_psram().await;
|
setup_qmi_psram().await;
|
||||||
|
|
||||||
|
Timer::after_millis(100).await;
|
||||||
setup_display(display, spawner).await;
|
setup_display(display, spawner).await;
|
||||||
setup_sd(sd).await;
|
setup_sd(sd).await;
|
||||||
|
|
||||||
|
|||||||
@@ -549,13 +549,13 @@ pub fn init_psram_qmi(
|
|||||||
let min_deselect: u32 = ((18 * 1_000_000 + (clock_period_fs - 1)) / clock_period_fs
|
let min_deselect: u32 = ((18 * 1_000_000 + (clock_period_fs - 1)) / clock_period_fs
|
||||||
- u64::from(divisor + 1) / 2) as u32;
|
- u64::from(divisor + 1) / 2) as u32;
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
// #[cfg(feature = "defmt")]
|
||||||
defmt::info!(
|
// defmt::info!(
|
||||||
"clock_period_fs={} max_select={} min_deselect={}",
|
// "clock_period_fs={} max_select={} min_deselect={}",
|
||||||
clock_period_fs,
|
// clock_period_fs,
|
||||||
max_select,
|
// max_select,
|
||||||
min_deselect
|
// min_deselect
|
||||||
);
|
// );
|
||||||
|
|
||||||
qmi.direct_csr().write(|w| {
|
qmi.direct_csr().write(|w| {
|
||||||
w.set_clkdiv(10);
|
w.set_clkdiv(10);
|
||||||
|
|||||||
11
main_proc_macro/Cargo.toml
Normal file
11
main_proc_macro/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "main_proc_macro"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
proc-macro = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
quote = "1.0.41"
|
||||||
|
syn = "2.0.108"
|
||||||
21
main_proc_macro/src/lib.rs
Normal file
21
main_proc_macro/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
use proc_macro::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::{ItemFn, parse_macro_input};
|
||||||
|
|
||||||
|
#[proc_macro_attribute]
|
||||||
|
pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
|
let input = parse_macro_input!(item as ItemFn);
|
||||||
|
let name = &input.sig.ident;
|
||||||
|
|
||||||
|
// ensure we emit _start in the same module as the fn
|
||||||
|
let expanded = quote! {
|
||||||
|
#input
|
||||||
|
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub extern "Rust" fn _start() {
|
||||||
|
#name();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expanded.into()
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ use abi::{
|
|||||||
print,
|
print,
|
||||||
};
|
};
|
||||||
use alloc::{format, string::String, vec, vec::Vec};
|
use alloc::{format, string::String, vec, vec::Vec};
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable,
|
Drawable,
|
||||||
geometry::{Dimensions, Point},
|
geometry::{Dimensions, Point},
|
||||||
@@ -26,12 +25,6 @@ use embedded_layout::{
|
|||||||
prelude::Chain,
|
prelude::Chain,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "Rust" fn _start() {
|
pub extern "Rust" fn _start() {
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "doom"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
abi = { path = "../../abi" }
|
|
||||||
embedded-graphics = "0.8.1"
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
bindgen = "0.71.0"
|
|
||||||
cc = "1.0"
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
//! This build script copies the `memory.x` file from the crate root into
|
|
||||||
//! a directory where the linker can always find it at build time.
|
|
||||||
//! For many projects this is optional, as the linker always searches the
|
|
||||||
//! project root directory -- wherever `Cargo.toml` is. However, if you
|
|
||||||
//! are using a workspace or have a more complicated build setup, this
|
|
||||||
//! build script becomes required. Additionally, by requesting that
|
|
||||||
//! Cargo re-run the build script whenever `memory.x` is changed,
|
|
||||||
//! updating `memory.x` ensures a rebuild of the application with the
|
|
||||||
//! new memory settings.
|
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
build_newlib();
|
|
||||||
build_doom();
|
|
||||||
|
|
||||||
// Put `memory.x` in our output directory and ensure it's
|
|
||||||
// on the linker search path.
|
|
||||||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
|
||||||
File::create(out.join("memory.x"))
|
|
||||||
.unwrap()
|
|
||||||
.write_all(include_bytes!("memory.x"))
|
|
||||||
.unwrap();
|
|
||||||
println!("cargo:rustc-link-search={}", out.display());
|
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=memory.x");
|
|
||||||
println!("cargo:rustc-link-arg-bins=-Tmemory.x");
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: use target to change newlib build - only workds for rp2350 right now
|
|
||||||
fn build_newlib() {
|
|
||||||
let out_dir = std::env::var("OUT_DIR").unwrap();
|
|
||||||
let picolibc_dir = format!("{}/picolibc", out_dir);
|
|
||||||
|
|
||||||
if !Path::new(&picolibc_dir).exists() {
|
|
||||||
let status = Command::new("git")
|
|
||||||
.args(&[
|
|
||||||
"clone",
|
|
||||||
"https://github.com/picolibc/picolibc",
|
|
||||||
&picolibc_dir,
|
|
||||||
])
|
|
||||||
.status()
|
|
||||||
.expect("Failed to clone picolibc");
|
|
||||||
assert!(status.success());
|
|
||||||
}
|
|
||||||
|
|
||||||
let build_dir = format!("{}/build", picolibc_dir);
|
|
||||||
std::fs::create_dir_all(&build_dir).unwrap();
|
|
||||||
|
|
||||||
let status = Command::new(&format!("{picolibc_dir}/scripts/do-configure"))
|
|
||||||
.current_dir(&build_dir)
|
|
||||||
.args(&[
|
|
||||||
"thumbv8m_main_fp-none-eabi",
|
|
||||||
"--buildtype=minsize",
|
|
||||||
"-Dtests=true",
|
|
||||||
"-Dtinystdio=false",
|
|
||||||
"-Dsingle-thread=true",
|
|
||||||
"-Db_pie=true",
|
|
||||||
"-Ddefault_library=static",
|
|
||||||
"-Dtinystdio=false",
|
|
||||||
"-Dmultilib=false",
|
|
||||||
".",
|
|
||||||
])
|
|
||||||
.status()
|
|
||||||
.expect("Failed to run Meson configure");
|
|
||||||
assert!(status.success());
|
|
||||||
|
|
||||||
let status = Command::new("ninja")
|
|
||||||
.current_dir(&build_dir)
|
|
||||||
.status()
|
|
||||||
.expect("Failed to run Ninja build");
|
|
||||||
assert!(status.success());
|
|
||||||
|
|
||||||
println!("cargo:rustc-link-search={}/newlib", build_dir);
|
|
||||||
println!("cargo:rustc-link-lib=c");
|
|
||||||
println!("cargo:rustc-link-lib=m");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_doom() {
|
|
||||||
let ref dg_src_dir = std::path::PathBuf::from("doomgeneric/doomgeneric");
|
|
||||||
let mut dg_c_paths = vec![];
|
|
||||||
let mut dg_h_paths = vec![];
|
|
||||||
|
|
||||||
// Find most c and h files
|
|
||||||
for entry in std::fs::read_dir(dg_src_dir).unwrap() {
|
|
||||||
let entry = entry.unwrap();
|
|
||||||
if let Some(filename) = entry.file_name().to_str() {
|
|
||||||
if filename.starts_with("doomgeneric")
|
|
||||||
|| filename.contains("_allegro")
|
|
||||||
|| filename.contains("_sdl")
|
|
||||||
|| filename.contains("net_")
|
|
||||||
|| filename == "i_main.c"
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if filename.ends_with(".h") {
|
|
||||||
dg_h_paths.push(dg_src_dir.join(filename));
|
|
||||||
} else if filename.ends_with(".c") {
|
|
||||||
dg_c_paths.push(dg_src_dir.join(filename));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dg_c_paths
|
|
||||||
.iter()
|
|
||||||
.chain(dg_h_paths.iter())
|
|
||||||
.for_each(|path| println!("cargo:rerun-if-changed={}", path.to_str().unwrap()));
|
|
||||||
|
|
||||||
cc::Build::new()
|
|
||||||
.compiler("arm-none-eabi-gcc")
|
|
||||||
.flag("-w") // silence warnings
|
|
||||||
.flag("-Os") // optimize for size
|
|
||||||
.flag("-ffunction-sections")
|
|
||||||
.flag("-fdata-sections")
|
|
||||||
.define("CMAP256", None)
|
|
||||||
.define("DOOMGENERIC_RESX", Some("320"))
|
|
||||||
.define("DOOMGENERIC_RESY", Some("200"))
|
|
||||||
.flag_if_supported("-std=gnu99")
|
|
||||||
.define("_POSIX_C_SOURCE", Some("200809L"))
|
|
||||||
.files(dg_c_paths)
|
|
||||||
.compile("doomgeneric");
|
|
||||||
}
|
|
||||||
Submodule user-apps/doom/doomgeneric deleted from fc60163949
@@ -1,31 +0,0 @@
|
|||||||
MEMORY
|
|
||||||
{
|
|
||||||
RAM : ORIGIN = 0x0, LENGTH = 400K
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
.text : ALIGN(4)
|
|
||||||
{
|
|
||||||
*(.text .text.*);
|
|
||||||
*(.rodata .rodata.*);
|
|
||||||
} > RAM
|
|
||||||
|
|
||||||
.data : ALIGN(4)
|
|
||||||
{
|
|
||||||
*(.data .data.*);
|
|
||||||
} > RAM
|
|
||||||
|
|
||||||
.bss : ALIGN(4)
|
|
||||||
{
|
|
||||||
*(.bss .bss.*);
|
|
||||||
*(COMMON);
|
|
||||||
} > RAM
|
|
||||||
|
|
||||||
.syscall_table (NOLOAD) : ALIGN(4)
|
|
||||||
{
|
|
||||||
__user_reloc_start = .;
|
|
||||||
KEEP(*(.user_reloc*));
|
|
||||||
__user_reloc_end = .;
|
|
||||||
} > RAM
|
|
||||||
}
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
use abi::{
|
|
||||||
abi_sys::{get_ms, sleep},
|
|
||||||
display::Display,
|
|
||||||
};
|
|
||||||
use core::ffi::{c_int, c_uchar};
|
|
||||||
use embedded_graphics::{
|
|
||||||
Drawable, Pixel,
|
|
||||||
draw_target::DrawTarget,
|
|
||||||
pixelcolor::Rgb565,
|
|
||||||
prelude::{Point, RgbColor},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
#[allow(non_snake_case)]
|
|
||||||
static mut DG_ScreenBuffer: *const u8 = core::ptr::null();
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct RGBA {
|
|
||||||
pub b: u8,
|
|
||||||
pub g: u8,
|
|
||||||
pub r: u8,
|
|
||||||
pub a: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe extern "C" {
|
|
||||||
fn D_DoomMain();
|
|
||||||
fn doomgeneric_Tick();
|
|
||||||
fn M_FindResponseFile();
|
|
||||||
|
|
||||||
pub static colors: [RGBA; 256];
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn tick() {
|
|
||||||
unsafe { doomgeneric_Tick() };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ScreenBuffer<const RESX: usize, const RESY: usize, const SIZE: usize>(pub [u8; SIZE]);
|
|
||||||
|
|
||||||
impl<const RESX: usize, const RESY: usize, const SIZE: usize> ScreenBuffer<RESX, RESY, SIZE> {
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const NA: () = assert!(SIZE == RESX * RESY);
|
|
||||||
|
|
||||||
pub const fn new() -> Self {
|
|
||||||
Self([0_u8; SIZE])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
extern "C" fn DG_SetWindowTitle() {}
|
|
||||||
|
|
||||||
pub fn create<const RESX: usize, const RESY: usize, const SIZE: usize>(
|
|
||||||
screenbuffer: &ScreenBuffer<RESX, RESY, SIZE>,
|
|
||||||
) {
|
|
||||||
unsafe {
|
|
||||||
M_FindResponseFile();
|
|
||||||
|
|
||||||
DG_ScreenBuffer = screenbuffer.0.as_ptr();
|
|
||||||
|
|
||||||
D_DoomMain();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const X: usize = 320;
|
|
||||||
const Y: usize = 200;
|
|
||||||
const SIZE: usize = X * Y;
|
|
||||||
|
|
||||||
pub static mut DISPLAY: Option<Display> = None;
|
|
||||||
pub static mut SCREEN_BUFFER: ScreenBuffer<X, Y, SIZE> = ScreenBuffer::new();
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
extern "C" fn DG_DrawFrame() {
|
|
||||||
let palette565: [Rgb565; 256] = unsafe {
|
|
||||||
colors.map(|c| {
|
|
||||||
Rgb565::new(
|
|
||||||
((c.r as u16 * 31) / 255) as u8, // red 5 bits
|
|
||||||
((c.g as u16 * 63) / 255) as u8, // green 6 bits
|
|
||||||
((c.b as u16 * 31) / 255) as u8, // blue 5 bits
|
|
||||||
)
|
|
||||||
})
|
|
||||||
};
|
|
||||||
let buf = unsafe { &SCREEN_BUFFER.0 };
|
|
||||||
|
|
||||||
let display = unsafe { DISPLAY.as_mut().unwrap() };
|
|
||||||
display.clear(Rgb565::BLACK).unwrap();
|
|
||||||
|
|
||||||
for y in 0..Y {
|
|
||||||
for x in 0..X {
|
|
||||||
let idx = y * X + x;
|
|
||||||
let color = palette565[buf[idx] as usize];
|
|
||||||
|
|
||||||
Pixel(Point::new(x as i32, y as i32), color)
|
|
||||||
.draw(display)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
extern "C" fn DG_GetTicksMs() -> u32 {
|
|
||||||
get_ms() as u32
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
extern "C" fn DG_GetKey(pressed: *mut c_int, key: *mut c_uchar) -> c_int {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
extern "C" fn DG_SleepMs(ms: u32) {
|
|
||||||
sleep(ms.into());
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
use core::ffi::{c_char, c_int, c_uchar, c_void};
|
|
||||||
use core::ptr;
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub static _ctype_: [c_uchar; 256] = [0u8; 256];
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct Reent {
|
|
||||||
pub errno: c_int,
|
|
||||||
_reserved: [u8; 32],
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub static mut _reent_data: Reent = Reent {
|
|
||||||
errno: 0,
|
|
||||||
_reserved: [0; 32],
|
|
||||||
};
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub static mut _impure_ptr: *mut Reent = unsafe { &mut _reent_data as *mut Reent };
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn __errno() -> *mut c_int {
|
|
||||||
unsafe { &mut (*_impure_ptr).errno as *mut c_int }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn exit(_status: i32) -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn close(_file: i32) -> i32 {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct Stat {
|
|
||||||
st_mode: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn fstat(_file: i32, st: *mut Stat) -> i32 {
|
|
||||||
unsafe {
|
|
||||||
if !st.is_null() {
|
|
||||||
(*st).st_mode = 0x2000; // S_IFCHR
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn isatty(_file: i32) -> i32 {
|
|
||||||
1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn lseek(_file: i32, _ptr: i32, _dir: i32) -> i32 {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn lseek64(_fd: c_int, _offset: i64, _whence: c_int) -> i64 {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn open(_name: *const u8, _flags: i32, _mode: i32) -> i32 {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn read(_file: i32, _ptr: *mut u8, len: usize) -> i32 {
|
|
||||||
len as i32
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn write(_file: i32, _ptr: *const u8, len: usize) -> i32 {
|
|
||||||
len as i32
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn rename(_old: *const c_char, _new: *const c_char) -> c_int {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn kill(_pid: i32, _sig: i32) -> i32 {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn getpid() -> i32 {
|
|
||||||
1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn link(_old: *const u8, _new: *const u8) -> i32 {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn unlink(_name: *const u8) -> i32 {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn mkdir(_path: *const u8, _mode: u32) -> i32 {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn sbrk(incr: isize) -> *mut c_void {
|
|
||||||
core::ptr::null_mut()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "C" fn fini() {}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#![no_std]
|
|
||||||
#![no_main]
|
|
||||||
#![allow(static_mut_refs)]
|
|
||||||
#![feature(c_variadic)]
|
|
||||||
|
|
||||||
extern crate alloc;
|
|
||||||
use abi::{
|
|
||||||
display::Display,
|
|
||||||
fs::{file_len, read_file},
|
|
||||||
get_key, get_ms,
|
|
||||||
keyboard::{KeyCode, KeyState},
|
|
||||||
print, sleep,
|
|
||||||
};
|
|
||||||
use alloc::vec;
|
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{pixelcolor::Rgb565, prelude::Point};
|
|
||||||
|
|
||||||
mod doom;
|
|
||||||
use crate::doom::{DISPLAY, SCREEN_BUFFER, create, tick};
|
|
||||||
mod libc;
|
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "Rust" fn _start() {
|
|
||||||
main()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
print!("Starting Doom app");
|
|
||||||
let display = Display;
|
|
||||||
unsafe { DISPLAY = Some(display) };
|
|
||||||
|
|
||||||
unsafe { create(&SCREEN_BUFFER) };
|
|
||||||
|
|
||||||
loop {
|
|
||||||
tick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,27 +8,16 @@ use abi::{
|
|||||||
fs::{list_dir, read_file},
|
fs::{list_dir, read_file},
|
||||||
get_key,
|
get_key,
|
||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print,
|
main, print,
|
||||||
};
|
};
|
||||||
use alloc::{format, string::ToString, vec};
|
use alloc::{format, string::ToString, vec};
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable, image::Image, mono_font::MonoTextStyle, mono_font::ascii::FONT_6X10,
|
Drawable, image::Image, mono_font::MonoTextStyle, mono_font::ascii::FONT_6X10,
|
||||||
pixelcolor::Rgb565, prelude::*, text::Text,
|
pixelcolor::Rgb565, prelude::*, text::Text,
|
||||||
};
|
};
|
||||||
use tinybmp::Bmp;
|
use tinybmp::Bmp;
|
||||||
|
|
||||||
#[panic_handler]
|
#[main]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location());
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "Rust" fn _start() {
|
|
||||||
main()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
print!("Starting Gallery app");
|
print!("Starting Gallery app");
|
||||||
let mut bmp_buf = vec![0_u8; 100_000];
|
let mut bmp_buf = vec![0_u8; 100_000];
|
||||||
|
|||||||
@@ -7,26 +7,15 @@ use abi::{
|
|||||||
fs::{file_len, read_file},
|
fs::{file_len, read_file},
|
||||||
get_key, get_ms,
|
get_key, get_ms,
|
||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print, sleep,
|
main, print, sleep,
|
||||||
};
|
};
|
||||||
use alloc::vec;
|
use alloc::{format, vec};
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
image::ImageDrawable, pixelcolor::Rgb565, prelude::Point, transform::Transform,
|
image::ImageDrawable, pixelcolor::Rgb565, prelude::Point, transform::Transform,
|
||||||
};
|
};
|
||||||
use tinygif::Gif;
|
use tinygif::Gif;
|
||||||
|
|
||||||
#[panic_handler]
|
#[main]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "Rust" fn _start() {
|
|
||||||
main()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
print!("Starting Gif app");
|
print!("Starting Gif app");
|
||||||
let mut display = Display;
|
let mut display = Display;
|
||||||
@@ -51,11 +40,14 @@ pub fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
frame_num += 1;
|
frame_num += 1;
|
||||||
|
|
||||||
if frame_num % 100 == 0 {
|
if frame_num % 5 == 0 {
|
||||||
let event = get_key();
|
let event = get_key();
|
||||||
if event.state != KeyState::Idle {
|
if event.state != KeyState::Idle {
|
||||||
match event.key {
|
match event.key {
|
||||||
KeyCode::Esc => return,
|
KeyCode::Esc => {
|
||||||
|
drop(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,16 +9,10 @@ use abi::{
|
|||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print, sleep,
|
print, sleep,
|
||||||
};
|
};
|
||||||
use core::panic::PanicInfo;
|
use alloc::format;
|
||||||
use embedded_graphics::{pixelcolor::Rgb565, prelude::RgbColor};
|
use embedded_graphics::{pixelcolor::Rgb565, prelude::RgbColor};
|
||||||
use embedded_snake::{Direction, SnakeGame};
|
use embedded_snake::{Direction, SnakeGame};
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "Rust" fn _start() {
|
pub extern "Rust" fn _start() {
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user