Hello,
I have a pure-C library that I'd like to build, and then import into another project that targets the nRF52832 (nRF5 SDK v16.0.0). The library has no dependencies on nRF5 SDK, meaning the code does not #include any files from the nRF5 SDK. This library ends up being linked with a nRF5 SDK v16.0.0 project that is currently being built with SEGGER Embedded Studio.
Previously, I created a library project in SES and copied the source code files for the library into the project and built the project with SES. That has been working, but now I'm wanting to build the library source code using CMake so I can target multiple platforms with ease, and not have to depend on SES. I captured the build output from SES and was able to get a CMake project configured to build the library successfully, and my nRF5 SDK project successfully builds as well.
One thing I noticed is the SES library project uses gcc flag to use SEGGER standard C include files instead of gcc standard C, as well as some SES specific preprocessor definitions that end up affecting what gets included during the build:
-nostdinc "-isystemC:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 5.68/include" -D__SIZEOF_WCHAR_T=4 -D__ARM_ARCH_7EM__ -D__SES_ARM -D__ARM_ARCH_FPV4_SP_D16__ -D__SES_VERSION=54200 -D__GNU_LINKER
My question is, can I remove the SES-specific GCC flags from my CMake configuration and use purely GCC when compiling my library, or will this have ill effects? A specific example I can think of is, will it affect printf, in that if my library calls printf within the source code, and I debug my nRF5 SDK project via SES IDE, will the printf statements from my library source code print to the SES output window/debug terminal?
On a different note, for what it's worth, the output file size of the library when building with different configurations:
SEGGER Embedded Studio: 499KB CMake with ARM Embedded Toolchain GCC, using same SES compiler flags (and SES stdc includes): 1245KB CMake with ARM Embedded Toolchain GCC, removing SES-specific compiler flags: 2693KB
When I take the built library and then import it into my nRF5 SDK project, the output files for the target device is 345KB, 346KB, 346KB respectively (referencing library file build output size). The file sizes are pretty drastic, so I'm not sure how confident I can be that everything is going to work properly if I remove SES specific build configuration flags when building my library. Any advice?