3.3.5 Linker Options
Keywords: sdccman

##
3.3.5 Linker Options

- [--lib-path <absolute] path to additional libraries> This option is passed to the linkage editor's additional libraries search path. The path name must be absolute. Additional library files may be specified in the command line. See section Compiling programs for more details.
- [-L <absolute] path to additional libraries> Same as above.
- [—xram-loc <Value>] The start location of the external ram, default value is 0. The value entered can be in Hexadecimal or Decimal format, e.g.: —xram-loc 0x8000 or —xram-loc 32768.
- [—code-loc <Value>] The start location of the code segment, default value 0. Note when this option is used the interrupt vector table is also relocated to the given address. The value entered can be in Hexadecimal or Decimal format, e.g.: —code-loc 0x8000 or —code-loc 32768.
- [—stack-loc <Value>] The value entered can be in Hexadecimal or Decimal format, e.g. —stack-loc 0x20 or —stack-loc 32.

  For stm8, by default the stack is placed at the device-specific reset value. By using this option, the stack can be placed anywhere in the lower 16-bits of the stm8 memory space. This is particularly useful for working around the stack roll-over antifeature present in some stm8 devices.

- [—xstack-loc <Value>] By default the external stack is placed after the __pdata segment. Using this option the xstack can be placed anywhere in the external memory space of the 8051. The value entered can be in Hexadecimal or Decimal format, e.g. —xstack-loc 0x8000 or —xstack-loc 32768. The provided value should not overlap any other memory areas such as the pdata or xdata segment and with enough space for the current application.
- [—data-loc <Value>] The start location of the internal ram data segment. The value entered can be in Hexadecimal or Decimal format, eg. —data-loc 0x20 or —data-loc 32. (By default, the start location of the internal ram data segment is set as low as possible in memory, taking into account the used register banks and the bit segment at address 0x20. For example if register banks 0 and 1 are used without bit variables, the data segment will be set, if —data-loc is not used, to location 0x10.)
- [—idata-loc <Value>] The start location of the indirectly addressable internal ram of the 8051, default value is 0x80. The value entered can be in Hexadecimal or Decimal format, eg. —idata-loc 0x88 or —idata-loc 136.
- [—bit-loc <Value>] The start location of the bit addressable internal ram of the 8051. This is not implemented yet. Instead an option can be passed directly to the linker: -Wl -bBSEG=<Value>.
- [—out-fmt-ihx] The linker output (final object code) is in Intel Hex format. This is the default option. The format itself is documented in the documentation of srecord.
- [—out-fmt-s19] The linker output (final object code) is in Motorola S19 format. The format itself is documented in the documentation of srecord.
- [—out-fmt-elf] The linker output (final object code) is in ELF format. (Currently only supported for the HC08, S08 and STM8 processors). When used with –debug, the debug info is in DWARF format instead of CDB.
- [-Wl linkOption[,linkOption]...] Pass the linkOption to the linker. If a bootloader is used an option like ”-Wl -bCSEG=0x1000” would be typical to set the start of the code segment. Either use the double quotes around this option or use no space (e.g. -Wl-bCSEG=0x1000). See also #pragma constseg and #pragma codeseg in section3.16. File sdcc/sdas/doc/asmlnk.txt has more on linker options.