Skip to content

Commit 2ba145c

Browse files
bors[bot]japaric
andcommitted
Merge #24
24: Logging with symbols r=therealprof a=japaric Obscure stuff with symbols; perfect fit for the nomicon, IMO. r? @rust-embedded/resources (anyone) Co-authored-by: Jorge Aparicio <jorge@japaric.io>
2 parents eb89516 + 53d1567 commit 2ba145c

37 files changed

+801
-9
lines changed

.travis.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
language: rust
22

3-
addons:
4-
apt:
5-
packages:
6-
- qemu-system-arm
7-
83
matrix:
94
include:
105
- rust: beta
11-
12-
matrix:
13-
include:
146
- rust: nightly
157

168
install:
179
- bash ci/install.sh
18-
- export PATH="$PATH:$PWD/gcc/bin"
10+
- export PATH="$PATH:$PWD/gcc/bin:$PWD/qemu"
1911

2012
script:
2113
- bash ci/script.sh

ci/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ main() {
1616

1717
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj
1818

19+
mkdir qemu
20+
curl -L https://github.com/japaric/qemu-bin/raw/master/14.04/qemu-system-arm-2.12.0 > qemu/qemu-system-arm
21+
chmod +x qemu/qemu-system-arm
22+
1923
rustup component add llvm-tools-preview
2024

2125
curl -LSfs https://japaric.github.io/trust/install.sh | \

ci/logging/app/.cargo/config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[target.thumbv7m-none-eabi]
2+
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
3+
rustflags = ["-C", "link-arg=-Tlink.x"]
4+
5+
[build]
6+
target = "thumbv7m-none-eabi"

ci/logging/app/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
authors = ["Jorge Aparicio <jorge@japaric.io>"]
3+
edition = "2018"
4+
name = "app"
5+
version = "0.1.0"
6+
7+
[dependencies]
8+
cortex-m-semihosting = "0.3.1"
9+
rt = { path = "../rt" }
10+
11+
[profile.release]
12+
codegen-units = 1
13+
lto = true

ci/logging/app/dev.objdump

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
00001fe1 l .rodata 00000001 Goodbye
2+
00001fe0 l .rodata 00000001 Hello, world!

ci/logging/app/dev.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0x1fe0
2+
0x1fe1

ci/logging/app/release.objdump

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
00000a7d l .rodata 00000001 Goodbye
2+
00000a7c l .rodata 00000001 Hello, world!

ci/logging/app/release.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0xa7c
2+
0xa7d

ci/logging/app/src/main.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![no_main]
2+
#![no_std]
3+
4+
use core::fmt::Write;
5+
use cortex_m_semihosting::{debug, hio};
6+
7+
use rt::entry;
8+
9+
entry!(main);
10+
11+
fn main() -> ! {
12+
let mut hstdout = hio::hstdout().unwrap();
13+
14+
#[export_name = "Hello, world!"]
15+
static A: u8 = 0;
16+
17+
writeln!(hstdout, "{:#x}", &A as *const u8 as usize);
18+
19+
#[export_name = "Goodbye"]
20+
static B: u8 = 0;
21+
22+
writeln!(hstdout, "{:#x}", &B as *const u8 as usize);
23+
24+
debug::exit(debug::EXIT_SUCCESS);
25+
26+
loop {}
27+
}

ci/logging/app2/.cargo/config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[target.thumbv7m-none-eabi]
2+
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
3+
rustflags = [
4+
"-C", "link-arg=-Tlink.x",
5+
"-C", "link-arg=-Tlog.x", # <- NEW!
6+
]
7+
8+
[build]
9+
target = "thumbv7m-none-eabi"

0 commit comments

Comments
 (0)