Debugger doesn't start (HardFault / MemManage)

Hello, 

after facing problem with ULINK2 with using Memory layout from Target Register of uVision, I have switched to Scatterfile with followed content:

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_SDRAM1 0xC0000000 0x00100000  {  ; RW data stored in SDRAM (1M)
   .ANY (+RW +ZI)
  }
  RW_IRAM1 0x20000000 0x00040000  {
   .ANY (+RW +ZI)
  }
  RW_IRAM2 0x20040000 UNINIT 0x00010000  {
    EventRecorder.o (+ZI)
  }
}

But now I can not start my Debugger, because I'm redirect to HardFault_Handler. If I stop the debugger and show Callee Code, it points to MemManage_Handler.

I'm trying to access in Compiler v5 (C99 mode) external SDRAM from CubeMX and self defined Viriable as followed:

__attribute__ ((at(0xC0050000))) uint32_t framebuffer[2];

Who knows the solution? Maybe the Scatter file is wrong for that situation?

Parents
  • It is very difficult to decipher the solution from just the above information. 0xC0050000 should be located within RW_SDRAM1 region. Has the memory been initialized when the code attempts to write to it?

    I suspect you will need to debug the initialization code. In the Project Options, go to the Debug tab, and deselect "Run to main()" so that the code loads and stops at the initial Reset handler. You can step through from there to determine when exactly in the code this HardFault is triggered. Trace is also a very useful tool if this is available to you.

Reply
  • It is very difficult to decipher the solution from just the above information. 0xC0050000 should be located within RW_SDRAM1 region. Has the memory been initialized when the code attempts to write to it?

    I suspect you will need to debug the initialization code. In the Project Options, go to the Debug tab, and deselect "Run to main()" so that the code loads and stops at the initial Reset handler. You can step through from there to determine when exactly in the code this HardFault is triggered. Trace is also a very useful tool if this is available to you.

Children