mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Implement initial support for lm32 and or1k
Picolibc doesn't maintain meson.build or cross*.txt files for lm32 and or1k CPUs. This commit adds meson.build files for both of them. Also libc/Makefile got modifed to determine CPU family from $(CPU) value and generate cross.txt file. Now picolibc gets compiled with LiteX flags too. It doesn't compile on neither of them yet, but at least riscv still works.
This commit is contained in:
parent
ca4e17d886
commit
ab881c561f
4 changed files with 143 additions and 20 deletions
|
@ -3,10 +3,55 @@ include $(SOC_DIRECTORY)/software/common.mak
|
|||
|
||||
all: libc.a iob.c.o
|
||||
|
||||
libc.a:
|
||||
CPUFAMILY=
|
||||
|
||||
ifneq ($(findstring $(CPU), serv femtorv picorv32 minerva vexriscv vexriscv_smp ibex cv32e40p rocket blackparrot),)
|
||||
CPUFAMILY = riscv
|
||||
else ifeq ($(CPU), lm32)
|
||||
CPUFAMILY = lm32
|
||||
else ifeq ($(CPU), mor1kx)
|
||||
CPUFAMILY = or1k
|
||||
else ifeq ($(CPU), microwatt)
|
||||
CPUFAMILY = powerpc
|
||||
else ifeq ($(CPU), zynq7000)
|
||||
CPUFAMILY = arm
|
||||
else
|
||||
$(error Unsupported CPU)
|
||||
endif
|
||||
|
||||
define CROSSFILE
|
||||
[binaries]
|
||||
c = '$(TRIPLE)-gcc'
|
||||
ar = '$(TRIPLE)-ar'
|
||||
as = '$(TRIPLE)-as'
|
||||
nm = '$(TRIPLE)-nm'
|
||||
strip = '$(TRIPLE)-strip'
|
||||
|
||||
[host_machine]
|
||||
system = 'unknown'
|
||||
cpu_family = '$(CPUFAMILY)'
|
||||
cpu = '$(CPU)'
|
||||
endian = '$(CPUENDIANNESS)'
|
||||
|
||||
[built-in options]
|
||||
c_args = [ '-DPRINTF_LEVEL=1', $(foreach flag,$(filter-out $(INCLUDES) $(DEPFLAGS),$(CFLAGS)),'$(flag)',) ]
|
||||
c_link_args = [ '-DPRINTF_LEVEL=1', $(foreach flag,$(LDFLAGS),'$(flag)',) ]
|
||||
endef
|
||||
|
||||
export CROSSFILE
|
||||
cross.txt:
|
||||
@echo "$$CROSSFILE" > $@
|
||||
|
||||
$(PICOLIBC_DIRECTORY)/newlib/libc/machine/$(CPUFAMILY)/meson.build:
|
||||
cp $(LIBC_DIRECTORY)/$(CPUFAMILY)-meson.build $@
|
||||
|
||||
libc.a: cross.txt $(PICOLIBC_DIRECTORY)/newlib/libc/machine/$(CPUFAMILY)/meson.build
|
||||
meson $(PICOLIBC_DIRECTORY) \
|
||||
-Dmultilib=false \
|
||||
--cross-file "$(LIBC_DIRECTORY)/cross-rv32im.txt"
|
||||
-Dpicocrt=false \
|
||||
-Dincludedir=picolibc/$(TRIPLE)/include \
|
||||
-Dlibdir=picolibc/$(TRIPLE)/lib \
|
||||
--cross-file cross.txt
|
||||
meson compile
|
||||
cp newlib/libc.a libc.a
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
[binaries]
|
||||
c = 'riscv64-unknown-elf-gcc'
|
||||
ar = 'riscv64-unknown-elf-ar'
|
||||
as = 'riscv64-unknown-elf-as'
|
||||
nm = 'riscv64-unknown-elf-nm'
|
||||
strip = 'riscv64-unknown-elf-strip'
|
||||
|
||||
[host_machine]
|
||||
system = 'unknown'
|
||||
cpu_family = 'riscv'
|
||||
cpu = 'riscv32'
|
||||
endian = 'little'
|
||||
|
||||
[properties]
|
||||
c_args = [ '-DPRINTF_LEVEL=1', '-DSCANF_LEVEL=1', '-nostdlib', '-mno-save-restore', '-march=rv32im', '-mabi=ilp32']
|
||||
c_link_args = [ '-DPRINTF_LEVEL=1', '-DSCANF_LEVEL=1', '-nostdlib', '-mno-save-restore', '-march=rv32im', '-mabi=ilp32']
|
||||
skip_sanity_check = true
|
||||
|
48
litex/soc/software/libc/lm32-meson.build
Normal file
48
litex/soc/software/libc/lm32-meson.build
Normal file
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright © 2019 Keith Packard
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
srcs_machine = [
|
||||
'setjmp.S',
|
||||
]
|
||||
|
||||
foreach target : targets
|
||||
value = get_variable('target_' + target)
|
||||
set_variable('lib_machine' + target,
|
||||
static_library('machine' + target,
|
||||
srcs_machine,
|
||||
pic: false,
|
||||
include_directories: inc,
|
||||
c_args: value[1] + arg_fnobuiltin))
|
||||
endforeach
|
||||
|
48
litex/soc/software/libc/or1k-meson.build
Normal file
48
litex/soc/software/libc/or1k-meson.build
Normal file
|
@ -0,0 +1,48 @@
|
|||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Copyright © 2019 Keith Packard
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
srcs_machine = [
|
||||
'setjmp.S',
|
||||
]
|
||||
|
||||
foreach target : targets
|
||||
value = get_variable('target_' + target)
|
||||
set_variable('lib_machine' + target,
|
||||
static_library('machine' + target,
|
||||
srcs_machine,
|
||||
pic: false,
|
||||
include_directories: inc,
|
||||
c_args: value[1] + arg_fnobuiltin))
|
||||
endforeach
|
||||
|
Loading…
Reference in a new issue