Skip to content

Commit 53c1163

Browse files
committed
01: Remove LTO to fix linking bug.
For some reason, LTO caused "_start" to start at 0x00080020 instead of 0x00080000.
1 parent 18c7259 commit 53c1163

File tree

4 files changed

+59
-23
lines changed

4 files changed

+59
-23
lines changed

Diff for: 01_wait_forever/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ version = "0.1.0"
44
authors = ["Andre Richter <[email protected]>"]
55
edition = "2018"
66

7-
[profile.release]
8-
lto = true
9-
107
# The features section is used to select the target board.
118
[features]
129
default = []

Diff for: 01_wait_forever/src/_arch/aarch64/cpu.rs

-18
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,3 @@
66
77
// Assembly counterpart to this file.
88
global_asm!(include_str!("cpu.S"));
9-
10-
//--------------------------------------------------------------------------------------------------
11-
// Public Code
12-
//--------------------------------------------------------------------------------------------------
13-
14-
/// Pause execution on the core.
15-
#[inline(always)]
16-
pub fn wait_forever() -> ! {
17-
unsafe {
18-
loop {
19-
#[rustfmt::skip]
20-
asm!(
21-
"wfe",
22-
options(nomem, nostack, preserves_flags)
23-
);
24-
}
25-
}
26-
}

Diff for: 01_wait_forever/src/panic_wait.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
//! A panic handler that infinitely waits.
66
7-
use crate::cpu;
7+
// use crate::cpu;
88
use core::panic::PanicInfo;
99

1010
#[panic_handler]
1111
fn panic(_info: &PanicInfo) -> ! {
12-
cpu::wait_forever()
12+
unimplemented!()
1313
}

Diff for: 02_runtime_init/README.md

+57
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,46 @@
2323
## Diff to previous
2424
```diff
2525

26+
diff -uNr 01_wait_forever/Cargo.toml 02_runtime_init/Cargo.toml
27+
--- 01_wait_forever/Cargo.toml
28+
+++ 02_runtime_init/Cargo.toml
29+
@@ -4,6 +4,9 @@
30+
authors = ["Andre Richter <[email protected]>"]
31+
edition = "2018"
32+
33+
+[profile.release]
34+
+lto = true
35+
+
36+
# The features section is used to select the target board.
37+
[features]
38+
default = []
39+
40+
diff -uNr 01_wait_forever/src/_arch/aarch64/cpu.rs 02_runtime_init/src/_arch/aarch64/cpu.rs
41+
--- 01_wait_forever/src/_arch/aarch64/cpu.rs
42+
+++ 02_runtime_init/src/_arch/aarch64/cpu.rs
43+
@@ -6,3 +6,21 @@
44+
45+
// Assembly counterpart to this file.
46+
global_asm!(include_str!("cpu.S"));
47+
+
48+
+//--------------------------------------------------------------------------------------------------
49+
+// Public Code
50+
+//--------------------------------------------------------------------------------------------------
51+
+
52+
+/// Pause execution on the core.
53+
+#[inline(always)]
54+
+pub fn wait_forever() -> ! {
55+
+ unsafe {
56+
+ loop {
57+
+ #[rustfmt::skip]
58+
+ asm!(
59+
+ "wfe",
60+
+ options(nomem, nostack, preserves_flags)
61+
+ );
62+
+ }
63+
+ }
64+
+}
65+
2666
diff -uNr 01_wait_forever/src/_arch/aarch64/cpu.S 02_runtime_init/src/_arch/aarch64/cpu.S
2767
--- 01_wait_forever/src/_arch/aarch64/cpu.S
2868
+++ 02_runtime_init/src/_arch/aarch64/cpu.S
@@ -191,6 +231,23 @@ diff -uNr 01_wait_forever/src/memory.rs 02_runtime_init/src/memory.rs
191231
+ }
192232
+}
193233

234+
diff -uNr 01_wait_forever/src/panic_wait.rs 02_runtime_init/src/panic_wait.rs
235+
--- 01_wait_forever/src/panic_wait.rs
236+
+++ 02_runtime_init/src/panic_wait.rs
237+
@@ -4,10 +4,10 @@
238+
239+
//! A panic handler that infinitely waits.
240+
241+
-// use crate::cpu;
242+
+use crate::cpu;
243+
use core::panic::PanicInfo;
244+
245+
#[panic_handler]
246+
fn panic(_info: &PanicInfo) -> ! {
247+
- unimplemented!()
248+
+ cpu::wait_forever()
249+
}
250+
194251
diff -uNr 01_wait_forever/src/runtime_init.rs 02_runtime_init/src/runtime_init.rs
195252
--- 01_wait_forever/src/runtime_init.rs
196253
+++ 02_runtime_init/src/runtime_init.rs

0 commit comments

Comments
 (0)