-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add crate build test for thumb*
targets. [IRR-2018-embedded]
#53190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
d71cc75
320b240
9e2dc55
5af644c
633832f
7c438d4
bbbe441
6c52653
09854b0
c2b612a
5c654f2
62b3935
10395f3
e9c2de8
ad78c2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# How to run this | ||
# $ ./x.py clean | ||
# $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi src/test/run-make | ||
|
||
# Supported targets: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎊 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we now build required artifacts in |
||
# - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1) | ||
# - thumbv7em-none-eabi (Bare Cortex-M4, M7) | ||
# - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat) | ||
# - thumbv7m-none-eabi (Bare Cortex-M3) | ||
|
||
# See https://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or | ||
ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi)) | ||
|
||
# We need to be outside of 'src' dir in order to run cargo | ||
WORK_DIR := $(RUST_TEST_TMPDIR)/run-make/$(TARGET) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We typically use |
||
|
||
CRATE := cortex-m | ||
CRATE_VER := 0.5.0 | ||
|
||
RUSTC := $(RUSTC_ORIGINAL) | ||
LD_LIBRARY_PATH := $(HOST_RPATH_DIR) | ||
|
||
all: | ||
env | ||
mkdir -p $(WORK_DIR) | ||
-cd $(WORK_DIR) && rm -rf $(CRATE) | ||
cd $(WORK_DIR) && $(CARGO) clone $(CRATE) --vers $(CRATE_VER) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps consider making The typical way to test an external crate is via ./x.py test src/tools/cargotest The problem is that
|
||
cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build -j 1 --target $(TARGET) -v | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sekineh is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During debug this ( |
||
else | ||
|
||
all: | ||
|
||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this block be combined with the block above (line 980)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first, I've written it in the form the second
if
is merged with the firstif
.Later, I divided them into two
if
s with clear intention. They are representing the two different purposes/concerns.Let me explain the intention(s) below.
The first
if
The first
if
serves for buildingcompile::Test
. Unfortunately, you can't buildcompile::Test
forno_std
. In that case, buildcompile::Std
instead. It should be in the form ofA
orB
. Adding unrelatedC
in one arm is not a good idea.It's also a verbatim copy of @japaric's code found in
dist.rs
and supposed to be like a idiom which would be used in various places consistently. In the currentbootstrap
code,test
support forno_std
target is quite minimum. To widen the supported coverage forno_std
, we might want to grepbuilder.ensure(compile::Test
and replace it with this snippet.But in future,
no_std
might getlibtest
support. At that time the wholeif
must be reverted back to the original single line:If you merged two
if
s, the whole change would be much less trivial.The second
if
The second
if
serves for a totally different purpose. For the majority ofrun-make
tests, host compiler is NEVER needed. It is needed because we must runcargo
and some dependent crate (e.g.cc
) requires host compiler to be successfully built.