Merge branch 'bin-loader' into 'thread_scheduler'

Binary loader

See merge request simpleos/burritos!12
This commit is contained in:
Legot Quentin
2023-04-04 13:35:10 +00:00
15 changed files with 758 additions and 67 deletions

View File

@ -1,9 +1,15 @@
TOPDIR=.
include $(TOPDIR)/Makefile.config
all: dumps user_lib tests
#
# Main targets
#
build: user_lib
$(MAKE) build -C riscv_instructions/
dumps:
$(MAKE) dumps -C riscv_instructions/
mkdir -p ${TOPDIR}/target/dumps/
@ -18,4 +24,7 @@ tests: user_lib
find . -name '*.guac' -exec mv {} ${TOPDIR}/target/guac/ \;
clean:
rm -rf $(TOPDIR)/target
$(MAKE) clean -C userlib/
$(MAKE) clean -C riscv_instructions/
$(RM) -rf $(TOPDIR)/target

View File

@ -1,5 +1,11 @@
include $(TOPDIR)/Makefile.config
USERLIB = $(TOPDIR)/userlib
AS = $(RISCV_AS) -c
GCC = $(RISCV_GCC)
LD = $(RISCV_LD)
INCPATH += -I$(TOPDIR) -I$(USERLIB)
LDFLAGS = $(RISCV_LDFLAGS) -T $(USERLIB)/ldscript.lds
ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH)
@ -7,16 +13,16 @@ CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
# Rules
%.o: %.s
$(RISCV_AS) $(ASFLAGS) -c $<
$(AS) $(ASFLAGS) -c $<
%.o: %.c
$(RISCV_GCC) $(CFLAGS) -c $<
$(GCC) $(CFLAGS) -c $<
%.dump: %.o
$(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@
%.guac: %.o
$(RISCV_LD) $(LDFLAGS) $+ -o $@
$(LD) $(LDFLAGS) $+ -o $@
# Dependencies
.%.d: %.s
@ -31,6 +37,9 @@ CFLAGS = $(RISCV_CFLAGS) $(INCPATH)
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
$(PROGRAMS):
$(LD) $(LDFLAGS) $+ -o $@
# Targets
#clean:
# rm -rf *.o 2> /dev/null

5
test/riscv_instructions/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*
!.gitignore
!*.c
!*.md
!**/Makefile

View File

@ -1,3 +1,8 @@
build:
make build -C boolean_logic/
make build -C jump_instructions/
make build -C simple_arithmetics/
dumps:
make dumps -C boolean_logic/
make dumps -C jump_instructions/
@ -6,4 +11,9 @@ dumps:
tests:
make tests -C boolean_logic/
make tests -C jump_instructions/
make tests -C simple_arithmetics/
make tests -C simple_arithmetics/
clean:
$(MAKE) clean -C boolean_logic/
$(MAKE) clean -C jump_instructions/
$(MAKE) clean -C simple_arithmetics/

View File

@ -1,9 +1,17 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
PROGRAMS = comparisons if switch
build: $(PROGRAMS)
dumps: comparisons.dump if.dump switch.dump
tests: comparisons.guac if.guac switch.guac
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
clean:
$(RM) comparisons comparisons.o if if.o
# Dependances
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o

View File

@ -1,6 +1,15 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
PROGRAMS = jump ret
build: $(PROGRAMS)
dumps: jump.dump ret.dump
tests: jump.guac ret.guac
tests: jump.guac ret.guac
clean:
$(RM) jump jump.o ret ret.o
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o

View File

@ -1,6 +1,16 @@
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
PROGRAMS = unsigned_addition unsigned_division unsigned_multiplication unsigned_substraction
build: $(PROGRAMS)
dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump
tests: unsigned_addition.guac unsigned_division.guac unsigned_multiplication.guac unsigned_substraction.guac
tests: unsigned_addition.guac unsigned_division.guac unsigned_multiplication.guac unsigned_substraction.guac
clean:
$(RM) unsigned_addition unsigned_addition.o unsigned_division unsigned_division.o unsigned_multiplication unsigned_multiplication.o unsigned_substraction unsigned_substraction.o
TOPDIR = ../..
include $(TOPDIR)/Makefile.tests
$(PROGRAMS): % : $(USERLIB)/sys.o $(USERLIB)/libnachos.o %.o

View File

@ -1,4 +1,7 @@
TOPDIR = ../
include $(TOPDIR)/Makefile.tests
default: sys.o libnachos.o
default: sys.o libnachos.o
clean:
$(RM) libnachos.o sys.o

View File

@ -84,7 +84,7 @@
typedef int t_error;
/* Stop Nachos, and print out performance stats */
void Halt();
void Shutdown();
/* Return the time spent running Nachos */