Use refactored Makefile from JTAG tutorial everywhere.

pull/19/head
Andre Richter 5 years ago committed by Andre Richter
parent 0844823805
commit 76b86a4997

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,26 +26,37 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -d in_asm $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -d in_asm
clippy:
cargo xclippy --target=$(TARGET)
clean: clean:
cargo clean cargo clean

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,26 +26,34 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -d in_asm $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -d in_asm
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,26 +26,34 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial null -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial null -serial stdio
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -26,26 +26,34 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial null -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial null -serial stdio
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,26 +26,34 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,26 +26,34 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
.PHONY: all qemu clippy clean objdump nm .PHONY: all qemu clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,40 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
DOCKER_TTY = --privileged -v /dev:/dev DOCKER_CMD = docker run -it --rm
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm .PHONY: all qemu raspboot clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,40 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
DOCKER_TTY = --privileged -v /dev:/dev DOCKER_CMD = docker run -it --rm
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm .PHONY: all qemu raspboot clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,40 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
DOCKER_TTY = --privileged -v /dev:/dev DOCKER_CMD = docker run -it --rm
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm .PHONY: all qemu raspboot clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,40 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work
DOCKER_TTY = --privileged -v /dev:/dev DOCKER_CMD = docker run -it --rm
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm .PHONY: all qemu raspboot clippy clean objdump nm
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)

@ -46,7 +46,7 @@ DOCKER_ARG_NET = --network host
DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0 DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtag .PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,44 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_TTY = --privileged -v /dev:/dev CONTAINER_GDB = andrerichter/raspi3-gdb
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -63,3 +76,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> * Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> * Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> * Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,44 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_TTY = --privileged -v /dev:/dev CONTAINER_GDB = andrerichter/raspi3-gdb
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -63,3 +76,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> * Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

@ -1,7 +1,7 @@
# #
# MIT License # MIT License
# #
# Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> # Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -26,31 +26,44 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_TTY = --privileged -v /dev:/dev CONTAINER_GDB = andrerichter/raspi3-gdb
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -63,3 +76,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

@ -1,7 +1,7 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2018 Andre Richter <andre.o.richter@gmail.com> * Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

@ -26,31 +26,44 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_TTY = --privileged -v /dev:/dev CONTAINER_GDB = andrerichter/raspi3-gdb
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_CMD = docker run -it --rm
DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = qemu-system-aarch64 -M raspi3 -kernel kernel8.img
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(UTILS_CONTAINER) $(QEMU_CMD) -serial stdio $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_QEMU) -serial stdio
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -63,3 +76,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

@ -26,32 +26,45 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_MISC = -v $(shell pwd)/../emulation:/emulation CONTAINER_GDB = andrerichter/raspi3-gdb
DOCKER_TTY = --privileged -v /dev:/dev
QEMU_CMD = bash /emulation/qemu_multi_uart.sh DOCKER_CMD = docker run -it --rm
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
DOCKER_ARG_EMU = -v $(shell pwd)/../emulation:/emulation
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = bash /emulation/qemu_multi_uart.sh
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(DOCKER_MISC) $(UTILS_CONTAINER) $(QEMU_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_EMU) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_QEMU)
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -64,3 +77,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

@ -26,32 +26,45 @@ TARGET = aarch64-unknown-none
SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld SOURCES = $(wildcard **/*.rs) $(wildcard **/*.S) link.ld
OBJCOPY = cargo objcopy --
XRUSTC_CMD = cargo xrustc --target=$(TARGET) --release
CARGO_OUTPUT = target/$(TARGET)/release/kernel8
OBJCOPY = cargo objcopy --
OBJCOPY_PARAMS = --strip-all -O binary OBJCOPY_PARAMS = --strip-all -O binary
UTILS_CONTAINER = andrerichter/raspi3-utils CONTAINER_UTILS = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v $(shell pwd):/work -w /work CONTAINER_OPENOCD = andrerichter/raspi3-openocd
DOCKER_MISC = -v $(shell pwd)/../emulation:/emulation CONTAINER_GDB = andrerichter/raspi3-gdb
DOCKER_TTY = --privileged -v /dev:/dev
QEMU_CMD = bash /emulation/qemu_multi_uart.sh DOCKER_CMD = docker run -it --rm
RASPBOOT_CMD = raspbootcom /dev/ttyUSB0 kernel8.img DOCKER_ARG_CURDIR = -v $(shell pwd):/work -w /work
DOCKER_ARG_TTY = --privileged -v /dev:/dev
DOCKER_ARG_JTAG = -v $(shell pwd)/../X1_JTAG_boot:/jtag
DOCKER_ARG_NET = --network host
DOCKER_ARG_EMU = -v $(shell pwd)/../emulation:/emulation
.PHONY: all qemu raspboot clippy clean objdump nm DOCKER_EXEC_QEMU = bash /emulation/qemu_multi_uart.sh
DOCKER_EXEC_RASPBOOT = raspbootcom /dev/ttyUSB0
.PHONY: all qemu raspboot clippy clean objdump nm jtagboot openocd gdb gdb-opt0
all: clean kernel8.img all: clean kernel8.img
target/$(TARGET)/release/kernel8: $(SOURCES) $(CARGO_OUTPUT): $(SOURCES)
cargo xbuild --target=$(TARGET) --release $(XRUSTC_CMD)
kernel8.img: target/$(TARGET)/release/kernel8 kernel8.img: $(CARGO_OUTPUT)
cp $< . cp $< .
$(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img $(OBJCOPY) $(OBJCOPY_PARAMS) $< kernel8.img
qemu: all qemu: all
$(DOCKER_CMD) $(DOCKER_MISC) $(UTILS_CONTAINER) $(QEMU_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_EMU) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_QEMU)
raspboot: all raspboot: all
$(DOCKER_CMD) $(DOCKER_TTY) $(UTILS_CONTAINER) $(RASPBOOT_CMD) $(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_TTY) \
$(CONTAINER_UTILS) $(DOCKER_EXEC_RASPBOOT) kernel8.img
clippy: clippy:
cargo xclippy --target=$(TARGET) cargo xclippy --target=$(TARGET)
@ -64,3 +77,23 @@ objdump:
nm: nm:
cargo nm --target $(TARGET) -- kernel8 | sort cargo nm --target $(TARGET) -- kernel8 | sort
jtagboot:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_JTAG) $(CONTAINER_UTILS) \
$(DOCKER_EXEC_RASPBOOT) /jtag/jtag_boot.img
openocd:
$(DOCKER_CMD) $(DOCKER_ARG_TTY) $(DOCKER_ARG_NET) $(CONTAINER_OPENOCD)
define gen_gdb
$(XRUSTC_CMD) -- $1
cp $(CARGO_OUTPUT) kernel8_for_jtag
$(DOCKER_CMD) $(DOCKER_ARG_CURDIR) $(DOCKER_ARG_NET) $(CONTAINER_GDB) \
gdb-multiarch -q kernel8_for_jtag
endef
gdb: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2)
gdb-opt0: clean $(SOURCES)
$(call gen_gdb,-C debuginfo=2 -C opt-level=0)

Loading…
Cancel
Save