From 27477755edcf76c7bd579661fc83d6ae2a4970eb Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Thu, 30 Aug 2018 02:05:40 +0900 Subject: [PATCH 01/14] [ci] add qemu-system-arm in docker image --- src/ci/docker/dist-various-1/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index e2484b7224b26..c7e6af28f9d4f 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -22,7 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev \ pkg-config \ gcc-arm-none-eabi \ - libnewlib-arm-none-eabi + libnewlib-arm-none-eabi \ + qemu-system-arm WORKDIR /build From 502023a9baeb9c0f8cc50874e74b22c526fce923 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Mon, 3 Sep 2018 05:42:40 +0900 Subject: [PATCH 02/14] [ci] thumbv7m-none-eabi: build lm3s6965evb and runon QEMU --- src/test/run-make/thumb-none-qemu/Makefile | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/run-make/thumb-none-qemu/Makefile diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile new file mode 100644 index 0000000000000..8194b949dfcdc --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -0,0 +1,40 @@ +-include ../../run-make-fulldeps/tools.mk + +# How to run this +# $ ./x.py clean +# $ ./x.py test --target thumbv7m-none-eabi src/test/run-make + +ifeq ($(TARGET),thumbv7m-none-eabi)) + +# For cargo setting +RUSTC := $(RUSTC_ORIGINAL) +LD_LIBRARY_PATH := $(HOST_RPATH_DIR) +# We need to be outside of 'src' dir in order to run cargo +WORK_DIR := $(TMPDIR) + +HERE := $(shell pwd) + +CRATE := lm3s6965evb +CRATE_URL := https://github.com/japaric/lm3s6965evb +CRATE_SHA1 := 9eeea58826438e84d89e9691a1bb0f85b03d377c +QEMU_CPU := cortex-m3 +QEMU_MACHINE := lm3s6965evb + +all: + env + mkdir -p $(WORK_DIR) + -cd $(WORK_DIR) && rm -rf $(CRATE) + cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) + cd $(WORK_DIR)/$(CRATE) && $(CARGO) build --target $(TARGET) -v + cd $(WORK_DIR)/$(CRATE) && qemu-system-arm \ + -cpu $(QEMU_CPU) \ + -machine $(QEMU_MACHINE) \ + -semihosting-config enable=on,target=native \ + -nographic \ + -kernel target/$(TARGET)/debug/$(CRATE) > out.txt + cd $(WORK_DIR)/$(CRATE) && grep "x = 42" out.txt +else + +all: + +endif From 719a592cb08ab32d8e348796afd278a36c396c37 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Mon, 3 Sep 2018 09:51:01 +0900 Subject: [PATCH 03/14] [ci] thumbv7m-none-eabi: add more variable. --- src/test/run-make/thumb-none-qemu/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index 8194b949dfcdc..514c8348f82f1 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -11,14 +11,16 @@ RUSTC := $(RUSTC_ORIGINAL) LD_LIBRARY_PATH := $(HOST_RPATH_DIR) # We need to be outside of 'src' dir in order to run cargo WORK_DIR := $(TMPDIR) - HERE := $(shell pwd) + +# hint: we could set variables per $(TARGET) basis in order to support other targets. CRATE := lm3s6965evb CRATE_URL := https://github.com/japaric/lm3s6965evb CRATE_SHA1 := 9eeea58826438e84d89e9691a1bb0f85b03d377c QEMU_CPU := cortex-m3 QEMU_MACHINE := lm3s6965evb +QEMU_OUTPUT_TEXT := "x = 42" all: env @@ -32,7 +34,7 @@ all: -semihosting-config enable=on,target=native \ -nographic \ -kernel target/$(TARGET)/debug/$(CRATE) > out.txt - cd $(WORK_DIR)/$(CRATE) && grep "x = 42" out.txt + cd $(WORK_DIR)/$(CRATE) && grep $(QEMU_OUTPUT_TEXT) out.txt else all: From a04754fd365398e5445d2c4b985023350fb2c4aa Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Sun, 30 Sep 2018 09:34:51 +0900 Subject: [PATCH 04/14] [ci] run-make/thumb-none-qemu: uses cortex-m-rt crate. --- src/test/run-make/thumb-none-qemu/Makefile | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index 514c8348f82f1..d1482a1dda49f 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -15,26 +15,17 @@ HERE := $(shell pwd) # hint: we could set variables per $(TARGET) basis in order to support other targets. -CRATE := lm3s6965evb -CRATE_URL := https://github.com/japaric/lm3s6965evb -CRATE_SHA1 := 9eeea58826438e84d89e9691a1bb0f85b03d377c -QEMU_CPU := cortex-m3 -QEMU_MACHINE := lm3s6965evb -QEMU_OUTPUT_TEXT := "x = 42" +CRATE := cortex-m-rt +CRATE_URL := https://github.com/rust-embedded/cortex-m-rt +CRATE_SHA1 := 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd all: env mkdir -p $(WORK_DIR) -cd $(WORK_DIR) && rm -rf $(CRATE) cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) - cd $(WORK_DIR)/$(CRATE) && $(CARGO) build --target $(TARGET) -v - cd $(WORK_DIR)/$(CRATE) && qemu-system-arm \ - -cpu $(QEMU_CPU) \ - -machine $(QEMU_MACHINE) \ - -semihosting-config enable=on,target=native \ - -nographic \ - -kernel target/$(TARGET)/debug/$(CRATE) > out.txt - cd $(WORK_DIR)/$(CRATE) && grep $(QEMU_OUTPUT_TEXT) out.txt + cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu | grep "x = 42" + cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu --release | grep "x = 42" else all: From fdf4d6efac79de2df444ee4975b381b43d76dee1 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Sun, 30 Sep 2018 10:55:49 +0900 Subject: [PATCH 05/14] [ci] run-make/thumb-none-qemu: add thumbv6m-none-qemu --- src/test/run-make/thumb-none-qemu/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index d1482a1dda49f..518b2ec643175 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -4,7 +4,7 @@ # $ ./x.py clean # $ ./x.py test --target thumbv7m-none-eabi src/test/run-make -ifeq ($(TARGET),thumbv7m-none-eabi)) +ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7m-none-eabi)) # For cargo setting RUSTC := $(RUSTC_ORIGINAL) From 5b0f4869764167c2444d179ace2e220943506a7b Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Wed, 10 Oct 2018 10:50:25 +0900 Subject: [PATCH 06/14] [ci] run-make/thumb-none-qemu: transfer logic to script.sh --- src/test/run-make/thumb-none-qemu/Makefile | 21 +++++++-------------- src/test/run-make/thumb-none-qemu/script.sh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 src/test/run-make/thumb-none-qemu/script.sh diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index 518b2ec643175..91921a2a9f86d 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -7,27 +7,20 @@ ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7m-none-eabi)) # For cargo setting -RUSTC := $(RUSTC_ORIGINAL) +export RUSTC := $(RUSTC_ORIGINAL) LD_LIBRARY_PATH := $(HOST_RPATH_DIR) # We need to be outside of 'src' dir in order to run cargo -WORK_DIR := $(TMPDIR) -HERE := $(shell pwd) +export WORK_DIR := $(TMPDIR) +export HERE := $(shell pwd) # hint: we could set variables per $(TARGET) basis in order to support other targets. -CRATE := cortex-m-rt -CRATE_URL := https://github.com/rust-embedded/cortex-m-rt -CRATE_SHA1 := 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd +export CRATE := cortex-m-rt +export CRATE_URL := https://github.com/rust-embedded/cortex-m-rt +export CRATE_SHA1 := 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd all: - env - mkdir -p $(WORK_DIR) - -cd $(WORK_DIR) && rm -rf $(CRATE) - cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) - cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu | grep "x = 42" - cd $(WORK_DIR)/$(CRATE) && $(CARGO) run --target $(TARGET) --example qemu --release | grep "x = 42" + bash script.sh else - all: - endif diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh new file mode 100644 index 0000000000000..022f1cef63191 --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -0,0 +1,16 @@ +set -exuo pipefail + +CRATE=cortex-m-rt +CRATE_URL=https://github.com/rust-embedded/cortex-m-rt +CRATE_SHA1=62972c8a89ff54b76f9ef0d600c1fcf7a233aabd + +env | sort +mkdir -p $WORK_DIR +pushd $WORK_DIR + rm -rf $CRATE || echo OK + bash -x $HERE/../git_clone_sha1.sh $CRATE $CRATE_URL $CRATE_SHA1 + pushd $CRATE + $CARGO run --target $TARGET --example qemu | grep "x = 42" + $CARGO run --target $TARGET --example qemu --release | grep "x = 42" + popd +popd \ No newline at end of file From a4faa5ef7319ea6b457fee233a0699569c393f7a Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Wed, 10 Oct 2018 10:51:28 +0900 Subject: [PATCH 07/14] [ci] run-make/thumb-none-qemu: transfer logic to script.sh (2) --- src/test/run-make/thumb-none-qemu/Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index 91921a2a9f86d..bf57bc5b31105 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -13,12 +13,6 @@ LD_LIBRARY_PATH := $(HOST_RPATH_DIR) export WORK_DIR := $(TMPDIR) export HERE := $(shell pwd) - -# hint: we could set variables per $(TARGET) basis in order to support other targets. -export CRATE := cortex-m-rt -export CRATE_URL := https://github.com/rust-embedded/cortex-m-rt -export CRATE_SHA1 := 62972c8a89ff54b76f9ef0d600c1fcf7a233aabd - all: bash script.sh else From 8d2b2ee5c2ea2e7de7bb14aeaae2c6f3b75a0305 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Tue, 16 Oct 2018 20:56:02 +0900 Subject: [PATCH 08/14] [ci] run-make/thumb-none-qemu: add example crate. --- src/test/run-make/thumb-none-qemu/Makefile | 12 +++++++- .../thumb-none-qemu/example/Cargo.toml | 11 +++++++ .../run-make/thumb-none-qemu/example/memory.x | 23 ++++++++++++++ .../thumb-none-qemu/example/src/main.rs | 30 +++++++++++++++++++ src/test/run-make/thumb-none-qemu/script.sh | 11 +++---- 5 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 src/test/run-make/thumb-none-qemu/example/Cargo.toml create mode 100644 src/test/run-make/thumb-none-qemu/example/memory.x create mode 100644 src/test/run-make/thumb-none-qemu/example/src/main.rs diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index bf57bc5b31105..75c17372bc238 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -8,11 +8,21 @@ ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7m-none-eabi)) # For cargo setting export RUSTC := $(RUSTC_ORIGINAL) -LD_LIBRARY_PATH := $(HOST_RPATH_DIR) +export LD_LIBRARY_PATH := $(HOST_RPATH_DIR) # We need to be outside of 'src' dir in order to run cargo export WORK_DIR := $(TMPDIR) export HERE := $(shell pwd) +## clean up unused env variables which might cause harm. +# unexport RUSTC_LINKER +# unexport RUSTC_BOOTSTRAP +# unexport RUST_BUILD_STAGE +# unexport RUST_TEST_THREADS +# unexport RUST_TEST_TMPDIR +# unexport AR +# unexport CC +# unexport CXX + all: bash script.sh else diff --git a/src/test/run-make/thumb-none-qemu/example/Cargo.toml b/src/test/run-make/thumb-none-qemu/example/Cargo.toml new file mode 100644 index 0000000000000..499553304c681 --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/example/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "example" +version = "0.1.0" +authors = ["Hideki Sekine "] +# edition = "2018" + +[dependencies] +cortex-m = "0.5.4" +cortex-m-rt = "=0.5.4" +panic-halt = "0.2.0" +cortex-m-semihosting = "0.3.1" diff --git a/src/test/run-make/thumb-none-qemu/example/memory.x b/src/test/run-make/thumb-none-qemu/example/memory.x new file mode 100644 index 0000000000000..dc7ad967a42a8 --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/example/memory.x @@ -0,0 +1,23 @@ +/* Device specific memory layout */ + +/* This file is used to build the cortex-m-rt examples, + but not other applications using cortex-m-rt. */ + +MEMORY +{ + /* FLASH and RAM are mandatory memory regions */ + /* Update examples/data_overflow.rs if you change these sizes. */ + FLASH : ORIGIN = 0x00000000, LENGTH = 256K + RAM : ORIGIN = 0x20000000, LENGTH = 64K + + /* More memory regions can declared: for example this is a second RAM region */ + /* CCRAM : ORIGIN = 0x10000000, LENGTH = 8K */ +} + +/* The location of the stack can be overridden using the `_stack_start` symbol. + By default it will be placed at the end of the RAM region */ +/* _stack_start = ORIGIN(CCRAM) + LENGTH(CCRAM); */ + +/* The location of the .text section can be overridden using the `_stext` symbol. + By default it will place after .vector_table */ +/* _stext = ORIGIN(FLASH) + 0x40c; */ \ No newline at end of file diff --git a/src/test/run-make/thumb-none-qemu/example/src/main.rs b/src/test/run-make/thumb-none-qemu/example/src/main.rs new file mode 100644 index 0000000000000..e94aa74de5883 --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/example/src/main.rs @@ -0,0 +1,30 @@ +// #![feature(stdsimd)] +#![no_main] +#![no_std] + +extern crate cortex_m; + +extern crate cortex_m_rt as rt; +extern crate cortex_m_semihosting as semihosting; +extern crate panic_halt; + +use core::fmt::Write; +use cortex_m::asm; +use rt::entry; + +entry!(main); + +fn main() -> ! { + let x = 42; + + loop { + asm::nop(); + + // write something through semihosting interface + let mut hstdout = semihosting::hio::hstdout().unwrap(); + write!(hstdout, "x = {}\n", x); + + // exit from qemu + semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS); + } +} \ No newline at end of file diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh index 022f1cef63191..5c46c4bd26dc0 100644 --- a/src/test/run-make/thumb-none-qemu/script.sh +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -1,16 +1,13 @@ set -exuo pipefail -CRATE=cortex-m-rt -CRATE_URL=https://github.com/rust-embedded/cortex-m-rt -CRATE_SHA1=62972c8a89ff54b76f9ef0d600c1fcf7a233aabd +CRATE=example env | sort mkdir -p $WORK_DIR pushd $WORK_DIR rm -rf $CRATE || echo OK - bash -x $HERE/../git_clone_sha1.sh $CRATE $CRATE_URL $CRATE_SHA1 + cp -a $HERE/example . pushd $CRATE - $CARGO run --target $TARGET --example qemu | grep "x = 42" - $CARGO run --target $TARGET --example qemu --release | grep "x = 42" + $CARGO run --target $TARGET popd -popd \ No newline at end of file +popd From f40fd4bace651be6fad51723b139dbebbf00f883 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Tue, 16 Oct 2018 21:07:44 +0900 Subject: [PATCH 09/14] [ci] run both debug and release --- src/test/run-make/thumb-none-qemu/script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh index 5c46c4bd26dc0..c7133f8fb7fce 100644 --- a/src/test/run-make/thumb-none-qemu/script.sh +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -8,6 +8,7 @@ pushd $WORK_DIR rm -rf $CRATE || echo OK cp -a $HERE/example . pushd $CRATE - $CARGO run --target $TARGET + $CARGO run --target $TARGET | grep "x = 42" + $CARGO run --target $TARGET --release | grep "x = 42" popd popd From 3064e0a16600ab4e32e486a495b1da5b737b711a Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Tue, 16 Oct 2018 21:08:13 +0900 Subject: [PATCH 10/14] [ci] fix tidy warning. --- src/test/run-make/thumb-none-qemu/example/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-make/thumb-none-qemu/example/src/main.rs b/src/test/run-make/thumb-none-qemu/example/src/main.rs index e94aa74de5883..d88a327ef08b4 100644 --- a/src/test/run-make/thumb-none-qemu/example/src/main.rs +++ b/src/test/run-make/thumb-none-qemu/example/src/main.rs @@ -27,4 +27,4 @@ fn main() -> ! { // exit from qemu semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS); } -} \ No newline at end of file +} From 06d0a715b564a656e8e272307c5915f0f65ae040 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Tue, 16 Oct 2018 21:42:42 +0900 Subject: [PATCH 11/14] [ci] clean up potentially harmful envs --- src/test/run-make/thumb-none-qemu/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/Makefile b/src/test/run-make/thumb-none-qemu/Makefile index 75c17372bc238..ffd17721b73bb 100644 --- a/src/test/run-make/thumb-none-qemu/Makefile +++ b/src/test/run-make/thumb-none-qemu/Makefile @@ -14,14 +14,14 @@ export WORK_DIR := $(TMPDIR) export HERE := $(shell pwd) ## clean up unused env variables which might cause harm. -# unexport RUSTC_LINKER -# unexport RUSTC_BOOTSTRAP -# unexport RUST_BUILD_STAGE -# unexport RUST_TEST_THREADS -# unexport RUST_TEST_TMPDIR -# unexport AR -# unexport CC -# unexport CXX +unexport RUSTC_LINKER +unexport RUSTC_BOOTSTRAP +unexport RUST_BUILD_STAGE +unexport RUST_TEST_THREADS +unexport RUST_TEST_TMPDIR +unexport AR +unexport CC +unexport CXX all: bash script.sh From 7cac7b613d3ad516ce7df66539812bff988d3095 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Thu, 18 Oct 2018 06:53:17 +0900 Subject: [PATCH 12/14] [ci] run-make/thumb-none-qemu: use GNU LD. --- src/test/run-make/thumb-none-qemu/script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh index c7133f8fb7fce..d20afefb4a52d 100644 --- a/src/test/run-make/thumb-none-qemu/script.sh +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -8,7 +8,7 @@ pushd $WORK_DIR rm -rf $CRATE || echo OK cp -a $HERE/example . pushd $CRATE - $CARGO run --target $TARGET | grep "x = 42" - $CARGO run --target $TARGET --release | grep "x = 42" + env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" $CARGO run --target $TARGET | grep "x = 42" + env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" $CARGO run --target $TARGET --release | grep "x = 42" popd popd From 35bbcf14f4c83201386268c88cd8014234257667 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Fri, 19 Oct 2018 00:36:24 +0900 Subject: [PATCH 13/14] [ci] fix tidy warning. --- src/test/run-make/thumb-none-qemu/script.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh index d20afefb4a52d..0f1c49f3a71b1 100644 --- a/src/test/run-make/thumb-none-qemu/script.sh +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -8,7 +8,9 @@ pushd $WORK_DIR rm -rf $CRATE || echo OK cp -a $HERE/example . pushd $CRATE - env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" $CARGO run --target $TARGET | grep "x = 42" - env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" $CARGO run --target $TARGET --release | grep "x = 42" + env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ + $CARGO run --target $TARGET | grep "x = 42" + env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ + $CARGO run --target $TARGET --release | grep "x = 42" popd popd From f87230362355e40bd5e9b359d12098562478fa13 Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Sun, 4 Nov 2018 12:32:25 +0900 Subject: [PATCH 14/14] [ci] run-make/thumb-none-qemu: add .cargo/config --- .../thumb-none-qemu/example/.cargo/config | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/run-make/thumb-none-qemu/example/.cargo/config diff --git a/src/test/run-make/thumb-none-qemu/example/.cargo/config b/src/test/run-make/thumb-none-qemu/example/.cargo/config new file mode 100644 index 0000000000000..0d6b19c124b1e --- /dev/null +++ b/src/test/run-make/thumb-none-qemu/example/.cargo/config @@ -0,0 +1,31 @@ +[target.thumbv7m-none-eabi] +# uncomment this to make `cargo run` execute programs on QEMU +runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" + +[target.thumbv6m-none-eabi] +# uncomment this to make `cargo run` execute programs on QEMU +# For now, we use cortex-m3 instead of cortex-m0 which are not supported by QEMU +runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" + +[target.'cfg(all(target_arch = "arm", target_os = "none"))'] +# uncomment ONE of these three option to make `cargo run` start a GDB session +# which option to pick depends on your system +# runner = "arm-none-eabi-gdb -q -x openocd.gdb" +# runner = "gdb-multiarch -q -x openocd.gdb" +# runner = "gdb -q -x openocd.gdb" + +rustflags = [ + # LLD (shipped with the Rust toolchain) is used as the default linker + "-C", "link-arg=-Tlink.x", + + # if you run into problems with LLD switch to the GNU linker by commenting out + # this line + # "-C", "linker=arm-none-eabi-ld", + + # if you need to link to pre-compiled C libraries provided by a C toolchain + # use GCC as the linker by commenting out both lines above and then + # uncommenting the three lines below + # "-C", "linker=arm-none-eabi-gcc", + # "-C", "link-arg=-Wl,-Tlink.x", + # "-C", "link-arg=-nostartfiles", +] \ No newline at end of file