Search code examples
carmmapleprintfstm32

snprintf crash when displaying %d or %u


I'm trying to print an integer into a string with snprintf for display on an OLED display from an ARM micro. However, when I use %d or %u the micro locks up and stops executing. Using %x or %c works fine, but the output isn't much use.

What could cause this behaviour? Unfortunately I don't have access to a JTAG device to debug. I'm using arm-none-eabi-gcc to compile and it's all running on a maple mini.

UPDATE

Passing values < 10 seems to make it work.


Solution

  • This actually turned out to be a stack size issue with the RTOS that I was using. I guess the added complexity of the snprintf call was pushing it over the limit and crashing.

    Thanks to all who took a crack at answering this!