Debugging C crashes on device, understanding hardware limits

Hi all,

I have been enjoying messing around with the Playdate C API this weekend. I'm trying to see how far I can get porting some existing projects to Playdate. It is definitely easy to get crashes on launch which are hard to debug

In browsing the forums, it seems that it can be a bit tricky to debug once you start hitting the hardware limits. I'm curious about a number of specifics:

  • Are there hard limits on stack? I've noticed some threads which mention the stack space is small. Some of the C_API files in the SDK mention STACK_SIZE = 61800... So is it about 61kb? Is it possible to tweak the stack size in the build toolchain?
  • Are there hard heap limits? C_API files mention HEAP_SIZE = 8388208, so is expected user heap ~8MB? Does the device itself have 16MB RAM, with ~8MB reserved for system use?
  • Is logToConsole buffered? When my application crashes, it doesn't seem to consistently output the same debug lines. If it is buffered, is there a way to flush the console?
  • Is it possible at all to symbolicate the pc register in the crash log?
  • Is it possible to do remote debugging with C?

Thank you!


(I realized I posted this in the wrong forum before, so I just moved it to "Get Help")

Bump on this, I'm having similar crash-on-launch problems that don't happen in the simulator. Thanks!

Just tossing one on the pile:

  • If the update callback takes 10 seconds to return, the OS forces the program to terminate as a crash. This is a lot easier to trigger on the hardware than in the simulator.

Oh. Ohhhhh.

I think that's my issue. I'm running a suite of cpu opcode tests in a z80 emulator.