From f106b4a3ab6859c2ab54e8377609e643a4eef1e6 Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Tue, 2 May 2023 16:53:21 +0000 Subject: [PATCH] hello_world/Makefile: Add base address define. Add compiler define as gcc-8. hello_world/powerpc.lds.S: Assembler for setting address offset in linker script hello_world.elf|bin|hex: Removed as these compiled by the user. Makefile: Set RESET_ADDRESS to 0. Add verilator thread count define (default 1) --- Makefile | 4 +- hello_world/Makefile | 30 +- hello_world/hello_world.bin | Bin 6280 -> 0 bytes hello_world/hello_world.elf | Bin 87184 -> 0 bytes hello_world/hello_world.hex | 785 --------------------- hello_world/{powerpc.lds => powerpc.lds.S} | 9 +- 6 files changed, 33 insertions(+), 795 deletions(-) delete mode 100755 hello_world/hello_world.bin delete mode 100755 hello_world/hello_world.elf delete mode 100644 hello_world/hello_world.hex rename hello_world/{powerpc.lds => powerpc.lds.S} (50%) diff --git a/Makefile b/Makefile index 610f48d..b764793 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ _fpga_files = fpga/soc_reset.vhdl \ EXTERNAL_CORE=false # VHDL does not allow integers greater than 2^32, so shift down # by 16 bits and add 16 bits zeros back on in soc-generic.vhdl -RESET_ADDRESS=65280 # 0xff00_0000>>16 +RESET_ADDRESS=0 # 65280 # 0xff00_0000>>16 ifeq ($(EXTERNAL_CORE),false) fpga_files = $(_fpga_files) $(_soc_files) $(core_files) synth_files = $(core_files) $(soc_files) $(fpga_files) $(clkgen) $(toplevel) $(dmi_dtm) @@ -249,10 +249,12 @@ microwatt.json: $(synth_files) $(RAM_INIT_FILE) microwatt.v: $(synth_files) $(RAM_INIT_FILE) $(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(GHDL_TARGET_GENERICS) $(synth_files) -e toplevel; write_verilog $@" +THREADS=1 # How many threads should be used for verilator binary # Need to investigate why yosys is hitting verilator warnings, and eventually turn on -Wall # --top-module toplevel microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uart-verilator.c verilator -O3 -CFLAGS "-DCLK_FREQUENCY=$(CLK_FREQUENCY) -I../verilator" \ + --threads $(THREADS) \ --assert \ --cc microwatt.v \ --exe verilator/microwatt-verilator.cpp verilator/uart-verilator.c \ diff --git a/hello_world/Makefile b/hello_world/Makefile index dd51bd3..d84e7cd 100644 --- a/hello_world/Makefile +++ b/hello_world/Makefile @@ -5,21 +5,39 @@ ifneq ("$(ARCH)", "ppc64le") endif endif -CC = $(CROSS_COMPILE)gcc +#BOOT_INIT_BASE ?= 0xf0000000 # at QSPI address +#BOOT_INIT_BASE ?= 0x00600000 # inside DRAM address space +#BOOT_INIT_BASE ?= 0xff000000 # at ROM hi address (with coldboot firmware) +BOOT_INIT_BASE ?= 0x0 # start at zero (usual) + +# Debian Buster install doesn't have +# powerpc64le-linux-gnu-gcc, instead have to specify gcc-8 +COMPILER=gcc-8 + +CC = $(CROSS_COMPILE)$(COMPILER) LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy -CFLAGS = -Os -g -Wall -std=c99 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections -I../include +CFLAGS = -Os -g -Wall -std=c99 -mabi=elfv2 -msoft-float -mno-string \ + -mno-multiple -mno-vsx -mno-altivec -mlittle-endian \ + -fno-stack-protector -mstrict-align -ffreestanding \ + -fdata-sections -ffunction-sections -I../include \ + -DBOOT_INIT_BASE=$(BOOT_INIT_BASE) + ASFLAGS = $(CFLAGS) -LDFLAGS = -T powerpc.lds +LDFLAGS = -static -nostdlib -T powerpc.lds --gc-sections all: hello_world.hex +powerpc.lds: powerpc.lds.S + $(CC) $(CFLAGS) -P -E powerpc.lds.S -o powerpc.lds + console.o: ../lib/console.c $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ -hello_world.elf: hello_world.o head.o console.o - $(LD) $(LDFLAGS) -o $@ $^ +hello_world.elf: hello_world.o head.o console.o powerpc.lds + $(LD) $(LDFLAGS) -o $@ hello_world.o head.o console.o + powerpc64le-linux-gnu-objdump -D hello_world.elf > hello_world.as hello_world.bin: hello_world.elf $(OBJCOPY) -O binary $^ $@ @@ -28,7 +46,7 @@ hello_world.hex: hello_world.bin ../scripts/bin2hex.py $^ > $@ clean: - @rm -f *.o hello_world.elf hello_world.bin hello_world.hex + @rm -f *.o hello_world.elf hello_world.bin hello_world.hex powerpc.lds distclean: clean rm -f *~ diff --git a/hello_world/hello_world.bin b/hello_world/hello_world.bin deleted file mode 100755 index e4b14ca6f70843d9d43a149c8d18fb1f22072fe5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6280 zcmeHLOKTHR6#ix!(->Qg&_$tQZ(>0!L+mo4rcCOqrrLt21#vMox`+?zqmV>1IusWz z6clk$H|@$SMBKZpR=U%9c3W+|KD%DA7YG}( z_2C??XVDrq04o8E56;$)=V?9H6dE5a){U8ApVddAtP73)+vZl6xYs?Z#jmbUYsKC+IwsDSF6-zo`e@*LO zl+PAIP(GC8yM~)J$ECndX<9qK~kuhFJt?oFmQR~1+ z64*W0g!cGj9}189gsGtY%16og`42X>-LT_w?#vCj-1#N0&fEafG3L(`zaj@amA~bn zt&)TIox|=qJBNP5)^26|fWykH!0tDmbF*#<_^%M zg)pLbARHr!V*7u}-XON`Y9OqU&Id@>+~=8F30f=aQ!Ew8wPXtH^Q8H(2?RBPk)sOf zvAEQWWqDv)PY9$2Y36OsPU*Vh_jEa@gZT3S`k-o-QKIuQ+Z$c zZS*@>9rSp^3atDl9=V));!qvVn%e5Pjp|Y<7O+DL&|V=;EAw^Y>hZVK2ezw78>FY5*Zl7{RgMUR%CWB>gD;mPx# diff --git a/hello_world/hello_world.elf b/hello_world/hello_world.elf deleted file mode 100755 index 5eeedc452464d33864fa4a2deb5dd10f5eccbfd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 87184 zcmeH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