danc314
Joined: 23 Mar 2007 Posts: 1
|
Using version4 linker in MPLAB project |
Posted: Fri Mar 23, 2007 10:43 am |
|
|
Hi All,
So I'm new to the PIC game, though not embedded programming. Truth is, I freaked when I heard there wasn't a linker, and *that* was why .c files were being #included (what????). Then I read some more, and found out that from version 4 on there is a linker (although CCS seems to shy away from actually telling anyone about it in anything more than a whisper - weird). So I rewrote the horrifically non-structured, all-global code to something approaching code that would allow me to retain my sanity during development and debugging. I then created an MPLAB project with all the .c files, added #export(relocatable) commands to each module, then tried to compile. Fine, they all produce object files. Then I tried to figure out how to get them to link. My first instinct was to create a dummy .c file that imports all the .o files. While this seems to sort-of try to work, it always gives me an over-ROM error that I don't get otherwise. And by otherwise, I mean my test to see if I could build this just using the command-line, a'la...
"c:\Program Files\PICC\ccsc" +FM +DF +LN +T -A +M +Z +ICD +Y=9 +EA +EXPORT fade.c
"c:\Program Files\PICC\ccsc" +FM +DF +LN +T -A +M +Z +ICD +Y=9 +EA +EXPORT main.c
"c:\Program Files\PICC\ccsc" +FM +DF +LN +T -A +M +Z +ICD +Y=9 +EA LINK="main.hex=main.o,fade.o"
(a few .c files ommitted for clarity)
From the command-line it builds fine. And I would just do that, except that MPLAB seems to need a project in order to be able to use the debugger. So I'm currently trying to figure out how build this in MPLAB. Basically, how do you use the linker in MPLAB?
And yes, I am new to PICs, so if I'm doing something silly or making incorrect assumptions, I pre-emptively claim no ego about any kind of PIC-programming-prowess.
Thanks!
Dan
P.S. I'm using Version 4.30 of the PCM compiler, on a 16f886. And trying to use an ICD2 if that makes any difference. |
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Fri Mar 23, 2007 12:35 pm |
|
|
Did you read the "Version 4 Comments" thread at the top of the page? If not, have a quick look at it and you'll quickly understand why CCS kind of 'whispers' about the linker.
CCS has a history of using paying customers to test their compiler, but they seriously screwed the pooch with the version 4 release. The only reason I'm still using it is that I'm too heavily invested in terms of both time & money to switch to anything else now. |
|