Embedded systems often require a careful eye to where memory resources are being
spent, especially runtime memory utilization like stack and heap memories.
Great Post, really love it!
Do I miss something or is hit_breakpoint function never defined?
I would assume it would look something like this:
def hit_breakpoint() -> bool:
locations = []
for gdb_breakpoint in gdb.breakpoints():
for location in gdb_breakpoint.locations:
locations.append(location.address)
pc = int(gdb.parse_and_eval("$pc"))
if pc in locations:
return True
return False
Hi. I’ve been reading this blog for a very long time. I advise all friends to read, but many miss useful articles and I would like to convey useful information to them. I ask permission to translate it for my readers and friends from Armenia, Ukraine, Russia and Georgia.
Thank you, this was something I needed to be very vigilant about on a project a few years ago - it’s nice to see a range of solutions.
When it was an issue for me, we used the Keil toolchain. Fortunately, the armcc linker also has a command line option to generate static call traces, and report stack usage per function: https://www.keil.com/appnotes/files/apnt_316.pdf
I used to post-process that file with a Python script to create an estimated worst-case stack for each task and IRQ handler, generating a report on each build, and I would force the build to fail if stack space was tight. The script would need to know the possible nested interrupt combinations, so it would need to be configured with a list of interrupt handlers and interrupt priority levels.