How to Load Two Binaries with Debugger/GDB

Hello,

I’m currently working on adding a new framework for an RTOS that involves shipping pre-compiled, target specific, kernels, and then building a C user space from source. We’re targeting STM32 devices first, so I’ve been adding on to that platform as well. I have everything working just fine for the userspace source project that one would start new from, building, uploading, and debugging. The issue I’m running into now with the pre-compiled kernel is how to best copy the binary from the framework into the project using scons and also load the pre-compiled kernel using GDB. Outside of PlatformIO we load both the kernel and userspace binaries separately, but I have not been able to accomplish this with the debug_load_cmds option since you can only load the binary that GDB was started with or load a binary to a specific address, but I cannot load another binary from a different file location. How would you recommend we do this?

Thank you!
-Kent

1 Like

This is in fact already possible, I was just misunderstanding the docs initially.

You can load two ELFs, in my particular case, a kernel and a userspace, using the following option in your platformio.ini.

debug_load_cmds = 
    load /path/to/external/firmware.elf
    load

The second load is for the target created from your actual PlatformIO project, which is inferred.

-Kent

2 Likes