Hemashushu’s Homepage

Curiosity, exploration and creation

Books

Many of the books and articles below only have titles and no content yet, this is because:

  1. I wrote them earlier, and most of the tools I used have been significantly updated. Much of the original content is no longer applicable, and I need time to update it.

  2. Some of the articles use generic software, such as the GCC compiler and C/Python/JavaScript/Rust languages. Now that I have my own language and compiler, I plan to replace all the tools in these articles with my own, therefore, it will take some time.

I will publish the following articles gradually, you can add my website to your bookmarks to check back for updates.

Tutorials

  • S01 - XiaoXuan's Adventures in RISC-V Wonderland Walkthrough the RISC-V platform with XiaoXuan Native: compilation, assembly, instructions, processes and memory

  • S20 - Building a Task List Organizer Web Application with XiaoXuan Script Build a local web application with IndexedDB, Web Storage API, and XiaoXuan Script

  • S30 - Mastering MCU Hardware Programming with XiaoXuan Micro A step-by-step guide to writing programs (firmware) for ARM Cortex-M chips

  • S40 - Zero to AI: Building a Deep Learning Framework from Scratch with XiaoXuan Lang, Volumn 1 Hands-on deep learning theory and practice, without any third-party libraries

  • S70 - Building Your Own Usable Programming Language: A Step-by-Step Guide Implement a programming language using XiaoXuan Lang: the lexer, parser, and interpreter

  • S71 - Designing a Runtime Virtual Machine (VM) for Systems Programming The memory, stack and the concurrency model of XiaoXuan Core VM

  • S80 - Zero to OS: Building Your Own Usable Operating System, Volumn 1: The User Space Build the user-space part of an OS for RISC-V platform from scratch in XiaoXuan Core

  • S81 - Zero to OS: Building Your Own Usable Operating System, Volumn 2: The Kernel Write a simple kernel in XiaoXuan Native for RISC-V platform

  • S82 - Building a Docker-like Container Utility from Scratch using XiaoXuan Core Linux namespaces, capabilities, seccomp and virtual networking

  • S83 - Building a KVM-based Virtual Machine Tool Using XiaoXuan Native Linux KVM, kernel, and virtual device I/O

  • S90 - Building Your Own Linux-Capable CPU: A Step-by-Step Guide Design a RISC-V CPU core using XiaoXuan Logic

  • S10 - Mastering Cross-Platform Development with QEMU Set up linux system and development environment in QEMU

Manuals

  • M01 - The XiaoXuan Programming Language Reference Syntax, fundamental, and the standard library

  • M02 - An introduction to the XiaoXuan Core Assembly The syntax, structure, and the VM instructions

  • M03 - An introduction to the XiaoXuan Core Intermediate Representation (IR) The syntax, structure and modules

Articles

  • XiaoXuan Script Object Notation (ASON): a new easy-to-read and write data representation format
  • XiaoXuan Allocator: an efficient memory allocator for automatic memory management programming language
  • XiaoYu SPI Flash FileSystem: a fail-safe filesystem designed for SPI flash chip

Table of content

  • S01 - XiaoXuan's Adventures in RISC-V Wonderland

    Walkthrough the RISC-V platform with XiaoXuan Native: compilation, assembly, instructions, processes and memory
    2024-02-17
    • Let's cross-compile the first program and run it
    • Write a "Hello World" program that can run standalone without an OS
    • Get to know XiaoXuan Assembly Language, and build "Hello World" program using it
    • Uncovering the ELF executable file, slim down the "Hello World" program to just 70 bytes
    • Setting up a Linux system and RISC-V development environment in QEMU
    • The memory layout of process, and the calling conventions
    • Static libraries, dynamic libraries, and dynamic linking
    • Design an assembly language with a target architecture of RISC-V
    • Implement the assembler and linker
  • S20 - Building a Task List Organizer Web Application with XiaoXuan Script

    Build a local web application with IndexedDB, Web Storage API, and XiaoXuan Script
    2024-02-21
    • Setting up the XiaoXuan Script development environment
    • Analyzing and designing the application's workflow
    • Writing basic pages
    • Introduction to the Web IndexedDB API
    • Writing basic XiaoXuan Script code for CRUD functionality
    • Introduction to the Web Storage API and adding attachment functionality
  • S30 - Mastering MCU Hardware Programming with XiaoXuan Micro

    A step-by-step guide to writing programs (firmware) for ARM Cortex-M chips
    2024-02-22
    • Introduction to STM32 MCU chips
    • Write your first firmware: Blinky
    • Respond to button presses with GPIOs
    • Master interrupts for efficient programming
    • Communicate with UART: sending and receiving data
    • Boost performance with Direct Memory Access (DMA)
    • Fine-tune your system with the clock tree
    • Schedule tasks with Timers
    • Convert analog signals: reading temperature with ADC
    • Control RGB LEDs with digital-to-analog converters (DACs)
    • Access the RTC module with the I2C protocol
    • Connect external Flash memory chips with the SPI protocol
    • Drive servos for precise motion control
    • Display graphics on OLED display module
  • S40 - Zero to AI: Building a Deep Learning Framework from Scratch with XiaoXuan Lang, Volumn 1

    Hands-on deep learning theory and practice, without any third-party libraries
    2024-02-17
    • The myth and truth of AI, and some foundations you need to know
    • Implementing neural network layers: weights and biases
    • Building a handwritten number recognition program: training and testing
    • Implementing backpropagation
    • Improving learning efficiency: parameter update methods and parameter initialization
    • Improving recognition accuracy with convolution neural networks (CNNs): implementing convolutional and pooling layers
    • Adding network layers, towards deep learning
  • S70 - Building Your Own Usable Programming Language: A Step-by-Step Guide

    Implement a programming language using XiaoXuan Lang: the lexer, parser, and interpreter
    2024-02-17
    • Programming language fundamentals: interpreters, VM, compilers, AOT and JIT
    • S-Expressions: designing a simple syntax
    • Implementing lexer: converting characters to language elements "tokens"
    • Implementing parser: converting tokens to structured "statements"
    • Evaluating expressions: understanding the "intent" of statements
    • Variables and context: enabling multiple statements to express complex "intents"
    • Statement blocks and variable scopes: organizing sentences to express more complex intents
    • Implementing control flow: conditional branches and loops, completing a "basic language"
    • Implementing functions: code structuring and reusability
    • Adding native functions: turn our language from "toy" to "tool"
    • Implementing anonymous functions (closures): enhancing language expressiveness
    • Adding syntax sugar: making our language more modern
    • Implementing "objects": handling complex data types
    • Implementing a minimal standard library: Lists, Maps, Sets, and file I/O
  • S71 - Designing a Runtime Virtual Machine (VM) for Systems Programming

    The memory, stack and the concurrency model of XiaoXuan Core VM
    2023-06-13
    • Data types and thoughts on floating-pointer numbers
    • The triadic stack
    • Using indexes instead of pointer
    • The instruction set
    • Using structured blocks instead of jumps for control flow
    • Tail call optimization
    • Environment calls
    • System calls
    • Bridge functions and external calls
    • A Data-race-free parallel Model
  • S80 - Zero to OS: Building Your Own Usable Operating System, Volumn 1: The User Space

    Build the user-space part of an OS for RISC-V platform from scratch in XiaoXuan Core
    2024-01-09
    • Set up a RISC-V virtual machine using QEMU
    • Write a minimal `init` program
    • Write a minimal `shell` program
    • Fundamentals of file system and processes, implementing the `pwd` and `ls` commands
    • Implement the `mount` and `umount` commands
    • Principals of `redirect`, implementing the `echo` and `cat` commands
    • Principal of `pipe`, implementing the `tee` and `tr` commands
    • Session and process groups
    • The `root` privileges, users and groups, and the `setuid` bit
    • Add support for shell scripts
  • S81 - Zero to OS: Building Your Own Usable Operating System, Volumn 2: The Kernel

    Write a simple kernel in XiaoXuan Native for RISC-V platform
    2024-02-06
    • RISC-V QEMU boot process and basic input/ouput
    • Creating a bare-metal "Hello, World" program
    • CPU interrupts and task switching
    • Multi-level page tables
    • Creating a simple file system
    • Pipes: Inter-process communication
    • Creating a simple shell
  • S82 - Building a Docker-like Container Utility from Scratch using XiaoXuan Core

    Linux namespaces, capabilities, seccomp and virtual networking
    2024-01-15
    • The principal of Linux container
    • Isolating the file system
    • Isolating the process space
    • Isolating the accounts
    • The virtual networking devices and route
  • S83 - Building a KVM-based Virtual Machine Tool Using XiaoXuan Native

    Linux KVM, kernel, and virtual device I/O
    2024-02-01
    • Comparison of CPU virtualization, simulators, and containers.
    • Creating a minimal virtual machine using the KVM API
    • Creating a virtual serial port device
    • Creating a virtual block device
    • Building a minimal kernel and a simple userspace program
    • Guide to booting a Linux kernel
  • S90 - Building Your Own Linux-Capable CPU: A Step-by-Step Guide

    Design a RISC-V CPU core using XiaoXuan Logic
    2024-01-15
    • Digital circuit fundamentals: combinational and sequential circuits
    • Building a Blinky circuit, and interacting with the visual simulator
    • Synthesizing and downloading to FPGA hardware (Optional)
    • Introduction to RISC-V Instruction Architecture
    • Instruction decoder
    • Register File and Arithmetic Logic Unit (ALU)
    • Jump and branch instructions
    • Memory and load/store instructions
    • RISC-V calling convention ABI and implementing the functon calling
    • Memory mapping and implementing the UART peripheral
    • ROM and Building a simple program (firmware)
    • Synthesizing and downloading to FPGA hardware (Optional)
    • Interacting via USB-UART and terminal on computer
  • S10 - Mastering Cross-Platform Development with QEMU

    Set up linux system and development environment in QEMU
    2024-02-17
    • Build a minimal Linux system
    • Build a base Linux system using Buildroot
    • Setting up a complete RISC-V Linux system, and developing with XiaoXuan Lang
    • Setting up remote editing and debugging by VSCode
  • M01 - The XiaoXuan Programming Language Reference

    Syntax, fundamental, and the standard library
    2023-04-16
    • Data types and Literals
    • Variables
    • Functions
    • Collection
    • Control Flow
    • Error Handling
    • Method, Generic and Interface
    • Pattern
    • Chain
    • Modules, Packages and Properties
    • Annotations and IoC
    • Macro
  • M02 - An introduction to the XiaoXuan Core Assembly

    The syntax, structure, and the VM instructions
    2023-09-10
    • Literals
    • Module Nodes
    • Instructions
    • Control Flow
    • Function Call
    • System Call
    • Environment Call
    • Packages and Modules
  • M03 - An introduction to the XiaoXuan Core Intermediate Representation (IR)

    The syntax, structure and modules
    2023-10-12
    • Data Types and Literals
    • Functions
    • Control Flow
    • Struct and Array
    • Packages and Modules