changeset 17:c0f6f3eb25ae

argccbc
author kono
date Sun, 25 Feb 2018 18:48:39 +0900
parents 7eb81a3c4b29
children d058830337d9
files src/makefile-armclang src/makefile-armgccbc src/usr/makfile-armgccbc
diffstat 3 files changed, 172 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/makefile-armclang	Tue Feb 20 18:12:18 2018 +0900
+++ b/src/makefile-armclang	Sun Feb 25 18:48:39 2018 +0900
@@ -64,7 +64,12 @@
 qemu: kernel.elf
 	@clear
 	@echo "Press Ctrl-A and then X to terminate QEMU session\n"
-	$(QEMU) -M versatilepb -m 128 -cpu arm1176  -nographic -kernel kernel.elf
+	export QEMU_AUDIO_DRV=none ; $(QEMU) -M versatilepb -m 128 -cpu arm1176  -nographic -soundhw hda -kernel kernel.elf
+
+qemu-debug : kernel.elf
+	@clear
+	@echo "Press Ctrl-A and then X to terminate QEMU session\n"
+	export QEMU_AUDIO_DRV=none ; $(QEMU)  -M versatilepb -m 128 -cpu arm1176 -nographic -singlestep -d exec,cpu,guest_errors -D qemu.log -kernel kernel.elf -s -S
 
 INITCODE_OBJ = initcode.o
 $(addprefix build/,$(INITCODE_OBJ)): initcode.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/makefile-armgccbc	Sun Feb 25 18:48:39 2018 +0900
@@ -0,0 +1,96 @@
+# specify path to QEMU, installed with MacPorts 
+QEMU = qemu-system-arm
+
+include makefile.inc
+
+CC = /usr/local/arm-cbc/bin/arm-none-eabi-gcc -B/usr/local/arm-cbc/bin/arm-none-eabi-
+AS = arm-linux-gnu-gcc
+LD = arm-linux-gnu-ld
+OBJCOPY = arm-linux-gnu-objcopy
+OBJDUMP = arm-linux-gnu-objdump
+CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
+
+ASFLAGS = 
+
+LIBGCC = $(shell $(CC) -print-libgcc-file-name)
+
+LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
+        -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), "  LINK     $(TARGET_DIR)$@")
+
+LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
+        $(1) -o $@.out $<, "  LINK     $(TARGET_DIR)$@")
+OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
+        -S -O binary --prefix-symbols="_binary_$@" $@.out $@, "  OBJCOPY  $(TARGET_DIR)$@")
+AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
+                $(1) -c -o $@ $<,"  AS       $(TARGET_DIR)$@")
+
+# link the libgcc.a for __aeabi_idiv. ARM has no native support for div
+LIBS = $(LIBGCC)
+
+OBJS = \
+	lib/string.o \
+	\
+	arm.o\
+	asm.o\
+	bio.o\
+	buddy.o\
+	console.o\
+	exec.o\
+	file.o\
+	fs.o\
+	log.o\
+	main.o\
+	memide.o\
+	pipe.o\
+	proc.o\
+	spinlock.o\
+	start.o\
+	swtch.o\
+	syscall.o\
+	sysfile.o\
+	sysproc.o\
+	trap_asm.o\
+	trap.o\
+	vm.o \
+	\
+	device/picirq.o \
+	device/timer.o \
+	device/uart.o
+
+KERN_OBJS = $(OBJS) entry.o
+kernel.elf: $(addprefix build/,$(KERN_OBJS)) kernel.ld build/initcode build/fs.img
+	cp -f build/initcode initcode
+	cp -f build/fs.img fs.img
+	$(call LINK_BIN, kernel.ld, kernel.elf, \
+		$(addprefix build/,$(KERN_OBJS)), \
+		initcode fs.img)
+	$(OBJDUMP) -S kernel.elf > kernel.asm
+	$(OBJDUMP) -t kernel.elf | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
+	rm -f initcode fs.img
+
+qemu: kernel.elf
+	@clear
+	@echo "Press Ctrl-A and then X to terminate QEMU session\n"
+	$(QEMU) -M versatilepb -m 128 -cpu arm1176  -nographic -kernel kernel.elf
+
+INITCODE_OBJ = initcode.o
+$(addprefix build/,$(INITCODE_OBJ)): initcode.S
+	$(call build-directory)
+	$(call AS_WITH, -nostdinc -I.)
+
+#initcode is linked into the kernel, it will be used to craft the first process
+build/initcode: $(addprefix build/,$(INITCODE_OBJ))
+	$(call LINK_INIT, -N -e start -Ttext 0)
+	$(call OBJCOPY_INIT)
+	$(OBJDUMP) -S $< > initcode.asm
+
+build/fs.img:
+	make -C tools
+	make -C usr -f makfile-armgccbc
+
+clean: 
+	rm -rf build
+	rm -f *.o *.d *.asm *.sym vectors.S bootblock entryother \
+	initcode initcode.out kernel xv6.img fs.img kernel.elf memfs
+	make -C tools clean
+	make -C usr clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/usr/makfile-armgccbc	Sun Feb 25 18:48:39 2018 +0900
@@ -0,0 +1,70 @@
+include ../makefile.inc
+
+CC = /usr/local/arm-cbc/bin/arm-none-eabi-gcc -B/usr/local/arm-cbc/bin/arm-none-eabi-
+AS = arm-linux-gnu-gcc
+LD = arm-linux-gnu-ld
+OBJCOPY = arm-linux-gnu-objcopy
+OBJDUMP = arm-linux-gnu-objdump
+CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0
+
+ASFLAGS = 
+
+LIBGCC = $(shell $(CC) -print-libgcc-file-name)
+
+LINK_BIN = $(call quiet-command,$(LD) $(LDFLAGS) \
+        -T $(1) -o $(2) $(3) $(LIBS) -b binary $(4), "  LINK     $(TARGET_DIR)$@")
+
+LINK_INIT = $(call quiet-command,$(LD) $(LDFLAGS) \
+        $(1) -o $@.out $<, "  LINK     $(TARGET_DIR)$@")
+OBJCOPY_INIT = $(call quiet-command,$(OBJCOPY) \
+        -S -O binary --prefix-symbols="_binary_$@" $@.out $@, "  OBJCOPY  $(TARGET_DIR)$@")
+AS_WITH = $(call quiet-command,$(AS) $(ASFLAGS) \
+                $(1) -c -o $@ $<,"  AS       $(TARGET_DIR)$@")
+
+CFLAGS += -iquote ../
+ASFLAGS += -I ../
+ULIB = ulib.o usys.o printf.o umalloc.o
+
+MKFS = ../tools/mkfs
+FS_IMAGE = ../build/fs.img
+
+UPROGS=\
+	_cat\
+	_echo\
+	_grep\
+	_init\
+	_kill\
+	_ln\
+	_ls\
+	_mkdir\
+	_rm\
+	_sh\
+	_stressfs\
+	_usertests\
+	_wc\
+	_zombie\
+	_hello\
+	_forktest\
+
+
+all: $(FS_IMAGE)
+
+_%: %.o $(ULIB)
+	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^  -L ../ $(LIBGCC)
+	$(OBJDUMP) -S $@ > $*.asm
+	$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
+
+_forktest: forktest.o $(ULIB)
+	# forktest has less library code linked in - needs to be small
+	# in order to be able to max out the proc table.
+	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
+	$(OBJDUMP) -S _forktest > forktest.asm
+
+$(FS_IMAGE): $(MKFS)  $(UPROGS)
+	$(MKFS) $@  $(UPROGS) UNIX
+	$(OBJDUMP) -S usys.o > usys.asm
+
+clean: 
+	rm -f *.o *.d *.asm *.sym $(FS_IMAGE) \
+	.gdbinit \
+	$(UPROGS)