Skip to content

Instantly share code, notes, and snippets.

@9names
9names / pico_usb_serial_logger.rs
Last active April 4, 2022 12:34
Pico USB serial abstraction
//! # Pico USB Serial - with format, panics.
//! Should move into it's own crate.
//!
//! heavily inspired by https://github.com/eterevsky/rp2040-blink/blob/main/src/main.rs and https://github.com/mvirkkunen/rtt-target
#![no_std]
#![no_main]
use core::cell::RefCell;
use core::fmt::Write;
@9names
9names / hsprobe_swd_decode
Last active April 6, 2022 11:52
comparing SWD output from hsprobe and dappermime with probe-rs
swd-1: LINERESET
swd-1: JTAG->SWD
swd-1: LINERESET
swd-1: IDCODE
swd-1: OK
swd-1: 0x2ba01477
swd-1: W ABORT
swd-1: OK
swd-1: 0x0000001e
swd-1: W SELECT
@9names
9names / do_not_run.sh
Created July 3, 2022 12:26
Set up Rust and try to build probe-rs under qemu
sudo qemu-debootstrap --arch=mipsel --keyring /usr/share/keyrings/debian-archive-keyring.gpg \
--variant=buildd --exclude=debfoster unstable debian-mipsel http://ftp.debian.org/debian
sudo apt install qemu binfmt-support qemu-user-static
sudo cp /usr/bin/qemu-mipsel-static debian-mipsel/usr/bin/
cd debian-mipsel
for f in dev dev/pts sys proc run ; do sudo mount --bind /$f ./$f ; done
sudo chroot .
apt update
apt install dialog locales
@9names
9names / pico_display_pack_testing.rs
Last active September 12, 2022 10:25
A quick test of the pico display pack with the mipidsi crate
//! # Pimoroni Display Pack Example
#![no_std]
#![no_main]
use embedded_hal::digital::v2::InputPin;
// The macro for our start-up function
use rp_pico::entry;
// Time handling traits
@9names
9names / build_release_commit.sh
Last active October 1, 2023 02:16
bflb-mcu-tool git rebuild
#!/bin/bash
export GIT_AUTHOR_NAME="""bouffalolab"""
export GIT_AUTHOR_EMAIL="""[email protected]"""
export GIT_AUTHOR_DATE="$2"
export GIT_COMMITTER_NAME="""bouffalolab"""
export GIT_COMMITTER_EMAIL="""[email protected]"""
export GIT_COMMITTER_DATE="$2"
rm "*" -rf
tar -xvf ../bflb-mcu-tool-$1.tar.gz --strip-components=1
@9names
9names / text_on_test_image.rs
Created November 29, 2022 07:58
test program for mipidsi w/ rp2040-hal and pico-display
//! Blinks the LED on a Pico board
//!
//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED.
#![no_std]
#![no_main]
use bsp::{entry, hal};
use cortex_m::delay::Delay;
use defmt::*;
use defmt_rtt as _;
@9names
9names / watchdog_spinlock_test.rs
Last active January 5, 2023 23:16
watchdog spinlock test
//! Blinks the LED on a Pico board
//!
//! This will blink an LED attached to GP25, which is the pin the Pico uses for the on-board LED.
#![no_std]
#![no_main]
use cortex_m::prelude::_embedded_hal_watchdog_Watchdog;
use cortex_m_rt::entry;
use defmt::*;
use defmt_rtt as _;
@9names
9names / Cargo.toml
Last active January 18, 2023 11:30
bl702 LCD test
[package]
name = "bl702-hal"
version = "0.0.3"
edition = "2021"
license = "MIT OR MulanPSL-2.0"
keywords = ["hal", "bl702", "riscv"]
categories = ["embedded", "no-std", "hardware-support"]
repository = "https://github.com/9names/bl702-hal"
description = "HAL for the Bouffalo Lab BL702 microcontroller family"
@9names
9names / Cargo.toml
Created February 5, 2023 05:04
enabling critical-section for stm32f4
[package]
name = "stm32f4-test"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
stm32f4 = { path = "../stm32f4", features = ["rt", "critical-section"] }
embedded-hal = { version="0.2.7", features = ["unproven"] }
riscv64-unknown-elf-size target/riscv32ec-unknown-none-elf/release/hello-wch --radix=10
text data bss dec hex filename
496 0 2048 2544 9f0 target/riscv32ec-unknown-none-elf/release/hello-wch
riscv64-unknown-elf-nm target/riscv32ec-unknown-none-elf/release/hello-wch --print-size --size-sort --radix=d
00000396 00000002 T DefaultExceptionHandler
00000398 00000002 T DefaultInterruptHandler
00000400 00000004 T default_pre_init
00000404 00000020 T default_mp_hook
00000424 00000022 T default_setup_interrupts
00000352 00000044 T main