FLAG DAY: fix all names to harmonize around 'bao1x'

The code base had evolved through several code names, interim
names, company names and chip names that alternatively did or did
not exist.

Baochip is the definitive name of the company, and the Baochip1x
(full part number BAO1X2S4F-WA) is the definitivey part number of
the SoC. For convenience, the part number is shortened to 'bao1x'
in most feature flags and variable references.

This commit fixes all of the odd names and removes some unmaintained
early targets.
This commit is contained in:
bunnie 2025-09-18 21:25:51 +08:00
parent edf5206846
commit 1255bf12d9
231 changed files with 1222 additions and 22809 deletions

2
.gitignore vendored
View file

@ -7,7 +7,7 @@ services/xous-ticktimer/src/version.rs
apps/i18n.json
services/gam/src/apps.rs
services/status/src/app_autogen.rs
services/cram-console/src/app_autogen.rs
services/bao1x-console/src/app_autogen.rs
# shouldn't be committed
apps/vault/tools/crypto_data

280
Cargo.lock generated
View file

@ -325,10 +325,10 @@ name = "bao-console"
version = "0.1.0"
dependencies = [
"aes",
"cram-hal-service",
"cramium-api",
"cramium-emu",
"cramium-hal",
"bao1x-api",
"bao1x-emu",
"bao1x-hal",
"bao1x-hal-service",
"log",
"modals",
"num-derive 0.4.2",
@ -351,12 +351,12 @@ dependencies = [
name = "bao-video"
version = "0.1.0"
dependencies = [
"bao1x-api",
"bao1x-emu",
"bao1x-hal",
"bao1x-hal-service",
"base64 0.22.1",
"blitstr2",
"cram-hal-service",
"cramium-api",
"cramium-emu",
"cramium-hal",
"libm 0.2.8",
"locales",
"log",
@ -375,6 +375,108 @@ dependencies = [
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bao1x-api"
version = "0.1.0"
dependencies = [
"num-derive 0.4.2",
"num-traits",
"rkyv 0.8.8",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-names",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bao1x-emu"
version = "0.1.0"
dependencies = [
"bao1x-api",
"log",
"minifb",
"num-derive 0.4.2",
"num-traits",
"rand 0.8.5",
"rand_core 0.6.4",
"rkyv 0.8.8",
"ux-api",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bao1x-hal"
version = "0.1.0"
dependencies = [
"bao1x-api",
"bitfield",
"bitflags 1.3.2",
"either",
"log",
"num-derive 0.4.2",
"num-traits",
"rkyv 0.8.8",
"usb-device",
"utralib 0.1.25",
"ux-api",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-names",
"xous-api-ticktimer",
"xous-riscv",
]
[[package]]
name = "bao1x-hal-service"
version = "0.1.0"
dependencies = [
"bao1x-api",
"bao1x-hal",
"bitfield",
"log",
"num-derive 0.4.2",
"num-traits",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
"rkyv 0.8.8",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bao1x-mbox1"
version = "0.1.0"
dependencies = [
"aes",
"log",
"num-derive 0.4.2",
"num-traits",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
]
[[package]]
name = "bao1x-mbox2"
version = "0.1.0"
dependencies = [
"log",
"num-derive 0.4.2",
"num-traits",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
]
[[package]]
name = "bare-metal"
version = "0.2.4"
@ -388,9 +490,9 @@ dependencies = [
name = "baremetal"
version = "0.1.0"
dependencies = [
"bao1x-api",
"bao1x-hal",
"base64 0.22.1",
"cramium-api",
"cramium-hal",
"critical-section",
"digest 0.10.7",
"ed25519-dalek",
@ -979,8 +1081,8 @@ dependencies = [
name = "cram-console"
version = "0.1.0"
dependencies = [
"cram-hal-service",
"cramium-hal",
"bao1x-hal",
"bao1x-hal-service",
"ime-plugin-shell",
"locales",
"log",
@ -998,108 +1100,6 @@ dependencies = [
"xous-swapper",
]
[[package]]
name = "cram-hal-service"
version = "0.1.0"
dependencies = [
"bitfield",
"cramium-api",
"cramium-hal",
"log",
"num-derive 0.4.2",
"num-traits",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
"rkyv 0.8.8",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cram-mbox1"
version = "0.1.0"
dependencies = [
"aes",
"log",
"num-derive 0.4.2",
"num-traits",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
]
[[package]]
name = "cram-mbox2"
version = "0.1.0"
dependencies = [
"log",
"num-derive 0.4.2",
"num-traits",
"utralib 0.1.25",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-api-ticktimer",
]
[[package]]
name = "cramium-api"
version = "0.1.0"
dependencies = [
"num-derive 0.4.2",
"num-traits",
"rkyv 0.8.8",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-names",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cramium-emu"
version = "0.1.0"
dependencies = [
"cramium-api",
"log",
"minifb",
"num-derive 0.4.2",
"num-traits",
"rand 0.8.5",
"rand_core 0.6.4",
"rkyv 0.8.8",
"ux-api",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-log",
"xous-api-names",
"xous-ipc 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cramium-hal"
version = "0.1.0"
dependencies = [
"bitfield",
"bitflags 1.3.2",
"cramium-api",
"either",
"log",
"num-derive 0.4.2",
"num-traits",
"rkyv 0.8.8",
"usb-device",
"utralib 0.1.25",
"ux-api",
"xous 0.9.66 (registry+https://github.com/rust-lang/crates.io-index)",
"xous-api-names",
"xous-api-ticktimer",
"xous-riscv",
]
[[package]]
name = "crc"
version = "1.8.1"
@ -2271,10 +2271,10 @@ checksum = "0fd8b261ccf00df8c5cc60c082bb7d7aa64c33a433cfcc091ca244326c924b2c"
name = "gam"
version = "0.1.0"
dependencies = [
"bao1x-hal-service",
"blitstr2",
"com",
"content-plugin-api",
"cram-hal-service",
"digest 0.9.0",
"enum_dispatch",
"graphics-server",
@ -2393,9 +2393,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
name = "graphics-server"
version = "0.1.0"
dependencies = [
"bao1x-hal",
"bao1x-hal-service",
"blitstr2",
"cram-hal-service",
"cramium-hal",
"keyboard",
"locales",
"log",
@ -2948,13 +2948,13 @@ dependencies = [
"aes",
"aes-gcm-siv",
"aes-kw",
"bao1x-api",
"bao1x-emu",
"bao1x-hal",
"bao1x-hal-service",
"blowfish",
"byteorder",
"cipher",
"cram-hal-service",
"cramium-api",
"cramium-emu",
"cramium-hal",
"digest 0.10.7",
"hex 0.4.3",
"hkdf",
@ -3146,9 +3146,9 @@ dependencies = [
"aes-gcm-siv",
"armv7",
"atsama5d27",
"bao1x-api",
"bao1x-hal",
"com_rs 0.1.0 (git+https://github.com/betrusted-io/com_rs?branch=main)",
"cramium-api",
"cramium-hal",
"crc 1.8.1",
"critical-section",
"curve25519-dalek-loader",
@ -3328,11 +3328,11 @@ dependencies = [
name = "modals"
version = "0.1.0"
dependencies = [
"bao1x-api",
"bao1x-emu",
"bao1x-hal-service",
"bit_field",
"blitstr2",
"cram-hal-service",
"cramium-api",
"cramium-emu",
"gam",
"locales",
"log",
@ -3909,13 +3909,13 @@ version = "0.1.0"
dependencies = [
"aes",
"aes-gcm-siv",
"bao1x-emu",
"bao1x-hal",
"bao1x-hal-service",
"bitfield",
"bitflags 1.3.2",
"blowfish",
"cipher",
"cram-hal-service",
"cramium-emu",
"cramium-hal",
"digest 0.10.7",
"gam",
"hex 0.4.3",
@ -6009,10 +6009,10 @@ dependencies = [
name = "usb-bao1x"
version = "0.1.0"
dependencies = [
"cram-hal-service",
"cramium-api",
"cramium-emu",
"cramium-hal",
"bao1x-api",
"bao1x-emu",
"bao1x-hal",
"bao1x-hal-service",
"frunk_core",
"locales",
"log",
@ -6044,9 +6044,9 @@ dependencies = [
name = "usb-device-xous"
version = "0.1.0"
dependencies = [
"bao1x-hal",
"bao1x-hal-service",
"bitfield",
"cram-hal-service",
"cramium-hal",
"embedded-time",
"frunk_core",
"fugit",
@ -7004,8 +7004,8 @@ version = "0.9.38"
dependencies = [
"aes",
"armv7",
"bao1x-hal",
"bitflags 1.3.2",
"cramium-hal",
"critical-section",
"crossbeam-channel",
"gdbstub",
@ -7025,7 +7025,7 @@ dependencies = [
name = "xous-log"
version = "0.1.28"
dependencies = [
"cramium-hal",
"bao1x-hal",
"log",
"num-derive 0.4.2",
"num-traits",
@ -7055,8 +7055,8 @@ dependencies = [
name = "xous-pl230"
version = "0.1.0"
dependencies = [
"bao1x-hal",
"bitfield",
"cramium-hal",
"log",
"pio",
"pio-proc",
@ -7104,8 +7104,8 @@ version = "0.1.0"
dependencies = [
"aes",
"aes-gcm-siv",
"cramium-api",
"cramium-hal",
"bao1x-api",
"bao1x-hal",
"loader",
"log",
"num-derive 0.4.2",

View file

@ -86,8 +86,8 @@ members = [
"services/ffi-test",
"services/tts",
"services/cram-console",
"services/cram-mbox1",
"services/cram-mbox2",
"services/bao1x-mbox1",
"services/bao1x-mbox2",
#"services/test-spawn",
#"services/test-spawn/spawn",
"services/usb-test",
@ -105,17 +105,16 @@ members = [
"libs/xous-bio",
"libs/xous-bio-bdma",
"libs/xous-pl230",
"libs/cramium-hal",
"services/cram-hal-service",
"libs/bao1x-hal",
"services/bao1x-hal-service",
"services/xous-swapper",
"services/test-swapper",
"services/cram-console",
"services/bao-video",
"services/usb-bao1x",
"services/bao-console",
"libs/ux-api",
"services/cramium-emu",
"libs/cramium-api",
"services/bao1x-emu",
"libs/bao1x-api",
"services/keystore",
"libs/precursor-hal",
"baremetal",
@ -155,8 +154,8 @@ opt-level = "s" # z,s: Optimize for size instead of performance; 1 for easier de
sha2 = { git = "https://github.com/betrusted-io/hashes.git", branch = "sha2-v0.10.8-xous" }
# sha2 = { path = "../hashes/sha2" }
# Debugging the cramium-soc feature on aes ("--features swap" only needed for loader):
# cargo tree -e features --features cramium-soc --features swap -f "{p} {f}"
# Debugging the bao1x feature on aes ("--features swap" only needed for loader):
# cargo tree -e features --features bao1x --features swap -f "{p} {f}"
[patch.crates-io.aes]
path = "services/aes"

View file

@ -1,39 +1,39 @@
# "Baochip" / "Cramium" Series API Organization & Glossary
# "Baochip" / "bao1x" Series API Organization & Glossary
## API Organization
The Baochip platform has the following API structure. Note that
`cramium` is the original code name for the target chip, which after
`bao1x` is the original code name for the target chip, which after
two years of extensive code development migrated to the `baochip`
brand name. At the moment the misnaming stands, due to the amount
of code that carries the legacy name.
`libs/cramium-api`: contains hardware-abstracted API code to the hardware
`libs/bao1x-api`: contains hardware-abstracted API code to the hardware
layers (traits, some constants, enums, etc.). For example, "here is
an IO trait that lets you configure and set GPIO pins", which could
then be implemented in hardware or emulation. The APIs aren't entirely
generic across all SoCs because they are tweaked to accommodate
quirks of the cramium SoC.
quirks of the bao1x SoC.
`libs/cramium-hal`: contains board-specific driver codes that do not
`libs/bao1x-hal`: contains board-specific driver codes that do not
require persistent services to be started. Possibly misnamed because
it also includes not just cramium-chip items, but also e.g. peripherals
to the cramium SoC, such as the PMIC and camera.
it also includes not just bao1x-chip items, but also e.g. peripherals
to the bao1x SoC, such as the PMIC and camera.
`services/cramium-hal-service`: contains the `main` process that manages
`services/bao1x-hal-service`: contains the `main` process that manages
shared resources, such as UDMA, IO pins, IFRAM. These drivers cannot
be delegated to a `lib` crate because there can be only one instance
of these resources, and instead we have to dynamically allocate
access to these through IPC messaging.
`services/cramium-emu`: hosted mode emulation of things in
cramium-hal-service.
`services/bao1x-emu`: hosted mode emulation of things in
bao1x-hal-service.
`services/bao-video`: contains a `main` process that integrates
the camera and OLED driver. This means that all graphic drawing
primitives also interface with this crate. These are condensed
into a single process space to speed up execution, and kept
separate from cramium-hal-services because we want the video
separate from bao1x-hal-services because we want the video
services to not be blocked by, for example, a thread that is
handling I2C things.
@ -45,16 +45,9 @@ being formed and funded. Thus the name of the company and chip don't
even match compared to the final product. Here is a glossary of terms
you may encounter in this project.
`daric`: Code name for the MPW (multi-project-wafer) test SoC. It was
also supposed to be a product name but apparently this was already
taken and thus while lots of code uses the name, it can't be used
as a product name.
`daric`: Internal code name for the SoC while in development.
`cramium`: Putative name for a company that was supposed to be started
to sell what was the `daric` SoC, and was assumed to be the brand
name for the chip. As of writing the entity may still not exist.
`crossbar`: The parent company that was supposed to spin out `cramium`.
`crossbar`: The parent company that shouldered the cost of taping out the SoC.
Most of the OSS SoC code has its copyright assigned to this organization;
so, this is probably the most relevant legal entity even though its
name doesn't appear in marketing materials.
@ -64,33 +57,25 @@ variant of the `daric` chip. This is the relevant legal organization in terms
of purchasing chips and systems related to this code base; thus from a user
perspective this is the brand used in Xous.
`baochip zero`: Actual brand name of the chip. Internally code named `nto` (which
stands for "Next Tape Out" - look, I don't come up with half of these names,
I just use them).
`cramium-soc`: The name of the Xous target that is actually the `baochip zero`.
`bao1x`: The short name of the Xous target that targets the `Baochip1x` SoC.
It is also used as a target for "pure SoC" simulations; i.e., verilog RTL
simulations where the peripherals are entirely virtual test benches.
`cramium-fpga`: A placeholder target that is meant to be a down-sized
FPGA implementation of the SoC. This will likely be an Artix-7 100T
implementation, targeting the Digilent Arty A7.
`baosec`: Internal code name of a board that contains the `baochip zero` with
`baosec`: Internal code name of a board that contains the `Baochip1x` with
a USB security token form factor. This is likewise the name of the xtask target
to build images for this board. Contains a camera, display, storage, USB
and buttons. `board-baosec` is the flag for the board target, and `loader-baosec`
is an analogous flag but for no-std environments. `hosted-baosec` likewise
is for `baosec` but running on an x86 host (for UX development).
`baosec-emu`: xtask target for hosted mode emulation for `baosec`. `cramium-emu`
contains hosted mode shims for the `baosec` target. `cramium-emu` mis-named and
`baosec-emu`: xtask target for hosted mode emulation for `baosec`. `bao1x-emu`
contains hosted mode shims for the `baosec` target. `bao1x-emu` mis-named and
should probably be renamed to `baosec-emu`.
`baosor`: Internal code name of a board that contains the `baochip zero` with
`baosor`: Internal code name of a board that contains the `baochip1x` with
the Precursor form factor. `board-basor` is the flag for the board target,
and `loader-baosor` is an analogous flag but for no-std environments.
`dabao`: Internal codename of a breakout board for the `baochip zero` that
`dabao`: Internal codename of a breakout board for the `Baochip1x` that
contains nothing more than the chip, a power regulator and a USB connector.

View file

@ -359,7 +359,7 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- Shut down I2C block after this read happens by disabling it
- Harden the RTC handler such that if junk corrupts the RTC it doesn't loop forever being confused about the junk data.
- More multi-platform support work
- Preliminary Cramium SoC and FPGA targets incorporated
- Preliminary bao1x SoC and FPGA targets incorporated
- atsama5d27 target support via PRs from Foundation Devices (thank you!!). Xous is now booting on the ATSAMA5D27-SOM1-EK1 dev board!
- Fix edge case in phase 1 loader (thanks to @southpawflow for reporting it and providing the test case files)
- Implementations removed from crates.io (API crates still published) -- nobody is using the implementation crates it seems, and they are very hard to maintain.
@ -401,7 +401,7 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- Issue #341 closed (support open wifi networks) - requires EC update.
- Rust 1.71.0 support - @xobs discovered that Rust 1.71.0 now shifts the address around of hardware management structures such that when we bind them to interrupt handlers, the final address of the interrupt handler is different from the address we see inside the `new()` function. It's actually allowed to do this. @xobs has created the "deferred-init + Box" pattern to harden against this. Deferred-init refers to binding the address of the hardware structure to the interrupt handler *after* `new()` has returned. This ensures that at least all the optimization that may happen inside `new()` are finalized. Additionally, wrapping the result of `new()` inside `Box()` ensures that the resulting structure is put on the heap. Because `Box` also implements `Pin`, the compiler won't muck with the address any further and should prevent future incompatibilities with Rust. The only place this pattern could not be applied is in the USB stack, because the USB crate we use expects to have an un-Box'd hardware management structure. However, deferred-init alone seems to be good enough, at least for now, to allow this to work.
- Fix (hopefully for real this time?) a bug in the "flush cache" instruction for Vex that affected specifically virtual memory configurations like ours. This will require a firmware update.
- More cramium SoC target integration and libraries; support multi-SVD targets in `utralib`
- More bao1x SoC target integration and libraries; support multi-SVD targets in `utralib`
- Add menu option in `vault` to type usernames (in addition to passwords)
- Fix minor issue in precursorupdater where `--config` argument would not quit and run an update instead
- Fix issue in `ProcessStartup` where `repr(C)` was missing, thanks to @vihaanjim for finding that subtle bug!
@ -479,7 +479,7 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- Fix panic reporting in userspace panics. There was an API incompatibility between `std` and the panic handler where we instantiated the panic handler as a "well known service" but actually it needed to be registered with xous-names.
- Added "device RAM allocation". A region of memory requested using the `map_memory` API with a physical address of `None` and a flag of `xous::MemoryFlags::DEV` will be allocated as contiguous physical pages of memory. It returns `OutOfMemory` if a contiguous block cannot be found; it is up to the userspace to de-allocate or swap out memory to create a large enough block. This API is useful for creating regions of RAM to be passed on to e.g. DMA devices or hardware coprocessors.
- cleaned up swap API; removed elements that are no longer needed (e.g. SID/CID for userspace calls from kernel)
- Cramium target:
- bao1x target:
- USB core able to enumerate, communicate to Linux devices. Windows compat still WIP.
- Mailbox protocol to other devices has been tested, working.
- TRNG has been tuned, partially validated.

View file

@ -8,8 +8,8 @@ description = "Baremetal target"
[dependencies]
xous = "0.9.66"
utralib = { version = "0.1.25", optional = true, default-features = false }
cramium-hal = { path = "../libs/cramium-hal", optional = true, default-features = false }
cramium-api = { path = "../libs/cramium-api", optional = true, default-features = false }
bao1x-hal = { path = "../libs/bao1x-hal", optional = true, default-features = false }
bao1x-api = { path = "../libs/bao1x-api", optional = true, default-features = false }
vexriscv = { version = "0.5.6", package = "xous-riscv" }
riscv = { version = "0.14.0", features = ["critical-section-single-hart"] }
linked_list_allocator = { version = "0.10.5", optional = true }
@ -33,46 +33,46 @@ artybio = [
"linked_list_allocator",
"xous-bio-bdma/artybio",
"xous-bio-bdma/baremetal",
"nto-bio",
"bao1x-bio",
]
artyvexii = ["utralib/artyvexii", "linked_list_allocator"]
# Baochip feature tree below
v0p9 = [] # selects RAM timings for VDD core = 0.9V
cramium-soc = [
"utralib/cramium-soc",
bao1x = [
"utralib/bao1x",
"linked_list_allocator",
"cramium-hal/loader-baosec",
# "cramium-hal/debug-print-usb",
"cramium-api",
"bao1x-hal/loader-baosec",
# "bao1x-hal/debug-print-usb",
"bao1x-api",
"v0p9",
]
# activates BIO test suite
nto-bio = [
bao1x-bio = [
"xous-bio-bdma/bio-mul",
"xous-bio-bdma/baremetal",
"xous-bio-bdma/cramium-soc",
"xous-bio-bdma/bao1x",
"xous-bio-bdma/tests",
]
# selects features for EVB target (defaults to baosec)
nto-evb = []
nto-usb = [
bao1x-evb = []
bao1x-usb = [
"simple-fatfs",
"sha2",
"digest",
"ed25519-dalek",
# "cramium-hal/debug-print-usb",
# "cramium-hal/verbose-debug",
# "bao1x-hal/debug-print-usb",
# "bao1x-hal/verbose-debug",
]
nto-buttons = []
nto-trng = [
"nto-usb",
bao1x-buttons = []
bao1x-trng = [
"bao1x-usb",
"base64",
"xous-bio-bdma/baremetal",
"xous-bio-bdma/cramium-soc",
"xous-bio-bdma/bao1x",
]
trng-debug = []
verbose-debug = []
verilator-only = []
default = ["nto-usb", "nto-trng"]
default = ["bao1x-usb", "bao1x-trng"]

View file

@ -10,8 +10,8 @@ fn main() {
let linker_file_path = if target.starts_with("riscv") {
println!("cargo:rustc-link-search={}", out_dir.display());
#[cfg(feature = "cramium-soc")]
let p = PathBuf::from("src/platform/cramium/link.x");
#[cfg(feature = "bao1x")]
let p = PathBuf::from("src/platform/bao1x/link.x");
#[cfg(feature = "artybio")]
let p = PathBuf::from("src/platform/artybio/link.x");
#[cfg(feature = "artyvexii")]

View file

@ -6,7 +6,7 @@ use crate::platform;
// Note: inline constants are not yet stable in Rust: https://github.com/rust-lang/rust/pull/104087
#[link_section = ".text.init"]
#[export_name = "_start"]
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub extern "C" fn _start() {
unsafe {
#[rustfmt::skip]
@ -31,7 +31,7 @@ pub extern "C" fn _start() {
#[link_section = ".text.init"]
#[export_name = "_start"]
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub extern "C" fn _start() {
unsafe {
#[rustfmt::skip]

View file

@ -21,11 +21,9 @@ use xous_bio_bdma::*;
use crate::delay;
static UART_RX: Mutex<RefCell<VecDeque<u8>>> = Mutex::new(RefCell::new(VecDeque::new()));
#[cfg(feature = "nto-usb")]
#[allow(dead_code)]
static USB_RX: Mutex<RefCell<VecDeque<u8>>> = Mutex::new(RefCell::new(VecDeque::new()));
#[cfg(feature = "nto-usb")]
static USB_TX: Mutex<RefCell<VecDeque<u8>>> = Mutex::new(RefCell::new(VecDeque::new()));
#[cfg(feature = "nto-usb")]
static USB_CONNECTED: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicBool::new(false);
pub fn uart_irq_handler() {
@ -80,17 +78,17 @@ pub unsafe extern "C" fn rust_entry() -> ! {
// provide some feedback on the run state of the BIO by peeking at the program counter
// value, and provide feedback on the CPU operation by flashing the RGB LEDs.
let mut repl = crate::repl::Repl::new();
#[cfg(feature = "nto-bio")]
#[cfg(feature = "bao1x-bio")]
repl.init_cmd("bio"); // do a power-on BIO test
#[cfg(feature = "nto-usb")]
#[cfg(feature = "bao1x-usb")]
// do the main loop through the USB interface
{
use crate::platform::usb::glue;
let (mut last_usb_state, mut portsc) = glue::setup();
loop {
use cramium_hal::usb::driver::UsbDeviceState;
use bao1x_hal::usb::driver::UsbDeviceState;
let (new_usb_state, new_portsc) = glue::usb_status();
// break out of the loop when USB is disconnected, after it has been configured
@ -138,7 +136,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
}
}
#[cfg(not(feature = "nto-usb"))]
#[cfg(not(feature = "bao1x-usb"))]
// do the main loop through the serial port
loop {
// Handle keyboard events.
@ -235,7 +233,7 @@ pub fn fifo_basic() -> usize {
// The code readback is broken on the Arty BIO target due to a pipeline stage
// in the code readback path that causes the previous read's data to show up
// on the current read access. On the NTO-BIO (full chip version), the BIO runs
// on the current read access. On the bao1x-BIO (full chip version), the BIO runs
// at a much higher speed than the bus framework and thus the data is returned
// on time for the read. However in the FPGA for simplicity the BIO is geared
// at 2:1 BIO speed to CPU core speed, and the bus fabric runs at a single speed

View file

@ -1,7 +1,7 @@
#[cfg(any(feature = "cramium-soc"))]
mod cramium;
#[cfg(any(feature = "cramium-soc"))]
pub use cramium::*;
#[cfg(any(feature = "bao1x"))]
mod bao1x;
#[cfg(any(feature = "bao1x"))]
pub use bao1x::*;
#[cfg(any(feature = "artybio"))]
mod artybio;

View file

@ -0,0 +1,12 @@
pub mod bao1x;
pub use bao1x::*;
#[cfg(feature = "bao1x-trng")]
pub mod avtrng;
#[cfg(feature = "bao1x-bio")]
pub mod bio;
pub mod debug;
pub mod irq;
#[cfg(feature = "bao1x-usb")]
pub mod usb;
pub const UART_BAUD: u32 = 1_000_000;

View file

@ -1,6 +1,6 @@
use cramium_api::*;
use cramium_hal::iox::Iox;
use cramium_hal::udma;
use bao1x_api::*;
use bao1x_hal::iox::Iox;
use bao1x_hal::udma;
use utralib::CSR;
use utralib::utra;
use utralib::utra::sysctrl;
@ -26,7 +26,7 @@ pub const HEAP_LEN: usize = 1024 * 256;
// NOTE: there is an additional page above this for exception stack
pub const SCRATCH_PAGE: usize = HEAP_START - 8192;
pub const UART_IFRAM_ADDR: usize = cramium_hal::board::UART_DMA_TX_BUF_PHYS;
pub const UART_IFRAM_ADDR: usize = bao1x_hal::board::UART_DMA_TX_BUF_PHYS;
// the 800_000_000 setting is tested to work at least on one sample
pub const SYSTEM_CLOCK_FREQUENCY: u32 = 800_000_000;
@ -50,7 +50,7 @@ pub fn early_init() {
}
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
{
// sets up the FET control for DCDC2 (only useful on boards that support it)
iox.set_gpio_pin_value(IoxPort::PA, 5, IoxValue::High);
@ -224,38 +224,38 @@ pub fn early_init() {
crate::println!("This debug print should be on the UDMA UART");
// Setup I/Os so things that should be powered off are actually off
cramium_hal::board::setup_display_pins(&iox);
cramium_hal::board::setup_memory_pins(&iox);
cramium_hal::board::setup_i2c_pins(&iox);
cramium_hal::board::setup_camera_pins(&iox);
cramium_hal::board::setup_kb_pins(&iox);
cramium_hal::board::setup_oled_power_pin(&iox);
cramium_hal::board::setup_trng_power_pin(&iox);
bao1x_hal::board::setup_display_pins(&iox);
bao1x_hal::board::setup_memory_pins(&iox);
bao1x_hal::board::setup_i2c_pins(&iox);
bao1x_hal::board::setup_camera_pins(&iox);
bao1x_hal::board::setup_kb_pins(&iox);
bao1x_hal::board::setup_oled_power_pin(&iox);
bao1x_hal::board::setup_trng_power_pin(&iox);
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
{
crate::println!("Engage DCDC2");
let i2c_channel = cramium_hal::board::setup_i2c_pins(&iox);
use cramium_hal::udma::GlobalConfig;
let i2c_channel = bao1x_hal::board::setup_i2c_pins(&iox);
use bao1x_hal::udma::GlobalConfig;
let udma_global = GlobalConfig::new();
udma_global.clock(PeriphId::from(i2c_channel), true);
let i2c_ifram = unsafe {
cramium_hal::ifram::IframRange::from_raw_parts(
cramium_hal::board::I2C_IFRAM_ADDR,
cramium_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::board::I2C_IFRAM_ADDR,
4096,
)
};
let mut i2c = unsafe {
cramium_hal::udma::I2c::new_with_ifram(i2c_channel, 400_000, perclk, i2c_ifram, &udma_global)
bao1x_hal::udma::I2c::new_with_ifram(i2c_channel, 400_000, perclk, i2c_ifram, &udma_global)
};
if let Ok(mut pmic) = cramium_hal::axp2101::Axp2101::new(&mut i2c) {
match pmic.set_dcdc(&mut i2c, Some((0.88, true)), cramium_hal::axp2101::WhichDcDc::Dcdc2) {
if let Ok(mut pmic) = bao1x_hal::axp2101::Axp2101::new(&mut i2c) {
match pmic.set_dcdc(&mut i2c, Some((0.88, true)), bao1x_hal::axp2101::WhichDcDc::Dcdc2) {
Ok(_) => crate::println!("turned on DCDC2"),
Err(_) => crate::println!("couldn't turn off DCDC2"),
}
pmic.set_pwm_mode(&mut i2c, cramium_hal::axp2101::WhichDcDc::Dcdc2, true).ok();
pmic.set_pwm_mode(&mut i2c, bao1x_hal::axp2101::WhichDcDc::Dcdc2, true).ok();
}
// this does nothing on boards without the FET rework
crate::println!("Engage DCDC2 FET");
@ -462,9 +462,9 @@ pub unsafe fn init_clock_asic(freq_hz: u32) -> u32 {
// calculate perclk divider. Target 100MHz.
// perclk divider - set to divide by 16 off of an 800Mhz base. Only found on NTO.
// perclk divider - set to divide by 16 off of an 800Mhz base. Only found on bao1x.
// daric_cgu.add(utra::sysctrl::SFR_CGUFDPER.offset()).write_volatile(0x03_ff_ff);
// perclk divider - set to divide by 8 off of an 800Mhz base. Only found on NTO.
// perclk divider - set to divide by 8 off of an 800Mhz base. Only found on bao1x.
// TODO: this only works for two clock settings. Broken @ 600. Need to fix this to instead derive
// what pclk is instead of always reporting 100mhz
let (min_cycle, fd, perclk) = if let Some((min_cycle, fd, perclk)) = clk_to_per(freq_hz / 1_000_000, 100)
@ -672,13 +672,13 @@ pub fn clockset_wrapper(freq: u32) -> u32 {
// reset the baud rate on the console UART
let perclk = unsafe { crate::platform::init_clock_asic(freq) };
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR;
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling
// new.
udma::Uart::get_handle(utra::udma_uart_1::HW_UDMA_UART_1_BASE, uart_buf_addr, uart_buf_addr)
};
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling
// new.
@ -780,13 +780,13 @@ pub unsafe fn low_power() -> u32 {
// reset the UART
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR;
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling
// new.
udma::Uart::get_handle(utra::udma_uart_1::HW_UDMA_UART_1_BASE, uart_buf_addr, uart_buf_addr)
};
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling
// new.

View file

@ -1,7 +1,7 @@
use alloc::string::String;
use alloc::vec::Vec;
use cramium_hal::cache_flush;
use bao1x_hal::cache_flush;
use utralib::utra::bio_bdma::SFR_CONFIG_CLOCKING_MODE;
use utralib::*;
use xous_bio_bdma::*;

View file

@ -1,9 +1,9 @@
use core::sync::atomic::{AtomicBool, Ordering::SeqCst};
use cramium_api::*;
use cramium_hal::iox::Iox;
use cramium_hal::udma::UartIrq;
use cramium_hal::{udma, udma::GlobalConfig};
use bao1x_api::*;
use bao1x_hal::iox::Iox;
use bao1x_hal::udma::UartIrq;
use bao1x_hal::{udma, udma::GlobalConfig};
use utralib::generated::*;
pub static USE_CONSOLE: AtomicBool = AtomicBool::new(false);
@ -40,7 +40,7 @@ impl Uart {
} else {
let buf: [u8; 1] = [c];
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR;
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(
@ -49,7 +49,7 @@ impl Uart {
uart_buf_addr,
)
};
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(
@ -106,12 +106,12 @@ impl Write for Uart {
impl SerialRead for Uart {
fn getc(&mut self) -> Option<u8> {
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR;
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(utra::udma_uart_1::HW_UDMA_UART_1_BASE, uart_buf_addr, uart_buf_addr)
};
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(utra::udma_uart_2::HW_UDMA_UART_2_BASE, uart_buf_addr, uart_buf_addr)
@ -154,10 +154,10 @@ macro_rules! println
});
}
pub fn setup_rx(perclk: u32) -> cramium_hal::udma::Uart {
pub fn setup_rx(perclk: u32) -> bao1x_hal::udma::Uart {
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let udma_global = GlobalConfig::new();
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
{
iox.set_alternate_function(IoxPort::PD, 13, IoxFunction::AF1);
iox.set_alternate_function(IoxPort::PD, 14, IoxFunction::AF1);
@ -179,7 +179,7 @@ pub fn setup_rx(perclk: u32) -> cramium_hal::udma::Uart {
EventChannel::Channel1,
);
}
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
{
iox.set_alternate_function(IoxPort::PB, 13, IoxFunction::AF1);
iox.set_alternate_function(IoxPort::PB, 14, IoxFunction::AF1);
@ -209,12 +209,12 @@ pub fn setup_rx(perclk: u32) -> cramium_hal::udma::Uart {
// IFRAM0. This is a convention that must be respected by the UDMA UART library implementation
// for things to work.
let uart_buf_addr = crate::platform::UART_IFRAM_ADDR;
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(utra::udma_uart_1::HW_UDMA_UART_1_BASE, uart_buf_addr, uart_buf_addr)
};
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
let mut udma_uart = unsafe {
// safety: this is safe to call, because we set up clock and events prior to calling new.
udma::Uart::get_handle(utra::udma_uart_2::HW_UDMA_UART_2_BASE, uart_buf_addr, uart_buf_addr)
@ -224,9 +224,9 @@ pub fn setup_rx(perclk: u32) -> cramium_hal::udma::Uart {
// setup interrupt here
let mut uart_irq = UartIrq::new();
#[cfg(feature = "nto-evb")]
#[cfg(feature = "bao1x-evb")]
uart_irq.rx_irq_ena(udma::UartChannel::Uart1, true);
#[cfg(not(feature = "nto-evb"))]
#[cfg(not(feature = "bao1x-evb"))]
uart_irq.rx_irq_ena(udma::UartChannel::Uart2, true);
udma_uart

View file

@ -1,9 +1,9 @@
#[cfg(feature = "nto-usb")]
use cramium_hal::usb::utra::*;
#[cfg(feature = "bao1x-usb")]
use bao1x_hal::usb::utra::*;
use riscv::register::{mcause, mie, mstatus};
use vexriscv::register::vexriscv::{mim, mip};
#[cfg(feature = "nto-usb")]
#[cfg(feature = "bao1x-usb")]
use crate::usb::USB;
use crate::*;
@ -205,7 +205,7 @@ pub extern "C" fn trap_handler(
crate::println!("keypress interrupt {:x}", pending);
irqarray2.wo(utra::irqarray2::EV_PENDING, pending);
}
#[cfg(feature = "nto-usb")]
#[cfg(feature = "bao1x-usb")]
if (irqs_pending & (1 << utralib::utra::irqarray1::IRQARRAY1_IRQ)) != 0 {
// handle USB interrupt
unsafe {
@ -229,14 +229,14 @@ pub extern "C" fn trap_handler(
} else {
if (status & usb.csr.ms(USBSTS_EINT, 1)) != 0 {
// from udc_handle_interrupt
let mut ret = cramium_hal::usb::driver::CrgEvent::None;
let mut ret = bao1x_hal::usb::driver::CrgEvent::None;
let status = usb.csr.r(USBSTS);
// self.print_status(status);
let _result = if (status & usb.csr.ms(USBSTS_SYSTEM_ERR, 1)) != 0 {
crate::println!("System error");
usb.csr.wfo(USBSTS_SYSTEM_ERR, 1);
crate::println!("USBCMD: {:x}", usb.csr.r(USBCMD));
cramium_hal::usb::driver::CrgEvent::Error
bao1x_hal::usb::driver::CrgEvent::Error
} else {
if (status & usb.csr.ms(USBSTS_EINT, 1)) != 0 {
usb.csr.wfo(USBSTS_EINT, 1);

View file

@ -1,10 +1,10 @@
use core::convert::TryFrom;
use core::sync::atomic::{AtomicPtr, Ordering};
use cramium_hal::usb::compat::AtomicCsr;
use cramium_hal::usb::driver::CorigineUsb;
use cramium_hal::usb::driver::*;
use cramium_hal::usb::utra::*;
use bao1x_hal::usb::compat::AtomicCsr;
use bao1x_hal::usb::driver::CorigineUsb;
use bao1x_hal::usb::driver::*;
use bao1x_hal::usb::utra::*;
use super::*;
@ -42,9 +42,9 @@ pub(crate) static mut USB: Option<CorigineUsb> = None;
/// is allowed to assume that `USB` has the correct value to represent a `None` on boot.
pub unsafe fn init_usb() {
let mut usb = unsafe {
cramium_hal::usb::driver::CorigineUsb::new(
cramium_hal::board::CRG_UDC_MEMBASE,
AtomicCsr::new(cramium_hal::usb::utra::CORIGINE_USB_BASE as *mut u32),
bao1x_hal::usb::driver::CorigineUsb::new(
bao1x_hal::board::CRG_UDC_MEMBASE,
AtomicCsr::new(bao1x_hal::usb::utra::CORIGINE_USB_BASE as *mut u32),
AtomicCsr::new(utralib::utra::irqarray1::HW_IRQARRAY1_BASE as *mut u32),
)
};
@ -92,7 +92,7 @@ pub unsafe fn test_usb() {
loop {
usb.udc_handle_interrupt();
if usb.pp() {
poweron += 1; // .pp() is a sham. MPW has no way to tell if power is applied. This needs to be fixed for NTO.
poweron += 1; // .pp() is a sham. MPW has no way to tell if power is applied. This needs to be fixed for bao1x.
}
delay(100);
if poweron >= 4 {

View file

@ -1,4 +1,4 @@
use cramium_hal::usb::driver::UsbDeviceState;
use bao1x_hal::usb::driver::UsbDeviceState;
use crate::usb;
@ -20,11 +20,11 @@ pub fn setup() -> (UsbDeviceState, u32) {
// state, and we also understand that the .data section doesn't exist in the loader and
// we've taken countermeasures to initialize everything "from code", i.e. not relying
// on static compile-time assignments for the static mut state.
unsafe { crate::platform::cramium::usb::init_usb() };
unsafe { crate::platform::bao1x::usb::init_usb() };
// Below is all unsafe because USB is global mutable state
unsafe {
if let Some(ref mut usb_ref) = crate::platform::cramium::usb::USB {
if let Some(ref mut usb_ref) = crate::platform::bao1x::usb::USB {
crate::println!("inside update");
let usb = &mut *core::ptr::addr_of_mut!(*usb_ref);
usb.reset();
@ -32,7 +32,7 @@ pub fn setup() -> (UsbDeviceState, u32) {
loop {
usb.udc_handle_interrupt();
if usb.pp() {
poweron += 1; // .pp() is a sham. MPW has no way to tell if power is applied. This needs to be fixed for NTO.
poweron += 1; // .pp() is a sham. MPW has no way to tell if power is applied. This needs to be fixed for bao1x.
}
crate::platform::delay(100);
if poweron >= 4 {
@ -59,7 +59,7 @@ pub fn setup() -> (UsbDeviceState, u32) {
pub fn usb_status() -> (UsbDeviceState, u32) {
unsafe {
if let Some(ref mut usb_ref) = crate::platform::cramium::usb::USB {
if let Some(ref mut usb_ref) = crate::platform::bao1x::usb::USB {
let usb = &mut *core::ptr::addr_of_mut!(*usb_ref);
(usb.get_device_state(), usb.portsc_val())
} else {
@ -70,7 +70,7 @@ pub fn usb_status() -> (UsbDeviceState, u32) {
pub fn flush_tx() {
unsafe {
if let Some(ref mut usb_ref) = crate::platform::cramium::usb::USB {
if let Some(ref mut usb_ref) = crate::platform::bao1x::usb::USB {
let usb = &mut *core::ptr::addr_of_mut!(*usb_ref);
crate::usb::handlers::flush_tx(usb);
} else {

View file

@ -1,7 +1,7 @@
use core::sync::atomic::Ordering;
use cramium_hal::usb::driver::CorigineUsb;
use cramium_hal::usb::driver::*;
use bao1x_hal::usb::driver::CorigineUsb;
use bao1x_hal::usb::driver::*;
use super::*;

View file

@ -610,11 +610,11 @@ impl Csw {
csw_buf.copy_from_slice(self.as_ref());
}
fn send(&self, usb: &mut cramium_hal::usb::driver::CorigineUsb) {
fn send(&self, usb: &mut bao1x_hal::usb::driver::CorigineUsb) {
let csw_buf = unsafe { core::slice::from_raw_parts_mut(CSW_ADDR as *mut u8, size_of::<Csw>()) };
csw_buf.copy_from_slice(self.as_ref());
usb.bulk_xfer(1, cramium_hal::usb::driver::USB_SEND, CSW_ADDR, size_of::<Csw>(), 0, 0);
usb.ms_state = cramium_hal::usb::driver::UmsState::StatusPhase;
usb.bulk_xfer(1, bao1x_hal::usb::driver::USB_SEND, CSW_ADDR, size_of::<Csw>(), 0, 0);
usb.ms_state = bao1x_hal::usb::driver::UmsState::StatusPhase;
}
}
const BULK_CSW_SIG: u32 = 0x53425355; /* Spells out 'USBS' */

View file

@ -1,12 +0,0 @@
pub mod cramium;
pub use cramium::*;
#[cfg(feature = "nto-trng")]
pub mod avtrng;
#[cfg(feature = "nto-bio")]
pub mod bio;
pub mod debug;
pub mod irq;
#[cfg(feature = "nto-usb")]
pub mod usb;
pub const UART_BAUD: u32 = 1_000_000;

View file

@ -4,14 +4,14 @@ use alloc::string::{String, ToString};
use alloc::vec::Vec;
#[allow(unused_imports)]
#[cfg(feature = "cramium-soc")]
use cramium_api::*;
#[cfg(feature = "bao1x")]
use bao1x_api::*;
#[allow(unused_imports)]
use utralib::*;
#[cfg(any(feature = "artybio", feature = "nto-bio"))]
#[cfg(any(feature = "artybio", feature = "bao1x-bio"))]
use xous_bio_bdma::*;
#[cfg(feature = "nto-trng")]
#[cfg(feature = "bao1x-trng")]
static TRNG_INIT: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicBool::new(false);
pub struct Error {
@ -74,7 +74,7 @@ impl Repl {
let cmd = parts.next().unwrap_or("").to_string();
let args: Vec<String> = parts.map(|s| s.to_string()).collect();
match cmd.as_str() {
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
"mon" => {
#[cfg(feature = "artybio")]
let bio_ss = BioSharedState::new();
@ -156,7 +156,7 @@ impl Repl {
));
}
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
"rram" => {
if args.len() == 2 || args.len() == 3 {
let addr = usize::from_str_radix(&args[0], 16)
@ -184,7 +184,7 @@ impl Repl {
poke.len() * core::mem::size_of::<u32>(),
)
};
let mut rram = cramium_hal::rram::Reram::new();
let mut rram = bao1x_hal::rram::Reram::new();
rram.write_slice(addr, poke_inner);
crate::println!("RRAM written {:x} into {:x}, {} times", value, addr, count);
} else {
@ -198,7 +198,7 @@ impl Repl {
));
}
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
"bogomips" => {
crate::println!("start test");
// start the RTC
@ -238,7 +238,7 @@ impl Repl {
crate::platform::setup_timer();
}
#[cfg(feature = "nto-bio")]
#[cfg(feature = "bao1x-bio")]
"bio" => {
const BIO_TESTS: usize =
// get_id
@ -291,7 +291,7 @@ impl Repl {
}
// map the BIO ports to GPIO pins
// let iox = cramium_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
// let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
// iox.set_ports_from_pio_bitmask(0xFFFF_FFFF);
crate::println!("Resetting block");
@ -343,7 +343,7 @@ impl Repl {
// Final report
crate::println!("\n--- BIO Tests Complete: {}/{} passed. ---\n", passing_tests, BIO_TESTS);
}
#[cfg(feature = "nto-bio")]
#[cfg(feature = "bao1x-bio")]
"bdma" => {
let mut seed = 0;
loop {
@ -360,7 +360,7 @@ impl Repl {
rcurst.wo(utra::sysctrl::SFR_RCURST0, 0x55AA);
// rcurst.wo(utra::sysctrl::SFR_RCURST1, 0x55AA);
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
"clocks" => {
if args.len() == 1 {
let f = u32::from_str_radix(&args[0], 10)
@ -377,11 +377,11 @@ impl Repl {
return Err(Error::help("clocks <CPU freq in MHz, 100-1600>"));
}
}
#[cfg(feature = "nto-buttons")]
#[cfg(feature = "bao1x-buttons")]
"buttons" => {
use cramium_hal::iox::Iox;
use bao1x_hal::iox::Iox;
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let (rows, cols) = cramium_hal::board::baosec::setup_kb_pins(&iox);
let (rows, cols) = bao1x_hal::board::baosec::setup_kb_pins(&iox);
loop {
let kps = crate::scan_keyboard(&iox, &rows, &cols);
for kp in kps {
@ -391,7 +391,7 @@ impl Repl {
}
}
}
#[cfg(feature = "nto-bio")]
#[cfg(feature = "bao1x-bio")]
"pin" => {
// We need at least a subcommand.
if args.is_empty() {
@ -402,7 +402,7 @@ impl Repl {
// Initialize BIO and IOX once, as they are common to all subcommands.
let mut bio_ss = BioSharedState::new();
let iox = cramium_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
iox.set_ports_from_pio_bitmask(0xFFFF_FFFF);
match subcommand {
@ -558,29 +558,29 @@ impl Repl {
}
}
}
#[cfg(all(feature = "cramium-soc", not(feature = "nto-evb")))]
#[cfg(all(feature = "bao1x", not(feature = "bao1x-evb")))]
"ldo" => {
if args.len() != 1 {
return Err(Error::help("vdd85 [on|off]"));
}
use cramium_hal::iox::Iox;
use bao1x_hal::iox::Iox;
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
if args[0] == "off" {
crate::println!("Check DCDC2");
let i2c_channel = cramium_hal::board::setup_i2c_pins(&iox);
use cramium_hal::udma::GlobalConfig;
let i2c_channel = bao1x_hal::board::setup_i2c_pins(&iox);
use bao1x_hal::udma::GlobalConfig;
let udma_global = GlobalConfig::new();
udma_global.clock(PeriphId::from(i2c_channel), true);
let i2c_ifram = unsafe {
cramium_hal::ifram::IframRange::from_raw_parts(
cramium_hal::board::I2C_IFRAM_ADDR,
cramium_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::board::I2C_IFRAM_ADDR,
4096,
)
};
let perclk = 100_000_000; // assume this value
let mut i2c = unsafe {
cramium_hal::udma::I2c::new_with_ifram(
bao1x_hal::udma::I2c::new_with_ifram(
i2c_channel,
400_000,
perclk,
@ -589,9 +589,9 @@ impl Repl {
)
};
if let Ok(mut pmic) = cramium_hal::axp2101::Axp2101::new(&mut i2c) {
if let Ok(mut pmic) = bao1x_hal::axp2101::Axp2101::new(&mut i2c) {
pmic.update(&mut i2c).ok();
if let Some((voltage, _dvm)) = pmic.get_dcdc(cramium_hal::axp2101::WhichDcDc::Dcdc2) {
if let Some((voltage, _dvm)) = pmic.get_dcdc(bao1x_hal::axp2101::WhichDcDc::Dcdc2) {
crate::println!(
"DCDC2 is on and {}.{}v",
voltage as i32,
@ -602,7 +602,7 @@ impl Repl {
match pmic.set_dcdc(
&mut i2c,
Some((0.88, true)),
cramium_hal::axp2101::WhichDcDc::Dcdc2,
bao1x_hal::axp2101::WhichDcDc::Dcdc2,
) {
Ok(_) => crate::println!("turned on DCDC2"),
Err(_) => {
@ -625,9 +625,9 @@ impl Repl {
iox.set_gpio_pin_value(IoxPort::PA, 5, IoxValue::High);
}
}
#[cfg(all(feature = "cramium-soc", not(feature = "nto-evb")))]
#[cfg(all(feature = "bao1x", not(feature = "bao1x-evb")))]
"wfi" => {
let iox = cramium_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let ao_bkupreg = CSR::new(utralib::HW_AOBUREG_BASE as *mut u32);
for i in 0..8 {
@ -715,19 +715,19 @@ impl Repl {
crate::println!("clocks @ 100MHz");
// configure PMIC to be off
let i2c_channel = cramium_hal::board::setup_i2c_pins(&iox);
use cramium_hal::udma::GlobalConfig;
let i2c_channel = bao1x_hal::board::setup_i2c_pins(&iox);
use bao1x_hal::udma::GlobalConfig;
let udma_global = GlobalConfig::new();
udma_global.clock(PeriphId::from(i2c_channel), true);
let i2c_ifram = unsafe {
cramium_hal::ifram::IframRange::from_raw_parts(
cramium_hal::board::I2C_IFRAM_ADDR,
cramium_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::board::I2C_IFRAM_ADDR,
bao1x_hal::board::I2C_IFRAM_ADDR,
4096,
)
};
let mut i2c = unsafe {
cramium_hal::udma::I2c::new_with_ifram(
bao1x_hal::udma::I2c::new_with_ifram(
i2c_channel,
400_000,
perclk,
@ -736,8 +736,8 @@ impl Repl {
)
};
if let Ok(mut pmic) = cramium_hal::axp2101::Axp2101::new(&mut i2c) {
match pmic.set_dcdc(&mut i2c, None, cramium_hal::axp2101::WhichDcDc::Dcdc2) {
if let Ok(mut pmic) = bao1x_hal::axp2101::Axp2101::new(&mut i2c) {
match pmic.set_dcdc(&mut i2c, None, bao1x_hal::axp2101::WhichDcDc::Dcdc2) {
Ok(_) => crate::println!("turned off DCDC2"),
Err(_) => crate::println!("couldn't turn off DCDC2"),
}
@ -784,7 +784,7 @@ impl Repl {
crate::platform::clockset_wrapper(800_000_000);
crate::println!("exiting wfi");
}
#[cfg(feature = "nto-trng")]
#[cfg(feature = "bao1x-trng")]
"trngro" => {
use base64::{Engine as _, engine::general_purpose};
fn encode_base64(input: &[u8]) -> String { general_purpose::STANDARD.encode(input) }
@ -793,7 +793,7 @@ impl Repl {
unsafe { core::slice::from_raw_parts(slice.as_ptr() as *const u8, len) }
}
let mut trng = cramium_hal::sce::trng::Trng::new(utralib::utra::trng::HW_TRNG_BASE);
let mut trng = bao1x_hal::sce::trng::Trng::new(utralib::utra::trng::HW_TRNG_BASE);
if TRNG_INIT.swap(true, core::sync::atomic::Ordering::SeqCst) == false {
crate::println!("setting up TRNG");
trng.setup_raw_generation(256);
@ -801,7 +801,7 @@ impl Repl {
} else {
// safety: the handle is already initialized
unsafe {
trng.force_mode(cramium_hal::sce::trng::Mode::Raw);
trng.force_mode(bao1x_hal::sce::trng::Mode::Raw);
}
}
crate::println!("====ROSTART====");
@ -853,7 +853,7 @@ impl Repl {
}
usb.bulk_xfer(
3,
cramium_hal::usb::driver::USB_SEND,
bao1x_hal::usb::driver::USB_SEND,
tx_buf.as_ptr() as usize,
b64_as_slice.len() + 1,
0,
@ -865,7 +865,7 @@ impl Repl {
}
}
}
#[cfg(feature = "nto-trng")]
#[cfg(feature = "bao1x-trng")]
"trngav" => {
use base64::{Engine as _, engine::general_purpose};
fn encode_base64(input: &[u8]) -> String { general_purpose::STANDARD.encode(input) }
@ -874,12 +874,12 @@ impl Repl {
unsafe { core::slice::from_raw_parts(slice.as_ptr() as *const u8, len) }
}
use cramium_hal::iox::Iox;
use bao1x_hal::iox::Iox;
use xous_bio_bdma::*;
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
let (power_port, power_pin) = cramium_hal::board::setup_trng_power_pin(&iox);
let bio_input = cramium_hal::board::setup_trng_input_pin(&iox);
let (power_port, power_pin) = bao1x_hal::board::setup_trng_power_pin(&iox);
let bio_input = bao1x_hal::board::setup_trng_input_pin(&iox);
// turn on the system
iox.set_gpio_pin_value(power_port, power_pin, IoxValue::High);
@ -926,7 +926,7 @@ impl Repl {
}
usb.bulk_xfer(
3,
cramium_hal::usb::driver::USB_SEND,
bao1x_hal::usb::driver::USB_SEND,
tx_buf.as_ptr() as usize,
b64_as_slice.len() + 1,
0,
@ -947,17 +947,17 @@ impl Repl {
_ => {
crate::println!("Command not recognized: {}", cmd);
crate::print!("Commands include: echo, poke, peek, bogomips");
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
crate::print!(", rram, clocks");
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
crate::print!(", mon");
#[cfg(feature = "nto-bio")]
#[cfg(feature = "bao1x-bio")]
crate::print!(", bio, bdma, pin");
#[cfg(all(feature = "cramium-soc", not(feature = "nto-evb")))]
#[cfg(all(feature = "bao1x", not(feature = "bao1x-evb")))]
crate::print!(", ldo, wfi");
#[cfg(feature = "nto-usb")]
#[cfg(feature = "bao1x-usb")]
crate::print!(", usb");
#[cfg(feature = "nto-trng")]
#[cfg(feature = "bao1x-trng")]
crate::print!(", trngro, trngav");
crate::println!("");
}

View file

@ -16,7 +16,7 @@ xous-kernel = { package = "xous", version = "0.9.66", features = [
] }
utralib = { version = "0.1.25", optional = true, default-features = false }
rand_chacha = { version = "0.3.1", optional = true, default-features = false }
cramium-hal = { path = "../libs/cramium-hal", optional = true, default-features = false }
bao1x-hal = { path = "../libs/bao1x-hal", optional = true, default-features = false }
loader = { path = "../loader", optional = true, features = ["swap"] }
aes = { path = "../services/aes", default-features = false, optional = true }
@ -45,18 +45,12 @@ critical-section = "1.1.1"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ci)', 'cfg(baremetal)'] }
[features]
vexii-test = [] # integration test for vexii, not a production configuration
cramium-soc = [
"utralib/cramium-soc",
"rand_chacha",
"raw-trng",
"aes/cramium-soc",
]
vexii-test = [] # integration test for vexii, not a production configuration
bao1x = ["utralib/bao1x", "rand_chacha", "raw-trng", "aes/bao1x"]
verilator-only = []
cramium-fpga = ["utralib/cramium-fpga", "rand_chacha"]
board-baosec = ["cramium-hal/kernel-baosec", "memmap-flash", "swap"]
board-baosor = ["cramium-hal/kernel-baosor"]
board-dabao = ["cramium-hal/kernel-dabao"]
board-baosec = ["bao1x-hal/kernel-baosec", "memmap-flash", "swap"]
board-baosor = ["bao1x-hal/kernel-baosor"]
board-dabao = ["bao1x-hal/kernel-dabao"]
hosted-baosec = []
atsama5d27 = ["utralib/atsama5d27"]

View file

@ -50,10 +50,10 @@ fn sip_read() -> usize {
existing
}
// using verilator-only as a proxy for the cramium-soc config;
// using verilator-only as a proxy for the bao1x config;
// when the flag is off, assume precursor config
#[cfg(all(feature = "vexii-test", feature = "verilator-only"))]
use crate::platform::cramium::{
use crate::platform::bao1x::{
LEGACY_INT_VMEM,
legacy_int::{SUPER_MASK, SUPER_PENDING},
};

View file

@ -12,7 +12,7 @@ pub mod syscall;
#[cfg(any(feature = "precursor", feature = "renode"))]
use utralib::generated::*;
#[cfg(any(feature = "cramium-soc", feature = "cramium-fpga"))]
#[cfg(any(feature = "bao1x"))]
use xous_kernel::PID;
#[cfg(any(feature = "precursor", feature = "renode"))]
use xous_kernel::{MemoryFlags, MemoryType, PID};
@ -64,7 +64,7 @@ pub fn init() {
pub fn idle() -> bool {
// Issue `wfi`. This will return as soon as an external interrupt
// is available.
#[cfg(any(feature = "cramium-fpga", feature = "cramium-soc", feature = "renode"))]
#[cfg(any(feature = "bao1x", feature = "renode"))]
// "traditional" path for stopping a clock
unsafe {
riscv::asm::wfi()

View file

@ -2,12 +2,8 @@
// SPDX-FileCopyrightText: 2024 bunnie <bunnie@kosagi.com>
// SPDX-License-Identifier: Apache-2.0
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub mod rand;
#[cfg(feature = "cramium-fpga")]
pub mod rand_fake;
#[cfg(feature = "cramium-fpga")]
pub use rand_fake as rand;
#[cfg(any(feature = "debug-print", feature = "print-panics"))]
pub mod uart;

View file

@ -5,7 +5,7 @@
use core::convert::TryInto;
use cramium_hal::sce;
use bao1x_hal::sce;
use rand_chacha::ChaCha8Rng;
use rand_chacha::rand_core::RngCore;
use rand_chacha::rand_core::SeedableRng;
@ -36,7 +36,7 @@ static LOCAL_RNG_STATE: [AtomicU32; 8] = [
///
/// Needed so that the kernel can allocate names.
/// This driver "owns" the hardware TRNG on the chip. Because there aren't two
/// TRNG ports on the Cramium implementation, it means that userspace applications
/// TRNG ports on the bao1x implementation, it means that userspace applications
/// have to extract random numbers from the kernel through the SID request mechanism.
/// This is ostensibly harmless, if everything is implemented well, but if there is
/// a problem it does mean that the state of the kernel TRNG is disclosed to userspace.

View file

@ -6,14 +6,12 @@
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
#![allow(static_mut_refs)]
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
use utralib::generated::*;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
use xous_kernel::{MemoryFlags, MemoryType};
#[cfg(feature = "cramium-fpga")]
use crate::io::{SerialRead, SerialWrite};
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
use crate::{
PID,
debug::shell::process_characters,
@ -24,43 +22,18 @@ use crate::{
/// UART virtual address.
///
/// See https://github.com/betrusted-io/xous-core/blob/master/docs/memory.md
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const UART_ADDR: usize = 0xffcf_0000;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const IRQ0_ADDR: usize = UART_ADDR + 0x1000;
/// UART instance.
///
/// Initialized by [`init`].
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub static mut UART: Option<Uart> = None;
/// All dummy stubs for cramium-fpga because we want the console to have the DUART
#[cfg(feature = "cramium-fpga")]
pub fn init() {}
#[cfg(feature = "cramium-fpga")]
pub struct Uart {}
#[cfg(feature = "cramium-fpga")]
#[allow(dead_code)]
impl Uart {
pub fn new(_addr: usize, _irq_addr: usize, _callback: fn(&mut Self)) -> Uart { Uart {} }
pub fn init(&mut self) {}
}
#[cfg(feature = "cramium-fpga")]
impl SerialWrite for Uart {
fn putc(&mut self, _c: u8) {}
}
#[cfg(feature = "cramium-fpga")]
impl SerialRead for Uart {
fn getc(&mut self) -> Option<u8> { None }
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub fn init() {
// Map the UART peripheral.
MemoryManager::with_mut(|memory_manager| {
@ -83,12 +56,12 @@ pub fn init() {
}
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub struct Uart {
uart_csr: CSR<u32>,
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
impl Uart {
pub fn new(addr: usize, _irq_addr: usize, _callback: fn(&mut Self)) -> Uart {
Uart { uart_csr: CSR::new(addr as *mut u32) }
@ -99,7 +72,7 @@ impl Uart {
}
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
impl SerialWrite for Uart {
fn putc(&mut self, c: u8) {
while self.uart_csr.r(utra::duart::SFR_SR) != 0 {}
@ -107,7 +80,7 @@ impl SerialWrite for Uart {
}
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
impl SerialRead for Uart {
fn getc(&mut self) -> Option<u8> { None }
}

View file

@ -7,12 +7,12 @@ pub mod precursor;
#[cfg(any(feature = "atsama5d27"))]
pub mod atsama5d2;
#[cfg(any(any(feature = "cramium-soc", feature = "cramium-fpga")))]
pub mod cramium;
#[cfg(any(any(feature = "bao1x")))]
pub mod bao1x;
#[cfg(any(any(feature = "cramium-soc", feature = "cramium-fpga")))]
pub use cramium::rand;
#[cfg(not(any(feature = "cramium-soc", feature = "cramium-fpga")))]
#[cfg(any(any(feature = "bao1x")))]
pub use bao1x::rand;
#[cfg(not(any(feature = "bao1x")))]
pub mod rand;
/// Platform specific initialization.
@ -24,6 +24,6 @@ pub fn init() {
#[cfg(any(feature = "atsama5d27"))]
self::atsama5d2::init();
#[cfg(any(feature = "cramium-fpga", feature = "cramium-soc"))]
self::cramium::init();
#[cfg(any(feature = "bao1x"))]
self::bao1x::init();
}

View file

@ -3,7 +3,7 @@
use core::cmp::Ordering;
use cramium_hal::udma::FLASH_SECTOR_LEN;
use bao1x_hal::udma::FLASH_SECTOR_LEN;
use loader::SWAP_FLG_WIRED;
use xous_kernel::SWAPPER_PID;
use xous_kernel::arch::EXCEPTION_STACK_TOP;

View file

@ -1,5 +1,5 @@
[package]
name = "cramium-api"
name = "bao1x-api"
version = "0.1.0"
edition = "2021"

View file

@ -135,7 +135,7 @@ impl IoxHal {
REFCOUNT.fetch_add(1, Ordering::Relaxed);
let xns = xous_names::XousNames::new().unwrap();
let conn =
xns.request_connection(SERVER_NAME_CRAM_HAL).expect("Couldn't connect to Cramium HAL server");
xns.request_connection(SERVER_NAME_BAO1X_HAL).expect("Couldn't connect to bao1x HAL server");
IoxHal { conn }
}

View file

@ -149,7 +149,7 @@ impl Keyboard {
}
pub fn set_vibe(&self, _enable: bool) -> Result<(), xous::Error> {
// no vibe on cramium target, ignore API call
// no vibe on bao1x target, ignore API call
Ok(())
}

View file

@ -18,7 +18,7 @@ pub const PERCLK: u32 = 100_000_000;
pub const SERVER_NAME_KBD: &str = "_Matrix keyboard driver_";
/// Do not change this constant, it is hard-coded into libraries in order to break
/// circular dependencies on the IFRAM block.
pub const SERVER_NAME_CRAM_HAL: &str = "_Cramium-SoC HAL_";
pub const SERVER_NAME_BAO1X_HAL: &str = "_bao1x-SoC HAL_";
pub mod camera {
#[derive(Clone, Copy)]

View file

@ -1,5 +1,5 @@
[package]
name = "cramium-hal"
name = "bao1x-hal"
version = "0.1.0"
edition = "2021"
@ -32,7 +32,7 @@ usb-device = { git = "https://github.com/betrusted-io/usb-device.git", branch =
bitfield = "0.13.2"
either = { version = "1.9.0", default-features = false }
ux-api = { path = "../ux-api", default-features = false, optional = true }
cramium-api = { path = "../cramium-api", default-features = false }
bao1x-api = { path = "../bao1x-api", default-features = false }
# [target.'cfg(target_os = "xous")'.dependencies]
xous = { version = "0.9.66", features = ["v2p"] }
@ -49,33 +49,33 @@ board-baosec = [
"display-sh1107",
"axp2101",
"bmp180",
"utralib/cramium-soc",
"utralib/bao1x",
"ux-api/board-baosec",
] # USB form factor token
loader-baosec = [
"utralib/cramium-soc",
"utralib/bao1x",
"camera-gc2145",
"display-sh1107",
"axp2101",
"bmp180",
"ux-api/loader-baosec",
]
kernel-baosec = ["utralib/cramium-soc"]
kernel-baosor = ["utralib/cramium-soc"]
kernel-dabao = ["utralib/cramium-soc"]
kernel-baosec = ["utralib/bao1x"]
kernel-baosor = ["utralib/bao1x"]
kernel-dabao = ["utralib/bao1x"]
test-baosec = ["ux-api/loader-baosec", "camera-gc2145"]
hosted-baosec = ["std"] # emulated hardware on x86 platform
board-baosor = [
"camera-gc2145",
"axp2101",
"utralib/cramium-soc",
"utralib/bao1x",
] # Precursor form factor
loader-baosor = []
board-dabao = ["utralib/cramium-soc"] # Dev board form factor
board-dabao = ["utralib/bao1x"] # Dev board form factor
loader-dabao = []
verilator-only = ["utralib/cramium-soc"]
mpw = ["utralib/cramium-soc"]
hdl-test = ["utralib/cramium-soc"]
verilator-only = ["utralib/bao1x"]
mpw = ["utralib/bao1x"]
hdl-test = ["utralib/bao1x"]
verbose-debug = []
debug-print-usb = []
@ -90,7 +90,7 @@ std = [
"usb-device",
"xous-api-ticktimer",
"ux-api/std",
"cramium-api/std",
"bao1x-api/std",
]
derive-rkyv = ["rkyv"]
default = []

View file

@ -1,4 +1,4 @@
use cramium_api::*;
use bao1x_api::*;
pub const AXP2101_DEV: u8 = 0x34;

View file

@ -1,4 +1,4 @@
use cramium_api::{I2cApi, I2cResult};
use bao1x_api::{I2cApi, I2cResult};
pub const BMP180_ADDR: u8 = 0x77;
const REG_CALIB_START: u8 = 0xAA;

View file

@ -1,5 +1,5 @@
// Constants that define pin locations, RAM offsets, etc. for the BaoSec board
use cramium_api::*;
use bao1x_api::*;
pub const I2C_AXP2101_ADR: u8 = 0x34;
pub const I2C_TUSB320_ADR: u8 = 0x47;
@ -232,7 +232,7 @@ pub fn setup_camera_pins<T: IoSetup + IoGpio>(iox: &T) -> (IoxPort, u8) {
}
/// returns the USB SE0 port and pin number
/// TODO: remove this - not actually present on NTO baosec
/// TODO: remove this - not actually present on bao1x baosec
const SE0_PIN: u8 = 6;
pub fn setup_usb_pins<T: IoSetup + IoGpio>(iox: &T) -> (IoxPort, u8) {
iox.setup_pin(

View file

@ -1,5 +1,5 @@
use cramium_api::camera::*;
use cramium_api::*;
use bao1x_api::camera::*;
use bao1x_api::*;
use utralib::CSR;
use utralib::utra;
use utralib::utra::udma_camera::REG_CAM_CFG_GLOB;
@ -183,7 +183,7 @@ impl Gc2145 {
// divide the clock down, so that the system can keep up.
// self.poke(i2c, 0xFA, 0x32); // this offers a higher frame rate, but a greater bus congestion -
// maybe available on NTO
// maybe available on bao1x
// self.poke(i2c, 0xFA, 0x63); // this is necessary for MPW due to SPI backpressure bug
self.poke(i2c, 0xFA, 0x52); // this is necessary for MPW due to SPI backpressure bug
}

View file

@ -1,4 +1,4 @@
use cramium_api::*;
use bao1x_api::*;
#[cfg(feature = "std")]
use xous::Result;
use xous::{MemoryRange, Message, send_message};
@ -45,10 +45,10 @@ impl IframRange {
REFCOUNT.fetch_add(1, Ordering::Relaxed);
let xns = xous_api_names::XousNames::new().unwrap();
// This constant is in fact hard-coded because we are trying to break a circular
// dependency on the cram-hal-service crate and make this library "neutral" so it
// dependency on the bao1x-hal-service crate and make this library "neutral" so it
// can be included in any context.
let conn =
xns.request_connection("_Cramium-SoC HAL_").expect("Couldn't connect to Cramium HAL server");
xns.request_connection("_bao1x-SoC HAL_").expect("Couldn't connect to bao1x HAL server");
let bank_code = match bank {
Some(IframBank::Bank0) => 0,
Some(IframBank::Bank1) => 1,

View file

@ -1,4 +1,4 @@
use cramium_api::*;
use bao1x_api::*;
use utralib::generated::utra::iox;
use crate::SharedCsr;
@ -199,7 +199,7 @@ impl Iox {
if enable {
let map: Option<(IoxPort, u8)> = match i {
// For NTO the ports should be in correct order
// For bao1x the ports should be in correct order
0 => Some((IoxPort::PB, 0)),
1 => Some((IoxPort::PB, 1)),
2 => Some((IoxPort::PB, 2)),

View file

@ -50,13 +50,13 @@ pub fn cache_flush() {
}
/// A function for dumping stack. Used to help diagnose tricky problems. Invoke as:
/// `unsafe { cramium_hal::dump_stack!(0x300) };` inside any stack frame where
/// `unsafe { bao1x_hal::dump_stack!(0x300) };` inside any stack frame where
/// you want to dump some stack. The extents are specified as number of bytes,
/// and should be word-aligned.
#[macro_export]
macro_rules! dump_stack {
($extent_bytes:expr) => {{
$crate::dump_stack!($extent_bytes, cramium_hal::read_sp);
$crate::dump_stack!($extent_bytes, bao1x_hal::read_sp);
}};
// Explicit SP reader path
($extent_bytes:expr, $read_sp:path) => {{

View file

@ -1,5 +1,5 @@
use cramium_api::camera::*;
use cramium_api::*;
use bao1x_api::camera::*;
use bao1x_api::*;
use utralib::CSR;
use utralib::utra;
use utralib::utra::udma_camera::REG_CAM_CFG_GLOB;

View file

@ -1,6 +1,6 @@
// `Command` vendored from https://github.com/ithinuel/sh1107-rs/tree/main
use cramium_api::EventChannel;
use cramium_api::*;
use bao1x_api::EventChannel;
use bao1x_api::*;
use ux_api::minigfx::{ColorNative, FrameBuffer, Point};
use ux_api::platform::*;

View file

@ -1,4 +1,4 @@
use cramium_api::*;
use bao1x_api::*;
use utralib::*;
use crate::ifram::IframRange;
@ -13,7 +13,7 @@ const TIMEOUT_ITERS: usize = 5000;
// MPW had this register:
// pub const REG_SETUP: crate::Register = crate::Register::new(13, 0x1);
// pub const REG_SETUP_R_DO_RST: crate::Field = crate::Field::new(1, 0, REG_SETUP);
// It is gone in NTO and we use the UDMA system reset instead
// It is gone in bao1x and we use the UDMA system reset instead
#[cfg(feature = "mpw")]
const SETUP_OFFSET: usize = 13;
#[cfg(feature = "mpw")]
@ -70,9 +70,9 @@ const MAX_I2C_CMDLEN: usize = 512;
pub struct I2c<'a> {
csr: CSR<u32>,
#[allow(dead_code)] // used in NTO
#[allow(dead_code)] // used in bao1x
udma_global: &'a dyn UdmaGlobalConfig,
#[allow(dead_code)] // used in NTO
#[allow(dead_code)] // used in bao1x
channel: I2cChannel,
divider: u16,
perclk_freq: u32,
@ -141,7 +141,7 @@ impl<'a> I2c<'a> {
#[cfg(not(target_os = "xous"))]
#[allow(unused_mut)] // because it is used when `mpw` feature is selected
let mut csr = CSR::new(base_addr as *mut u32);
// reset the block, if MPW. If NTO, this is handled by udma global
// reset the block, if MPW. If bao1x, this is handled by udma global
#[cfg(feature = "mpw")]
unsafe {
csr.base().add(SETUP_OFFSET).write_volatile(DO_RST_MASK as u32);
@ -237,7 +237,7 @@ impl<'a> I2c<'a> {
self.udma_reset(Bank::Custom);
self.udma_reset(Bank::Tx);
self.udma_reset(Bank::Rx);
// reset the block, if MPW. If NTO, this needs to be handled by the upper level code with a
// reset the block, if MPW. If bao1x, this needs to be handled by the upper level code with a
// reset to udma_global
#[cfg(feature = "mpw")]
unsafe {
@ -328,7 +328,7 @@ impl<'a> I2c<'a> {
}
pub fn reset(&mut self) {
// reset the block, if MPW. If NTO, this needs to be handled by the upper level code with a
// reset the block, if MPW. If bao1x, this needs to be handled by the upper level code with a
// reset to udma_global
#[cfg(feature = "mpw")]
unsafe {

View file

@ -4,7 +4,7 @@ pub mod uart;
use core::mem::size_of;
use cramium_api::*;
use bao1x_api::*;
pub use i2c::*;
pub use spim::*;
pub use uart::*;
@ -218,7 +218,7 @@ pub(crate) const CFG_PENDING: u32 = 0b10_0000; // indicates a transfer pending
pub(crate) const CFG_SHADOW: u32 = 0b10_0000; // indicates a shadow transfer
#[allow(dead_code)]
pub(crate) const CFG_BACKPRESSURE: u32 = 0b1000_0000; // use RX backpressure to stall interface (found on SPIM in NTO)
pub(crate) const CFG_BACKPRESSURE: u32 = 0b1000_0000; // use RX backpressure to stall interface (found on SPIM in bao1x)
#[repr(usize)]
pub enum Bank {

View file

@ -1,4 +1,4 @@
use cramium_api::*;
use bao1x_api::*;
use utralib::*;
use crate::ifram::IframRange;

View file

@ -349,7 +349,7 @@ impl UartIrq {
/// pattern looks:
///
/// ```rust
/// let mut uart_irq = Box::pin(cramium_hal::udma::UartIrq::new());
/// let mut uart_irq = Box::pin(bao1x_hal::udma::UartIrq::new());
/// Pin::as_mut(&mut uart_irq).register_handler(udma::UartChannel::Uart1, uart_handler);
/// ```
///

View file

@ -1159,9 +1159,9 @@ impl CorigineUsb {
}
/*
Configured as: 1 interrupt, 4 phys EPIN, 4 phys EPOUT
INFO:cramium_hal::usb::driver: devcap: 20014401 (libs/cramium-hal/src/usb/driver.rs:781)
INFO:cramium_hal::usb::driver: max speed: 1 (libs/cramium-hal/src/usb/driver.rs:782)
INFO:cramium_hal::usb::driver: usb3 disable: 8 (libs/cramium-hal/src/usb/driver.rs:783)
INFO:bao1x_hal::usb::driver: devcap: 20014401 (libs/bao1x-hal/src/usb/driver.rs:781)
INFO:bao1x_hal::usb::driver: max speed: 1 (libs/bao1x-hal/src/usb/driver.rs:782)
INFO:bao1x_hal::usb::driver: usb3 disable: 8 (libs/bao1x-hal/src/usb/driver.rs:783)
*/
// NOTE: the indices are byte-addressed, and so need to be divided by size_of::<u32>()
@ -2185,7 +2185,7 @@ impl CorigineUsb {
/*
Functions below implement the "device management" APIs.
These are mostly dummy thunks on the Cramium target because only a single core is possible
These are mostly dummy thunks on the bao1x target because only a single core is possible
on this SoC.
This would be cleaner if we implemented it as a trait, I think - but we've got a lot to do

View file

@ -20,7 +20,7 @@ rkyv = { version = "0.8.8", default-features = false, features = [
[features]
# selection of board settings for display resolution
cramium-soc = []
bao1x = []
board-baosec = []
board-baosor = []
hosted-baosec = []

View file

@ -3,74 +3,74 @@
// The order of these modules affects the link order in the loader, which is referred to in the graphics engine.
// To make changes, see <xous_root>/libs/blitstr2/codegen/main.go
#![allow(dead_code)]
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const FONT_BASE: usize = 0x2053_0000;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const FONT_BASE: usize = 0x6004_0000;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const EMOJI_OFFSET: usize = 0x0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const EMOJI_LEN: usize = 0xab00;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const ZH_OFFSET: usize = 0xab00;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const ZH_LEN: usize = 0x3fea0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const JA_OFFSET: usize = 0x4a9a0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const JA_LEN: usize = 0x56920;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const KR_OFFSET: usize = 0xa12c0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const KR_LEN: usize = 0x61600;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const BOLD_OFFSET: usize = 0x1028c0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const BOLD_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const MONO_OFFSET: usize = 0x1042a0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const MONO_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const REGULAR_OFFSET: usize = 0x105c80;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const REGULAR_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const TALL_OFFSET: usize = 0x107660;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const TALL_LEN: usize = 0x6780;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const SMALL_OFFSET: usize = 0x10dde0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const SMALL_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const FONT_TOTAL_LEN: usize = 0x10f7c0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const EMOJI_OFFSET: usize = 0x0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const EMOJI_LEN: usize = 0xab00;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const BOLD_OFFSET: usize = 0xab00;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const BOLD_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const MONO_OFFSET: usize = 0xc4e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const MONO_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const REGULAR_OFFSET: usize = 0xdec0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const REGULAR_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const TALL_OFFSET: usize = 0xf8a0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const TALL_LEN: usize = 0x6780;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const SMALL_OFFSET: usize = 0x16020;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const SMALL_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const FONT_TOTAL_LEN: usize = 0x17a00;

View file

@ -230,12 +230,12 @@ pub const CODEPOINTS: [u32; 207] = [
0x0FFFD,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 1656;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -1543,12 +1543,12 @@ pub const CODEPOINTS: [u32; 1368] = [
0x1FAF6,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 10944;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -11131,12 +11131,12 @@ pub const CODEPOINTS: [u32; 11081] = [
0x0FFE5,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 88648;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -12586,12 +12586,12 @@ pub const CODEPOINTS: [u32; 12464] = [
0x0FFE6,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 99712;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -230,12 +230,12 @@ pub const CODEPOINTS: [u32; 207] = [
0x0FFFD,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 1656;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -230,12 +230,12 @@ pub const CODEPOINTS: [u32; 207] = [
0x0FFFD,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 1656;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -230,12 +230,12 @@ pub const CODEPOINTS: [u32; 207] = [
0x0FFFD,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 1656;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -228,12 +228,12 @@ pub const CODEPOINTS: [u32; 207] = [
0x0FFFD,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 6624;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -8357,12 +8357,12 @@ pub const CODEPOINTS: [u32; 8181] = [
0x0FF60,
];
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
pub static GLYPH_LOCATION: core::sync::atomic::AtomicU32 = core::sync::atomic::AtomicU32::new(0);
pub const GLYPH_LEN: usize = 65448;
pub fn glyphs() -> &'static [u32] {
#[cfg(any(feature="precursor", feature="renode", feature="cramium-soc", feature="board-baosec"))]
#[cfg(any(feature="precursor", feature="renode", feature="bao1x", feature="board-baosec"))]
unsafe {
let data: *const u32 = core::mem::transmute(GLYPH_LOCATION.load(core::sync::atomic::Ordering::SeqCst));
core::slice::from_raw_parts(data, GLYPH_LEN)

View file

@ -1,4 +1,4 @@
// note: cramium-soc is a bit of a misplaced feature as it is a chip not a platform,
// note: bao1x is a bit of a misplaced feature as it is a chip not a platform,
// but it's included here to make vscode code analyzer a bit happier
#[cfg(any(feature = "board-baosec", feature = "hosted-baosec"))]
mod baosec;

View file

@ -62,7 +62,7 @@ hosted-baosec = ["blitstr2/hosted-baosec"]
# Used by font codegen routine
hosted = ["blitstr2/hosted"]
renode = ["blitstr2/renode"]
cramium-soc = []
bao1x = []
precursor = ["blitstr2/precursor"]
derive-rkyv = ["rkyv"]

View file

@ -3,74 +3,74 @@
// The order of these modules affects the link order in the loader, which is referred to in the graphics engine.
// To make changes, see <xous_root>/services/graphics-server/src/blitstr2/codegen/main.go
#![allow(dead_code)]
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const FONT_BASE: usize = 0x2053_0000;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const FONT_BASE: usize = 0x6002_0000;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const EMOJI_OFFSET: usize = 0x0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const EMOJI_LEN: usize = 0xab00;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const ZH_OFFSET: usize = 0xab00;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const ZH_LEN: usize = 0x3fea0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const JA_OFFSET: usize = 0x4a9a0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const JA_LEN: usize = 0x56920;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const KR_OFFSET: usize = 0xa12c0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const KR_LEN: usize = 0x61600;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const BOLD_OFFSET: usize = 0x1028c0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const BOLD_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const MONO_OFFSET: usize = 0x1042a0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const MONO_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const REGULAR_OFFSET: usize = 0x105c80;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const REGULAR_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const TALL_OFFSET: usize = 0x107660;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const TALL_LEN: usize = 0x6780;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const SMALL_OFFSET: usize = 0x10dde0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const SMALL_LEN: usize = 0x19e0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
pub const FONT_TOTAL_LEN: usize = 0x10f7c0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const EMOJI_OFFSET: usize = 0x0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const EMOJI_LEN: usize = 0xab00;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const BOLD_OFFSET: usize = 0xab00;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const BOLD_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const MONO_OFFSET: usize = 0xc4e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const MONO_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const REGULAR_OFFSET: usize = 0xdec0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const REGULAR_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const TALL_OFFSET: usize = 0xf8a0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const TALL_LEN: usize = 0x6780;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const SMALL_OFFSET: usize = 0x16020;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const SMALL_LEN: usize = 0x19e0;
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
pub const FONT_TOTAL_LEN: usize = 0x17a00;

View file

@ -194,8 +194,7 @@ pub fn draw_text_view<T: FrameBuffer>(display: &mut T, msg: &mut xous::envelope:
let mut tv = buffer.to_original::<TextView, _>().unwrap();
if tv.clip_rect.is_none() {
if cfg!(feature = "hosted-baosec") || cfg!(feature = "cramium-soc") || cfg!(feature = "board-baosec")
{
if cfg!(feature = "hosted-baosec") || cfg!(feature = "bao1x") || cfg!(feature = "board-baosec") {
tv.clip_rect = Some(Rectangle::new(Point::new(0, 0), display.dimensions() - Point::new(1, 1)));
} else {
return;

View file

@ -82,7 +82,7 @@ pub enum GfxOpcode {
TestPattern,
/// SuspendResume callback
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
SuspendResume,
/// draw the boot logo (for continuity as apps initialize)

View file

@ -36,7 +36,7 @@ pub const BIP39_TABLE: [&'static str; 2048] = [
"column", "combine", "come", "comfort", "comic", "common", "company", "concert", "conduct", "confirm",
"congress", "connect", "consider", "control", "convince", "cook", "cool", "copper", "copy", "coral",
"core", "corn", "correct", "cost", "cotton", "couch", "country", "couple", "course", "cousin", "cover",
"coyote", "crack", "cradle", "craft", "cram", "crane", "crash", "crater", "crawl", "crazy", "cream",
"coyote", "crack", "cradle", "craft", "bao1x", "crane", "crash", "crater", "crawl", "crazy", "cream",
"credit", "creek", "crew", "cricket", "crime", "crisp", "critic", "crop", "cross", "crouch", "crowd",
"crucial", "cruel", "cruise", "crumble", "crunch", "crush", "cry", "crystal", "cube", "culture", "cup",
"cupboard", "curious", "current", "curtain", "curve", "cushion", "custom", "cute", "cycle", "dad",

View file

@ -249,12 +249,12 @@ impl Typesetter {
let mut ellipsis = style_glyph('…', base_style);
ellipsis.kern = 0;
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
let mut large_space = style_glyph(' ', &GlyphStyle::Cjk);
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
let mut large_space = style_glyph(' ', &GlyphStyle::Tall);
if cfg!(feature = "cramium-soc") {
if cfg!(feature = "bao1x") {
large_space.wide = glyph_to_height_hint(GlyphStyle::Tall) as u8;
} else {
large_space.wide = glyph_to_height_hint(GlyphStyle::Cjk) as u8;

View file

@ -14,13 +14,12 @@ utralib = { version = "0.1.25", default-features = false }
xous = "0.9.66"
[features]
cramium-soc = ["utralib/cramium-soc"]
cramium-fpga = ["utralib/cramium-fpga"]
bao1x = ["utralib/bao1x"]
artybio = ["utralib/artybio"]
precursor = []
hosted = []
renode = []
# may be activated in conjunction with "cramium-soc", "rp2040" targets when not running Xous
# may be activated in conjunction with "bao1x", "rp2040" targets when not running Xous
baremetal = []
std = []
arty = []
@ -28,4 +27,4 @@ bio-mul = []
debug-print = []
tests = []
default = ["tests", "cramium-soc"]
default = ["tests", "bao1x"]

View file

@ -8,21 +8,18 @@ edition = "2021"
[dependencies]
log = "0.4.14"
defmt = { version = "0.3", optional = true }
utralib = { version = "0.1.25", default-features = false, features = [
"cramium-soc",
] }
utralib = { version = "0.1.25", default-features = false, features = ["bao1x"] }
[target.'cfg(target_os = "xous")'.dependencies]
xous = "0.9.66"
[features]
cramium-soc = ["utralib/cramium-soc"]
cramium-fpga = ["utralib/cramium-fpga"]
bao1x = ["utralib/bao1x"]
precursor = []
hosted = []
renode = []
# may be activated in conjunction with "cramium-soc", "rp2040" targets when not running Xous
# may be activated in conjunction with "bao1x", "rp2040" targets when not running Xous
baremetal = []
tests = []
default = ["tests", "cramium-soc"]
default = ["tests", "bao1x"]

View file

@ -16,15 +16,14 @@ utralib = { version = "0.1.25", default-features = false }
xous = "0.9.66"
[features]
cramium-soc = ["utralib/cramium-soc"]
cramium-fpga = ["utralib/cramium-fpga"]
bao1x = ["utralib/bao1x"]
rp2040 = ["defmt"]
arty = []
precursor = []
hosted = []
renode = []
# may be activated in conjunction with "cramium-soc", "rp2040" targets when not running Xous
# may be activated in conjunction with "bao1x", "rp2040" targets when not running Xous
baremetal = []
tests = []
default = ["tests", "cramium-soc"]
default = ["tests", "bao1x"]

View file

@ -12,14 +12,13 @@ bitfield = "0.13.2"
# xous-pio = { path = "../xous-pio", optional = true, default-features = false }
pio-proc = "0.2.2"
pio = "0.2.1"
cramium-hal = { path = "../cramium-hal", optional = true, default-features = false }
bao1x-hal = { path = "../bao1x-hal", optional = true, default-features = false }
[target.'cfg(target_os = "xous")'.dependencies]
xous = "0.9.66"
[features]
cramium-soc = ["utralib/cramium-soc"]
cramium-fpga = ["utralib/cramium-fpga"]
bao1x = ["utralib/bao1x"]
precursor = []
hosted = []
renode = []
@ -28,5 +27,5 @@ dma-mainram = []
baremetal = []
debug-print = []
tests = ["cramium-hal"]
tests = ["bao1x-hal"]
default = ["tests"]

View file

@ -150,7 +150,7 @@ pub fn basic_tests(pl230: &mut Pl230) -> bool {
#[cfg(feature = "pio")]
pub fn pio_test(pl230: &mut Pl230) -> bool {
use cramium_hal::iox;
use bao1x_hal::iox;
use xous_pio::*;
report_api("channels", pl230.csr.rf(utra::pl230::STATUS_CHNLS_MINUS1) + 1);

View file

@ -18,19 +18,19 @@ utralib = { version = "0.1.25", optional = true, default-features = false }
armv7 = { git = "https://github.com/Foundation-Devices/armv7.git", branch = "update", optional = true }
atsama5d27 = { git = "https://github.com/Foundation-Devices/atsama5d27.git", branch = "master", optional = true }
sha2-loader = { path = "./sha2-loader", default-features = false, optional = true }
cramium-hal = { path = "../libs/cramium-hal", optional = true, default-features = false }
cramium-api = { path = "../libs/cramium-api", optional = true, default-features = false }
bao1x-hal = { path = "../libs/bao1x-hal", optional = true, default-features = false }
bao1x-api = { path = "../libs/bao1x-api", optional = true, default-features = false }
ux-api = { path = "../libs/ux-api", optional = true, default-features = false }
xous-pl230 = { path = "../libs/xous-pl230", optional = true, features = [
"tests",
"pio",
"cramium-soc",
"bao1x",
"baremetal",
# "dma-mainram", # PL-230 option - this fails on MPW
] }
# xous-pio = { path = "../libs/xous-pio", optional = true, features = [
# "tests",
# "cramium-soc",
# "bao1x",
# "baremetal",
# ] }
aes-gcm-siv = { version = "0.11.1", default-features = false, features = [
@ -82,20 +82,20 @@ renode = [
"secboot",
"sha2-loader",
]
cramium-soc = [
bao1x = [
"dep:aes",
"aes/cramium-soc",
"utralib/cramium-soc",
# "cramium-hal/debug-print-usb",
"aes/bao1x",
"utralib/bao1x",
# "bao1x-hal/debug-print-usb",
"debug-print",
"cramium-hal",
"cramium-api",
"bao1x-hal",
"bao1x-api",
"rand_chacha",
"sram-margin",
# "boot-delay",
]
board-baosec = [
"cramium-hal/loader-baosec",
"bao1x-hal/loader-baosec",
"updates",
"usb",
"simple-fatfs",
@ -105,9 +105,8 @@ board-baosec = [
"digest",
"ux-api/loader-baosec",
]
board-baosor = ["cramium-hal/loader-baosor"]
board-dabao = ["cramium-hal/loader-dabao"]
cramium-fpga = ["utralib/cramium-fpga", "debug-print", "linked_list_allocator"]
board-baosor = ["bao1x-hal/loader-baosor"]
board-dabao = ["bao1x-hal/loader-dabao"]
atsama5d27 = ["utralib/atsama5d27", "armv7", "dep:atsama5d27"]
# precursor flags
@ -120,9 +119,9 @@ secboot = []
# swap flag
swap = ["dep:aes-gcm-siv"]
# cramium target flags
# bao1x target flags
board-bringup = []
sh1107-bringup = [] # used to discover FB parameters
sh1107-bringup = [] # used to discover FB parameters
sram-margin = []
boot-delay = []
simulation-only = []
@ -136,13 +135,13 @@ dump-trng = []
fast-fclk = []
clock-tests = []
reset-debug = []
cam-test = ["nalgebra", "libm", "cramium-hal/debug-print-usb"]
cam-test = ["nalgebra", "libm", "bao1x-hal/debug-print-usb"]
usb = ["critical-section"]
qr = ["nalgebra", "libm"]
updates = []
cramium-mpw = ["cramium-hal/mpw"]
userspace-swap-debug = [] # sets up app UART mapping.
always-update = [] # always go into update mode, for fast dev loops
bao1x-mpw = ["bao1x-hal/mpw"]
userspace-swap-debug = [] # sets up app UART mapping.
always-update = [] # always go into update mode, for fast dev loops
# general flags
debug-print = []

View file

@ -10,11 +10,9 @@ fn main() {
let linker_file_path = if target.starts_with("riscv") {
println!("cargo:rustc-link-search={}", out_dir.display());
#[cfg(feature = "cramium-soc")]
let p = PathBuf::from("src/platform/cramium/link-soc.x");
#[cfg(feature = "cramium-fpga")]
let p = PathBuf::from("src/platform/cramium/link-fpga.x");
#[cfg(not(any(feature = "cramium-soc", feature = "cramium-fpga")))]
#[cfg(feature = "bao1x")]
let p = PathBuf::from("src/platform/bao1x/link.x");
#[cfg(not(any(feature = "bao1x")))]
let p = PathBuf::from("src/platform/precursor/link.x");
println!("cargo:rerun-if-changed={}", p.clone().into_os_string().into_string().unwrap());

View file

@ -10,7 +10,7 @@ use crate::platform;
pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
#[cfg(any(feature = "precursor", feature = "renode"))]
let _kernel_args = _kernel_args;
#[cfg(any(feature = "cramium-soc", feature = "cramium-fpga"))]
#[cfg(any(feature = "bao1x"))]
let _kernel_args = platform::FLASH_BASE + platform::KERNEL_OFFSET;
unsafe {
@ -23,10 +23,10 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
ram_top = in(reg) (platform::RAM_BASE + platform::RAM_SIZE),
);
}
// Stub for clearing IFRAM & RAM on Cramium target. This is required
// Stub for clearing IFRAM & RAM on bao1x target. This is required
// to clear the parity check bits, which are randomly set on boot. System will
// eventually hang if these bits aren't cleared.
#[cfg(all(any(feature = "cramium-soc", feature = "cramium-fpga"), not(feature = "simulation-only")))]
#[cfg(all(any(feature = "bao1x"), not(feature = "simulation-only")))]
unsafe {
#[rustfmt::skip]
asm! (
@ -87,14 +87,14 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
}
}
// This is code for debugging RV32 core reset on the cramium target.
// This is code for debugging RV32 core reset on the bao1x target.
#[cfg(feature = "reset-debug")]
#[link_section = ".text.init"]
#[export_name = "_start"]
pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
#[cfg(any(feature = "precursor", feature = "renode"))]
let _kernel_args = _kernel_args;
#[cfg(any(feature = "cramium-soc", feature = "cramium-fpga"))]
#[cfg(any(feature = "bao1x"))]
let _kernel_args = platform::FLASH_BASE + platform::KERNEL_OFFSET;
unsafe {
#[rustfmt::skip]
@ -228,7 +228,7 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
#[export_name = "abort"]
/// This is only used in debug mode
pub extern "C" fn abort() -> ! {
#[cfg(not(feature = "cramium-soc"))]
#[cfg(not(feature = "bao1x"))]
unsafe {
#[rustfmt::skip]
asm!(
@ -237,7 +237,7 @@ pub extern "C" fn abort() -> ! {
options(noreturn)
);
}
#[cfg(feature = "cramium-soc")]
#[cfg(feature = "bao1x")]
unsafe {
use utralib::generated::*;
let uart = utra::duart::HW_DUART_BASE as *mut u32;

View file

@ -15,7 +15,7 @@ impl Uart {
uart.wo(utra::uart::RXTX, c as u32)
}
#[cfg(any(feature = "cramium-soc", feature = "cramium-fpga"))]
#[cfg(any(feature = "bao1x"))]
pub fn putc(&self, c: u8) {
let base = utra::duart::HW_DUART_BASE as *mut u32;
let mut uart = CSR::new(base);

Some files were not shown because too many files have changed in this diff Show more