This repository was archived by the owner on Jan 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ version = "0.1.0"
4
4
authors = [
" Jorge Aparicio <[email protected] >" ]
5
5
6
6
[dependencies ]
7
- r0 = " 0.2.0 "
7
+ r0 = " 0.2.1 "
8
8
9
9
[dependencies .cortex-m ]
10
10
optional = true
Original file line number Diff line number Diff line change @@ -7,20 +7,19 @@ SECTIONS
7
7
/* Vector table */
8
8
_VECTOR_TABLE = .;
9
9
LONG (ORIGIN(RAM ) + LENGTH (RAM));
10
- LONG (__reset + 1 );
11
10
11
+ KEEP(*(.rodata.reset_handler));
12
12
KEEP(*(.rodata._EXCEPTIONS));
13
13
__exceptions = .;
14
14
15
15
KEEP(*(.rodata._INTERRUPTS));
16
16
__interrupts = .;
17
17
18
- /* Entry point : the reset handler */
19
- __reset = .;
20
- KEEP(*(.text.start));
21
-
22
18
*(.text.*);
23
19
*(.rodata.*);
20
+ _init_array_start = ALIGN (4);
21
+ KEEP(*(.init_array));
22
+ _init_array_end = ALIGN (4);
24
23
} > FLASH
25
24
26
25
.bss : ALIGN (4)
Original file line number Diff line number Diff line change 31
31
#![ feature( compiler_builtins_lib) ]
32
32
#![ feature( lang_items) ]
33
33
#![ feature( linkage) ]
34
+ #![ feature( used) ]
34
35
#![ no_std]
35
36
36
37
#[ cfg( feature = "panic-over-itm" ) ]
@@ -44,13 +45,10 @@ extern crate r0;
44
45
45
46
mod lang_items;
46
47
47
- // TODO make private and use `#[used]`
48
48
/// The reset handler
49
49
///
50
50
/// This is the entry point of all programs
51
- #[ doc( hidden) ]
52
- #[ export_name = "start" ]
53
- pub unsafe extern "C" fn reset_handler ( ) -> ! {
51
+ unsafe extern "C" fn reset_handler ( ) -> ! {
54
52
extern "C" {
55
53
static mut _ebss: u32 ;
56
54
static mut _sbss: u32 ;
@@ -59,10 +57,14 @@ pub unsafe extern "C" fn reset_handler() -> ! {
59
57
static mut _sdata: u32 ;
60
58
61
59
static _sidata: u32 ;
60
+
61
+ static _init_array_start: extern "C" fn ( ) ;
62
+ static _init_array_end: extern "C" fn ( ) ;
62
63
}
63
64
64
65
:: r0:: zero_bss ( & mut _sbss, & mut _ebss) ;
65
66
:: r0:: init_data ( & mut _sdata, & mut _edata, & _sidata) ;
67
+ :: r0:: run_init_array ( & _init_array_start, & _init_array_end) ;
66
68
67
69
// NOTE `rustc` forces this signature on us. See `src/lang_items.rs`
68
70
extern "C" {
@@ -79,3 +81,8 @@ pub unsafe extern "C" fn reset_handler() -> ! {
79
81
asm ! ( "wfi" :: :: "volatile" ) ;
80
82
}
81
83
}
84
+
85
+ #[ allow( dead_code) ]
86
+ #[ used]
87
+ #[ link_section = ".rodata.reset_handler" ]
88
+ static RESET_HANDLER : unsafe extern "C" fn ( ) -> ! = reset_handler;
You can’t perform that action at this time.
0 commit comments