{"id":51631917,"url":"https://github.com/ajsb85/rt1060-rs","last_synced_at":"2026-07-13T08:31:01.206Z","repository":{"id":370076999,"uuid":"1293069970","full_name":"ajsb85/rt1060-rs","owner":"ajsb85","description":"NXP i.MX RT1060 (MIMXRT1062, Cortex-M7) emulator in Rust — run real MadMachine SwiftIO, Zephyr and Arduino firmware for the SwiftIO Micro","archived":false,"fork":false,"pushed_at":"2026-07-08T05:57:04.000Z","size":207,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-08T07:09:41.750Z","etag":null,"topics":["arm","cortex-m7","embedded","emulator","imxrt","madmachine","mimxrt1062","nxp","rust","simulator","swift","swiftio"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajsb85.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-08T04:53:06.000Z","updated_at":"2026-07-08T05:57:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ajsb85/rt1060-rs","commit_stats":null,"previous_names":["ajsb85/rt1060-rs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ajsb85/rt1060-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajsb85%2Frt1060-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajsb85%2Frt1060-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajsb85%2Frt1060-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajsb85%2Frt1060-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajsb85","download_url":"https://codeload.github.com/ajsb85/rt1060-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajsb85%2Frt1060-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35416386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","cortex-m7","embedded","emulator","imxrt","madmachine","mimxrt1062","nxp","rust","simulator","swift","swiftio"],"created_at":"2026-07-13T08:31:00.412Z","updated_at":"2026-07-13T08:31:01.200Z","avatar_url":"https://github.com/ajsb85.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rt1060-rs\n\nA cycle-lite, dependency-free **Rust emulator for the NXP i.MX RT1060**\n(MIMXRT1062DVL6B, single Arm Cortex-M7). It runs **real, unmodified\nfirmware** — the end goal is booting **MadMachine SwiftIO** (embedded Swift)\non the **SwiftIO Micro** board, with Zephyr and Arduino images along the way.\n\nBuilt in the lineage of [rp2040js](https://github.com/wokwi/rp2040js),\n[rp2350-rs](https://github.com/ajsb85/rp2350-rs), and\n[mg24-rs](https://github.com/ajsb85/mg24-rs): the CPU is register state only,\nevery memory access goes through a borrowed `Bus`, and there is no\n`Rc\u003cRefCell\u003e`, no trait objects, and no allocation in the hot loop.\n\n## Target hardware — MadMachine SwiftIO Micro\n\n| | |\n|---|---|\n| MCU | NXP **MIMXRT1062** (i.MX RT1060) |\n| Core | Arm **Cortex-M7** r1p2, FPv5-D16, L1 I/D cache, MPU |\n| Clock | 600 MHz |\n| RAM | 32 MB SDRAM (SEMC @ `0x8000_0000`) + 512 KB FlexRAM TCM + 1 MB OCRAM |\n| Flash | 16 MB FlexSPI NOR (`0x6000_0000`) |\n| I/O | 44 GPIO, 14 ADC, 14 PWM, 2 I²C, 2 SPI, 3 UART, 1 I²S, 1 CAN, SD, RGB LED |\n\n## Status\n\nMilestone tracking lives in [`ROADMAP.md`](ROADMAP.md). Snapshot:\n\n| Area | State |\n|---|---|\n| Cortex-M7 core (Thumb-2 + DSP parallel-add/SEL, exceptions, NVIC 158 IRQs, SysTick, MPU) | ✅ ported |\n| FPv5-D16 FPU (single- **and** double-precision, GE flags) | ✅ |\n| Memory map + AIPS bus (ITCM/DTCM/OCRAM/FlexSPI/SDRAM) | ✅ |\n| Loader (ELF32, raw bin, MadMachine `micro.img`) | ✅ |\n| LPUART (console), GPIO, CCM, GPT, SRC, WDOG | ✅ |\n| CCM_ANALOG PLLs (LOCK/OSC/DCDC), SEMC status, boot spin-loops | ✅ terminate |\n| RGB LED observable (GPIO1 9/10/11, active-low) via `led_rgb()` | ✅ |\n| Clock-tree frequency model (core/IPG/PERCLK/UART) → `core_hz()` | ✅ |\n| PIT, GPT (clock-domain accurate) | ✅ |\n| eDMA (32-ch TCD through the bus) + DMAMUX hw requests, LPI2C, LPSPI, ADC | ✅ + device hooks |\n| FlexPWM (`pwm_duty()`) + QTMR (PERCLK counting) | ✅ |\n| USDHC + attachable **SD card** — real Zephyr driver inits it (reset, CMD0-CMD7 ident, CMD6 switches) + **mounts FAT** | ✅ |\n| USB OTG register block (init runs; full CDC enumeration ⬜) | ✅ |\n| FlexCAN (message buffers + loopback), SAI/I²S | ✅ |\n| FlexSPI IP command engine (program/read/erase + JEDEC ID vs backed NOR) | ✅ |\n| eDMA scatter-gather + channel linking; PLL2 PFD clock roots | ✅ |\n| **Boots real NXP SDK blinky (ITCM / FlexSPI-XIP / SDRAM) — LED toggles** | ✅ |\n| **Boots a real embedded-Swift blink — drives the SwiftIO RGB LED** | ✅ |\n| **Boots the REAL MadMachine SwiftIO Blink** (`mm build`: SwiftIO + Zephyr + embedded Swift) through the full RTOS stack — **zero unimplemented instructions**, LED toggles | ✅ |\n| **Runs 9 REAL MadMachine SwiftIO Playground examples** — Potentiometer (ADC+IRQ), BreathingLED (PWM), Humiture (SHT3x I2C), Accelerometer (LIS3DH I2C), RTC (PCF8563 I2C), LCD (ST7789 SPI), Speaker (SAI/I2S), SerialLEDSwitch (UART RX) — each drives a real peripheral end-to-end with an emulated device/input | ✅ |\n| **Emulates `mm download` end-to-end** — boots the real `SerialLoader` bootloader, programs a real `micro.img` to the NOR `user` partition over the serial protocol, then **two-stage boots** it: `cold_boot_from_flash` models the Boot ROM (NOR → parse header → SDRAM → run the Zephyr app) | ✅ |\n| **GDB remote stub** + `RT1060_TRACE` logging + criterion benches | ✅ |\n| SwiftIO 44-pin map (id→GPIO, from HAL static analysis) via `swiftio_pin()` | ✅ |\n| **HIL parity vs a physical Teensy 4.1** (same MIMXRT1062) — boots PJRC's unmodified Arduino blinky via the i.MX RT Boot ROM → IVT path (`cold_boot_from_ivt`) and reproduces the **exact LED cadence** (SysTick 100 kHz external clock); cross-checked against the board flashed with the same `.hex` | ✅ |\n| **Real MadMachine SwiftIO stack on a Teensy 4.1** — `import SwiftIO`/Zephyr re-based off SDRAM into OCRAM + wrapped as a Teensy flash image; boots with zero unimplemented instructions and blinks the onboard LED (`DigitalOut(Id.D16)`); flashed to the physical board, LED blinks at 1 Hz | ✅ |\n| USB CDC enumeration, SEMC real command decode, ENET | ⬜ ROADMAP |\n| MadMachine two-stage bootloader (eboot); WASM front-end; SwiftIO USB-serial HIL | ⬜ ROADMAP |\n\n## Quick start\n\n```rust\nuse rt1060_rs::{Rt1060, loader};\n\n// Load a MadMachine user image (runs from SDRAM at 0x8000_0000).\nlet bytes = std::fs::read(\"micro.img\").unwrap();\nlet image = loader::load_micro_img(\u0026bytes).unwrap();\nlet mut soc = Rt1060::boot(\u0026image);\n\n// Run and read what the firmware printed on the LPUART1 console.\nsoc.run(1_000_000);\nprint!(\"{}\", soc.console_string());\n```\n\nRaw binaries and ELFs load the same way via `loader::load_bin(addr, \u0026data)`\nand `loader::load_elf(\u0026bytes)`.\n\n### Debug with GDB\n\n```bash\ncargo run --example gdbserver -- firmware.elf 3333\ngdb-multiarch -ex \"target remote :3333\" firmware.elf\n```\n\nRegister/memory access, breakpoints, and step/continue all work. Set\n`RT1060_TRACE=1` to log peripheral writes (`=all` for reads too) while a\nfirmware image brings the chip up — the fastest way to see which registers a\ndriver pokes.\n\n## Build \u0026 test\n\n```bash\ncargo test                                   # unit + integration tests\ncargo clippy --all-targets -- -D warnings    # lint gate\ncargo fmt --all -- --check                   # format gate\n```\n\nThe library is `#![no_std]`-friendly in spirit (host-side `std` for I/O\nsinks) and has **zero runtime dependencies**.\n\n## Register truth\n\nEvery nontrivial register cites its source: the CMSIS header\n`MIMXRT1062.h`, the CMSIS-SVD `MIMXRT1062.xml`, the i.MX RT1060 reference\nmanual, or the cross-checked Renode `IMX*` models (RT1064 is memory-map\nidentical to RT1062). See [`CLAUDE.md`](CLAUDE.md) for the hard rules and\n[`CONTRIBUTING.md`](CONTRIBUTING.md) for the workflow.\n\n## License\n\nMIT © 2026 Alexander Salas Bastidas `\u003cajsb85@firechip.dev\u003e`. Portions ported\nfrom mg24-rs / rp2350-rs and inspired by rp2040js (Uri Shaked, MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajsb85%2Frt1060-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajsb85%2Frt1060-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajsb85%2Frt1060-rs/lists"}