CH32V307 Picolibc to the rescue
With our shiny new risv32 gcc, let's look at the generated code size.
The demo is a small graphic demo using a SSD1306
With vanilla libc build with our shiny riscv32gcc : Code = 50 kB
Let's build and install picolibc
In order to do so, create a cross.txt containing :
[binaries]
c = 'riscv64-unknown-elf-gcc'
ar = 'riscv64-unknown-elf-ar'
as = 'riscv64-unknown-elf-as'
ld = 'riscv64-unknown-elf-ld'
strip = 'riscv64-unknown-elf-strip'
[host_machine]
system = 'unknown'
cpu_family = 'riscv'
cpu = 'riscv'
endian = 'little'
[properties]
c_args = [ '-nostdlib', '-msave-restore', '-fno-common' ]
# default multilib is 64 bit
c_args_ = [ '-march=rv32imac', '-mabi=ilp32']
needs_exe_wrapper = true
skip_sanity_check = true
make sure our shiny new riscv gcc is in your path, then
mkdir build && cd build && meson --cross-file ../cross.txt .. && ninja && ninja install
then use --specs=picolibc.specs to compile AND to link.
Comments
Post a Comment