Question
Hard Fault on first SRAM access
Posted on August 23, 2012 at 04:51
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 = 20001940R1 = 0R2 = 0R3 = 0R12 = 1fffe944LR [R14] = 20001950 subroutine call return addressPC [R15] = 8000379 program counterPSR = 80006a0BFAR = e000ed38CFSR = 400HFSR = 40000000DFSR = 8AFSR = 0SCB_SHCSR = 0Tried making this the first thing inuint32t *ACTLR = (uint32_t *)0xE000E008;
// *ACTLR |= 2; never executed this
[Hard fault handler - all numbers in hex]R0 = 20001940R1 = 0R2 = 0R3 = 0R12 = e008LR [R14] = 20001950 subroutine call return addressPC [R15] = 8000177 program counterPSR = 8000378BFAR = e000ed38CFSR = 400HFSR = 40000000DFSR = 8AFSR = 0SCB_SHCSR = 0help or thoughtful guidance appreciated. #stm32-hardfault-impreciserr