I'm working on an application that will be remotely installed and needs the ability to download firmware images over a cell modem. The current design works well (and uses two project files: one for the bootloader, which resides in a protected region of flash, and one for the upgradeable application code). However, code space is getting tight, and there's a fair amount of cell modem and associated network code that's in both programs, so I'd like to share as much code as possible between the two programs.
I could put the common code in a ROM library, but then I run into linker issues with compiler helper routines (_ICMP, _LCMP_RC, etc.). I could duplicate the library source code for the few routines needed, but the compiler still controls the names of the helper routines and so I'd end up with several symbols defined twice when I tried to link the ROM library into the bootloader or app.
Another idea is to create a single project that encompasses the bootloader and the application, and use pragmas to place application code, strings, and constants in the unprotected region of flash. That would make debugging easier too, since I'd have a single set of debug symbols. But then I'd have to do all variable initialization "manually" since the compiler doesn't give the user much control over the .copy and .startData sections.
Any recommendations? I'm leaning toward the single project, but I'd appreciate any input on this.