Skip to content

Commit fd93076

Browse files
committed
Logging with symbols
1 parent 68e14cf commit fd93076

35 files changed

+773
-0
lines changed

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"

ci/logging/app2/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/app2/dev.objdump

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

0 commit comments

Comments
 (0)