AnsweredHot!How to ignore a custom linker file (procdefs.ld) via configuration?

Author
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
2017/07/14 13:11:24 (permalink)
0

How to ignore a custom linker file (procdefs.ld) via configuration?

I'm currently working with code that utilizes a custom linker for using the code with a bootloader.  However when I want to debug via tool, or run without the bootloader, I need to manually rename or remove procdefs.ld in order to run the code sans-bootloader.
 
Is there a way through configuration to tell XC32 (or any of the other toolchains for that matter) to ignore the procdefs.ld file?  That way I can have a config for debugging and development and another for use with the bootloader?
 
Thanks in advance
#1
RISC
Super Member
  • Total Posts : 4039
  • Reward points : 0
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/14 14:08:09 (permalink)
+2 (2)
Hi,
You can exclude files from each configuration (at least for c and h files).
Maybe this works also for linker files...
Create a new configuration, right click on the file and try to select "exclude from configuration"
Regards
 
#2
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/17 06:50:31 (permalink)
0
RISC
Hi,
You can exclude files from each configuration (at least for c and h files).
Maybe this works also for linker files...
Create a new configuration, right click on the file and try to select "exclude from configuration"
Regards
 




This isn't what I'm really looking for as procdefs.ld is not included in the project, it is placed in the directory of the source (.c and .h) files and MPLAB X will automatically use it.
Currently my only way to do a regular build without special linking is to either rename or remove the procdefs.ld file.
#3
RISC
Super Member
  • Total Posts : 4039
  • Reward points : 0
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/17 15:38:46 (permalink)
+1 (1)
Hi,
Which version of XC32 do you use ?
As far as I know the current version v1.44 (and previous ones) do not use anymore procdefs.ld
Regards
 
#4
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 07:41:07 (permalink)
0
RISC
Hi,
Which version of XC32 do you use ?
As far as I know the current version v1.44 (and previous ones) do not use anymore procdefs.ld
Regards
 




Currently using XC32 v1.40.
 
I suppose it COULD work just to set a configuration to use XC32 v1.44 and it would simply no longer use the file if you're correct in that v1.44 no longer uses procdefs.ld, but surely there must be an option, command line or otherwise, to accomplish what I'm looking to do.
#5
aschen0866
Super Member
  • Total Posts : 4074
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 11:11:22 (permalink)
0
KTrenholm
 
This isn't what I'm really looking for as procdefs.ld is not included in the project, it is placed in the directory of the source (.c and .h) files and MPLAB X will automatically use it.
 

If the custom linker script is not added to the "Linker Files" logic folder, MPLABX shouldn't use it even though the file is in the same directory as your source code. Creating two configurations as RISC suggested should work.
 
Alternatively, if you know what real changes are needed for a custom linker script, you can take advantage of linker preprocessing as discussed in this thread:
 
http://www.microchip.com/forums/m865555.aspx
 
 
#6
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 11:21:49 (permalink)
0
aschen0866
KTrenholm
 
This isn't what I'm really looking for as procdefs.ld is not included in the project, it is placed in the directory of the source (.c and .h) files and MPLAB X will automatically use it.
 

If the custom linker script is not added to the "Linker Files" logic folder, MPLABX shouldn't use it even though the file is in the same directory as your source code. Creating two configurations as RISC suggested should work.
 
Alternatively, if you know what real changes are needed for a custom linker script, you can take advantage of linker preprocessing as discussed in this thread:
 
http://www.microchip.com/forums/m865555.aspx
 
 




Currently it is definitely using the procdefs.ld without being added to project.  Is this something that changed in a recent MPLAB X version?  I am currently on 3.50
#7
rodims
Super Member
  • Total Posts : 715
  • Reward points : 0
  • Joined: 2009/02/10 11:08:59
  • Location: 51.9627, 7.6262
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 11:53:10 (permalink) ☄ Helpfulby KTrenholm 2017/07/18 13:27:47
+1 (1)
By experiment with Process Monitor:  (XC32 1.44 and MpLabX 3.65)
 
the PROCDEFS.GLD is searched in the following order:
1) the project directory
2) The Compiler directory, e.g.
   C:\Program Files (x86)\Microchip\xc32\v1.44\pic32mx\lib\proc\32MX220F032D\procdefs.ld
    (32MX220F032D is the selected device )
 
i.e. if a procdefs.ld is found in the project directory, then it is used (read)
if it's not found, the procdefs.ld in the compilers directory is used (read)
#8
aschen0866
Super Member
  • Total Posts : 4074
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 13:51:32 (permalink) ☄ Helpfulby KTrenholm 2017/07/19 06:33:41
+1 (1)
I'd recommend you use the single-file version of linker script. I can't remember what was the intention at the time they had to separate a complete linker script into two files, i.e., procdefs.ld and elf32pic32.x. They don't do this any more for PIC32MZ and any other new devices.
#9
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 13:59:14 (permalink)
0
aschen0866
I'd recommend you use the single-file version of linker script. I can't remember what was the intention at the time they had to separate a complete linker script into two files, i.e., procdefs.ld and elf32pic32.x. They don't do this any more for PIC32MZ and any other new devices.




Could this be why I have problems building if I attempt to include procdefs.ld in the project? 
I.E. it's expecting the linker script in single file format if it's included in the project?
 
If that's the case, yeah single script sounds like the way to go so I could include/exclude it per configuration.
Is it as simple as a copy/paste job?  I'm not very familiar with the ins and outs of linker scripts so this is new territory.
 
#10
aschen0866
Super Member
  • Total Posts : 4074
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/18 14:52:14 (permalink) ☼ Best Answerby KTrenholm 2017/07/19 06:33:51
+2 (2)
KTrenholm
 
Is it as simple as a copy/paste job?  


Yes. Copy \pic32mx\lib\ldscripts\elf32pic32mx.x and paste it to the end of procdefs.ld. Then remove the line that says "INCLUDE procdefs.ld". You can give the file any name you want with the .ld extension. 
#11
KTrenholm
Junior Member
  • Total Posts : 113
  • Reward points : 0
  • Joined: 2012/08/08 14:04:23
  • Location: Connecticut, USA
  • Status: offline
Re: How to ignore a custom linker file (procdefs.ld) via configuration? 2017/07/19 06:35:50 (permalink)
0
aschen0866
KTrenholm
 
Is it as simple as a copy/paste job?  


Yes. Copy \pic32mx\lib\ldscripts\elf32pic32mx.x and paste it to the end of procdefs.ld. Then remove the line that says "INCLUDE procdefs.ld". You can give the file any name you want with the .ld extension. 



This is the info I needed for it to come together.  Now I can ignore it on a per-config basis.
 
Thanks!
#12
Jump to:
© 2017 APG vNext Commercial Version 4.5