From db390537a9f5463fb3cf31faa37bdd84011b3e11 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Wed, 28 Jul 2021 20:06:09 +0200 Subject: [PATCH] Compile entire picolibc It does not compile yet, will need __iob array to be defined Also there are multiple definitions of some functions --- litex/soc/integration/builder.py | 4 +- litex/soc/software/libc/Makefile | 9 ++-- litex/soc/software/libc/do-rv32im-configure | 11 ---- litex/soc/software/libc/swap_libc.sh | 58 --------------------- 4 files changed, 9 insertions(+), 73 deletions(-) delete mode 100755 litex/soc/software/libc/do-rv32im-configure delete mode 100644 litex/soc/software/libc/swap_libc.sh diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index cc24531f4..e50c4a8e0 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -36,12 +36,14 @@ def _create_dir(d, remove_if_exists=False): # Software Packages -------------------------------------------------------------------------------- soc_software_packages = [ + # picolibc + "libc", + # Compiler-RT. "libcompiler_rt", # LiteX cores. "libbase", - "libc", # LiteX Ecosystem cores. "libfatfs", diff --git a/litex/soc/software/libc/Makefile b/litex/soc/software/libc/Makefile index 7f47e0299..c2c495840 100644 --- a/litex/soc/software/libc/Makefile +++ b/litex/soc/software/libc/Makefile @@ -1,7 +1,10 @@ include ../include/generated/variables.mak include $(SOC_DIRECTORY)/software/common.mak -newlib/libc.a: - $(LIBC_DIRECTORY)/do-rv32im-configure $(PICOLIBC_DIRECTORY) +libc.a: + meson $(PICOLIBC_DIRECTORY) \ + -Dmultilib=false \ + --cross-file "$(LIBC_DIRECTORY)/cross-rv32im.txt" meson compile - sh $(LIBC_DIRECTORY)/swap_libc.sh + cp newlib/libc.a libc.a + diff --git a/litex/soc/software/libc/do-rv32im-configure b/litex/soc/software/libc/do-rv32im-configure deleted file mode 100755 index 64bf04d47..000000000 --- a/litex/soc/software/libc/do-rv32im-configure +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -ARCH=riscv64-unknown-elf -DIR=`dirname $0` -meson "$1" \ - -Dtests=true \ - -Dmultilib=false \ - -Dincludedir="picolibc/$ARCH/include" \ - -Dlibdir="picolibc/$ARCH/lib" \ - --cross-file "$DIR/cross-rv32im.txt" \ - diff --git a/litex/soc/software/libc/swap_libc.sh b/litex/soc/software/libc/swap_libc.sh deleted file mode 100644 index 6a13f3f24..000000000 --- a/litex/soc/software/libc/swap_libc.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -AR=riscv64-unknown-elf-ar - -for obj in \ - vsnprintf.c.o \ - vfprintf.c.o \ - fputc.c.o \ - filestrput.c.o \ - dtoa_ryu.c.o \ - ryu_table.c.o \ - ryu_umul128.c.o \ - ryu_log10.c.o \ - ryu_log2pow5.c.o \ - ryu_pow5bits.c.o \ - ryu_divpow2.c.o \ - qsort.c.o \ - strchr.c.o \ - strpbrk.c.o \ - strrchr.c.o \ - strcpy.c.o \ - strncpy.c.o \ - strcmp.S.o \ - strncmp.c.o \ - strcat.c.o \ - strncat.c.o \ - strlen.c.o \ - strnlen.c.o \ - strspn.c.o \ - memcmp.c.o \ - memset.S.o \ - memcpy.c.o \ - memmove.S.o \ - strstr.c.o \ - memchr.c.o \ - strtoul.c.o \ - strtol.c.o \ - snprintf.c.o \ - sprintf.c.o \ - rand.c.o \ - srand.c.o \ - abort.c.o \ - errno.c.o \ - strerror.c.o \ - strtod.c.o \ - ctype_.c.o \ - locale.c.o \ - mbtowc_r.c.o \ - wctomb_r.c.o \ - strcasecmp.c.o \ - isdigit.c.o \ -; do - $AR x "newlib/libc.a" $obj - $AR csr "../libbase/libbase.a" $obj - $AR csr "../libbase/libbase-nofloat.a" $obj - rm $obj -done -