@ -1,25 +1,26 @@
# Commands:
# Commands:
# make build Build
# make build Build
# make run Build and run in QEMU
# make run Build and run in QEMU
# make justrun Run the last build
# make justrun Run the last build
# make doc Generate docs
# make doc Generate docs
# make asm Open the deassemble file of the last build
# make asm Open the deassemble file of the last build
# make header Open 'objdump -h' of the last build
# make header Open 'objdump -h' of the last build
# make clean Clean
# make clean Clean
#
#
# Options:
# Options:
# arch = x86_64 | riscv32 | aarch64
# arch = x86_64 | riscv32 | aarch64
# d = int | in_asm | ... QEMU debug info
# d = int | in_asm | ... QEMU debug info
# mode = debug | release
# mode = debug | release
# LOG = off | error | warn | info | debug | trace
# LOG = off | error | warn | info | debug | trace
# SFSIMG = SFS image path of user programs
# SFSIMG = SFS image path of user programs
# smp = 1 | 2 | ... SMP core number
# smp = 1 | 2 | ... SMP core number
# board = fpga Only available on riscv32, build without bbl, run on board
# board = none Running on qemu
# | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+
# | fpga Only available on riscv32, build without bbl, run on board
# m_mode Only available on riscv32, build for M-Mode, without MMU
# | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+
# m_mode Only available on riscv32, build for M-Mode, without MMU
arch ?= riscv32
arch ?= riscv32
board ?= raspi3
board ?= none
mode ?= debug
mode ?= debug
LOG ?= debug
LOG ?= debug
smp ?= 4
smp ?= 4
@ -83,7 +84,9 @@ features += no_mmu m_mode
bbl_m_mode := --enable-boot-machine
bbl_m_mode := --enable-boot-machine
e n d i f
e n d i f
i f n e q ( $( board ) , n o n e )
features += board_$( board)
features += board_$( board)
e n d i f
build_args := --target $( target) .json --features " $( features) "
build_args := --target $( target) .json --features " $( features) "
i f e q ( $( mode ) , r e l e a s e )
i f e q ( $( mode ) , r e l e a s e )
@ -98,7 +101,7 @@ ifeq ($(uname), Darwin)
prefix := x86_64-elf-
prefix := x86_64-elf-
e n d i f
e n d i f
e l s e i f e q ( $( arch ) , r i s c v 3 2 )
e l s e i f e q ( $( arch ) , r i s c v 3 2 )
prefix := riscv64 -unknown-elf-
prefix := riscv32 -unknown-elf-
e l s e i f e q ( $( arch ) , a a r c h 6 4 )
e l s e i f e q ( $( arch ) , a a r c h 6 4 )
prefix ?= aarch64-none-elf-
prefix ?= aarch64-none-elf-
e n d i f
e n d i f
@ -159,7 +162,7 @@ else
$( bbl_m_mode) \
$( bbl_m_mode) \
--with-arch= rv32imac \
--with-arch= rv32imac \
--disable-fp-emulation \
--disable-fp-emulation \
--host= riscv64 -unknown-elf \
--host= riscv32 -unknown-elf \
--with-payload= $( abspath $( kernel) ) && \
--with-payload= $( abspath $( kernel) ) && \
make && \
make && \
cp bbl ../../kernel/$@
cp bbl ../../kernel/$@