Skip to content

Instantly share code, notes, and snippets.

View xobs's full-sized avatar

Sean Cross xobs

View GitHub Profile
target\debug\create-image.exe `
target\riscv32imac-unknown-xous-elf\release\xous_presign.img `
--kernel target/riscv32imac-unknown-xous-elf/release/xous-kernel `
--init target/riscv32imac-unknown-xous-elf/release/xous-ticktimer `
--init target/riscv32imac-unknown-xous-elf/release/xous-log `
--init fake-root-keys\target\riscv32imac-unknown-xous-elf\debug\fake-root-keys `
--init pddb-raw\target\riscv32imac-unknown-xous-elf\debug\pddb-raw `
--init target/riscv32imac-unknown-xous-elf/release/xous-names `
--init target/riscv32imac-unknown-xous-elf/release/xous-susres `
--init target\riscv32imac-unknown-xous-elf\release\pddb `
Creating path test-create...
ERR :pddb: got msg: Envelope { sender: Sender { data: 181c0007 }, body: MutableBorrow(MemoryMessage { id: 28, buf: MemoryRange { addr: 40000000, size: 1000 }, offset: None, valid: None }) } (services\pddb\src\main.rs:639)
TRCE:pddb::backend::hw: alloc fast_space_len: 2041, log_len 0, has 3 pages: true (services\pddb\src\backend\hw.rs:1431)
DBG :pddb::backend::basis: dict: key not in cache test-create (services\pddb\src\backend\basis.rs:1649)
TRCE:pddb::backend::hw: block: [30, 83, c3, 29, cb, 71, 82, 19, d6, 5e, a0, 5, 73, e4, b0, c] (services\pddb\src\backend\hw.rs:1365)
TRCE:pddb::backend::hw: patch: [6f, f3, 20, 7, 9f, 63, f4, 1, 27, e5, 87, e3, 8b, 58, e1, 5f] (services\pddb\src\backend\hw.rs:1368)
DBG :pddb::backend::basis: adding dictionary test-create (services\pddb\src\backend\basis.rs:342)
DBG :pddb::backend::basis: syncing dict test-create with 0 keys (services\pddb\src\backend\basis.rs:1472)
TRCE:pddb::backend::hw: Error decrypting page: Error (services\pddb\src\backend
@xobs
xobs / 1. pddb format no flush
Last active November 1, 2022 01:37
Lots from pddb spelunking
Mapped UART @ 60001000
Process: map success!
Note: character injection via console UART is enabled.
Allocating IRQ...
Claimed IRQ 3
LOG: my PID is 3
LOG: Creating the reader thread
LOG: Running the output
LOG: Xous Logging Server starting up...
LOG: Server listening on address SID([1937076088, 1735355437, 1919251245, 544367990])
@xobs
xobs / ring-transpile-c2rust.py
Last active August 16, 2022 14:47
Sample program to convert C to Rust
#
# 1. Install c2rust dependencies:
# sudo apt install build-essential llvm clang libclang-dev cmake libssl-dev pkg-config python3
# 2. Install c2rust:
# cargo install c2rust:
# 3. Run this program inside the target directory:
# python ring-transpile-c2rust.py
#
# This creates a bunch of `.rs` files with `#[no_mangle] extern "C"` declarations,
# which allow other Rust code to link against it. This program also tries hard to
@xobs
xobs / PORTING-XOUS-RS.md
Last active April 15, 2022 05:40
Porting Xous to a New Rust Version

Use git log to figure out where the oldest patch is:

$ git pull
$ git log HEAD~52

--  output ended up being too old --
$ git log HEAD~49
Author: Sean Cross <sean@xobs.io>
Date: Wed May 12 17:38:01 2021 +0800
@xobs
xobs / build.ps1
Last active January 7, 2021 11:23
Powershell script to build Renode
param (
[Boolean]$submodules = $true,
[switch]$debug = $false,
[switch]$clean = $false
)
$env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
# This should be the path to a "bin/" directory of the musl.cc toolchain,
# available for download from https://musl.cc/
@xobs
xobs / xousserverstring.rs
Created January 5, 2021 01:09
Example implementation of a Xous server string
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct XousServerName {
pub name: [u8; 32],
pub length: usize,
}
impl XousServerName {
pub fn new() -> Self {
Default::default()
@xobs
xobs / file.patch
Last active April 30, 2020 12:02
Add a flush to wishbone-tool uart
diff --git a/wishbone-tool/src/bridge/uart.rs b/wishbone-tool/src/bridge/uart.rs
index 0ca9c9a..daf9025 100644
--- a/wishbone-tool/src/bridge/uart.rs
+++ b/wishbone-tool/src/bridge/uart.rs
@@ -239,7 +239,9 @@ impl UartBridge {
// LiteX ignores the bottom two Wishbone bits, so shift it by
// two when writing the address.
serial.write_u32::<BigEndian>(addr >> 2)?;
- Ok(serial.write_u32::<BigEndian>(value)?)
+ serial.write_u32::<BigEndian>(value)?;
@xobs
xobs / tag-read.c
Last active January 31, 2020 09:52
Read tags from a binary stream
#include <stdio.h>
#include <stdint.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv) {
int f = open("args.bin", O_RDONLY);
uint8_t fourcc[4];
uint32_t val;
@xobs
xobs / keytest.py
Created November 30, 2019 08:10
Fomu keyboard test
import time
import microcontroller
import digitalio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
# A simple neat keyboard demo in CircuitPython