Hello everyone. I compiled a project in platformIO. I asked the compiler to generate a “test.map” file. I found that some of my things were discarded by the compiler, but I want to keep it. How do I do it in platformIO?
I added “attribute((used))” but it doesn’t seem to work
I found the “keil” version of my project. This is to compile this project with “keil”, I would like to ask if the “gcc” compiler also has these instructions.
I found that adding the “build_unflags = -gc-sections” option seems to have no effect.
What part of memory do you want to place rti_fn in?
Another option you can try to add the next line to your build_flags:
build_flags = -Wl,--undefined=your_symbol
Another option would be delete flags -fdata-sections, -ffunction-sections at least for src folder so that linker wouldn’t be able to discard the entire section.
Mr. maxgerhardt said “attribute (( used))” has no problem. So I think there is a problem with the compile option. The RT-Thread real-time operating system has a GCC build environment. I started to view its Python script, found the relevant compile options, and then wrote “platformio.ini”. The compilation works fine, but the system still doesn’t work.
I am sorry, I don’t want to show you a wrong solution.
The “RT-Thread” real-time operating system is similar to “UNIX.” I originally thought that I only need to put its source code file into “platformIO” to compile it. It seems that my thoughts are wrong now.
Hi, I have same problem like @tuzik, I also use RT-thread RTOS.
I have fixed the problem by update Keil MDK from v5.25-> v5.29. Hope this may help you. And I guess the problem is caused by the Arm Clang complier which is Integrated in Keil MDK.