How to debug an SOS panic? B5som

From your words, I read that this is the size of the firmware, or the space it takes in the flash memory of the device.
As I re-learned today (here), that is different from the RAM your program uses. So the memory handler will help you identify if that is an issue.
Cheers