Dave,
Thank you for your contribution! Your page was very helpful to me. I am one of those unsuspecting embedded developers that got bit by sprintf
using %f
.
I’ve got heap_useNewlib_NXP.c running on Cypress PSoC 6 (M4). I’ve attached my linker script in case anyone finds it useful. I decided to give the heap all available memory:
__HeapLimit = __StackLimit - 1;
HEAP_SIZE = __HeapLimit - __HeapBase;
Then, I didn’t know how big it was, so I added this to heap_useNewlib_NXP.c:
size_t xPortGetHeapSize( void ) PRIVILEGED_FUNCTION {
return (size_t)&HEAP_SIZE;
}
so I can use this command:
> heap-stats
Total heap size: 57183
Free bytes in the heap now: 29919
Looks like I’ve got lots of room now. When I first switched, it seemed that newlib’s heap used more space than heap4, and I was already tight on space, so I had problems. Eventually I switched to newlib-nano supplemented with Marco Paland’s printf.
Thanks again, Carl
cy8c6xx7_cm4_dual.CK3.zip (3.9 KB)
EDIT: I should have mentioned that I am running with newlib version 3.3. I get the warning, but it seems to work fine.