-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from riscv64-sifive-mee to riscv64-sifive-elf
I've added support to our ELF toolchain that replaces the various features of the MEE toolchain we used to have in a cleaner way. This allows us to both ship a single toolchain binary as well as remove some command line arguments that were required by the MEE toolchain. This simplifies the MEE's build scripts, and should also simplify users build scripts as well. Signed-off-by: Palmer Dabbelt <[email protected]>
- Loading branch information
1 parent
b715980
commit 650d1c3
Showing
7 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ | |
*.mk | ||
/return_pass | ||
/return_fail | ||
*.specs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,39 @@ | |
%.c: mee/machine/@[email protected] | ||
%.S: mee/machine/@[email protected] | ||
%.o: mee/machine/@[email protected] | ||
%.c: riscv__menv__mee.specs | ||
%.S: riscv__menv__mee.specs | ||
%.o: riscv__menv__mee.specs | ||
%.c: riscv__mmachine__@[email protected] | ||
%.S: riscv__mmachine__@[email protected] | ||
%.o: riscv__mmachine__@[email protected] | ||
|
||
# Every test depends on the generated linker script. | ||
$(check_PROGRAMS): mee-@[email protected] | ||
$(check_PROGRAMS): riscv__mmachine__@[email protected] | ||
|
||
# Every test depends on the freshly-compiled library. | ||
$(check_PROGRAMS): libmee-@[email protected] | ||
$(check_PROGRAMS): libriscv__mmachine__@[email protected] | ||
|
||
# Generates a linker script that's more reasonable that whatever GCC's default | ||
# is. | ||
ldsdir = $(libdir) | ||
lds_DATA = mee-@[email protected] | ||
mee-@[email protected]: @LDSCRIPT_GENERATOR@ @[email protected] | ||
lds_DATA = riscv__mmachine__@[email protected] | ||
riscv__mmachine__@[email protected]: @LDSCRIPT_GENERATOR@ @[email protected] | ||
$< --dtb $(filter %.dtb,$^) --linker $@ | ||
|
||
# Generates a SPEC file that sets a reasonable set of default options for this | ||
# build. | ||
specdir = $(libdir) | ||
spec_DATA = | ||
|
||
spec_DATA += riscv__mmachine__@[email protected] | ||
riscv__mmachine__@[email protected]: @SPECS_GENERATOR@ @[email protected] | ||
$< --dtb $(filter %.dtb,$^) --specs $@ --prefix @prefix@ --machine @MACHINE_NAME@ | ||
|
||
spec_DATA += riscv__menv__mee.specs | ||
riscv__menv__mee.specs: riscv__menv__mee.specs.in | ||
cat $^ > $@ | ||
|
||
# In order to generate code that's actually compatible with a machine we must | ||
# pass the march and mabi arguments to GCC that coorespond to the hardware. | ||
# This is handled by generating a makefile fragment, including it, and then | ||
|
@@ -45,6 +64,7 @@ nobase_include_HEADERS = \ | |
mee/compiler.h \ | ||
mee/clock.h \ | ||
mee/io.h \ | ||
mee/machine.h \ | ||
mee/shutdown.h \ | ||
mee/tty.h \ | ||
mee/uart.h | ||
|
@@ -64,14 +84,12 @@ mee/machine/@[email protected]: @MEE_HEADER_GENERATOR@ @[email protected] | |
# Everything in here is compiled into a single library, which contains all the | ||
# source files in the project. It's named for one specific machine, which GCC | ||
# uses to select the target machine that this MEE implementation points at. | ||
lib_LIBRARIES = libmee-@[email protected] | ||
lib_LIBRARIES = libriscv__mmachine__@[email protected] | ||
|
||
libmee_@MACHINE_NAME@_a_CFLAGS = -mmee-machine=@MACHINE_NAME@ | ||
libmee_@MACHINE_NAME@_a_CFLAGS += -ffunction-sections -fdata-sections | ||
libmee_@MACHINE_NAME@_a_CFLAGS += -march=$(FRAMEWORK_BOARD_DTS_MARCH) -mabi=$(FRAMEWORK_BOARD_DTS_MABI) | ||
libmee_@MACHINE_NAME@_a_CCASFLAGS = $(libmee_@MACHINE_NAME@_a_CFLAGS) -DASSEMBLY | ||
libriscv__mmachine__@MACHINE_NAME@_a_CFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
libriscv__mmachine__@MACHINE_NAME@_a_CCASFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
|
||
libmee_@MACHINE_NAME@_a_SOURCES = \ | ||
libriscv__mmachine__@MACHINE_NAME@_a_SOURCES = \ | ||
src/drivers/fixed-clock.c \ | ||
src/drivers/sifive,fe310-g000,hfrosc.c \ | ||
src/drivers/sifive,fe310-g000,hfxosc.c \ | ||
|
@@ -92,37 +110,28 @@ check_PROGRAMS = | |
# The simplest possible pair of tests: one that passes and one that fails | ||
check_PROGRAMS += return_pass | ||
return_pass_SOURCES = test/return_pass.c | ||
return_pass_CFLAGS = -mmee-machine=@MACHINE_NAME@ | ||
return_pass_CFLAGS += -ffunction-sections -fdata-sections | ||
return_pass_CFLAGS += -march=$(FRAMEWORK_BOARD_DTS_MARCH) -mabi=$(FRAMEWORK_BOARD_DTS_MABI) | ||
return_pass_CFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
return_pass_LDFLAGS = -L. -Wl,--gc-sections -Wl,-Map=return_pass.map | ||
|
||
check_PROGRAMS += return_fail | ||
return_fail_SOURCES = test/return_fail.c | ||
return_fail_CFLAGS = -mmee-machine=@MACHINE_NAME@ | ||
return_fail_CFLAGS += -ffunction-sections -fdata-sections | ||
return_fail_CFLAGS += -march=$(FRAMEWORK_BOARD_DTS_MARCH) -mabi=$(FRAMEWORK_BOARD_DTS_MABI) | ||
return_fail_CFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
return_fail_LDFLAGS = -L. -Wl,--gc-sections -Wl,-Map=return_fail.map | ||
|
||
# A simple "Hello, World!" program that directly uses the MEE interface to | ||
# print to the serial terminal. | ||
check_PROGRAMS += hello | ||
hello_SOURCES = test/hello.c | ||
hello_CFLAGS = -mmee-machine=@MACHINE_NAME@ | ||
hello_CFLAGS += -ffunction-sections -fdata-sections | ||
hello_CFLAGS += -march=$(FRAMEWORK_BOARD_DTS_MARCH) -mabi=$(FRAMEWORK_BOARD_DTS_MABI) | ||
hello_CFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
hello_LDFLAGS = -L. -Wl,--gc-sections -Wl,-Map=hello.map | ||
|
||
check_PROGRAMS += pll_set_hz | ||
pll_set_hz_SOURCES = test/pll_set_hz.c | ||
pll_set_hz_CFLAGS = -mmee-machine=@MACHINE_NAME@ | ||
pll_set_hz_CFLAGS += -ffunction-sections -fdata-sections | ||
pll_set_hz_CFLAGS += -march=$(FRAMEWORK_BOARD_DTS_MARCH) -mabi=$(FRAMEWORK_BOARD_DTS_MABI) | ||
pll_set_hz_CFLAGS = -menv=mee -mmachine=@MACHINE_NAME@ | ||
pll_set_hz_LDFLAGS = -L. -Wl,--gc-sections -Wl,-Map=pll_set_hz.map | ||
|
||
# Extra clean targets | ||
clean-local: | ||
-rm -rf @[email protected] | ||
-rm -rf mee/machine/@[email protected] @[email protected] mee-@[email protected] | ||
-rm -rf return_pass.map return_fail.map | ||
-rm -rf hello.map | ||
-rm -rf *.map *.specs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
/* Copyright 2018 SiFive, Inc */ | ||
|
||
#ifndef __MEE_MACHINE_HEADER | ||
#error "The toolchain must define __MEE_MACHINE_HEADER" | ||
#endif | ||
|
||
#include __MEE_MACHINE_HEADER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters