Skip to content

Instantly share code, notes, and snippets.

View xobs's full-sized avatar

Sean Cross xobs

View GitHub Profile
@xobs
xobs / siliwiz-design-noout.json
Created February 13, 2023 05:40
Files that cause siliwiz to fail
{
"version": 1,
"app": "siliwiz",
"timestamp": 1676266623,
"rects": [
{ "x": 14.4, "y": 18, "height": 363, "width": 372, "layer": "p substrate" },
{ "x": 118.4, "y": 147, "height": 118, "width": 152, "layer": "n diffusion" },
{ "x": 341.4, "y": 350, "height": 28, "width": 39, "layer": "p tap" },
{ "x": 180.4, "y": 129, "height": 158, "width": 31, "layer": "polysilicon" },
{ "x": 345.4, "y": 352, "height": 24, "width": 32, "layer": "metal1 via" },
@xobs
xobs / plan9.patch
Created December 6, 2022 14:56
Get things building for rust-1.65.0
diff --git a/library/std/src/sync/condvar.rs b/library/std/src/sync/condvar.rs
index eb1e7135a6e..ba270d2aee5 100644
--- a/library/std/src/sync/condvar.rs
+++ b/library/std/src/sync/condvar.rs
@@ -122,10 +122,10 @@ impl Condvar {
/// let condvar = Condvar::new();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
+ // #[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
@xobs
xobs / build.sh
Created November 10, 2022 02:35
Testing rustc crashes with GAM
#!/bin/bash
set -e
set > /opt/Xous/environment
export PATH=/opt/gcc/xpack-riscv-none-elf-gcc-12.1.0-2/bin/:$PATH
echo "Building rust..."
cd /opt/Xous/rust-next
rm -rf target-*
rustup override set $RUSTUP_TOOLCHAIN
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 <[email protected]>
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()