6.6.4 xc16-ld (16-Bit Linker)

A subset of command-line options may be specified in MPLAB X IDE. Select a category, and then set up linker options. For additional options, see the MPLAB® XC16 Assembler, Linker and Utilities User’s Guide (DS50002106). See also “Options Page Features.”.

Table 6-8. GENERAL CATEGORY
OptionDescriptionCommand Line
Heap sizeSpecify the size of the heap in bytes. Allocate a run-time heap of size bytes for use by C programs. The heap is allocated from unused data memory. If not enough memory is available, an error is reported.--heap size
Min stack sizeSpecify the minimum size of the stack in bytes. By default, the linker allocates all unused data memory for the run-time stack. Alternatively, the programmer may allocate the stack by declaring two global symbols: __SP_init and __SPLIM_init. Use this option to ensure that at least a minimum sized stack is available. The actual stack size is reported in the link map output file. If the minimum size is not available, an error is reported.--stack size
Use local stackCheck to prevent allocating the stack in extended data space memory.

Uncheck to allow allocating the stack in extended data space memory.

--local-stack

--no-local-stack

Allow overlapped sectionsCheck to not check section addresses for overlaps.

Uncheck to check for overlaps.

--check-sections

--no-check-sections

Init data sectionsCheck to support initialized data.

Uncheck to not support.

--data-init

--no-data-init

Pack data templateCheck to pack initial data values.

Uncheck to not pack.

--pack-data

--no-pack-data

Create handlesCheck to support far code pointers.

Uncheck to not support.

--handles

--no-handles

Create default ISRCheck to create an interrupt function for unused vectors.

Uncheck to not create a default ISR.

--isr

--no-isr

Remove unused sectionsCheck to not enable garbage collection of unused input sections (on some targets).

Uncheck to enable garbage collection.

--no-gc-sections

--gc-sections

Fill value for upper byte of dataEnter a fill value for upper byte of data. Use this value as the upper byte (bits 16-23) when encoding data into program memory. This option affects the encoding of sections created with the psv or eedata attribute, as well as the data initialization template if the --no-pack-data option is enabled.--fill-upper=value
Stack guardband sizeEnter a stack guardband size to ensure that enough stack space is available to process a stack overflow exception.--stackguard=size
Additional driver optionsType here any additional driver options not existing in this GUI otherwise. The string you introduce here will be emitted as is in the driver invocation command.
Use response file to linkCheck to create a makefile that uses a response file for the link step. In Windows, you have a maximum command line length of 8191 chars. When linking long programs, the link line might go over this limit. MPLAB XC16 provides a response file work-around. See MPLAB X IDE documentation, Troubleshooting section, for details.

Uncheck to not use a response file.

Table 6-9. Symbols and Macros Category
OptionDescriptionCommand Line
Linker symbolsCreate a global symbol in the output file containing the absolute address (expr). You may use this option as many times as necessary to define multiple symbols in the command line. A limited form of arithmetic is supported for the expr in this context: you may give a hexadecimal constant or the name of an existing symbol, or use + and - to add or subtract hexadecimal constants or symbols.--defsym=sym
Define Linker macrosAdd linker macros.-Dmacro
SymbolsSpecify symbol information in the output.
- Keep all
- Strip debugging info--strip-debug (-S)
- Strip all symbol info--strip-all (-s)
Table 6-10. Fill Flash Memory Category
OptionDescriptionCommand Line
Which areas to fillSpecify which area of Flash memory to fill.

No Fill - None (default).

Fill All Unused - Fill all unused memory.

Provide Range to fill - Fill a range of memory. Enter a range under “Memory Address Range”.

How to fill itSpecify how to fill Flash memory.

Provide sequence of values - Provide a sequence under the Sequence option.

Constant or incrementing value - Provide either:

  • Constant = a value,


    Increment/Decrement = No Incrementing

  • Constant = a value,


    Increment/Decrement = Increment Const OR


    Decrement Const,


    Increment/Decrement Constant = a value

SequenceWhen Provide sequence of values is selected, enter a sequence. The form is n1, n2, .... where n1 uses C syntax.

Example: 0x10, 25, 0x3F, 16.

--fill=sequence
ConstantWhen Constant or incrementing value is selected, enter a constant. Specify the constant using C syntax (e.g., 0x for hex, 0 for octal). 


Example: 0x10 is the same as 020 or 16.

--fill=constant
Increment/DecrementWhen Constant or incrementing value is selected, you may select to increment or decrement the initial value of “Constant” on each consecutive address.

No Incrementing - Do not change constant value.

Increment Const - Increment the constant value by the amount specified under the option “Increment/Decrement Constant.”

Decrement Const - Decrement the constant value by the amount specified under the option “Increment/Decrement Constant.”

Increment/Decrement ConstantWhen Increment Const or Decrement Const is selected, enter a constant increment or decrement value. Specify the constant using C syntax (e.g., 0x for hex, 0 for octal).

Example: 0x10 is the same as 020 or 16.

--fill=constant+=incr

--fill=constant-=decr

Memory Address RangeWhen Provide Range to fill is selected, enter the range here. Specify range as Start:End where Start and End use C syntax.

Example 0x100:0x1FF is the same as 256:511

.
--fill=value@range
Table 6-11. Libraries Category
OptionDescriptionCommand Line
LibrariesAdd libraries to be linked with the project files. You may add more than one.--library=name
Library directoryAdd a library directory to the library search path. You may add more than one.--library-path=“name
Force linking of objects that might not be compatibleCheck to force linking of objects that might not be compatible. The linker will compare the project device to information contained in the objects combined during the link. If a possible conflict is detected, an error (in the case of a possible instruction set incompatibility) or a warning (in the case of possible register incompatibility) will be reported. Specify this option to override such errors or warnings.

Uncheck to not force linking.

--force-link

--no-force-link

Don’t merge I/O library functionsCheck to not merge I/O library functions. Do not attempt to conserve memory by merging I/O library function calls. In some instances the use of this option will increase memory usage.

Uncheck to merge I/O library functions to conserve memory.

--no-smart-io

--smart-io

Exclude standard librariesCheck to not use the standard system startup files or libraries when linking. Only use library directories specified on the command line.

Uncheck to use the standard system startup files and libraries.

--nostdlib
Table 6-12. Diagnostics Category
OptionDescriptionCommand Line
Generate map fileCreate a map file.-Map=“file
Display memory usageCheck to print memory usage report.

Uncheck to not print a report.

--report-mem
Generate cross-reference fileCheck to create a cross-reference table.

Uncheck to not create this table.

--cref
Warn on section realignmentCheck to warn if start of section changes due to alignment.

Uncheck to not warn.

--warn-section-align
Trace SymbolsAdd/remove trace symbols.--trace-symbol=symbol
Table 6-13. Code Guard Category
OptionDescriptionCommand Line
Boot RAMSpecify the boot RAM segment: none, small, medium or large.--boot=option_ram
Boot FlashSpecify the boot Flash segment: none, small, medium, or large standard or none, small, medium, or large high.--boot=option_flash_std

--boot=option_flash_high

Boot EEPROMSpecify the boot EEPROM segment.--boot=eeprom
Boot write-protectSpecify the boot write protected segment.--boot=write_protect
Secure RAMSpecify the secure RAM segment: none, small, medium or large.--secure=option_ram
Secure FlashSpecify the secure Flash segment: none, small, medium, or large standard or none, small, medium, or large high.--secure=option_flash_std

--secure=option_flash_high

Secure EEPROMSpecify the secure EEPROM segment.--secure=eeprom
Secure write-protectSpecify the secure write protected segment.--secure=write_protect
General write-protectSpecify the general write protected segment.--general=write_protect
General code-protectSpecify the secure code protected segment: standard or high.--general=code_protect_std

--general=code_protect_high

For more information on CodeGuard™ options, see “Options that Specify CodeGuard Security Features” in the MPLAB® XC16 Assembler, Linker and Utilities User’s Guide (DS50002106).

Note: Not all development tools support CodeGuard programming. See tool documentation for more information.