Update and cleanup makefile.

* Change few places from riscv64 to riscv32. Previously it was rv64
  because the code author does not have a 32bit toolchain and used a
  64bit one instead.

* Add new board type 'none', for running on qemu.
master
dzy 6 years ago
parent 52a2e24021
commit 25ccdf6731

@ -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
endif endif
ifneq ($(board), none)
features += board_$(board) features += board_$(board)
endif
build_args := --target $(target).json --features "$(features)" build_args := --target $(target).json --features "$(features)"
ifeq ($(mode), release) ifeq ($(mode), release)
@ -98,7 +101,7 @@ ifeq ($(uname), Darwin)
prefix := x86_64-elf- prefix := x86_64-elf-
endif endif
else ifeq ($(arch), riscv32) else ifeq ($(arch), riscv32)
prefix := riscv64-unknown-elf- prefix := riscv32-unknown-elf-
else ifeq ($(arch), aarch64) else ifeq ($(arch), aarch64)
prefix ?= aarch64-none-elf- prefix ?= aarch64-none-elf-
endif endif
@ -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/$@

Loading…
Cancel
Save