Hi i am new with Keil and it my question. I use u8g2 library with nRF52832. This library has a file with fonts in which there are many arrays of very large sizes but only one is used depending on the selected font. When I try to compile my project Keil is an error that the controller does not have enough space for the project is larger than 40MB which is logical since nRF52832 has only 65KB RAM and 512KB ROM. What can I do to Keil use only the currently used arrays and buffers and not all that are in the library's file?
when a library contains something that is called the whole library is loaded. unless you have the source for the library you can do nothing
I'm using the opensource library. What should I change in it to work?
Use "One ELF section per function", and make sure objects within the library are as small and separable as possible so the dead code removal can eliminate things which aren't used/touched.
Perhaps start by understanding why elements which you aren't using are being retained. Look at MAP files, dissect objects with FromELF to understand the content and interrelationships.
Engage the library developers where you pay for advise, support or consulting.
when a library contains something that is called the whole library is loaded.
That's wrong, and I'm reasonably sure you know it. You may have mixed up "library" with "object file." And even for those this is no longer universally true, and hasn't been for quite a while. Linkers have become a good deal better at picking apart object files to use only pieces of them, and compilers have been extended to help linkers with that.