As a side-effect of an embedded project I've been working on, I've developed a small operating system for an ARM processor. While the OS and my user code are in separate directories and have clean boundaries between them, they're built into a single image using a single Makefile.
I'd like to release the OS as open source. It consists of an exokernel and userland driver libraries.
What I'm trying to decide is how a user of this OS should combine it with their own code at build time so they have a single image to flash. I can think of three possibilities:
1) Have the user include the OS source files as part of their project. They'd be recreating the setup I currently have, and it's how FreeRTOS, for example, appears to do it (although it only has three files).
2) Have the OS build itself into a .a file that the user code can link with. That would allow the user full control over memory placement using their own linker script (and allow the linker to tell them when a combined text, BSS or data section exceeds its space).
3) Have the OS build itself into a raw binary that expects to have the user code concatenated onto the end of it. The user code would begin with a small header (placed by the linker script) that had the address of the main function. The user code would also link with a .a file of just the userland drivers, not the kernel.
(1) would make it easiest for me to develop the OS and my user code in parallel with git subtree. (2) seems to have the most useful link process. (3) gives the biggest separation.
If you were using it, which would you prefer and why?