This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Device hanging after raising .bss to/over 0x10000 (64kb)

I'm having a peculiar problem with my device in a memory heavy application, two of my libraries use statically allocated memory and one uses what i allocate with mem_manager. Overall memory usage doesn't seem to go past about 80kb per linker, but if i try to add mem manager blocks or FreeRTOS heap the result is same. My application won't run. Well to be honest i'm not sure my application doesn't run, but when take SEGGER debugger to it and halt it, it shows no exception. All it seems to me is that the device hangs.

Parents
  • Hi,

    Even though the device appears to hang, on the technical perspective, the CPU is always running and hence executing instructions (unless halted by debugger or a halt instruction or when in sleep). In your case, i think the CPU is executing a loop of instructions. All you need to do is compile your code in debug mode, let it run in debugger for a while and pause it to see what the CPU, program counter (PC) is executing. You most likely will get a context from this where you can go forward with your debug session. 

    My guess is that your application most likely is seeing a stack overflow.  But this should have sooner or later result in a hardfault unless the stack overflow took the PC into a legitimate code sectiton. In which case the behavior is unpredictable.

  • This is a distinct possibility, I must admit. I fudged the code around a bit and managed to hit HardFaultMemManage on occasion. This is weird as though i don't think I'm using more than half the available memory. I will have to go over the linker .map file and try to make some sense out of this.

Reply Children
Related