what is rv64ilp32?
The advancement of AIoT technology has driven the demand for higher computing power in Microcontrollers (MCU) and Application Processors (AP), highlighting the limitations of the 32-bit architecture. Memory access and atomic operation instructions are challenging to meet the requirements of modern systems, leading to a transition towards a 64-bit architecture. This transition faces challenges: running 32-bit software on 64-bit hardware affects performance due to the mismatch in pointer and register widths. To address this issue, the Xuantie team of DAMO Academy of Alibaba proposed the Relaxed-Addressing Mode and, in collaboration with the PLCT Lab of Institute of Software, Chinese Academy of Sciences , released the industry's first RISC-V new 32-bit product-grade open-source toolchain (rv64ilp32 toolchain), designed specifically for firmware, RTOS, and the Linux kernel, optimizing performance and cost. The new 32-bit Linux kernel significantly surpasses traditional solutions in performance, with a 300% improvement in ebpf performance and a 17% increase in iperf-tcp.
The Fedora community has a rich software ecosystem for RISC-V, and compared to traditional 64-bit solutions, the new 32-bit builds can save 39% of memory. This advantage makes Fedora RISC-V more widely applicable in the embedded system. Seeing the potential of the new 32-bit, we initiated the new 32-bit Fedora Remix project, which can now run on the k230 development board:
Quick Start
CanMV-K230 Fedora Firmware download:
[Release 2024.03.03-128m · ruyisdk/mkimg-k230-rv64ilp32](https://github.com/ruyisdk/mkimg-k230-rv64ilp32/releases/tag/2024.03.03-128m)
- rv64-canmv-rv64 (s64lp64+u64lp64) - rv32-canmv-rv64 (s64lp64+u32ilp32) - rv32-canmv-rv64ilp32 (s64ilp64 + u32ilp32)
Below is a comparison of memory overhead for different versions (compared to the traditional 64-bit k230, the new 32-bit Linux avoids 39% of memory overhead):
s64lp64 + u64lp64:
- free -h - total used free shared buff/cache available - Mem: 107Mi 39Mi 15Mi 1.0Mi 52Mi 53Mi
s64lp64 + u32ilp32:
free -h total used free shared buff/cache available Mem: 107Mi 33Mi 31Mi 1.0Mi 41Mi 67Mi
s64ilp32 + u32ilp32:
free -h total used free shared buff/cache available Mem: 108Mi 28Mi 41Mi 1.0Mi 38Mi 73Mi
(used: 39MB -> 33MB -> 28MB, Prevent 39% memory waste in s64ilp32 + u32ilp32
flash firmware
decompress zst file
zstd -d k230-sdcard-fedora_rv32-canmv-rv64ilp32.img.zst
Below is a comparison of memory overhead for different versions (compared to the traditional 64-bit k230, the new 32-bit Linux avoids 39% of memory overhead):
wipefs -a /dev/sdb dd if=k230-sdcard-fedora_rv32-canmv-rv64ilp32.img of=/dev/sdb bs=1M status=progress sync eject
Build Linux kernel
getting toolchain : https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32
geting Linux kernel:
git clone https://github.com/ruyisdk/k230-rv64ilp32-linux-kernel.git -b k230-6.6-ilp32-128M --depth=1 cd k230-rv64ilp32-linux-kernel
build the traditional s64lp64 Linux kernel:
make ARCH=riscv CROSS_COMPILE=<YOUR PATH>/riscv/bin/riscv64-unknown-elf- k230_evb_linux_enable_vector_defconfig all
To build a new 32-bit Linux, you only need to append a 64ilp32.config fragment.:
make ARCH=riscv CROSS_COMPILE=<YOUR PATH>/riscv/bin/riscv64-unknown-elf- k230_evb_linux_enable_vector_defconfig 64ilp32.config all