c - GCC - How to stop malloc being linked? -




i struggling code down minimal bare bones size! using stm32f0 32k flash , need part of flash data storage. code @ approx 20k flash size! of due use of stm32 hal functions can account , optimise later if needed.

however, biggest consumer of flash implicitly included library routines. can not seem remove these functions. not called anywhere in code or hal code. functions such _malloc_r (1.3k bytes), , __vfiprintf_r (3kb) , many others using large part of flash. think these libc functions. not use these , them gone!

does know how remove these?

i have tried different optimisation levels , linker options no luck far. have tried -nostdlib , --specs=nosys.specs no change. if remove file definitions functions such _exit linker error suggesting library still included , needs these. linker map confirms presence of lot of unwanted functions!

any suggestions?

solved... of code included , called assert. moment removed assert calls code size more halved! instead used stm32 hals assert_param macro light weight assert redirects user defined function.

it helpful if explain me how gcc decides include library functions when assert called? see assert.h declares external function __assert_func. how linker know reference library rather "undefined reference __asert_func"?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -