In os/various/syscalls.c, in function _sbrk_r: if called with 'incr' of zero fails due to this line:
chDbgCheck(incr > 0);
According to some definitions I've found, if called with incr == 0 it should return the current end of the heap, and not fail. And i'm seeing it get called that way when linking with g++.
To get my system working I hacked this into the function, but it's not a general solution (the return value isn't even accurate, it's just something to stop the runtime errors):
extern caddr_t __heap_base__; if ( incr == 0 ) { return __heap_base__; }
Is there a proper way to do this?
Some linker settings that may be pertinent (not the complete command line):
arm-none-eabi-g++ -nostartfiles -nodefaultlibs -nostdlib --specs=nano.specs --specs=nosys.specs -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
Hi,
Just the chDbgCheck() needs a change, chCoreAlloc() behaves as expected. I committed the change to the check.
Giovanni