Skip to content

8bitmcu/vtOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

vtOS: A hobby firmware with a terminal UI

This project features first-class support for the LILYGO T-Deck, transforming it into a standalone portable terminal.

This project implements a high-performance, attribute-aware terminal emulator for MicroPython. By wrapping the st (suckless terminal) engine in a custom C module, it achieves desktop-class terminal features on embedded hardware, including a zero-allocation status bar for real-time telemetry without heap fragmentation.

As a showcase of the engine's capabilities, this project includes a fully functional, VFS-aware C port of the vi text editor and frotz ZMachine interpreter that supports playing classic text games like Zork. The firmware provides a Python-based Telnet client, FTP server, a TUI based File Manager, IRC Client, RSS Reader and Network Manager demonstrating how the terminal engine can be easily extended.

ASCII demo (running on CYD) vi app
ascii demo vi app
Minesweeper (telnet) Zork (telnet)
minesweeper zork

πŸ“Ÿ T-Deck Hardware Integration

This project is optimized for the LilyGO T-Deck, leveraging MicroPython to interface with the ESP32-S3 and its integrated peripherals.

πŸ›  Supported Components

Component Specification Driver / Status
Memory 8MB PSRAM / 16MB Flash βœ… Enabled for Large Buffer Handling
Display 2.4" ST7789 LCD (320x240) βœ… Optimized SPI bus (Full Color)
LoRa Radio SX1262 βœ… Own Configuration Utility
Keyboard LILYGO Keyboard βœ… Mapped I2C Interface
Trackball LILYGO Trackball βœ… Mapped I2C Interface
Speaker I2S βœ… MP3/WAV Playback Support
Microphone I2S, ES7210 ADC βœ… WAV Recorder Support
SD Card SPI ❌ Experimental
Touchscreen GT911 todo

⚑ Quick Install (Pre-compiled Binaries)

You can download and flash the latest pre-compiled firmware directly to your T-Deck.

Option A: Flash from command line

  1. Download the Firmware: Go to the Releases Page and download the latest *.bin asset.

  2. Flash to the T-Deck: Make sure your T-Deck is plugged in via USB, then use esptool.py to write the firmware to the device. You may need to install esptool first (pip install esptool).

esptool.py -p /dev/ttyACM0 -b 460800 --chip esp32s3 write_flash 0x0 firmware.bin

Option B: Bootloader (Launcher)

This firmware is fully compatible with Launcher, an on-device application launcher and bootloader for ESP32 devices. This method is perfect if you want to seamlessly swap between vtOS and other firmware on the go without needing a PC.

  1. Install Launcher: Open a Web Serial compatible browser (like Chrome or Edge) and navigate to the Launcher website. Select Web Flasher and follow the prompts to install the bootloader directly to your T-Deck.
  2. Prepare your SD Card: Download the latest *.bin from the Releases Page and copy it to a MicroSD card.
  3. Boot and Install: Insert the MicroSD card into your T-Deck and power it on. Using the Launcher interface on the device's screen, navigate to your SD card and select the vtOS binary to flash it.

πŸ“ How to use

Trackball Usage

  • Short Press: Sends Esc
  • Long Press: Sends KeyboardInterrupt
  • Scroll up: Scroll up st terminal history
  • Scroll down: Scroll down st terminal history
  • Scroll left: Scroll up st command history
  • Scroll right: Scroll down st command history

Available commands

You can execute the following commands from the built-in shell:

Command Description
clear Clears the screen
fav Built-in shell aliases
fc Font Configuration Utility
fm Starts the TUI File Manager
ftp FTP Client that mounts it's content as a VFS
ftpd Launches a FTP Server on / with user admin and pwd admin
irc Connects to an IRC channel given a server, port, nickname and channel
loracfg Utility to configure LoRa frequency and power
lorachat A basic chatroom based on the LoRa radio
menu An interactive shortcut menu for commands
ms Opens the minesweeper clone
nm Starts the TUI Network Manager
play Audio player that supports WAV and MP3
rec Audio recorder
rss RSS Reader; connect to an http or https rss endpoint and retreives the titles
telnet Connects to a telnet server
vi Opens the vi port
zm Launches dfrotz, the ZMachine interpreter

To get out of the shell, type exit. This will bring you to the MicroPython shell, where you can type in python expressions. To get back to the built-in shell, type sh in the MicroPython shell.

πŸ”¨ How to Build (T-Deck)

Option A: Building on Host machine

Building this project requires a cross-compiler for the ESP32-S3 and the MicroPython source tree. Ensure you have the ESP-IDF (Espressif IoT Development Framework) installed. This project is verified using MicroPython v1.28.0 and ESP-IDF v5.5.1.

# Clone this repository
git clone https://github.com/8bitmcu/vtOS.git

# Copy the T-Deck board definition into your micropython source directory:
cp -r /path/to/vtOS/boards/LILYGO_T_DECK /path/to/micropython/ports/esp32/boards/

# Copy idf_component.yml into micropython esp32 ports:
cp /path/to/vtOS/modules/idf_component.yml /path/to/micropython/ports/esp32/main/

# Initialize the ESP-IDF environment
source $HOME/esp/esp-idf/export.sh

# Build the MicroPython Cross-Compiler
make -C /path/to/micropython/mpy-cross

# Navigate to the T-Deck port directory.
cd /path/to/micropython/ports/esp32

# Specify the BOARD as LILYGO_T_DECK to enable PSRAM / Flash support
# Specify USER_C_MODULES and FROZEN_MANIFEST for C modules and python scripts
make BOARD=LILYGO_T_DECK USER_C_MODULES=/path/to/vtOS/modules FROZEN_MANIFEST=/path/to/vtOS/modules/manifest.py

# Flash the firmware to the device
esptool.py -p /dev/ttyACM0 -b 460800 --chip esp32s3 write_flash 0x0 firmware.bin

Option B: Building using Docker and Makefile

You do not need to install the ESP-IDF, toolchains, or MicroPython source code on your host machine if you have Docker and Make installed.

Prerequisites:

  • Docker installed and running.
  • Make installed on your host system.
  • A Linux environment (or WSL2 on Windows) that allows USB device passthrough to Docker.

If you just want to build and flash the firmware, run these commands in order:

# 1. Clone this repository and enter in it
git clone https://github.com/8bitmcu/vtOS.git && cd vtOS

# 2. Initialize the environment (pulls MicroPython source)
make init

# 3. Compile the firmware
make build

# 4. Flash to the device (ensure your T-Deck is plugged in)
make flash

Makefile Reference

make init sets up the pristine build environment. Builds the necessary local Docker image (micropython-build) and creates a persistent Docker volume. It then clones MicroPython and its submodules directly into that volume. Run this once when setting up the project, or to force a fresh pull of the MicroPython source.

make build compiles the MicroPython firmware. Mounts your local boards/ and modules/ directories into the ESP-IDF container. It compiles the C-level modules, freezes your Python manifests, and builds the target specifically for the LILYGO_T_DECK. Outputs: The compiled binaries (firmware.bin, micropython.bin) will appear in your local build_output/ folder.

make flash flashes the compiled firmware to the ESP32-S3. Uses esptool.py inside the container to erase the flash and write the new firmware.bin to address 0x0.

make sync_files transfers your Python application code to the device. Uses mpremote to recursively copy everything inside ./modules/scripts/ into the root of the T-Deck's internal flash filesystem.

make sync_file FILE=filename.py transfers a single Python script file to the device. Uses mpremote to copy from ./modules/scripts/ into the root of the T-Deck's internal flash filesystem.

make repl opens the MicroPython interactive prompt. Connects your terminal to the device's serial output via mpremote. Press Ctrl+D inside the REPL to trigger a soft reboot, or Ctrl+] to exit back to your host terminal.

make core_dump analyzes fatal crashes. If your device crashes and enters a bootloop or halts, this command reads the raw coredump partition directly from the flash and maps it against the .elf file in your build volume to provide a human-readable C-level stack trace.

make clean cleans the build artifacts. Removes the compiled object files from the Docker volume and deletes the local build_output/ folder to ensure your next make build starts completely fresh.

Overriding Variables

The Makefile defaults to /dev/ttyACM0 for the USB connection. If your OS assigns a different port (e.g., /dev/ttyUSB0), you can override it inline without editing the Makefile:

make flash PORT=/dev/ttyUSB0
make repl PORT=/dev/ttyUSB0

βš–οΈ License & Attribution

This project's source code is licensed under the MIT License. However, if you compile the firmware with the optional frotz module enabled, the resulting compiled binary is distributed under the GPLv2 License.

Third-Party Components:

  • st License: MIT (c) st engineers.
  • st7789_mpy: (c) Russ Hughes. MIT License
  • vi (Toybox): (c) Rob Landley, Jarno MΓ€kipÀÀ. 0BSD License (Zero-Clause BSD).
  • frotz: (c) Stefan Jokisch, David Griffith. GPLv2 License
  • yxml: Copyright (c) 2013-2014 Yoran Heling. MIT License
  • MicroPython: (c) Damien P. George. MIT License

Fonts & Assets:

  • Terminus Font: (c) 2020 Dimitar Zhekov. Licensed under the SIL Open Font License 1.1.
  • Cozette Font: Copyright (c) 2020 Samhain samhain@moonwit.ch & contributors https://github.com/the-moonwitch/Cozette/contributors. Distributed under the terms of the MIT License.
  • Tamzen Font: Copyright 2011 Suraj N. Kurapati https://github.com/sunaku/tamzen-font. Tamzen font is free. You are hereby granted permission to use, copy, modify, and distribute it as you see fit. Tamzen font is provided "as is" without any express or implied warranty. The author makes no representations about the suitability of this font for a particular purpose. In no event will the author be held liable for damages arising from the use of this font.
  • Gohu Font: Copyright 2015 by Hugo Chargois. Distributed under the terms of the WTFPL version 2.

About

vtOS is an exploration into retro-computing on modern hardware.

Topics

Resources

License

Stars

9 stars

Watchers

0 watching

Forks

Contributors