-
Import your image or create image with GIMP.
-
Export as bmp -> advanced options -> 16bit
-
Then to get the raw bytes run
tail -c $bytes image.bmp > image.raw
where $bytes isw * h * 2
of the image. This removes the BMP header.
Build xtensa llvm from here https://esp32.com/viewtopic.php?t=9226&p=38466
But add the X86 target like so
cmake ../llvm-xtensa -DLLVM_TARGETS_TO_BUILD="Xtensa;X86" -DCMAKE_BUILD_TYPE=Release -G "Ninja"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Feed the WDT watchdog | |
pub fn feed_wdt() { | |
const RTC_WDT_BASE: u32 = 0x3ff48000; | |
const RTC_WDT_WPROTECT: u32 = RTC_WDT_BASE + 0xa4; | |
const RTC_WDT_FEED: u32 = RTC_WDT_BASE + 0xa0; | |
unsafe { | |
core::ptr::write_volatile(RTC_WDT_WPROTECT as *mut _, 0); // disable write protection | |
{ | |
core::ptr::write_volatile(RTC_WDT_FEED as *mut _, 0x1); // feed the watch dog |
To find the substitute path for the from section:
find $(rustc --print sysroot) -maxdepth 2 -mindepth 2 -type f -name "libstd-*" -exec strings {} \; | grep -o '^/rustc/[^/]\+/' | uniq
which produces something like /rustc/9a90d03ad171856dc016c2dcc19292ec49a8a26f/
Next install rust-src
component if you haven't already.
Then combine the output of rustc --print sysroot
with /lib/rustlib/src/rust
to find your downloaded sources.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rtfm::Mutex; // or mutex_trait | |
pub enum Operation<T: Mutex<T = ...> { | |
FileSystem(T) // Note: can't use impl Mutex<T = Filesystem> here, so we have to introduce the T type param | |
// ... | |
} | |
// If the `Operation` enum is buried deep within a type, it poisens that type with the same type parameter | |
pub struct Server<T: Mutex<T = ...> { | |
op: Operation<T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[naked] | |
#[no_mangle] | |
#[link_section = ".rwtext"] | |
unsafe extern "C" fn save_context() { | |
asm!( | |
" | |
s32i a2, sp, +XT_STK_A2 | |
s32i a3, sp, +XT_STK_A3 | |
s32i a4, sp, +XT_STK_A4 | |
s32i a5, sp, +XT_STK_A5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"[2021-10-12T09:55:08Z DEBUG probe_rs::probe::cmsisdap::tools] Searching for CMSIS-DAP probes using libusb\n" | |
"[2021-10-12T09:55:08Z DEBUG probe_rs::probe::cmsisdap::tools] Found 0 CMSIS-DAP probes using libusb, searching HID\n" | |
"[2021-10-12T09:55:08Z DEBUG probe_rs::probe::cmsisdap::tools] Found 0 CMSIS-DAP probes total\n" | |
"[2021-10-12T09:55:08Z DEBUG jaylink] libusb 1.0.24.11584\n" | |
"[2021-10-12T09:55:08Z DEBUG jaylink] libusb has capability API: true\n[2021-10-12T09:55:08Z DEBUG jaylink] libusb has HID access: true\n[2021-10-12T09:55:08Z DEBUG jaylink] libusb has hotplug support: true\n[2021-10-12T09:55:08Z DEBUG jaylink] libusb can detach kernel driver: true\n" | |
"[2021-10-12T09:55:08Z DEBUG jaylink] open_usb: device descriptor: DeviceDescriptor {\n bLength: 0x12,\n bDescriptorType: 0x1,\n bcdUSB: 0x200,\n bDeviceClass: 0x0,\n bDeviceSubClass: 0x0,\n bDeviceProtocol: 0x0,\n bMaxPacketSize: 0x40,\n idVendor: 0x1366,\n idProduct: 0x101,\n bc |
- Clone https://github.com/esp-rs/rust
- Ensure deps are met before starting the installation process, see the README.
- Run
./configure --experimental-targets=Xtensa --release-channel=nightly --enable-extended --tools=clippy,cargo,rustfmt
- Start the build with
./x.py build --stage 2
- Link the custom toolchain to rustup:
rustup toolchain link esp build/$HOST/stage2
Where $HOST is your machines triple, i.e x86_64-unknown-linux-gnu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ESP-ROM:esp32c3-api1-20210207 | |
Build:Feb 7 2021 | |
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT) | |
Saved PC:0x420182d6 | |
0x420182d6 - _ZN14esp_hal_common7embassy11time_driver12EmbassyTimer3now17hdd745a8ad9f1c59cE | |
at ??:?? | |
SPIWP:0xee | |
mode:DIO, clock div:1 | |
load:0x3fcd5820,len:0x16ec | |
0x3fcd5820 - _stack_start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! embassy wait | |
//! | |
//! This is an example of asynchronously `Wait`ing for a pin state to change. | |
#![no_std] | |
#![no_main] | |
#![feature(type_alias_impl_trait)] | |
use embassy_executor::Executor; | |
use embassy_time::{Duration, Timer}; |
OlderNewer