linker scripts

Please note that this toolsuite is not part of the official Firewing release but we will try and help where we can...

linker scripts

Postby Jerry Messina » Fri Apr 04, 2014 5:35 pm

Is there a way of specifying a different linker script other than the default one, either in the FW IDE or MPLAB?

I'm looking at trying to put a program into the Aux Flash of a 24EP (like what the microchip CE417 bootloader example does), and the code/int vector/rst vector layout is a lot different.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: linker scripts

Postby David John Barker » Fri Apr 04, 2014 5:58 pm

You cannot specify a different linker script.
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: linker scripts

Postby Jerry Messina » Fri Apr 04, 2014 6:12 pm

Ok then, could I use FW to generate a C file and then compile/link it using XC16 and a different script in MPLAB?
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: linker scripts

Postby David John Barker » Fri Apr 04, 2014 6:38 pm

Yes, you could do that. Or you could point the toolsuite to an alternative XC16 install (using the toolsuite *.ini method) and modify the default linker script. That way you can build and link in Firewing. Perhaps I should look at adding a linker script #option?
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: linker scripts

Postby Jerry Messina » Fri Apr 04, 2014 6:46 pm

>> Or you could point the toolsuite to an alternative XC16 install

That's a better idea... at least it's all done in one step. Thanks for the suggestion.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: linker scripts

Postby David John Barker » Sat Apr 05, 2014 12:15 pm

OK, I've taken a look and this and have created some gcc options which can be passed to XC16. First, you need to download the latest Firewing BETA:

http://www.firewing.info/downloads/firewing.1003.B22.exe

Next, download and install the latest XC16 toolsuite:

http://www.firewing.info/pmwiki.php?n=FirewingUser.XC32Toolsuite

The two new options are "_gccOptimise" and "_gccLink". For example,
Code: Select all
#option _gccLink = "C:\Program Files\Microchip\xc16\v1.11\support\PIC24H\gld\p24HJ128GP502.gld"
#option _gccOptimise = 0

will use the default linker file with an optimisation level of 0 (off). If your version of XC16 (or C30) allows it, the different optimisation levels are 0,1,2,3 or "s". Please note this is all experimental and I would appreciate if you could let me know if it works for you.
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: linker scripts

Postby Jerry Messina » Sat Apr 05, 2014 1:19 pm

Nice! I'll give it a try.

Dumb question... do the '#option' statements go in the toolsuite .ini file? They look like source file preprocessor options.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: linker scripts

Postby David John Barker » Sat Apr 05, 2014 1:21 pm

They are source code options, not *.ini file. They go at the top of your main program (or module if you prefer). Just use them like any other #option.
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Re: linker scripts

Postby Jerry Messina » Sat Apr 05, 2014 2:17 pm

I tried a few linker scripts and the #option seems to be picking up the right files from what i can tell. That'll definitely be easier than the other methods!

I also tried the #option _gccOptimise setting. It definitely gets used, and things change, so it seems ok at first glance. The thing is I'm not sure the resulting code will actually work. I tried XC16v1.11 with the 'progUART' sample, and there seems to be some missing code with _gccOptimise =1 or s (not sure about the other settings).

I'll have to take a closer look though. Maybe the optimizers smarter than me... it wouldn't be the first time that's for sure. Or, maybe it's the same sort of thing that happened back when I tried switching to later versions of XC1.20/1.21. They didn't work out too well either for whatever reason.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: linker scripts

Postby David John Barker » Sat Apr 05, 2014 3:02 pm

> I tried a few linker scripts and the #option seems to be picking up the right files from
> what i can tell. That'll definitely be easier than the other methods!

Yes, I think it is a really useful addition...

> I also tried the #option _gccOptimise...it seems ok at first glance...I'm not sure the resulting code will actually work

At least it's being picked up by the compiler - however, what XC16 decides to do with it is another matter. Unless you have a licensed version of XC16, there is little point in using any optimisation other than "0". Please let me know what you find...
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm

Next

Return to Microchip 16

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x