Operating system written in Rust for NumWorks calculator (model n0110)

Overview

RustWorks

An OS (eventually) for the Numworks calculator (model n0110).

Setup

First install Rust by following these instuctions then:

rustup target add thumbv7em-none-eabihf

# Ubuntu
sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi 
sudo apt-get install dfu-util
# macOS
brew tap osx-cross/arm
brew install arm-gcc-bin
brew install dfu-util

rustup component add llvm-tools-preview
cargo install cargo-binutils
cargo install cargo-make

# If you have an STLink debugger and can connect it to the calculator install `probe-run` or `cargo-embed` for easy debugging and `cargo-flash` if you just want faster flashing speeds.
cargo install probe-run
cargo install cargo-embed
cargo install cargo-flash

DFU Flash

Complete setup, plug in your calculator and put it into dfu mode (press 6 and reset at the same time), then run the following:

cargo make dfu

STLink

If you have an STLink debugger (I am using the STLink V3SET) you can flash faster by using one of the following:

Flash

cargo flash --chip=stm32f730V8Tx
# Or you can use this which does the same thing but might be easier to remember:
cargo make flash

Debug

Using cargo-embed (recommended):

cargo embed

Using probe-rs:

cargo run
Comments
  • Emulators?

    Emulators?

    Android emulator? Windows emulator? Linux emulator? iOS emulator?

    This would be awesome to have because it would make it so that we could make rustworks work in a fully open source platform, like, for example, creating our own calculator hardware (fully open source unlike Numworks).

    enhancement 
    opened by NebulaOnion 15
  • ERROR - Task dfu not found

    ERROR - Task dfu not found

    using branch split (or master) I get ERROR - Task dfu not found.

    [cargo-make] INFO - cargo make 0.35.15
    [cargo-make] INFO - Build File: Makefile.toml
    [cargo-make] INFO - Task: dfu
    [cargo-make] INFO - Profile: development
    [cargo-make] INFO - Running Task: legacy-migration
    [cargo-make] INFO - Running Task: workspace
    /Data/Repositories/rustworks
    [cargo-make][1] INFO - Build File: Makefile.toml
    [cargo-make][1] INFO - Task: dfu
    [cargo-make][1] INFO - Profile: development
    [cargo-make][1] ERROR - Task dfu not found
    [cargo-make][1] WARN - Build Failed.
    [cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 5 - Error while executing command, exit code: 1
    [cargo-make] WARN - Build Failed.
    

    Any idea why? Thanks!

    opened by Techwizz-somboo 4
  • Fix FMC timings

    Fix FMC timings

    The output ns_to_cycles function was off by a factor of 1000. The resulting values are later cast to u8 which masks the problem that the output of ns_to_cycles is larger than 255.

    The WE signal is now low for 28 ns instead of 376 ns, which is closer to the minimum timing. The overall drawing performance hasn't improved as much (only 10% - 30%), but I think the bottleneck is now the software and not the FMC controller. With the old timing values the CS line didn't toggle during a display clear, which probably means that the write FIFO was never empty. But with the new values the CS line toggles for each byte and I believe that the software isn't fast enough to keep the FIFO filled.

    opened by rfuest 4
  • Set speed for QSPI pins

    Set speed for QSPI pins

    This might help you get the QSPI flash working. I didn't have time to look at the actual QSPI communication, but this should be a step in the right direction.

    I've hooked up my calculator to a logic analyzer to check the QSPI communication and noticed that it seemed that there was no activity on the clock output. After increasing the speed setting for the QSPI pins the clock signal works correctly.

    The display output has changed from all 00s to all ffs, but I didn't try to execute the mass erase or flashing operations yet.

    opened by rfuest 2
  • dfu-util: File size is too big: Success

    dfu-util: File size is too big: Success

    Hello, I'm trying to use rustworks on my numworks (n110) from my Raspberry Pi 4 (with Raspberry Pi OS, I don't know if it matters) but when I run cargo make dfu I get the following error message:

    [cargo-make] INFO - Execute Command: "dfu-util" "-d" "0483:df11" "-a" "0" "-s" "0x08000000:leave" "-D" "target/thumbv7em-none-eabihf/debug/rustworks.bin"
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: File size is too big: Success
    [cargo-make] ERROR - Error while executing command, exit code: 74
    [cargo-make] WARN - Build Failed.
    

    Before running rustworks, I installed dependencies:

    rustup target add thumbv7em-none-eabihf
    sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi 
    sudo apt-get install dfu-util
    
    rustup component add llvm-tools-preview
    cargo install cargo-binutils
    cargo install cargo-make
    

    Then I cloned rustworks repository and ran cargo make dfu .

    The bin file (target/thumbv7em-none-eabihf/debug/rustworks.bin) has a size of 2, 28 GB which seems effectively too big to flash on the numworks.

    did I do something wrong?

    opened by LoucaFrss 1
  • Port to embedded-graphics 0.7

    Port to embedded-graphics 0.7

    This PR updates e-g to 0.7.

    I wanted to try some e-g features on real hardware and needed version 0.7 for that. The st7789 driver isn't released yet and I had to use a git dependency. I'm not sure if you want to merge this now or wait until the driver is released.

    opened by rfuest 1
  • Fix ExternalFlash

    Fix ExternalFlash

    First of all, sorry for the large PR. I hadn't intended to rewrite the entire file, but it turned out to be easier this way. By starting over I was able to test each function while implementing it. The code still needs some cleanup and contains a lot of duplication.

    Erasing, programming and reading (in indirect and memory mapped modes) all seem to work now. The main method demonstrates this by erasing the first flash block and programing 8 bytes into it. I haven't yet tested programming of other blocks.

    opened by rfuest 1
  • Fix FMC based LCD interface

    Fix FMC based LCD interface

    This PR fixes the FMC based LCD interface and changes the clock configuration. Previously the processor only ran at 16 Mhz (according to the clocks struct).

    The cause of the FMC issue was related to caching and speculative execution. By disabling these features using the MPU the display works as expected and updates very fast.

    The code in this PR is kind of messy and the MPU configuration probably isn't optimal, but it should be a starting point for further development. It could be improved a lot by implementing a higher level abstraction around the MPU (which I don't think exists yet).

    opened by rfuest 1
  • lcd_tearing_effect is an input

    lcd_tearing_effect is an input

    I just tried to run this project on my Numworks calculator and the non FSMC version did work instantly. It's great to see embedded-graphics working on a calculator.

    But I have noticed that the lcd_tearing_effect signal is incorrectly initialized as an output instead of an input.

    opened by rfuest 1
  • Split code into separate crates, start on dfu bootloader

    Split code into separate crates, start on dfu bootloader

    Split the code up into crates to improve compile times and make the definition of each part more obvious. Also allows for cleaner use of the board support crate outside of the OS crate. This also begins work on a DFU bootloader (still need working external flash drivers for memory mapped mode).

    opened by willemml 0
  • Use PTR constant instead of deprecated ptr() function on registers and peripherals

    Use PTR constant instead of deprecated ptr() function on registers and peripherals

    Command: crate build

    Full warning:

    warning: use of deprecated associated function `cortex_m::peripheral::MPU::ptr`: Use the associated constant `PTR` instead
       --> board-support/src/lib.rs:140:26
        |
    140 |         let mpu = &*MPU::ptr();
        |                          ^^^
        |
        = note: `#[warn(deprecated)]` on by default
    
    warning: `nw-board-support` (lib) generated 1 warning
    
    bug 
    opened by NebulaOnion 2
  • Better documentation

    Better documentation

    All code (especially code that deals with complex thing specific to embedded development like modifying registers) should be documented with comments explaining what's going on to make it easier for other people to understand and contribute to the project.

    documentation 
    opened by willemml 0
  • Bootloader & flasher for QPI external flash

    Bootloader & flasher for QPI external flash

    Need to finish QSPI flash and then create a boot loader so RustWorks can be flashed to external flash. Potentially useful links:

    • flashAlgorithm docs: https://www.keil.com/pack/doc/CMSIS/Pack/html/flashAlgorithm.html
    • flashAlgorithm for RP2040: https://github.com/rp-rs/flash-algo

    Todo:

    • [ ] Read external flash
    • [ ] Write external flash
    • [x] Flash algorithm implementation so that cargo flash can access external flash (done in willemml/rsworks-flash-algo)
    • [ ] Make probe-rs and cargo-embed use flash algorithm
    • [x] Enable writing external flash using dfu-util
    enhancement help wanted 
    opened by willemml 13
Owner
Rustacean https://keybase.io/willemml
null
Writing an OS in Rust, To Study Operating System and Computer System

Hun Os Writing an OS in Rust, To Study Operating System and Computer System Reference Os Written In Rust https://github.com/seonghun-dev/blog_os https

Jung Seonghun 2 Dec 15, 2022
A new operating system kernel with Linux binary compatibility written in Rust.

Kerla Kerla is a monolithic operating system kernel from scratch in Rust which aims to be compatible with the Linux ABI, that is, runs Linux binaries

Seiya Nuta 3.1k Jan 1, 2023
SteinsOS is an operating system written in Rust

SteinsOS is an operating system featuring non-preemptive kernel targeting on single-core armv8 architecture.

Sheng 84 Dec 15, 2022
Xrs is a POSIX-subset operating system kernel written in Rust.

XRS-OS ( ?? WIP) Xrs is a POSIX-subset operating system kernel written in Rust. Current project team members 0x5459 core developer (he/him) 0x5457 cor

null 7 Nov 16, 2022
An attempt at an operating system written in Rust

Rust Operating System An attempt at a simple operating system in Rust and a semester project for the Operating Systems course at CS@UCU. Documentation

Andriy Sultanov 10 Jan 15, 2022
Rux - An x86_64 toy operating system kernel written in Rust

Rux - An x86_64 toy operating system kernel written in Rust. Rux is a port of the Hux kernel, my x86 32-bit single-CPU toy kernel written in C, following the OSTEP book structure and terminology.

Guanzhou Jose Hu 6 Feb 26, 2022
A Rust Operating System, written from the ground up

ThornOS A Rust Operating System, written from the ground up Build Dependencies Bootimage TODO: Document build process in more detail Acknowledgements

Stuart Reid 1 Mar 31, 2022
🌃 Shade is an operating system written for the communication.

?? Shade Shade is an operating system written for the communication. ?? Experiencing Building Requirements System: Windows, Linux or macOS. Memory: 1G

EnabledFish 2 Dec 22, 2022
A hobby operating system written in Zig & C that reimagines classic UNIX ideas for modern technology

zorroOS is a hobby operating system written in Zig, currently targeting x86_64 PCs. Building Building zorroOS is simple. First, ensure that you have t

TalonFox 34 Jul 5, 2023
A hobby operating system, in Rust

intermezzOS: kernel intermezzOS is a hobby operating system. This repository is for its kernel. See the website for more. License This project is dual

intermezzOS 1.3k Jan 1, 2023
A simples rust operating system that prints hello world.

rust-os-helloworld A simples rust operating system that prints hello world. Just run: cargo install bootimage and: cargo bootimage Install QEMU and: q

null 3 Nov 24, 2021
A Real Time Operating System in Rust for Cortex M3 embedded systems

A Real Time Operating System in Rust for Cortex M3 embedded systems

Manuel Forcén Muñoz 5 Jun 1, 2022
A secure embedded operating system for microcontrollers

Tock is an embedded operating system designed for running multiple concurrent, mutually distrustful applications on Cortex-M and RISC-V based embedded

Tock Embedded OS 4.1k Jan 5, 2023
A secure embedded operating system for microcontrollers

Tock is an embedded operating system designed for running multiple concurrent, mutually distrustful applications on Cortex-M and RISC-V based embedded

Tock Embedded OS 4k Jan 2, 2023
The Stupid Operating System

Stupid Operating System SOS is a simple, tiny toy OS implemented in Rust. I'm writing this mostly for fun, to learn more about OS design and kernel ha

SOS 241 Dec 15, 2022
Aero is a new modern, unix based operating system. It is being developed for educational purposes.

Areo Aero is a new modern, unix based operating system written in Rust and is being developed for educational purposes. Aero follows the monolithic ke

Anhad Singh 623 Dec 24, 2022
The official kernel for Popcorn OS, and operating system designed for handheld devices.

About Popkern is the kernel for Popcorn OS, an operating system designed for handheld devices. As such, the kernel is (to be) optimised at all levels

Team Scena 3 Sep 19, 2021
Geng wanzheng ([a] more complete) asynchronous operating system

更完整系统(GWZOS) 更完整系统的目的是编写一个异步功能完整的异步操作系统。我们希望尽可能完整地实现异步内核的核心概念,提供相应的驱动、软件生态系统,为未来内核的设计探索可能的实现方案。对比不同解决方案的性能开销,得到较详细的内核验证结论。 感谢大家对项目的支持!接龙链接 设计文档请参考: 无相

Luo Jia 10 Aug 26, 2021
A small operating system, for my own learning

taos This project is the result of following Philipp Oppermann's series of tutorials in building a small operating system kernel targeting x86-64, alo

null 0 Nov 7, 2021