Skip to content

Instantly share code, notes, and snippets.

View MabezDev's full-sized avatar
🦀
I may be slow to respond.

Scott Mabin MabezDev

🦀
I may be slow to respond.
View GitHub Profile

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.

/// 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

Bootstrapping Rust with xtensa support

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"
@MabezDev
MabezDev / 1.md
Last active October 23, 2018 17:10
Create a 16bit R5G6B5 raw image for embedded displays.
  • 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 is w * h * 2 of the image. This removes the BMP header.