Skip to content

Commit dd266bb

Browse files
authored
Merge pull request #100 from Javier-varez/edition2024
Update book from edition 2018 to 2024
2 parents 708282c + 4b075c7 commit dd266bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+639
-477
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13-
continue-on-error: ${{ matrix.experimental || false }}
14-
15-
strategy:
16-
matrix:
17-
rust:
18-
- 1.63.0
19-
- nightly-2022-08-12 #Since Rust 1.63.0 came out Aug 11 2022, we use nightly from the day after.
20-
include:
21-
- rust: nightly-2022-08-12
22-
experimental: true
23-
2413
steps:
2514
- uses: actions/checkout@v2
2615

@@ -30,7 +19,7 @@ jobs:
3019
pip3 install --user python-dateutil linkchecker
3120
3221
- name: Cache installed binaries
33-
uses: actions/cache@v4
22+
uses: actions/cache@v4
3423
id: cache-bin
3524
with:
3625
path: ~/cache-bin
@@ -57,9 +46,9 @@ jobs:
5746
uses: actions-rs/toolchain@v1
5847
with:
5948
profile: minimal
60-
toolchain: ${{ matrix.rust }}
49+
toolchain: 1.89.0
6150
override: true
62-
components: rustfmt, clippy, llvm-tools-preview
51+
components: rustfmt, clippy, llvm-tools
6352
target: thumbv7m-none-eabi
6453

6554
- name: Install arm-none-eabi-gcc and qemu
@@ -85,8 +74,6 @@ jobs:
8574
8675
- name: Test
8776
run: bash ci/script.sh
88-
env:
89-
RUST_VERSION: ${{ matrix.rust }}
9077

9178
deploy:
9279
runs-on: ubuntu-latest

ci/asm/app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
authors = ["Jorge Aparicio <[email protected]>"]
3-
edition = "2018"
3+
edition = "2024"
44
name = "app"
55
version = "0.1.0"
66

ci/asm/app/release.objdump

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@ app: file format elf32-littlearm
33

44
Disassembly of section .text:
55

6-
<HardFault>:
7-
b 0x40 <HardFault> @ imm = #-0x4
6+
00000040 <HardFault>:
7+
40: push {r7, lr}
8+
42: mov r7, sp
9+
44: b 0x44 <HardFault+0x4> @ imm = #-0x4
810

9-
<main>:
10-
b 0x42 <main> @ imm = #-0x4
11+
00000046 <main>:
12+
46: push {r7, lr}
13+
48: mov r7, sp
14+
4a: b 0x4a <main+0x4> @ imm = #-0x4
1115

12-
<Reset>:
13-
push {r7, lr}
14-
mov r7, sp
15-
bl 0x42 <main> @ imm = #-0xa
16-
trap
16+
0000004c <Reset>:
17+
4c: push {r7, lr}
18+
4e: mov r7, sp
19+
50: bl 0x46 <main> @ imm = #-0xe
1720

18-
<UsageFault>:
19-
b 0x4e <UsageFault> @ imm = #-0x4
21+
00000054 <UsageFault>:
22+
54: push {r7, lr}
23+
56: mov r7, sp
24+
58: b 0x58 <UsageFault+0x4> @ imm = #-0x4
2025

21-
<HardFaultTrampoline>:
22-
mrs r0, msp
23-
b 0x40 <HardFault> @ imm = #-0x18
26+
0000005a <HardFaultTrampoline>:
27+
5a: mrs r0, msp
28+
5e: b 0x40 <HardFault> @ imm = #-0x22

ci/asm/app/release.vector_table

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
app: file format elf32-littlearm
33
Contents of section .vector_table:
4-
0000 00000120 45000000 4f000000 51000000 ... E...O...Q...
5-
0010 4f000000 4f000000 4f000000 00000000 O...O...O.......
6-
0020 00000000 00000000 00000000 4f000000 ............O...
7-
0030 00000000 00000000 4f000000 4f000000 ........O...O...
4+
0000 00000120 4d000000 55000000 5b000000 ... M...U...[...
5+
0010 55000000 55000000 55000000 00000000 U...U...U.......
6+
0020 00000000 00000000 00000000 55000000 ............U...
7+
0030 00000000 00000000 55000000 55000000 ........U...U...

ci/asm/app/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() -> ! {
1010
}
1111

1212
#[allow(non_snake_case)]
13-
#[no_mangle]
13+
#[unsafe(no_mangle)]
1414
pub fn HardFault(_ef: *const u32) -> ! {
1515
loop {}
1616
}

ci/asm/app2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
authors = ["Jorge Aparicio <[email protected]>"]
3-
edition = "2018"
3+
edition = "2024"
44
name = "app"
55
version = "0.1.0"
66

ci/asm/rt/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
edition = "2018"
2+
edition = "2024"
33
name = "rt"
44
version = "0.1.0"
55
authors = ["Jorge Aparicio <[email protected]>"]

ci/asm/rt/src/lib.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
use core::panic::PanicInfo;
44
// use core::ptr;
55

6-
#[no_mangle]
6+
#[unsafe(no_mangle)]
77
pub unsafe extern "C" fn Reset() -> ! {
88
// Omitted to simplify the `objdump` output
99
// Initialize RAM
10-
extern "C" {
10+
unsafe extern "C" {
1111
// static mut _sbss: u8;
1212
// static mut _ebss: u8;
1313

@@ -23,16 +23,16 @@ pub unsafe extern "C" fn Reset() -> ! {
2323
// ptr::copy_nonoverlapping(&_sidata as *const u8, &mut _sdata as *mut u8, count);
2424

2525
// Call user entry point
26-
extern "Rust" {
27-
fn main() -> !;
26+
unsafe extern "Rust" {
27+
safe fn main() -> !;
2828
}
2929

3030
main()
3131
}
3232

3333
// The reset vector, a pointer into the reset handler
34-
#[link_section = ".vector_table.reset_vector"]
35-
#[no_mangle]
34+
#[unsafe(link_section = ".vector_table.reset_vector")]
35+
#[unsafe(no_mangle)]
3636
pub static RESET_VECTOR: unsafe extern "C" fn() -> ! = Reset;
3737

3838
#[panic_handler]
@@ -43,22 +43,22 @@ fn panic(_panic: &PanicInfo<'_>) -> ! {
4343
#[macro_export]
4444
macro_rules! entry {
4545
($path:path) => {
46-
#[export_name = "main"]
46+
#[unsafe(export_name = "main")]
4747
pub unsafe fn __main() -> ! {
4848
// type check the given path
4949
let f: fn() -> ! = $path;
5050

5151
f()
5252
}
53-
}
53+
};
5454
}
5555

5656
pub union Vector {
5757
reserved: u32,
5858
handler: unsafe extern "C" fn(),
5959
}
6060

61-
extern "C" {
61+
unsafe extern "C" {
6262
fn NMI();
6363
fn HardFaultTrampoline(); // <- CHANGED!
6464
fn MemManage();
@@ -69,16 +69,14 @@ extern "C" {
6969
fn SysTick();
7070
}
7171

72-
#[link_section = ".vector_table.exceptions"]
73-
#[no_mangle]
72+
#[unsafe(link_section = ".vector_table.exceptions")]
73+
#[unsafe(no_mangle)]
7474
pub static EXCEPTIONS: [Vector; 14] = [
7575
Vector { handler: NMI },
7676
Vector { handler: HardFaultTrampoline }, // <- CHANGED!
7777
Vector { handler: MemManage },
7878
Vector { handler: BusFault },
79-
Vector {
80-
handler: UsageFault,
81-
},
79+
Vector { handler: UsageFault },
8280
Vector { reserved: 0 },
8381
Vector { reserved: 0 },
8482
Vector { reserved: 0 },
@@ -90,7 +88,7 @@ pub static EXCEPTIONS: [Vector; 14] = [
9088
Vector { handler: SysTick },
9189
];
9290

93-
#[no_mangle]
91+
#[unsafe(no_mangle)]
9492
pub extern "C" fn DefaultExceptionHandler() {
9593
loop {}
9694
}

ci/asm/rt2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
edition = "2018"
2+
edition = "2024"
33
name = "rt"
44
version = "0.1.0"
55
authors = ["Jorge Aparicio <[email protected]>"]

ci/dma/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
authors = ["Jorge Aparicio <[email protected]>"]
3-
edition = "2018"
3+
edition = "2024"
44
name = "shared"
55
version = "0.1.0"
66

0 commit comments

Comments
 (0)