2014-03-05 07:44 PM
hello everyone
today I have problem with memory but I cannot solve I don't know it relate stack and heap or not. in startupcode file, Iinitialize
stack_size : 0x00013000 and heap_size : 0x00006000 because I read on this page http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0203g/Beiddiij.html when debug, it jump to HardFault_Handler() and display statement: cannot access memory. I record the value of stack pointer register (SP), program counter (PC), Link register (LR) ------START----- SP: 0x20019258 LR: 0x080002CB PC: 0x080067D0 -----BEFORE DIED------ SP: 0x20019218 LR: 0x80062F9 PC: 0x08006F92 -----DIED----- SP: 0x200191B0 LR: 0xFFFFFFE9 PC: 0x0800052A can anyone help me? thank in advance!2014-03-05 08:01 PM
Try to use a proper Hard Fault Handler (Google: Hard Fault Handler Joseph Yiu)
Understand the processor registers, and the assembler code that is faulting. Then you'll have a clue about what memory it's trying to access, and perhaps why. Add assert() or other sanity checking on variable you are using, and gauge the stack depth and utilization. The stack size looks ridiculously large, have you made any effort to quantify how much you actually need based on your local/auto usage and call tree? Make sure malloc() isn't returning NULL pointers, and perhaps wrap the malloc/free so you can understand the usage.