procdefs.ld is the file you typically modify.

Method 1 – Copy In Both Linker Scripts & Modify

Copy the file “elf32pic32mx.x” from to your project directory from “C:\Program Files\Microchip\MPLAB C32\pic32mx\lib\ldscripts\”

Rename it “elf32pic32mx.ld”

Add it to your project (must be added prior to the next linker script so it is treated as the main script)

Open it and change the line “INCLUDE procdefs.ld” to “INCLUDE my_procdefs.ld”

Copy the procdefs.ld linker script for the device your using to your project directory from “C:\Program Files\microchip\mplabc32\pic32mx\lib\proc\”

Rename it to my_procdefs.ld

Add it to the project.

Method 2 – Only copy 1 linker script but don’t include in project

Copy the procdefs.ld linker script for the device your using to your project directory from “C:\Program Files\microchip\mplabc32\pic32mx\lib\proc\”

Do not rename it and do not add it to the project (requried)

Edit the procdefs.ld file in your project folder so it has your required changes.

You have to take the advice above literally. Put a procdefs.ld, edited to meet your needs in your project folder, but unlike C18/C30, you do not include this file in MPLAB. C32 has two linker files. There is an overly generic file that describes a few common features for all PIC32’s (elf32pic32mx.*), then procdefs.ld, which is specific to your device and in this case specific to your project. The main linker file is assumed by the IDE just like the case where you are using the generic linker files. By virtue include search path priorities, your modified procdefs.ld will be found by the primary linker file since it will search your project directory first.

If you include this file in your project you get errors since procdefs.ld expects definitions in the other linker file to be present before it’s parsed

View > Memory Important Note

If you change a linker script and then rebuild the memory view is only updated by being overwritten. If you change a linker address so that an area of memory is no longer used then the old value will remain there after a build. Right click and use “Fill Memory” first to get round this.

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *