MicroBlaze Linker Options - 2021.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2021-12-15
Version
2021.2 English

The mb-ld linker for the MicroBlaze soft processor provides additional options to those supported by the GNU compiler tools. The options are summarized in this section.

-defsym _TEXT_START_ADDR=value
By default, the text section of the output code starts with the base address 0x28. This can be overridden by using the -defsym _TEXT_START_ADDR option. If this is supplied to mb-gcc compiler, the text section of the output code starts from the given value.

You do not have to use -defsym _TEXT_START_ADDR if you want to use the default start address set by the compiler.

This is a linker option and should be used when you invoke the linker separately. If the linker is being invoked as a part of the mb-gcc flow, you must use the following option:

-Wl,-defsym -Wl,_TEXT_START_ADDR=value
-relax
This is a linker option that removes all unwanted imm instructions generated by the assembler. The assembler generates an imm instruction for every instruction where the value of the immediate cannot be calculated during the assembler phase. Most of these instructions do not need an imm instruction. These are removed by the linker when the -relax command line option is provided.

This option is required only when linker is invoked on its own. When linker is invoked through the mb-gcc compiler, this option is automatically provided to the linker.

-N
This option sets the text and data section as readable and writable. It also does not page-align the data segment. This option is required only for MicroBlaze programs. The top-level GCC compiler automatically includes this option, while invoking the linker, but if you intend to invoke the linker without using GCC, use this option.

The MicroBlaze linker uses linker scripts to assign sections to memory. These are listed in the following section.