Skip to content

Commit 60a43d1

Browse files
nemadhumarcmo
authored andcommitted
Fix hard fault due to uninitialized MPU BSS section
In the MPU protected BSS section, there is a flag indicating whether static instance has been created or not. The flag is not cleared and during a power interruption, the flag sometimes has a random value. This caused the SafeSupervisor static object to have random incorrect values due to missing constructor call, which leads to unintended behaviour, e.g. false positive safety checks. The solution is to zero out MPU protected BSS section. Change-Id: I5de341b0fd14a64b0c5b21a8b82a1ce30c6cfba8
1 parent d23acd9 commit 60a43d1

File tree

1 file changed

+16
-0
lines changed
  • executables/referenceApp/platforms/s32k148evb/main/src/bsp

1 file changed

+16
-0
lines changed

executables/referenceApp/platforms/s32k148evb/main/src/bsp/startUp.S

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,22 @@ Reset_Handler:
431431
bge .LC2
432432
.LC3:
433433

434+
/*
435+
* Zero out the MPU protected BSS section
436+
*/
437+
ldr r1, =__MPU_BSS_START
438+
ldr r2, =__MPU_BSS_END
439+
440+
subs r2, r1
441+
ble .LC7
442+
443+
movs r0, 0
444+
.LC6:
445+
str r0, [r1, r2]
446+
subs r2, 4
447+
bge .LC6
448+
.LC7:
449+
434450
#ifndef __START
435451
#define __START _start
436452
#endif

0 commit comments

Comments
 (0)