This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to debug through malloc function?

Hi All,

I am using EFM32GG11 cpu and have problem with malloc function. It crashes on the first call.

I have specified stack and heap areas in the scatter file.

I would like to debug through malloc function. I am using the standart C library linked to my keil MDK 5 project,

How could i build c runtime and link it to my project?

Thanks,

Parents
  • Define "crashes"

    Where does the processor end up?

    If you have a Hard Fault you're touching some memory oddly. Check that the memory described to the linker matches the capabilities of the part.

    Check how memory is arranged in the .MAP file.

    Make sure your SystemInit() code enables clocks, external memories, etc.

    Use FromELF to disassemble the .AXF file so you can play along with the debugger. You can step into code where you lack source, it is not that hard.

    Pretty sure Keil's code is solid, so issue is likely with structures, or initialization.

    Also shouldn't be hard to figure the linked-list implementation, and walk the heap structures.

    Check structure alignment, CM4 will fault on unaligned access with LDRD,STRD

Reply
  • Define "crashes"

    Where does the processor end up?

    If you have a Hard Fault you're touching some memory oddly. Check that the memory described to the linker matches the capabilities of the part.

    Check how memory is arranged in the .MAP file.

    Make sure your SystemInit() code enables clocks, external memories, etc.

    Use FromELF to disassemble the .AXF file so you can play along with the debugger. You can step into code where you lack source, it is not that hard.

    Pretty sure Keil's code is solid, so issue is likely with structures, or initialization.

    Also shouldn't be hard to figure the linked-list implementation, and walk the heap structures.

    Check structure alignment, CM4 will fault on unaligned access with LDRD,STRD

Children