Content originally posted in LPCWare by robertpalmerjr on Mon May 19 14:58:08 MST 2014
I'm using the NGX_xplorer_1830 board and running the freertos_blinky example.
I have a serial connection to USART0. If I use printf in the main (outside of a task), it will work. If I use printf() inside a task, the malloc fails (I single stepped into the printf assembly) and the information never prints. If I use the CR_PRINTF_CHAR symbol, it works fine (which makes sense since this flag causes printf to NOT use malloc).
I'm using the example, unchanged from the download. So the question is, WHY is malloc failing? The heap is configured as 16kB which should be PLENTY. The stack is configured as 128. I tried a stack of 256 and I tried a heap of 8k, 10k, and 32k - in all cases, malloc still fails.
I'm using lpcopen_2_09_lpcxpresso_ngx_xplorer_1830.zip
At least I have a work around for printf, but if malloc is failing, I need to know why - I'm going to need to call it directly from my code.