AnsweredAssumed Answered

Hard Fault on first SRAM access

Question asked by Rob.Roy on Aug 23, 2012
Latest reply on Aug 24, 2012 by Clive One
Hello,

STM32L152, Rowley CrossStudio 2.3, STM32L152DEMO pcb, Using CrossConnect debugger within CrossStudio.

I have seen this problem before, did not record/understand last time fixed.

What will cause a hard fault on first SRAM access in program (after startup_.s). I have a bunch of static structure global declarations before main, once in main execution hard faults at first SRAM access (usually is a push (R7, lr) ) and those values look reasonable.

Getting VCATCH, IMPRECISERR set, and drops to HardFault (CMSIS version). If I manually set CSB_SHCRS->BUSFAULTENA and rerun it will drop into bus fault handler.

The modified handler returns this:
[Hard fault handler - all numbers in hex]
R0 = 20001940
R1 = 0
R2 = 0
R3 = 0
R12 = 1fffe944
LR [R14] = 20001950  subroutine call return address
PC [R15] = 8000379  program counter
PSR = 80006a0
BFAR = e000ed38
CFSR = 400
HFSR = 40000000
DFSR = 8
AFSR = 0
SCB_SHCSR = 0

Tried making this the first thing in
uint32t *ACTLR = (uint32_t *)0xE000E008;
// *ACTLR |= 2; never executed this 
[Hard fault handler - all numbers in hex]
R0 = 20001940
R1 = 0
R2 = 0
R3 = 0
R12 = e008
LR [R14] = 20001950  subroutine call return address
PC [R15] = 8000177  program counter
PSR = 8000378
BFAR = e000ed38
CFSR = 400
HFSR = 40000000
DFSR = 8
AFSR = 0
SCB_SHCSR = 0

help or thoughtful guidance appreciated.

Outcomes