Jump to content
 
  • 0

PIC32 Linker scripts in MPLAB-X


Orunmila

Question

  • Member

I am trying to use a linker script with MPLAB-X for my PIC32 project but for some reason the script is not being passed to the linker at all. I expected that all I had to do was add the .ld file to my project, typically by placing it in the "Linker Files" virtual folder in MPLAB-X in my project. I did this and the linker script is being ignored by the linker.

This is one of those $100 questions (if you know the story of the mechanic asking $100 for knowing where to hit ...).

So my question is how do I get MPLAB-X to use my linker script which I have added to the PIC32 project?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • Member

Ok great news I figured out what was going wrong!

I was working with an old project file. The project was not using a linker script before.

It turns out that MPLAB is doing all kinds of strange things in the background to figure out that it has to treat files in the Logical Folder called by "name=LinkerScript" and "displayname=Linker Files" as linker scripts instead of C files, and once it has gotten itself confused about this there is no going back without recreating the entire project file. Now since ours contained hundreds of source files we tried to avoid this but alas, turns out there is not really another way :(

There is an example here https://www.microchip.com/forums/m651658.aspx on how to add the item back in. This seems to only work if you add it in AND rename the item BEFORE opening the project in MPLAB-X, if you open the project first you will be out of luck.

For now you will have to do a lot of trial and error, or just re-create the project if you need to add a linker script, and even then good luck, the IDE can muck it up quite easily!

I think I see a blog post coming on how to get a linker script into your MPLAB-X project. It seems to be harder than it should be!

Edit: I have written up my experience in a blog entry here:

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

 


×
×
  • Create New...