diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 882843529..3c932141f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -70,3 +70,4 @@ Copyright (c) 2015-2019 William D. Jones Copyright (c) 2013-2014 Yann Sionneau Copyright (c) 2015 Yves Delley Copyright (c) 2015 Zach Smith +Copyright (c) 2020 Yehowshua Immanuel diff --git a/README.md b/README.md index 8bb0a4051..8c6d2ed31 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![LiteX](https://raw.githubusercontent.com/enjoy-digital/litex/master/doc/litex.png) +![LiteX](doc/litex.png) ``` Copyright 2012-2020 / EnjoyDigital ``` @@ -95,6 +95,9 @@ Migen documentation can be found here: https://m-labs.hk/migen/manual # Quick start guide (for advanced users) 0. Install Python 3.5+ and FPGA vendor's development tools. 1. Install Migen/LiteX and the LiteX's cores: + +On MacOS, make sure you have [HomeBrew](https://brew.sh) installed. Then do, ``brew install wget``. + ```sh $ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py $ chmod +x litex_setup.py @@ -105,28 +108,47 @@ $ ./litex_setup.py init install --user (--user to install to user directory) $ ./litex_setup.py update ``` 3. Install a RISC-V toolchain: + +For Linux: ```sh $ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz $ tar -xvf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz $ export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/ ``` +MacOS: +```sh +$ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin.tar.gz +$ tar -xvf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin.tar.gz +$ export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin/bin/ +``` 4. Build the target of your board...: Go to litex-boards/litex_boards/xxyy/targets (xxyy being community/official/partner) and execute the target you want to build -5. ... and/or install Verilator and test LiteX on your computer: - Download and install Verilator: http://www.veripool.org/ - On Fedora: +5. ... and/or install [Verilator](http://www.veripool.org/) and test LiteX on your computer + +On Fedora: ```sh $ sudo dnf install libevent-devel json-c-devel ``` - On Ubuntu: +On Ubuntu: ```sh -$ sudo apt install libevent-dev libjson-c-dev +$ sudo apt install libevent-dev libjson-c-dev verilator +$ litex_sim +``` +On MacOS: + + +```sh +$ brew install json-c verilator libevent +$ brew cask install tuntap $ litex_sim ``` 6. Run a terminal program on the board's serial port at 115200 8-N-1. - You should get the BIOS prompt. + + You should get the BIOS prompt like the one below. + +![bios_screenshot](doc/bios_screenshot.png) # Contact -E-mail: florent@enjoy-digital.fr \ No newline at end of file +E-mail: florent@enjoy-digital.fr diff --git a/doc/bios_screenshot.png b/doc/bios_screenshot.png new file mode 100644 index 000000000..8de4f862c Binary files /dev/null and b/doc/bios_screenshot.png differ diff --git a/litex/build/sim/core/Makefile b/litex/build/sim/core/Makefile index b1c880280..28b45058f 100644 --- a/litex/build/sim/core/Makefile +++ b/litex/build/sim/core/Makefile @@ -1,8 +1,16 @@ include variables.mak +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Darwin) + CFLAGS += -I/usr/local/include/ + LDFLAGS += -L/usr/local/lib + LDFLAGS += -lpthread -ljson-c -lm -lstdc++ -ldl -levent +else + CC ?= gcc + CFLAGS += -Wall -$(OPT_LEVEL) -ggdb $(if $(COVERAGE), -DVM_COVERAGE) + LDFLAGS += -lpthread -Wl,--no-as-needed -ljson-c -lm -lstdc++ -Wl,--no-as-needed -ldl -levent +endif -CC ?= gcc -CFLAGS += -Wall -$(OPT_LEVEL) -ggdb $(if $(COVERAGE), -DVM_COVERAGE) -LDFLAGS += -lpthread -Wl,--no-as-needed -ljson-c -lm -lstdc++ -Wl,--no-as-needed -ldl -levent CC_SRCS ?= "--cc dut.v" diff --git a/litex/build/sim/core/modules/ethernet/Makefile b/litex/build/sim/core/modules/ethernet/Makefile index 211b76d5e..d29bf1c24 100644 --- a/litex/build/sim/core/modules/ethernet/Makefile +++ b/litex/build/sim/core/modules/ethernet/Makefile @@ -1,5 +1,6 @@ include ../variables.mak CFLAGS += -Itapcfg/src/include +UNAME_S := $(shell uname -s) all: $(OBJ_DIR)/ethernet.so @@ -8,7 +9,11 @@ include ../rules.mak OBJS = $(addprefix $(OBJ_DIR)/, ethernet.o tapcfg.o taplog.o) $(OBJ_DIR)/ethernet.so: $(OBJS) +ifeq ($(UNAME_S),Darwin) + $(CC) $(LDFLAGS) -o $@ $^ +else $(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^ +endif $(OBJ_DIR)/tapcfg.o: tapcfg/src/lib/tapcfg.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/litex/build/sim/core/modules/rules.mak b/litex/build/sim/core/modules/rules.mak index 7cbe265c8..62ff24288 100644 --- a/litex/build/sim/core/modules/rules.mak +++ b/litex/build/sim/core/modules/rules.mak @@ -1,8 +1,14 @@ +UNAME_S := $(shell uname -s) + $(OBJ_DIR)/%.o: %.c $(CC) -c $(CFLAGS) -I../.. -o $@ $< $(OBJ_DIR)/%.so: $(OBJ_DIR)/%.o +ifeq ($(UNAME_S),Darwin) + $(CC) $(LDFLAGS) -o $@ $^ +else $(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $< +endif .PHONY: clean clean: diff --git a/litex/build/sim/core/modules/variables.mak b/litex/build/sim/core/modules/variables.mak index 6c504f3c4..dee2a9832 100644 --- a/litex/build/sim/core/modules/variables.mak +++ b/litex/build/sim/core/modules/variables.mak @@ -1,5 +1,13 @@ CC ?= gcc -CFLAGS += -Wall -O3 -ggdb -fPIC -Werror +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Darwin) + CFLAGS += -I/usr/local/include/ + LDFLAGS += -L/usr/local/lib -ljson-c + CFLAGS += -Wall -O3 -ggdb -fPIC +else + CFLAGS += -Wall -O3 -ggdb -fPIC -Werror +endif LDFLAGS += -levent -shared -fPIC OBJ_DIR ?= . diff --git a/litex/build/sim/core/modules/xgmii_ethernet/Makefile b/litex/build/sim/core/modules/xgmii_ethernet/Makefile index 39f54cd8e..ece1f013c 100644 --- a/litex/build/sim/core/modules/xgmii_ethernet/Makefile +++ b/litex/build/sim/core/modules/xgmii_ethernet/Makefile @@ -1,5 +1,6 @@ include ../variables.mak CFLAGS += -Itapcfg/src/include +UNAME_S := $(shell uname -s) all: $(OBJ_DIR)/xgmii_ethernet.so @@ -8,7 +9,11 @@ include ../rules.mak OBJS = $(addprefix $(OBJ_DIR)/, xgmii_ethernet.o tapcfg.o taplog.o) $(OBJ_DIR)/xgmii_ethernet.so: $(OBJS) +ifeq ($(UNAME_S),Darwin) + $(CC) $(LDFLAGS) -o $@ $^ +else $(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^ +endif $(OBJ_DIR)/tapcfg.o: tapcfg/src/lib/tapcfg.c $(CC) $(CFLAGS) -c -o $@ $<