software: Avoid libase renaming to libutils/libcomm and keep readchar/putsnonl retro-compatibility.

We'll maybe do it but that's probably not the right time. We have to make
the picolibc switch as smooth as possible for users (and so avoid update
as much as possible).

In the long term, it would be good to provide a LiteX C SDK, so we'll make
eventual changes when doing this.
This commit is contained in:
Florent Kermarrec 2021-09-27 15:03:07 +02:00
parent ae1d43b965
commit 3d32ac3d2e
39 changed files with 45 additions and 65 deletions

View File

@ -43,8 +43,7 @@ soc_software_packages = [
"libcompiler_rt",
# LiteX cores.
"libutils",
"libcomm",
"libbase",
# LiteX Ecosystem cores.
"libfatfs",

View File

@ -21,12 +21,12 @@
#include "sfl.h"
#include "boot.h"
#include <libcomm/uart.h>
#include <libbase/uart.h>
#include <libutils/console.h>
#include <libutils/crc.h>
#include <libutils/jsmn.h>
#include <libutils/progress.h>
#include <libbase/console.h>
#include <libbase/crc.h>
#include <libbase/jsmn.h>
#include <libbase/progress.h>
#include <libliteeth/udp.h>
#include <libliteeth/tftp.h>

View File

@ -4,7 +4,7 @@
#include <stdlib.h>
#include <system.h>
#include <libutils/crc.h>
#include <libbase/crc.h>
#include <generated/csr.h>

View File

@ -5,7 +5,7 @@
#include <stdbool.h>
#include <generated/csr.h>
#include <libcomm/i2c.h>
#include <libbase/i2c.h>
#include "../command.h"
#include "../helpers.h"

View File

@ -4,11 +4,11 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <libutils/memtest.h>
#include <libbase/memtest.h>
#include <generated/csr.h>
#include <generated/mem.h>
#include <libcomm/i2c.h>
#include <libbase/i2c.h>
#include <liblitedram/sdram.h>
#include <liblitedram/bist.h>

View File

@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <libutils/memtest.h>
#include <libbase/memtest.h>
#include <generated/csr.h>
#include <generated/mem.h>

View File

@ -5,8 +5,8 @@
#include <stdio.h>
#include <string.h>
#include <libutils/console.h>
#include <libutils/crc.h>
#include <libbase/console.h>
#include <libbase/crc.h>
#include "readline.h"
#include "helpers.h"

View File

@ -7,7 +7,7 @@
#include <generated/csr.h>
#include <generated/soc.h>
#include <irq.h>
#include <libcomm/uart.h>
#include <libbase/uart.h>
#include <stdio.h>
#if defined(__microwatt__)

View File

@ -31,11 +31,11 @@
#include <generated/mem.h>
#include <generated/git.h>
#include <libutils/console.h>
#include <libutils/crc.h>
#include <libbase/console.h>
#include <libbase/crc.h>
#include <libcomm/spiflash.h>
#include <libcomm/uart.h>
#include <libbase/spiflash.h>
#include <libbase/uart.h>
#include <liblitedram/sdram.h>

View File

@ -47,6 +47,7 @@ DEPFLAGS += -MD -MP
#
INCLUDES = -I$(PICOLIBC_DIRECTORY)/newlib/libc/tinystdio \
-I$(PICOLIBC_DIRECTORY)/newlib/libc/include \
-I$(LIBBASE_DIRECTORY) \
-I$(SOC_DIRECTORY)/software/include \
-I$(SOC_DIRECTORY)/software \
-I$(BUILDINC_DIRECTORY) \

4
litex/soc/software/demo/demo.py Normal file → Executable file
View File

@ -8,7 +8,6 @@
import os
import argparse
from distutils.dir_util import copy_tree
def main():
parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.")
@ -20,8 +19,7 @@ def main():
os.makedirs("demo", exist_ok=True)
# Copy contents to demo directory
src = os.path.abspath(os.path.dirname(__file__))
copy_tree(src, "demo")
os.system(f"cp {os.path.abspath(os.path.dirname(__file__))}/* demo")
# Compile demo
build_path = args.build_path if os.path.isabs(args.build_path) else os.path.join("..", args.build_path)

View File

@ -9,7 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <libutils/console.h>
#include <libbase/console.h>
#define R(mul,shift,x,y) \
_=x; \

View File

@ -4,7 +4,7 @@
#include <generated/csr.h>
#include <generated/soc.h>
#include <irq.h>
#include <libcomm/uart.h>
#include <libbase/uart.h>
void isr(void);

View File

@ -6,8 +6,8 @@
#include <string.h>
#include <irq.h>
#include <libcomm/uart.h>
#include <libutils/console.h>
#include <libbase/uart.h>
#include <libbase/console.h>
#include <generated/csr.h>
/*-----------------------------------------------------------------------*/

View File

@ -6,21 +6,24 @@ OBJECTS = \
crc32.o \
system.o \
progress.o \
memtest.o
memtest.o \
uart.o \
spiflash.o \
i2c.o
all: libutils.a
all: libbase.a
libutils.a: $(OBJECTS)
$(AR) crs libutils.a $(OBJECTS)
libbase.a: $(OBJECTS)
$(AR) crs libbase.a $(OBJECTS)
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
%.o: $(LIBUTILS_DIRECTORY)/%.c
%.o: $(LIBBASE_DIRECTORY)/%.c
$(compile)
.PHONY: all clean
clean:
$(RM) $(OBJECTS)
$(RM) libutils.a .*~ *~
$(RM) libbase.a .*~ *~

View File

@ -12,6 +12,9 @@ typedef int (*console_read_nonblock_hook)(void);
void console_set_write_hook(console_write_hook h);
void console_set_read_hook(console_read_hook r, console_read_nonblock_hook rn);
#define readchar getchar
#define putsnonl(X) fputs(X, stdout)
int readchar_nonblock(void);
#ifdef __cplusplus

View File

@ -7,7 +7,7 @@ void isr(void);
#ifdef __or1k__
#include <libcomm/uart.h>
#include <libbase/uart.h>
#define EXTERNAL_IRQ 0x8

View File

@ -16,8 +16,8 @@
#include <stdio.h>
#include <libutils/console.h>
#include <libcomm/uart.h>
#include <libbase/console.h>
#include <libbase/uart.h>
#include <generated/csr.h>

View File

@ -1,24 +0,0 @@
include ../include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.mak
OBJECTS = \
uart.o \
spiflash.o \
i2c.o \
all: libcomm.a
libcomm.a: $(OBJECTS)
$(AR) crs libcomm.a $(OBJECTS)
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
%.o: $(LIBCOMM_DIRECTORY)/%.c
$(compile)
.PHONY: all clean
clean:
$(RM) $(OBJECTS)
$(RM) libcomm.a .*~ *~

View File

@ -15,8 +15,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <libutils/memtest.h>
#include <libutils/lfsr.h>
#include <libbase/memtest.h>
#include <libbase/lfsr.h>
#ifdef CSR_SDRAM_BASE
#include <generated/sdram_phy.h>

View File

@ -10,7 +10,7 @@
#include <stdint.h>
#include <string.h>
#include <libutils/progress.h>
#include <libbase/progress.h>
#include "udp.h"
#include "tftp.h"

View File

@ -14,7 +14,7 @@
#include <stdio.h>
#include <arpa/inet.h>
#include <system.h>
#include <libutils/crc.h>
#include <libbase/crc.h>
#include "udp.h"

View File

@ -4,8 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libutils/memtest.h>
#include <libutils/crc.h>
#include <libbase/memtest.h>
#include <libbase/crc.h>
#include <generated/csr.h>
#include <generated/mem.h>