Giter Site home page Giter Site logo

lpf-2001 / xv6-k210 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abrasumente233/xv6-k210

3.0 0.0 0.0 84.45 MB

Port XV6 to K210 board!

License: MIT License

Shell 0.01% Python 10.54% Perl 0.05% C 36.49% Assembly 0.44% Rust 3.57% Makefile 0.33% Jupyter Notebook 48.58%

xv6-k210's Introduction

XV6-RISCV On K210

Run xv6-riscv on k210 board
English | δΈ­ζ–‡

 (`-')           (`-')                   <-.(`-')                            
 (OO )_.->      _(OO )                    __( OO)                            
 (_| \_)--.,--.(_/,-.\  ,--.    (`-')    '-'. ,--.  .----.   .--.   .----.   
 \  `.'  / \   \ / (_/ /  .'    ( OO).-> |  .'   / \_,-.  | /_  |  /  ..  \  
  \    .')  \   /   / .  / -.  (,------. |      /)    .' .'  |  | |  /  \  . 
  .'    \  _ \     /_)'  .-. \  `------' |  .   '   .'  /_   |  | '  \  /  ' 
 /  .'.  \ \-'\   /   \  `-' /           |  |\   \ |      |  |  |  \  `'  /  
`--'   '--'    `-'     `----'            `--' '--' `------'  `--'   `---''   

run-k210

Dependencies

Installation

git clone https://github.com/HUST-OS/xv6-k210

Run on k210 board

First you need to connect your k210 board to your PC.
And check the USB serial port (In my situation it will be ttyUSB0):

ls /dev/ | grep USB

Build the kernel and user program:

cd xv6-k210
make build

Instead of the original file system, xv6-k210 runs with FAT32. You might need an SD card with FAT32 format.
Your SD card should NOT keep a partition table. To start shell and other user programs, you need to copy them into your SD card.
First, connect and mount your SD card (SD card reader required).

ls /dev/ # To check your SD device
mount <your SD device name> <mount point>
make sdcard dst="SD card mount point"
umount <mount point>

Then, insert the SD card to your k210 board and run:

make run

Sometimes you should change the USB serial port:

make run k210-serialport=`Your-USB-port`(default by ttyUSB0)

Ps: Most of the k210-port in Linux is ttyUSB0, if you use Windows or Mac OS, this doc may help you: maixpy-doc

Run on qemu-system-riscv64

First, make sure qemu-system-riscv64 is installed on your system.
Second, make a disk image file with FAT32 file system.

make fs

It will generate a disk image file fs.img, and compile some user programs like shell then copy them into the fs.img.
As long as the fs.img exists, you don't need to do this every time before running, unless you want to update it.

Finally, start running.

make run platform=qemu

Ps: Press Ctrl + A then X to quit qemu.

About shell

The shell commands are user programs, too. Those program should be put in a "/bin" directory in your SD card or the fs.img.
Now we support a few useful commands, such as cd, ls, cat and so on.

In addition, shell supports some shortcut keys as below:

  • Ctrl-H -- backspace
  • Ctrl-U -- kill a line
  • Ctrl-D -- end of file (EOF)
  • Ctrl-P -- print process list

Add my programs on xv6-k210

  1. Make a new C source file in xv6-user/ like myprog.c, and put your codes;
  2. You can include user.h to use the functions declared in it, such as open, gets and printf;
  3. Add a line "$U/_myprog\" in Makefile as below:
    UPROGS=\
        $U/_init\
        $U/_sh\
        $U/_cat\
        ...
        $U/_myprog\      # Don't ignore the leading '_'
  4. Then make:
    make userprogs
    Now you might see _myprog in xv6-user/ if no error detected. Finally you need to copy it into your SD (see here) or FS image (see here).

Progress

  • Multicore boot
  • Bare-metal printf
  • Memory alloc
  • Page Table
  • Timer interrupt
  • S mode extern interrupt
  • Receive uarths message
  • SD card driver
  • Process management
  • File system
  • User program
  • Steady keyboard input(k210)

TODO

Fix the bugs of U-mode exception on k210.

xv6-k210's People

Contributors

atomheartcoder avatar lpf-2001 avatar sktt1ryze avatar abrasumente233 avatar retrhelo avatar

Stargazers

 avatar ShiQiShen avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.