it's one of those bugs where you're like oh...right. it's doing exactly what i told it to. I just told it to do the wrong thing. Right. If you're updating data at the end of a file, you kind of don't want to delete the file entirely then do the update. Fix the code so that in the case of a file extension of a small key, you're re-inserting the key in its entirety (not just the updated portion) on the extension case. Also handled an issue with large files where key extension should not lead to overwrite of the neighboring data, and put a cap of the large file limit of 32GiB. See comments for thoughts on the trade-off of the large file limit versus the allocation limit of the number of files and the physically realistic outcomes for the PDDB. Basically as written the PDDB can handle 32GiB files (big enough to hold a blu-ray movie, but not a 4k/8k movie, uncompressed movies, and/or large virtual machine images), and can handle creation of files at an average rate of one per second for 10 years without stop before running out of virtual memory space. This isn't "Web scale" as large servers will definitely require files bigger than 32GiB these days, and can easily create files at a rate of thousands per second. But, the PDDB isn't performant enough nor targeted toward large scale server applications. It should, however, be adequate for pretty much any user data on a mobile phone if it were recompiled for a 64-bit target. And, if you needed to scale up to bigger files and/or more write cycles, the problem can be solved with some simple memory allocation tricks on the large pool, but because Precursor only has 16MiB of its own RAM to play with, we don't implement that as the RAM overhead is both detrimental and unnecessary at our scale of operation. |
||
|---|---|---|
| .cargo | ||
| .vscode | ||
| devkey | ||
| docs | ||
| emulation | ||
| imports | ||
| kernel | ||
| LICENSES | ||
| loader | ||
| locales | ||
| macros | ||
| precursors | ||
| services | ||
| svd2repl | ||
| svd2utra | ||
| tools | ||
| utralib | ||
| xous-ipc | ||
| xous-rs | ||
| xtask | ||
| .gitattributes | ||
| .gitignore | ||
| API.md | ||
| buildpush.ps1 | ||
| buildpush.sh | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| README.md | ||
| RELEASE-v0.8.md | ||
| RELEASE-v0.9.md | ||
| rustfmt.toml | ||
| start-gdb.sh | ||
| wb-gdb.sh | ||
Xous Core
Core files for the Xous microkernel operating system.
You might find this collection of Xous documentation handy.
This repository contains everything necessary to build the Xous kernel from source. It consists of the following projects:
- kernel: core memory manager, irq manager, and syscallhandler
- loader: initial loader used to start the kernel
- tools: programs used to construct a final boot image
- docs: documentation on various aspects of Xous
- emulation: Renode scripts used to emulate Xous
- xous-rs: userspace library
Dependencies
- Xous requires its own Rust target,
riscv32imac-unknown-xous-elf. If you runcargo xtaskfrom the command line, you should be prompted to install the target automatically if it does not already exist. - You may need to remove the
target/directory before building, ifrustccontinues to behave like it can't find thexoustarget even after it is installed. - If you plan on doing USB firmware updates, you'll need
progressbar2(updates) andpyusb(updates). Note thatpyusbhas name space conflicts with similarly named packages, so if updates aren't working you may need to create avenvor uninstall conflicting packages. - If you are doing development on the digital signatures with the Python helper scripts, you will need:
pycryptodome(signing - PEM read),cryptography(signing - x509 read),pynacl(signing - ed25519 signatures) (most users won't need this).
Quickstart using Hosted Mode
You can try out Xous in a "hosted mode" wherein programs are compiled for your native platform and are run locally as processes within your current operating system. System calls are replaced with network calls to a kernel that simply shuffles messages around.
Xous uses the xtask convention,
where various complex build commands are stored under cargo xtask.
This allows for us to create arbitrarily complex build sequences
without resorting to make (which is platform-dependent),
sh (which requires a lot of external tooling), or another build
system.
To build a set of sample programs and run them all using the kernel for communication, clone this repository and run:
cargo xtask run
This will build several servers and a "shell" program to control them
all. Most notably, a graphics-server will appear and kernel messages
will begin scrolling in your terminal.
Quickstart using an emulator
Xous uses Renode as the preferred emulator, because it is easy to extend the hardware peripherals without recompiling the entire emulator.
Download Renode and ensure it is in your path. Then, build Xous:
cargo xtask renode-image
This will compile everything in release mode for RISC-V, compile the tools
require to package it all up, then create an image file.
Finally, run Renode and specify the xous-release.resc REnode SCript:
renode emulation/xous-release.resc
Renode will start emulation automatically, and will run the same set of programs as in "Hosted mode".
Generating a hardware image
To build for real hardware, you must specify an .svd file. This
file is generated by the SoC build process and describes a single
Betrusted core. These addresses will change as hardware is modified,
so if you distribute a modified Betrusted core, you should be sure
to distribute the .svd file.
We have included a reference version of the gateware and its SVD
file in the precursors directory, so you can compile a gateware
for the reference image using this command:
cargo xtask hw-image precursors/soc.svd
The resulting images are in your target directory (typically target/riscv32imac-unknown-xous-elf/release/)
with the names xous.img (for the kernel) and loader.bin (for its bootloader). The corresponding
gateware is in precursors/soc_csr.bin. These can be written to your
device by following the update guide.