My project uses ARM Cortex M0+, with C++ and ArmClang 6.10.1. My ultimate goal is to set "Heap_Size EQU 0x0" in the startup.s file. My code builds fine, but when I run it in Keil simulator it crashes. Stepping through assembly instructions, it appears that the "_init_alloc" function exits with SIGRTMEM signal after comparing the 0x0 heap size to a "#0x10" immediate. To confirm, I set "Heap_Size EQU 0x10" and my program builds/runs as expected.
I've ensured that malloc+new are not used in my code (UNUSED according to the generated static call graph); I left free+delete alone since they are used in more places, but I don't think this matters since I'm not using malloc+new. After digging through the ARM info center, I used "IMPORT __ARM_use_no_argv" and an overridden "__aeabi_atexit" function to achieve this.
As a possibly related side-note, I can't use "IMPORT __use_no_heap_region" because the linker still finds references to malloc+free, resulting in "Error: L6915E: Library reports error: __use_no_heap was requested, but malloc was referenced". I'm not sure why entirely, but maybe because the linker can't remove them explicitly from the library (they still appear in the map file).
Conclusion: Is there some typical minimum heap size, and/or how is the aforementioned "#0x10" immediate determined? Is it specific to C++ or ArmClang? In another project that uses ArmCC with RTX and C only, the "Heap_Size EQU 0x0" works as expected. Thanks for any help!