File tree 2 files changed +18
-15
lines changed
2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## [ Unreleased]
9
9
10
+ - Add ` zero-init-ram ` feature to initialize RAM with zeros on startup. This can be necessary on
11
+ safety-critical hardware to properly initialize memory integrity measures.
12
+
13
+ ## [ v0.7.3]
14
+
10
15
- Fixed a potential miscompilation caused by the initial stack pointer
11
16
not being 8-byte aligned. This issue affected 0.7.1 and 0.7.2; for
12
17
more details please see [ the advisory] ([ #467 ] ).
13
18
- A linker error is generated if the initial stack pointer is not 8-byte aligned ([ #464 ] ).
14
19
- The initial stack pointer is now forced to be 8-byte aligned in the linker script,
15
20
to defend against it being overridden outside of the cortex-m-rt linker script ([ #465 ] ).
16
- - Add ` zero-init-ram ` feature to initialize RAM with zeros on startup. This can be necessary on
17
- safety-critical hardware to properly initialize memory integrity measures.
18
21
19
22
[ the advisory ] : https://github.com/rust-embedded/cortex-m/discussions/469
20
23
[ #464 ] : https://github.com/rust-embedded/cortex-m/issues/464
Original file line number Diff line number Diff line change @@ -521,19 +521,6 @@ cfg_global_asm! {
521
521
"ldr r0, =_stack_start
522
522
msr msp, r0" ,
523
523
524
- // If enabled, initialize RAM with zeros. This is not usually required, but might be necessary
525
- // to properly initialize checksum-based memory integrity measures on safety-critical hardware.
526
- #[ cfg( feature = "zero-init-ram" ) ]
527
- "ldr r0, =_ram_start
528
- ldr r1, =_ram_end
529
- movs r2, #0
530
- 0:
531
- cmp r1, r0
532
- beq 1f
533
- stm r0!, {{r2}}
534
- b 0b
535
- 1:" ,
536
-
537
524
// If enabled, initialise VTOR to the start of the vector table. This is normally initialised
538
525
// by a bootloader when the non-reset value is required, but some bootloaders do not set it,
539
526
// leading to frustrating issues where everything seems to work but interrupts are never
@@ -549,6 +536,19 @@ cfg_global_asm! {
549
536
// Example use cases include disabling default watchdogs or enabling RAM.
550
537
"bl __pre_init" ,
551
538
539
+ // If enabled, initialize RAM with zeros. This is not usually required, but might be necessary
540
+ // to properly initialize checksum-based memory integrity measures on safety-critical hardware.
541
+ #[ cfg( feature = "zero-init-ram" ) ]
542
+ "ldr r0, =_ram_start
543
+ ldr r1, =_ram_end
544
+ movs r2, #0
545
+ 0:
546
+ cmp r1, r0
547
+ beq 1f
548
+ stm r0!, {{r2}}
549
+ b 0b
550
+ 1:" ,
551
+
552
552
// Initialise .bss memory. `__sbss` and `__ebss` come from the linker script.
553
553
#[ cfg( not( feature = "zero-init-ram" ) ) ]
554
554
"ldr r0, =__sbss
You can’t perform that action at this time.
0 commit comments