Skip to content

Commit

Permalink
am,include,arch: merge riscv*.h into riscv.h
Browse files Browse the repository at this point in the history
  • Loading branch information
sashimi-yzh committed Jul 2, 2023
1 parent ad8f8fb commit e0ae9b7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 44 deletions.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -79,11 +79,12 @@ READELF = $(CROSS_COMPILE)readelf
INC_PATH += $(WORK_DIR)/include $(addsuffix /include/, $(addprefix $(AM_HOME)/, $(LIBS)))
INCFLAGS += $(addprefix -I, $(INC_PATH))

ARCH_H := arch/$(ARCH).h
CFLAGS += -O2 -MMD -Wall -Werror $(INCFLAGS) \
-D__ISA__=\"$(ISA)\" -D__ISA_$(shell echo $(ISA) | tr a-z A-Z)__ \
-D__ARCH__=$(ARCH) -D__ARCH_$(shell echo $(ARCH) | tr a-z A-Z | tr - _) \
-D__PLATFORM__=$(PLATFORM) -D__PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z | tr - _) \
-DARCH_H=\"arch/$(ARCH).h\" \
-DARCH_H=\"$(ARCH_H)\" \
-fno-asynchronous-unwind-tables -fno-builtin -fno-stack-protector \
-Wno-main -U_FORTIFY_SOURCE
CXXFLAGS += $(CFLAGS) -ffreestanding -fno-rtti -fno-exceptions
Expand Down
5 changes: 5 additions & 0 deletions am/include/arch/riscv32-nemu.h → am/include/arch/riscv.h
Expand Up @@ -7,7 +7,12 @@ struct Context {
void *pdir;
};

#ifdef __riscv_e
#define GPR1 gpr[15] // a5
#else
#define GPR1 gpr[17] // a7
#endif

#define GPR2 gpr[0]
#define GPR3 gpr[0]
#define GPR4 gpr[0]
Expand Down
15 changes: 0 additions & 15 deletions am/include/arch/riscv64-nemu.h

This file was deleted.

14 changes: 0 additions & 14 deletions am/include/arch/riscv64-npc.h

This file was deleted.

14 changes: 0 additions & 14 deletions am/include/arch/spike.h

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/isa/riscv.mk
Expand Up @@ -3,3 +3,6 @@ COMMON_CFLAGS := -fno-pic -march=rv64g -mcmodel=medany -mstrict-align
CFLAGS += $(COMMON_CFLAGS) -static
ASFLAGS += $(COMMON_CFLAGS) -O0
LDFLAGS += -melf64lriscv

# overwrite ARCH_H defined in $(AM_HOME)/Makefile
ARCH_H := arch/riscv.h

0 comments on commit e0ae9b7

Please sign in to comment.