Skip to content

Commit eec7db4

Browse files
committed
Add missing binary addresses to memory layout and main chapters
This change adds missing addresses to the disassembly in chapters `Memory Layout` and `A main interface`. The `Memory Layout` chapter does refer to the addresses in the text, while `A main interface` does not, but has been adapted for consistency in the format.
1 parent 47db755 commit eec7db4

6 files changed

Lines changed: 45 additions & 24 deletions

File tree

ci/main/app/app.objdump

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ app: file format elf32-littlearm
33

44
Disassembly of section .text:
55

6-
<main>:
7-
push {r7, lr}
8-
mov r7, sp
9-
sub sp, #0x4
10-
movs r0, #0x2a
11-
str r0, [sp]
12-
b 0x14 <main+0xc> @ imm = #-0x2
13-
b 0x14 <main+0xc> @ imm = #-0x4
6+
00000008 <main>:
7+
8: push {r7, lr}
8+
a: mov r7, sp
9+
c: sub sp, #0x4
10+
e: movs r0, #0x2a
11+
10: str r0, [sp]
12+
12: b 0x14 <main+0xc> @ imm = #-0x2
13+
14: b 0x14 <main+0xc> @ imm = #-0x4
1414

15-
<Reset>:
16-
push {r7, lr}
17-
mov r7, sp
18-
bl 0x8 <main> @ imm = #-0x16
15+
00000016 <Reset>:
16+
16: push {r7, lr}
17+
18: mov r7, sp
18+
1a: bl 0x8 <main> @ imm = #-0x16

ci/memory-layout/app.text.objdump

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ app: file format elf32-littlearm
33

44
Disassembly of section .text:
55

6-
<Reset>:
7-
push {r7, lr}
8-
mov r7, sp
9-
sub sp, #0x4
10-
movs r0, #0x2a
11-
str r0, [sp]
12-
b 0x14 <Reset+0xc> @ imm = #-0x2
13-
b 0x14 <Reset+0xc> @ imm = #-0x4
6+
00000008 <Reset>:
7+
8: push {r7, lr}
8+
a: mov r7, sp
9+
c: sub sp, #0x4
10+
e: movs r0, #0x2a
11+
10: str r0, [sp]
12+
12: b 0x14 <Reset+0xc> @ imm = #-0x2
13+
14: b 0x14 <Reset+0xc> @ imm = #-0x4

ci/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ main() {
5252

5353
# check that the Reset symbol is there
5454
diff -b app.text.objdump \
55-
<(cargo objdump --bin app -- -d --no-show-raw-insn --no-leading-addr)
55+
<(cargo objdump --bin app -- -d --no-show-raw-insn --print-imm-hex)
5656

5757
# check that the reset vector is there and has the right address
5858
diff -b app.vector_table.objdump \
@@ -70,7 +70,7 @@ main() {
7070
# check that the disassembly matches
7171
pushd app
7272
diff -b app.objdump \
73-
<(cargo objdump --bin app -- -d --no-show-raw-insn --no-leading-addr)
73+
<(cargo objdump --bin app -- -d --no-show-raw-insn --print-imm-hex)
7474
# disabled because of rust-lang/rust#53964
7575
# edition_check
7676
popd

flake.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
description = "embedonomicon";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { nixpkgs, utils, ... }:
10+
utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs { inherit system; };
13+
in
14+
{
15+
devShells.default = pkgs.mkShell {
16+
buildInputs = [
17+
pkgs.linkchecker
18+
];
19+
};
20+
});
21+
}

src/main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ $ cat src/main.rs
8989
The disassembly will be similar but will now include the user `main` function.
9090

9191
``` console
92-
$ cargo objdump --bin app -- -d --no-show-raw-insn
92+
$ cargo objdump --bin app -- -d --no-show-raw-insn --print-imm-hex
9393
```
9494

9595
``` text

src/memory-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Now let's inspect the output binary to confirm the memory layout looks the way w
214214
(this requires [`cargo-binutils`](https://github.com/rust-embedded/cargo-binutils#readme)):
215215

216216
``` console
217-
$ cargo objdump --bin app -- -d --no-show-raw-insn
217+
$ cargo objdump --bin app -- -d --no-show-raw-insn --print-imm-hex
218218
```
219219

220220
``` text

0 commit comments

Comments
 (0)