Skip to content

Commit 29b4e15

Browse files
Set --nmagic to avoid weirdness, and skip entry u32.
1 parent 4d8daf9 commit 29b4e15

3 files changed

Lines changed: 11 additions & 34 deletions

File tree

samples/.cargo/config.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[target.thumbv7em-none-eabihf]
2-
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"]
2+
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"] # , "-C", "link-arg=--nmagic"]
33

44
[target.thumbv7em-none-eabi]
5-
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"]
5+
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"] # , "-C", "link-arg=--nmagic"]
66

77
[target.thumbv7m-none-eabi]
8-
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"]
8+
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"] # , "-C", "link-arg=--nmagic"]
99

1010
[target.thumbv6m-none-eabi]
11-
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"]
11+
rustflags = ["-C", "link-arg=-Tneotron-cortex-m.ld"] # , "-C", "link-arg=--nmagic"]

samples/neotron-cortex-m.ld

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,28 @@ ENTRY(app_entry);
2525
/* # Sections */
2626
SECTIONS
2727
{
28-
29-
/* ### .entry_point */
30-
.entry_point ORIGIN(RAM) :
31-
{
32-
KEEP(*(.entry_point))
33-
} > RAM
34-
35-
PROVIDE(_stext = ADDR(.entry_point) + SIZEOF(.entry_point));
36-
3728
/* ### .text */
38-
.text _stext :
29+
.text : ALIGN(4)
3930
{
31+
. = ALIGN(4);
4032
*(.text .text.*);
41-
*(.HardFaultTrampoline);
42-
*(.HardFault.*);
33+
. = ALIGN(4);
4334
}
4435

4536
/* ### .rodata */
4637
.rodata : ALIGN(4)
4738
{
39+
. = ALIGN(4);
4840
*(.rodata .rodata.*);
49-
50-
/* 4-byte align the end (VMA) of this section.
51-
This is required by LLD to ensure the LMA of the following .data
52-
section will have the correct alignment. */
5341
. = ALIGN(4);
5442
}
5543

5644
/* ### .data */
5745
.data : ALIGN(4)
5846
{
5947
. = ALIGN(4);
60-
__sdata = .;
6148
*(.data .data.*);
62-
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
63-
__edata = .;
49+
. = ALIGN(4);
6450
}
6551

6652
/* LMA of .data */
@@ -70,10 +56,8 @@ SECTIONS
7056
.bss : ALIGN(4)
7157
{
7258
. = ALIGN(4);
73-
__sbss = .;
7459
*(.bss .bss.*);
75-
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
76-
__ebss = .;
60+
. = ALIGN(4);
7761
}
7862

7963
/* ### .uninit */
@@ -84,10 +68,6 @@ SECTIONS
8468
. = ALIGN(4);
8569
}
8670

87-
/* Place the heap right after `.uninit` */
88-
. = ALIGN(4);
89-
__sheap = .;
90-
9171
/* ## .got */
9272
/* Dynamic relocations are unsupported. This section is only used to detect relocatable code in
9373
the input files and raise an error if relocatable code is found */

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ extern "C" {
3636
// Static Variables
3737
// ============================================================================
3838

39-
#[link_section = ".entry_point"]
40-
#[used]
41-
pub static APP_ENTRY: AppStartFn = app_entry;
42-
4339
/// Holds a pointer to the OS API provided by the OS on start-up.
4440
///
4541
/// Once you've hit the application `main()`, this will be non-null.
@@ -257,6 +253,7 @@ impl Drop for ReadDir {
257253
///
258254
/// Will jump to the application entry point, and `extern "C"` function
259255
/// called `main`.
256+
#[no_mangle]
260257
extern "C" fn app_entry(api: *mut Api) -> i32 {
261258
API.store(api, Ordering::Relaxed);
262259
unsafe { neotron_main() }

0 commit comments

Comments
 (0)