Compare commits

...

32 Commits

Author SHA1 Message Date
b3cfe37bf6 update readme for build-std 2025-04-11 11:17:21 +08:00
652a9c5657 update cargo lockfile 2025-04-11 11:17:21 +08:00
ebbc5291f9 update fatfs dependency 2025-04-11 11:17:21 +08:00
65bc32ab8e move to build-std 2025-04-11 11:17:21 +08:00
c98c30c656 i2c: stop the bus after nack in pca switch 2025-03-28 14:54:42 +08:00
671cfc894c i2c: use enum errors 2025-03-19 15:13:29 +08:00
905b97431d executor: replace soft-deprecated pin_utils 2025-03-12 18:03:27 +08:00
e4e45274ff silence static mut ref warns for CORE1_ENABLED 2025-03-12 17:02:41 +08:00
8e827fc6ee cache: make dcci, dcc take raw const ptr 2025-03-12 17:02:41 +08:00
d3b4173edc silence static mut ref warns for L1_TABLE 2025-03-12 17:02:41 +08:00
f5aca2f0df remove unnecessary imports 2025-03-12 17:02:41 +08:00
8bd182b74e sync_channel: fix Box::from_raw warn 2025-03-12 17:02:41 +08:00
16092e66ce replace ref->ptr casts with raw ref ops 2025-03-12 17:02:41 +08:00
547a91c5dd update cargo lockfile 2025-03-12 17:02:41 +08:00
20730a0c6e bump llvm to 18 2025-03-12 17:02:41 +08:00
d6f2e51e10 bump compiler_builtins to 0.1.108 2025-03-12 17:02:41 +08:00
07c56258e8 bump rust vers 2025-03-12 17:02:41 +08:00
d92a40172b clean cache for L1Table after setup 2025-03-06 16:22:33 +08:00
a92aab6c9a remove unnecessary UnsafeCell from EXECUTOR 2025-02-27 15:32:05 +08:00
4364521a76 executor: revert to cells 2025-02-25 11:20:05 +08:00
4f90c61442 up liballoc to edition 2021 2025-02-17 09:35:31 +08:00
1c3912e34e flake: update dependencies 2025-02-13 17:04:57 +08:00
b01db024f2 update cargo lockfile 2025-02-13 16:59:05 +08:00
86af810f02 fix inline_const 2025-02-13 16:59:05 +08:00
7412291b16 remove stabilized feature flags 2025-02-13 16:59:05 +08:00
ac33c09578 remove allow incomplete_feature 2025-02-13 16:59:05 +08:00
9e41aed178 silence target-feature warns 2025-02-13 16:59:05 +08:00
ce57ae40de bump llvm 2025-02-13 10:57:25 +08:00
aecce03dc8 bump compiler_builtins 2025-02-12 10:36:08 +08:00
74436691ec bump rustc 2025-02-12 10:36:08 +08:00
0ed235475a enable vfp and NEON in boot_core1 2025-02-11 20:15:05 +08:00
c6f6bd292d libasync: clean up executor 2025-02-11 15:25:49 +08:00
23 changed files with 609 additions and 141 deletions

View File

@ -1,7 +1,6 @@
[target.armv7-none-eabihf]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "target-feature=a9,armv7-a,neon",
"-C", "target-cpu=cortex-a9",
]

444
Cargo.lock generated
View File

@ -2,6 +2,51 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"cpp_demangle",
"fallible-iterator",
"gimli",
"memmap2",
"object",
"rustc-demangle",
"smallvec",
]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "allocator-api2"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "bit_field"
version = "0.10.1"
@ -16,9 +61,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "byteorder"
version = "1.3.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60f0b0d4c0a382d2734228fd12b5a6b5dac185c60e938026fd31b265b94f9bd2"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
@ -34,15 +79,55 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "compiler_builtins"
version = "0.1.49"
version = "0.1.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20b1438ef42c655665a8ab2c1c6d605a305f031d38d9be689ddfef41a20f3aa2"
checksum = "d68bc55329711cd719c2687bb147bc06211b0521f97ef398280108ccb23227e9"
[[package]]
name = "core_io"
version = "0.1.0"
source = "git+https://git.m-labs.hk/M-Labs/rs-core_io.git?rev=e9d3edf027#e9d3edf0272502b0dd6c26e8a4869c2912657615"
[[package]]
name = "cpp_demangle"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d"
dependencies = [
"cfg-if",
]
[[package]]
name = "crc32fast"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
"cfg-if",
]
[[package]]
name = "derive_more"
version = "0.99.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "dlmalloc"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3264b043b8e977326c1ee9e723da2c1f8d09a99df52cacf00b4dbce5ac54414d"
dependencies = [
"cfg-if",
"libc",
"windows-sys",
]
[[package]]
name = "embedded-hal"
version = "0.2.7"
@ -66,10 +151,16 @@ dependencies = [
"log",
]
[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
[[package]]
name = "fatfs"
version = "0.3.6"
source = "git+https://git.m-labs.hk/M-Labs/rust-fatfs.git?rev=4b5e420084#4b5e420084fd1c4a9c105680b687523909b6469c"
source = "git+https://git.m-labs.hk/M-Labs/rust-fatfs.git?rev=6819267d08#6819267d08aaa6cb90ce86370d3347e25466af68"
dependencies = [
"bitflags",
"byteorder",
@ -77,6 +168,57 @@ dependencies = [
"log",
]
[[package]]
name = "flate2"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
dependencies = [
"crc32fast",
"miniz_oxide 0.8.8",
]
[[package]]
name = "fortanix-sgx-abi"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57cafc2274c10fab234f176b25903ce17e690fca7597090d50880e047a0389c5"
[[package]]
name = "getopts"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
dependencies = [
"unicode-width",
]
[[package]]
name = "gimli"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
dependencies = [
"fallible-iterator",
"stable_deref_trait",
]
[[package]]
name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash",
"allocator-api2",
]
[[package]]
name = "hermit-abi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "libasync"
version = "0.0.0"
@ -84,7 +226,6 @@ dependencies = [
"embedded-hal",
"libcortex_a9",
"nb 1.0.0",
"pin-utils",
"smoltcp",
]
@ -104,6 +245,12 @@ dependencies = [
"volatile-register",
]
[[package]]
name = "libc"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libconfig"
version = "0.1.0"
@ -136,13 +283,39 @@ dependencies = [
name = "libsupport_zynq"
version = "0.0.0"
dependencies = [
"addr2line",
"allocator-api2",
"byteorder",
"cc",
"compiler_builtins",
"dlmalloc",
"fortanix-sgx-abi",
"getopts",
"hashbrown",
"hermit-abi",
"libboard_zynq",
"libc",
"libcortex_a9",
"libregister",
"linked_list_allocator",
"memchr",
"miniz_oxide 0.7.2",
"object",
"r-efi",
"r-efi-alloc",
"r0",
"rustc-demangle",
"unicode-width",
"unwinding",
"wasi",
"windows-targets",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
@ -166,6 +339,39 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap2"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327"
dependencies = [
"libc",
]
[[package]]
name = "miniz_oxide"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
dependencies = [
"adler",
]
[[package]]
name = "miniz_oxide"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
dependencies = [
"adler2",
]
[[package]]
name = "nb"
version = "0.1.3"
@ -182,10 +388,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
[[package]]
name = "pin-utils"
version = "0.1.0"
name = "object"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"flate2",
"memchr",
"ruzstd",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "proc-macro2"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e244f96e03a3067f9e521d3167bd42657594cb8588c8d3a2db01545dc1af2e0"
[[package]]
name = "r-efi-alloc"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31d6f09fe2b6ad044bc3d2c34ce4979796581afd2f1ebc185837e02421e02fd7"
dependencies = [
"r-efi",
]
[[package]]
name = "r0"
@ -193,6 +443,29 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211"
[[package]]
name = "rustc-demangle"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "ruzstd"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d"
dependencies = [
"byteorder",
"derive_more",
"twox-hash",
]
[[package]]
name = "smallvec"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
[[package]]
name = "smoltcp"
version = "0.7.5"
@ -204,6 +477,29 @@ dependencies = [
"managed",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "szl"
version = "0.1.0"
@ -218,12 +514,50 @@ dependencies = [
"log",
]
[[package]]
name = "twox-hash"
version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if",
"static_assertions",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unwinding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37a19a21a537f635c16c7576f22d0f2f7d63353c1337ad4ce0d8001c7952a25b"
dependencies = [
"gimli",
"libc",
]
[[package]]
name = "vcell"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "void"
version = "1.0.2"
@ -238,3 +572,95 @@ checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6"
dependencies = [
"vcell",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

View File

@ -28,11 +28,11 @@ You can build SZL or experiments crate for the platform of your choice by using
nix build .#coraz7-experiments
```
Alternatively, you can still use ``cargo xbuild`` within ``nix develop`` shell.
Alternatively, you can still use ``cargo build -Zbuild-std=core,compiler_builtins,alloc`` within ``nix develop`` shell.
```shell
nix develop
cargo xbuild --release -p experiments
cargo build -Zbuild-std=core,compiler_builtins,alloc --release -p experiments
```
Currently the ELF output is placed at `target/armv7-none-eabihf/release/experiments`, or `result/experiments.elf` for Nix Flakes build.
@ -43,7 +43,7 @@ Currently the ELF output is placed at `target/armv7-none-eabihf/release/experime
```shell
nix develop
cargo xbuild --release -p experiments
cargo build -Zbuild-std=core,compiler_builtins,alloc --release -p experiments
cd openocd
openocd -f zc706.cfg
```
@ -52,7 +52,7 @@ openocd -f zc706.cfg
```shell
nix develop
cargo xbuild --release -p experiments --no-default-features --features=target_coraz7
cargo build -Zbuild-std=core,compiler_builtins,alloc --release -p experiments --no-default-features --features=target_coraz7
cd openocd
openocd -f cora-z7-10.cfg
```

View File

@ -4,7 +4,7 @@
"emit-debug-gdb-scripts": false,
"env": "",
"executables": true,
"features": "+v7,+vfp3,-d32,+thumb2,-neon",
"features": "+v7,+vfp3,-d32,+thumb2,+neon,+a9,+armv7-a",
"is-builtin": false,
"linker": "rust-lld",
"linker-flavor": "ld.lld",

View File

@ -1,9 +1,9 @@
#![no_std]
#![no_main]
#![allow(incomplete_features)]
#![feature(naked_functions)]
#![feature(asm)]
#![feature(inline_const)]
#![feature(strict_provenance)]
#![feature(raw_ref_op)]
extern crate alloc;
@ -73,7 +73,7 @@ interrupt_handler!(IRQ, irq, __irq_stack0_start, __irq_stack1_start, {
if id.0 == 0 {
gic.end_interrupt(id);
asm::exit_irq();
SP.write(&mut __stack1_start as *mut _ as u32);
SP.write((&raw mut __stack1_start).addr() as u32);
asm::enable_irq();
CORE1_RESTART.store(false, Ordering::Relaxed);
notify_spin_lock();

6
flake.lock generated
View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1736867362,
"narHash": "sha256-i/UJ5I7HoqmFMwZEH6vAvBxOrjjOJNU739lnZnhUln8=",
"lastModified": 1739206421,
"narHash": "sha256-PwQASeL2cGVmrtQYlrBur0U20Xy07uSWVnFup2PHnDs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9c6b49aeac36e2ed73a8c472f1546f6d9cf1addc",
"rev": "44534bc021b85c8d78e465021e21f33b856e2540",
"type": "github"
},
"original": {

View File

@ -11,7 +11,7 @@
let
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import rust-overlay) crosspkgs-overlay ]; };
rust = pkgs.rust-bin.nightly."2021-09-01".default.override {
rust = pkgs.rust-bin.nightly."2024-04-06".default.override {
extensions = [ "rust-src" ];
targets = [ ];
};
@ -95,10 +95,6 @@
dontFixup = true;
};
cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: {
postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018";
});
build-crate = name: crate: features: rustPlatform.buildRustPackage rec {
name = "${crate}";
@ -109,16 +105,16 @@
lockFile = ./Cargo.lock;
outputHashes = {
"core_io-0.1.0" = "sha256-0HINFWRiJx8pjMgUOL/CS336ih7SENSRh3Kah9LPRrw=";
"fatfs-0.3.6" = "sha256-Nz9hCq/1YgSXF8ltJ5ZawV0Hc8WV44KNK0tJdVnNb4U=";
"fatfs-0.3.6" = "sha256-s6eApcmY0K65YQl9gu9Mg6ZXlN/+UoCcrSh6TbqpqDw=";
};
};
nativeBuildInputs = [ cargo-xbuild pkgs.llvmPackages_13.clang-unwrapped ];
nativeBuildInputs = [ pkgs.cargo-xbuild pkgs.llvmPackages_18.clang-unwrapped ];
buildPhase = ''
export XARGO_RUST_SRC="${rust}/lib/rustlib/src/rust/library"
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
pushd ${crate}
cargo xbuild --release --frozen \
cargo build -Zbuild-std=core,compiler_builtins,alloc --release --frozen \
--no-default-features \
--features=${features}
popd
@ -152,7 +148,7 @@
) "mkdir $out\n" targets);
in rec {
packages.x86_64-linux = {
inherit cargo-xbuild szl mkbootimage;
inherit szl mkbootimage;
zc706-fsbl = fsbl { board = "zc706"; };
} // allTargetCrates ;
@ -164,12 +160,12 @@
name = "zynq-rs-dev-shell";
buildInputs = [
rust
cargo-xbuild
pkgs.cargo-xbuild
mkbootimage
pkgs.openocd pkgs.gdb
pkgs.openssh pkgs.rsync
pkgs.llvmPackages_13.clang-unwrapped
pkgs.llvmPackages_18.clang-unwrapped
(pkgs.python3.withPackages(ps: [ ps.pyftdi ]))
];
};

View File

@ -7,7 +7,6 @@ edition = "2018"
[dependencies]
#futures = { version = "0.3", default-features = false }
pin-utils = "0.1.0-alpha.4"
embedded-hal = "0.2"
nb = "1.0"
libcortex_a9 = { path = "../libcortex_a9" }

View File

@ -1,14 +1,12 @@
use alloc::{boxed::Box, vec::Vec};
use core::{
cell::{RefCell, UnsafeCell},
cell::{RefCell, Cell},
future::Future,
mem::MaybeUninit,
pin::Pin,
pin::{pin, Pin},
sync::atomic::{AtomicBool, Ordering},
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
};
use alloc::{boxed::Box, vec::Vec};
//use futures::future::FutureExt;
use pin_utils::pin_mut;
// NOTE `*const ()` is &AtomicBool
static VTABLE: RawWakerVTable = {
@ -39,7 +37,7 @@ fn wrap_waker(ready: &AtomicBool) -> Waker {
/// This is a singleton
pub struct Executor {
// Entered block_on() already?
in_block_on: RefCell<bool>,
in_block_on: Cell<bool>,
/// Tasks reside on the heap, so that we just queue pointers. They
/// must also be pinned in memory because our RawWaker is a pointer
@ -51,7 +49,7 @@ impl Executor {
/// Creates a new instance of the executor
pub fn new() -> Self {
Self {
in_block_on: RefCell::new(false),
in_block_on: Cell::new(false),
tasks: RefCell::new(Vec::new()),
}
}
@ -61,15 +59,12 @@ impl Executor {
// below has to become more complex. It's also likely that the
// application will only call `block_on` once on an infinite task
// (`Future<Output = !>`)
{
let mut in_block_on = self.in_block_on.borrow_mut();
if *in_block_on {
panic!("nested `block_on`");
}
*in_block_on = true;
if self.in_block_on.get() {
panic!("nested `block_on`");
}
self.in_block_on.replace(true);
pin_mut!(f);
let mut pinned_f = pin!(f);
let ready = AtomicBool::new(true);
let waker = wrap_waker(&ready);
let mut backup = Vec::new();
@ -77,13 +72,10 @@ impl Executor {
// advance the main task
if ready.load(Ordering::Relaxed) {
ready.store(false, Ordering::Relaxed);
// println!("run block_on");
let mut cx = Context::from_waker(&waker);
if let Poll::Ready(val) = f.as_mut().poll(&mut cx) {
if let Poll::Ready(val) = pinned_f.as_mut().poll(&mut cx) {
break val;
}
// println!("ran block_on");
}
// advance all tasks
@ -108,16 +100,12 @@ impl Executor {
// Requeue
self.tasks.borrow_mut().push(task);
}
// // try to sleep; this will be a no-op if any of the previous tasks generated a SEV or an
// // interrupt ran (regardless of whether it generated a wake-up or not)
// asm::wfe();
};
self.in_block_on.replace(false);
val
}
pub fn spawn(&self, f: impl Future + 'static) {
pub fn spawn(&self, f: impl Future<Output = ()> + 'static) {
let task = Box::pin(Task::new(f));
self.tasks.borrow_mut().push(task);
}
@ -129,10 +117,10 @@ pub struct Task {
}
impl Task {
fn new(f: impl Future + 'static) -> Self {
fn new(f: impl Future<Output = ()> + 'static) -> Self {
Task {
ready: AtomicBool::new(true),
f: Box::pin(async { f.await; }),
f: Box::pin(f),
}
}
}
@ -142,16 +130,15 @@ impl Task {
/// This lazily initializes the executor and allocator when first called
pub(crate) fn current() -> &'static Executor {
static INIT: AtomicBool = AtomicBool::new(false);
static mut EXECUTOR: UnsafeCell<MaybeUninit<Executor>> = UnsafeCell::new(MaybeUninit::uninit());
static mut EXECUTOR: MaybeUninit<Executor> = MaybeUninit::uninit();
if INIT.load(Ordering::Relaxed) {
unsafe { &*(EXECUTOR.get() as *const Executor) }
unsafe { EXECUTOR.assume_init_ref() }
} else {
unsafe {
let executorp = EXECUTOR.get() as *mut Executor;
executorp.write(Executor::new());
let executor = EXECUTOR.write(Executor::new());
INIT.store(true, Ordering::Relaxed);
&*executorp
&*executor
}
}
}

View File

@ -17,7 +17,7 @@ pub fn block_on<T>(f: impl Future<Output = T>) -> T {
/// Spawns a task onto the executor
///
/// The spawned task will not make any progress until `block_on` is called.
pub fn spawn(f: impl Future + 'static) {
pub fn spawn(f: impl Future<Output = ()> + 'static) {
executor::current().spawn(f)
}

View File

@ -1,4 +1,4 @@
use super::I2c;
use super::{I2c, Error};
use crate::time::Milliseconds;
use embedded_hal::timer::CountDown;
@ -35,25 +35,25 @@ impl<'a> EEPROM<'a> {
}
#[cfg(feature = "target_zc706")]
fn select(&mut self) -> Result<(), &'static str> {
fn select(&mut self) -> Result<(), Error> {
self.i2c.pca954x_select(0b1110100, Some(self.port))?;
Ok(())
}
#[cfg(feature = "target_kasli_soc")]
fn select(&mut self) -> Result<(), &'static str> {
fn select(&mut self) -> Result<(), Error> {
// tca9548 is compatible with pca9548
self.i2c.pca954x_select(0b1110001, Some(self.port))?;
Ok(())
}
#[cfg(feature = "target_ebaz4205")]
fn select(&mut self) -> Result<(), &'static str> {
fn select(&mut self) -> Result<(), Error> {
Ok(())
}
/// Random read
pub fn read<'r>(&mut self, addr: u8, buf: &'r mut [u8]) -> Result<(), &'static str> {
pub fn read<'r>(&mut self, addr: u8, buf: &'r mut [u8]) -> Result<(), Error> {
self.select()?;
self.i2c.start()?;
@ -78,7 +78,7 @@ impl<'a> EEPROM<'a> {
/// (i.e. `addr+buf.len()` < `addr/self.page_size+1`); otherwise, a roll-oever occurs,
/// where bytes beyond the page end. This smart function takes care of the scenario to avoid
/// any roll-over when writing ambiguous memory regions.
pub fn write(&mut self, addr: u8, buf: &[u8]) -> Result<(), &'static str> {
pub fn write(&mut self, addr: u8, buf: &[u8]) -> Result<(), Error> {
self.select()?;
let buf_len = buf.len();
@ -103,26 +103,28 @@ impl<'a> EEPROM<'a> {
}
/// Poll
pub fn poll(&mut self, timeout_ms: u64) -> Result<(), &'static str> {
pub fn poll(&mut self, timeout_ms: u64) -> Result<(), Error> {
self.select()?;
self.count_down.start(Milliseconds(timeout_ms));
loop {
self.i2c.start()?;
let ack = self.i2c.write(self.address << 1)?;
let res = self.i2c.write(self.address << 1);
self.i2c.stop()?;
if ack {
break
};
match res {
Ok(()) => break,
Err(Error::Nack) => (),
Err(e) => return Err(e)
}
if !self.count_down.waiting() {
return Err("I2C polling timeout")
return Err(Error::PollingTimeout)
}
}
Ok(())
}
pub fn read_eui48<'r>(&mut self) -> Result<[u8; 6], &'static str> {
pub fn read_eui48<'r>(&mut self) -> Result<[u8; 6], Error> {
let mut buffer = [0u8; 6];
self.read(0xFA, &mut buffer)?;
Ok(buffer)

View File

@ -11,6 +11,7 @@ use libregister::{RegisterR, RegisterRW};
use libregister::RegisterW;
#[cfg(feature = "target_kasli_soc")]
use log::info;
use log::error;
pub enum I2cMultiplexer {
PCA9548 = 0,
@ -18,6 +19,31 @@ pub enum I2cMultiplexer {
PCA9547 = 1,
}
#[derive(Debug)]
pub enum Error {
Nack,
SCLLow,
SDALow,
ArbitrationLost,
UnknownSwitch,
PollingTimeout,
OtherError,
}
impl From<Error> for &str {
fn from(err: Error) -> &'static str {
match err {
Error::Nack => "I2C write was not ACKed",
Error::SCLLow => "SCL stuck low",
Error::SDALow => "SDA stuck low",
Error::ArbitrationLost => "SDA arbitration lost",
Error::UnknownSwitch => "Unknown response for PCA954X autodetect",
Error::PollingTimeout => "I2C polling timeout",
Error::OtherError => "other error",
}
}
}
pub struct I2c {
regs: regs::RegisterBlock,
count_down: super::timer::global::CountDown<Microseconds>,
@ -148,7 +174,7 @@ impl I2c {
}
#[cfg(feature = "target_kasli_soc")]
fn pca_autodetect(&mut self) -> Result<I2cMultiplexer, &'static str> {
fn pca_autodetect(&mut self) -> Result<I2cMultiplexer, Error> {
// start with resetting the PCA954X
// SDA must be clear (before start)
// reset time is 500ns, unit_delay (100us) to account for propagation
@ -161,21 +187,26 @@ impl I2c {
self.start()?;
// read the config register
if !self.write(pca954x_read_addr)? {
return Err("PCA954X failed to ack read address");
}
self.write(pca954x_read_addr).map_err(|err| {
match err {
Error::Nack => error!("PCA954X failed to ack read address"),
_ => ()
}
err
}
)?;
let config = self.read(false)?;
let pca = match config {
0x00 => { info!("PCA9548 detected"); I2cMultiplexer::PCA9548 },
0x08 => { info!("PCA9547 detected"); I2cMultiplexer::PCA9547 },
_ => { return Err("Unknown response for PCA954X autodetect")},
_ => { return Err(Error::UnknownSwitch)},
};
self.stop()?;
Ok(pca)
}
pub fn init(&mut self) -> Result<(), &'static str> {
pub fn init(&mut self) -> Result<(), Error> {
self.scl_oe(false);
self.sda_oe(false);
self.scl_o(false);
@ -195,10 +226,10 @@ impl I2c {
}
if !self.sda_i() {
return Err("SDA is stuck low and doesn't get unstuck");
return Err(Error::SDALow);
}
if !self.scl_i() {
return Err("SCL is stuck low");
return Err(Error::SCLLow);
}
// postcondition: SCL and SDA high
@ -211,13 +242,13 @@ impl I2c {
Ok(())
}
pub fn start(&mut self) -> Result<(), &'static str> {
pub fn start(&mut self) -> Result<(), Error> {
// precondition: SCL and SDA high
if !self.scl_i() {
return Err("SCL is stuck low");
return Err(Error::SCLLow);
}
if !self.sda_i() {
return Err("SDA arbitration lost");
return Err(Error::ArbitrationLost);
}
self.sda_oe(true);
self.unit_delay();
@ -227,7 +258,7 @@ impl I2c {
Ok(())
}
pub fn restart(&mut self) -> Result<(), &'static str> {
pub fn restart(&mut self) -> Result<(), Error> {
// precondition SCL and SDA low
self.sda_oe(false);
self.unit_delay();
@ -238,7 +269,7 @@ impl I2c {
Ok(())
}
pub fn stop(&mut self) -> Result<(), &'static str> {
pub fn stop(&mut self) -> Result<(), Error> {
// precondition: SCL and SDA low
self.unit_delay();
self.scl_oe(false);
@ -246,13 +277,13 @@ impl I2c {
self.sda_oe(false);
self.unit_delay();
if !self.sda_i() {
return Err("SDA arbitration lost");
return Err(Error::ArbitrationLost);
}
// postcondition: SCL and SDA high
Ok(())
}
pub fn write(&mut self, data: u8) -> Result<bool, &'static str> {
pub fn write(&mut self, data: u8) -> Result<(), Error> {
// precondition: SCL and SDA low
// MSB first
for bit in (0..8).rev() {
@ -274,10 +305,10 @@ impl I2c {
self.sda_oe(true);
// postcondition: SCL and SDA low
Ok(ack)
if ack { Ok(()) } else { Err(Error::Nack) }
}
pub fn read(&mut self, ack: bool) -> Result<u8, &'static str> {
pub fn read(&mut self, ack: bool) -> Result<u8, Error> {
// precondition: SCL and SDA low
self.sda_oe(false);
@ -303,7 +334,7 @@ impl I2c {
Ok(data)
}
pub fn pca954x_select(&mut self, address: u8, channel: Option<u8>) -> Result<(), &'static str> {
pub fn pca954x_select(&mut self, address: u8, channel: Option<u8>) -> Result<(), Error> {
self.start()?;
// PCA9547 supports only one channel at a time
// for compatibility, PCA9548 is treated as such too
@ -324,13 +355,16 @@ impl I2c {
}
};
if !self.write(address << 1)? {
return Err("PCA954X failed to ack write address")
}
if !self.write(setting)? {
return Err("PCA954X failed to ack control word")
}
self.stop()?;
Ok(())
let write_res = self.write(address << 1).or_else( |err| {
error!("PCA954X write address fail: {:?}", err);
Err(err)
}).and_then(|_| self.write(setting).or_else(|err| {
error!("PCA954X control word fail: {:?}", err);
Err(err)
})
);
let stop_res = self.stop();
write_res.and(stop_res)
}
}

View File

@ -9,7 +9,6 @@ use super::time::Milliseconds;
use embedded_hal::timer::CountDown;
use libregister::{RegisterR, RegisterRW, RegisterW};
use log::{trace, debug};
use nb;
/// Basic SDIO Struct with common low-level functions.
pub struct Sdio {

View File

@ -15,7 +15,7 @@ features = ["collections"]
[dependencies.fatfs]
git = "https://git.m-labs.hk/M-Labs/rust-fatfs.git"
rev = "4b5e420084"
rev = "6819267d08"
default-features = false
features = ["core_io"]

View File

@ -1,5 +1,4 @@
use core_io::{BufRead, Error, ErrorKind, Read, Result as IoResult, Seek, SeekFrom, Write};
use fatfs;
use libboard_zynq::sdio::{sd_card::SdCard, CmdTransferError};
use log::debug;
use alloc::vec::Vec;

View File

@ -137,15 +137,15 @@ fn cache_line_addrs(first_addr: usize, beyond_addr: usize) -> impl Iterator<Item
(first_addr..beyond_addr).step_by(CACHE_LINE)
}
fn object_cache_line_addrs<T>(object: &T) -> impl Iterator<Item = usize> {
let first_addr = object as *const _ as usize;
let beyond_addr = (object as *const _ as usize) + core::mem::size_of_val(object);
fn object_cache_line_addrs<T>(object: *const T) -> impl Iterator<Item = usize> {
let first_addr = object.addr();
let beyond_addr = object.addr() + core::mem::size_of::<T>();
cache_line_addrs(first_addr, beyond_addr)
}
fn slice_cache_line_addrs<T>(slice: &[T]) -> impl Iterator<Item = usize> {
let first_addr = &slice[0] as *const _ as usize;
let beyond_addr = (&slice[slice.len() - 1] as *const _ as usize) +
let first_addr = (&raw const slice[0]).addr();
let beyond_addr = (&raw const slice[slice.len() - 1]).addr() +
core::mem::size_of_val(&slice[slice.len() - 1]);
cache_line_addrs(first_addr, beyond_addr)
}
@ -162,7 +162,7 @@ pub fn dccimvac(addr: usize) {
}
/// Data cache clean and invalidate for an object.
pub fn dcci<T>(object: &T) {
pub fn dcci<T>(object: *const T) {
// ref: L2C310 TRM 3.3.10
dmb();
for addr in object_cache_line_addrs(object) {
@ -203,7 +203,7 @@ pub fn dccmvac(addr: usize) {
}
}
/// Data cache clean for an object.
pub fn dcc<T>(object: &T) {
pub fn dcc<T>(object: *const T) {
dmb();
for addr in object_cache_line_addrs(object) {
dccmvac(addr);

View File

@ -1,10 +1,8 @@
#![no_std]
#![feature(never_type)]
#![feature(global_asm)]
#![feature(asm)]
#![allow(incomplete_features)]
#![feature(inline_const)]
#![feature(const_fn_trait_bound)]
#![feature(strict_provenance)]
#![feature(raw_ref_op)]
extern crate alloc;

View File

@ -1,3 +1,4 @@
use core::cell::UnsafeCell;
use bit_field::BitField;
use super::{regs::*, asm::*, cache::*};
use libregister::RegisterW;
@ -124,9 +125,9 @@ impl L1Entry {
}
const L1_TABLE_SIZE: usize = 4096;
static mut L1_TABLE: L1Table = L1Table {
static mut L1_TABLE: UnsafeCell<L1Table> = UnsafeCell::new(L1Table {
table: [L1Entry(0); L1_TABLE_SIZE]
};
});
#[repr(C, align(16384))]
pub struct L1Table {
@ -135,9 +136,7 @@ pub struct L1Table {
impl L1Table {
pub fn get() -> &'static mut Self {
unsafe {
&mut L1_TABLE
}
unsafe { L1_TABLE.get_mut() }
}
pub fn setup_flat_layout(&mut self) -> &Self {

View File

@ -37,7 +37,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
notify_spin_lock();
if !prev.is_null() {
unsafe {
Box::from_raw(prev);
let _ = Box::from_raw(prev);
}
}
Ok(())
@ -91,7 +91,7 @@ impl<'a, T> Sender<'a, T> where T: Clone {
for v in self.list.iter() {
let original = v.swap(core::ptr::null_mut(), Ordering::Relaxed);
if !original.is_null() {
Box::from_raw(original);
let _ = Box::from_raw(original);
}
}
}
@ -177,10 +177,7 @@ macro_rules! sync_channel {
{
use core::sync::atomic::{AtomicUsize, AtomicPtr};
use $crate::sync_channel::{Sender, Receiver};
const fn new_atomic() -> AtomicPtr<$t> {
AtomicPtr::new(core::ptr::null_mut())
}
static LIST: [AtomicPtr<$t>; $cap + 1] = [const { new_atomic() }; $cap + 1];
static LIST: [AtomicPtr<$t>; $cap + 1] = [const { AtomicPtr::new(core::ptr::null_mut()) }; $cap + 1];
static WRITE: AtomicUsize = AtomicUsize::new(0);
static READ: AtomicUsize = AtomicUsize::new(0);
(Sender::new(&LIST, &WRITE, &READ), Receiver::new(&LIST, &WRITE, &READ))

View File

@ -20,7 +20,6 @@ default = ["panic_handler", "dummy_irq_handler", "dummy_fiq_handler"]
[dependencies]
r0 = "1"
compiler_builtins = "=0.1.49"
linked_list_allocator = { version = "0.8", default-features = false, features = ["const_mut_refs"] }
libregister = { path = "../libregister" }
libcortex_a9 = { path = "../libcortex_a9" }
@ -28,3 +27,33 @@ libboard_zynq = { path = "../libboard_zynq" }
[build-dependencies]
cc = { version = "1.0" }
# HACK: insanity required to make build-std work with nix
[dev-dependencies]
compiler_builtins = "=0.1.108"
hashbrown = "=0.14.3"
libc = "=0.2.153"
rustc-demangle = "=0.1.23"
object = "=0.32.2"
byteorder = "=1.5.0"
dlmalloc = "=0.2.6"
addr2line = "=0.21.0"
miniz_oxide = "=0.7.2"
hermit-abi = "=0.3.9"
r-efi = "=4.3.0"
r-efi-alloc = "=1.0.0"
wasi = "=0.11.0"
fortanix-sgx-abi = "=0.5.0"
getopts = "=0.2.21"
allocator-api2 = "=0.2.16"
unwinding = "=0.2.1"
memchr = "=2.5.0"
unicode-width = "=0.1.11"
windows-targets = "=0.52.4"
windows_aarch64_gnullvm = "=0.52.4"
windows_aarch64_msvc = "=0.52.4"
windows_i686_gnu = "=0.52.4"
windows_i686_msvc = "=0.52.4"
windows_x86_64_gnu = "=0.52.4"
windows_x86_64_msvc = "=0.52.4"
windows_x86_64_gnullvm = "=0.52.4"

View File

@ -43,10 +43,11 @@ unsafe extern "C" fn boot_core0() -> ! {
let mpcore = mpcore::RegisterBlock::mpcore();
mpcore.scu_invalidate.invalidate_all_cores();
zero_bss(&mut __bss_start, &mut __bss_end);
zero_bss(&raw mut __bss_start, &raw mut __bss_end);
let mmu_table = mmu::L1Table::get()
.setup_flat_layout();
cache::dcc(mmu_table);
mmu::with_mmu(mmu_table, || {
mpcore.scu_control.start();
ACTLR.enable_smp();
@ -66,6 +67,7 @@ unsafe extern "C" fn boot_core0() -> ! {
unsafe extern "C" fn boot_core1() -> ! {
l1_cache_init();
enable_fpu();
let mpcore = mpcore::RegisterBlock::mpcore();
mpcore.scu_invalidate.invalidate_core1();
@ -132,7 +134,7 @@ impl Core1 {
CORE1_ENABLED.set(true);
}
// Flush cache-line
cache::dcc(unsafe { &CORE1_ENABLED });
cache::dcc(unsafe { &raw const CORE1_ENABLED });
if sdram {
cache::dccmvac(0);
asm::dsb();
@ -153,7 +155,7 @@ impl Core1 {
pub fn disable(&self) {
unsafe {
CORE1_ENABLED.set(false);
cache::dccmvac(&CORE1_ENABLED as *const _ as usize);
cache::dccmvac((&raw const CORE1_ENABLED).addr());
asm::dsb();
}
self.restart();

View File

@ -3,11 +3,10 @@
#![feature(alloc_error_handler)]
#![feature(panic_info_message)]
#![feature(naked_functions)]
#![feature(global_asm)]
#![feature(asm)]
#![feature(strict_provenance)]
#![feature(raw_ref_op)]
pub extern crate alloc;
pub extern crate compiler_builtins;
pub mod boot;
pub mod exception_vectors;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#![feature(strict_provenance)]
#![feature(raw_ref_op)]
extern crate alloc;
extern crate log;
@ -116,18 +119,18 @@ pub fn main_core0() {
unsafe {
let max_len =
&__runtime_end as *const usize as usize - &__runtime_start as *const usize as usize;
(&raw const __runtime_end).addr() - (&raw const __runtime_start).addr();
match slcr::RegisterBlock::unlocked(|slcr| slcr.boot_mode.read().boot_mode_pins()) {
slcr::BootModePins::Jtag => netboot::netboot(
&mut bootgen_file,
config,
&mut __runtime_start as *mut usize as *mut u8,
(&raw mut __runtime_start).cast(),
max_len,
),
slcr::BootModePins::SdCard => {
if boot_sd(
&mut bootgen_file,
&mut __runtime_start as *mut usize as *mut u8,
(&raw mut __runtime_start).cast(),
max_len,
)
.is_err()
@ -137,7 +140,7 @@ pub fn main_core0() {
netboot::netboot(
&mut bootgen_file,
config,
&mut __runtime_start as *mut usize as *mut u8,
(&raw mut __runtime_start).cast(),
max_len,
)
}
@ -148,7 +151,7 @@ pub fn main_core0() {
netboot::netboot(
&mut bootgen_file,
config,
&mut __runtime_start as *mut usize as *mut u8,
(&raw mut __runtime_start).cast(),
max_len,
)
}