Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix src build #74

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ all: $(VCDS)
@echo simulation ok.

clean:
-rm $(VCDS) $(XSIM) $(TRCE)
-rm -f $(VCDS) $(XSIM) $(TRCE)

$(VCDS): $(XSIM)
@echo finish | \
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

$(PROJ).ld: $(PROJ).lds Makefile
$(CPP) $(CPFLAGS) -DMLEN=$$(awk '/define MLEN/ { print 2**$$3 }' ../rtl/config.vh) $(PROJ).lds $(PROJ).ld
Expand Down
2 changes: 1 addition & 1 deletion src/badapple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

$(PROJ).a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
40 changes: 20 additions & 20 deletions src/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ ifndef CROSS
export ENDIAN = little
#export ENDIAN = big

export CROSS = riscv64-unknown-elf-
#export CROSS = riscv32-unknown-elf-
#export CROSS = riscv32-embedded$(ENDIAN)-elf-
#export CROSS = riscv-elf-
#export CROSS = riscv32-unknown-elf-
#export CROSS = riscv32-embedded-elf-
#export CROSS = riscv64-unknown-elf
#export CROSS = riscv32-unknown-elf
#export CROSS = riscv32-embedded$(ENDIAN)-elf
#export CROSS = riscv-elf
#export CROSS = riscv32-unknown-elf
export CROSS = riscv32-embedded-elf

export CCPATH = /usr/local/bin
#export CCPATH = /usr/local/bin
#export CCPATH = /opt/riscv/bin
#export CCPATH = /usr/local/share/gcc-$(CROSS)/bin/
export CCPATH = /usr/local/share/gcc-$(CROSS)/bin
#export CCPATH = /usr/local/share/toolchain-$(CROSS)/bin
endif

Expand All @@ -65,19 +65,19 @@ ifndef DARKLIBC
export DARKLIBC = darklibc
endif

export CC = $(CCPATH)/$(CROSS)gcc
export AS = $(CCPATH)/$(CROSS)as
export RL = $(CCPATH)/$(CROSS)ranlib
export LD = $(CCPATH)/$(CROSS)ld
export OC = $(CCPATH)/$(CROSS)objcopy
export OD = $(CCPATH)/$(CROSS)objdump
export AR = $(CCPATH)/$(CROSS)ar
export CPP = $(CCPATH)/$(CROSS)cpp
export CC = $(CCPATH)/$(CROSS)-gcc
export AS = $(CCPATH)/$(CROSS)-as
export RL = $(CCPATH)/$(CROSS)-ranlib
export LD = $(CCPATH)/$(CROSS)-ld
export OC = $(CCPATH)/$(CROSS)-objcopy
export OD = $(CCPATH)/$(CROSS)-objdump
export AR = $(CCPATH)/$(CROSS)-ar
export CPP = $(CCPATH)/$(CROSS)-cpp

CCFLAGS = -Wall -fcommon -ffreestanding -Os -fno-delete-null-pointer-checks -m$(ENDIAN)-endian
CCFLAGS += -march=$(ARCH) -mabi=$(ABI) -I$(DARKLIBC)/include -I../$(DARKLIBC)/include
CCFLAGS += -D__RISCV__ -DBUILD="\"$(BUILD)\"" -DARCH="\"$(ARCH)\""
export CCFLAGS += -mcmodel=medany -mexplicit-relocs # relocable clode
CFLAGS = -Wall -fcommon -ffreestanding -Os -fno-delete-null-pointer-checks -m$(ENDIAN)-endian
CFLAGS += -march=$(ARCH) -mabi=$(ABI) -I$(DARKLIBC)/include -I../$(DARKLIBC)/include
CFLAGS += -D__RISCV__ -DBUILD="\"$(BUILD)\"" -DARCH="\"$(ARCH)\""
export CFLAGS += -mcmodel=medany -mexplicit-relocs # relocatable code
export ASFLAGS = -march=$(ARCH)

ifdef ENDIAN==big
Expand Down
4 changes: 2 additions & 2 deletions src/coremark/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include ../config.mk

DFLAGS_STR = -DFLAGS_STR=\""-O2 -DPERFORMANCE_RUN=1"\"

CCFLAGS += -I. -I./src $(DFLAGS_STR) -DITERATIONS=4000 -DPERFORMANCE_RUN=1
CFLAGS += -I. -I./src $(DFLAGS_STR) -DITERATIONS=4000 -DPERFORMANCE_RUN=1

PROJ = coremark
OBJS = ./src/core_main.o ./src/core_matrix.o ./src/core_list_join.o ./src/core_state.o ./src/core_util.o core_portme.o ee_printf.o
Expand All @@ -53,7 +53,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

$(PROJ).a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
2 changes: 2 additions & 0 deletions src/coremark/core_portme.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Original Author: Shay Gal-on
*/
#include <io.h>
#include <stdio.h>
#include <string.h> // memcpy..
#include <unistd.h> // usleep..
#include "coremark.h"
#include "core_portme.h"

Expand Down
4 changes: 2 additions & 2 deletions src/darklibc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

include ../config.mk

CCFLAGS += -Iinclude
CFLAGS += -Iinclude

PROJ = darklibc
OBJS = stdio.o io.o string.o misc.o unistd.o util.o #small.o # start.o
Expand All @@ -51,7 +51,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

%.a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
1 change: 1 addition & 0 deletions src/darklibc/include/stddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifndef __STDDEF__
#define __STDDEF__

typedef unsigned int size_t;
#define EOF -1
#define NUL 0
#define NULL (void *)0
Expand Down
4 changes: 2 additions & 2 deletions src/darkshell/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include ../config.mk
# SMALL = 1

ifdef SMALL
CCFLAGS += -DSMALL
CFLAGS += -DSMALL
endif

PROJ = darkshell
Expand All @@ -56,7 +56,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(C) $(CFLAGS) -S $< -o $@

$(PROJ).a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
4 changes: 2 additions & 2 deletions src/donut/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include ../config.mk
# SMALL = 1

ifdef SMALL
CCFLAGS += -DSMALL
CFLAGS += -DSMALL
endif

PROJ = donut
Expand All @@ -56,7 +56,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

$(PROJ).a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
2 changes: 1 addition & 1 deletion src/mandelbrot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ clean:
$(AS) $(ASFLAGS) -c $< -o $@

%.s: %.c Makefile
$(CC) $(CCFLAGS) -S $< -o $@
$(CC) $(CFLAGS) -S $< -o $@

$(PROJ).a: $(OBJS) Makefile
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down