While PE has been quite helpful in getting my code up and running, at this stage I would like to write it out. This is apparently a somewhat intricate operation as there are no doubt many dependencies created by PE.
BTW I am using CW 10.4 with a Kinetis MCU, GCC compiler (C project).
I started by taking all the code from the Generated Code folder and moving it to my source folder, in the hope that PE would not blow any of it away. This more or less works, but you've also got to rename the various files (Events.c etc) that are in the source folder.
I then removed as many of the PE components as I dared. I left the MCU, but it kept generating the header files, cpu.c, and so on. So I removed that, and then found I had a compiler error -- no target specified. So I put it back in.
Then discovered I could disable PE code generation and in the project properties. Should have worked that out earlier obviously.
I began a slash and burn operation on the PE code, getting rid of a lot of the device structures, just leaving the register accesses. This by and large worked, the code still compiled and ran. It seemed that in many of the components, the use of the device structure is unnecessary, it holds no useful information. Then consolidating code into fewer files. All this was working fine.
Then I made the fool mistake of trying to organize some code into subfolders. That is, MY code, not PE code. Just one .c file and one .h file were moved first to a new source folder (compiler couldn't find them) then to a subfolder. I tried changing the paths so that the header files could be found, etc. It didn't work. Now I had two new compile errors:
cannot find -lrt
cannot find -luart
So I put things back to the way they were before (got rid of the subdirectory, put the files back where they were), but these two errors persist.
Knowing how CW works (ie "in mysterious ways") I am guessing this has nothing to do with moving the files to the subfolder, and everything to do with PE.