13.2 Contents

The map files produced by the linker consist of the following items.

Table 13-1. Linker Map File Contents
ItemDescription
Tool Name and CommandPath and executable name of the linker, as well as command line options used.
Archive MembersThe name of any members from archive files that are included in the link.
Memory Usage ReportThe starting address and length of all output sections in program memory, data memory and dynamic memory.
External Symbol TablesAll external symbols in data and program memory.
Memory ConfigurationAll of the memory regions defined for the link.
Linker Script and Memory MapModules, sections and symbols that are included in the link as specified in the linker script.

Map File

The following is an example of a linker map file for the MPLAB Discover project “Sensorless FOC using PLL Estimator for PMSM.” Note that sections have been shortened to save space. The character “:” represents lines removed.

Tool Name and Command

Tool Name:
  /opt/microchip/xc-dsc/v3.20/bin/bin/../bin/elf-ld

Command:
  -p33AK128MC106 \
  --mdfp=/home/user/.mchp_packs/Microchip/dsPIC33AK-MC_DFP/1.0.33/xc16 \
  -o \
  dist/default/debug/pmsm.X.debug.elf \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/.. \
  -L/home/c65161/.mchp_packs/Microchip/dsPIC33AK-MC_DFP/1.0.33/xc16/bin/../support/dsPIC33A/gld \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../support/dsPIC30F/gld \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../support/dsPIC33C/gld \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../support/dsPIC33E/gld \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../support/dsPIC33A/gld \
  -L/opt/microchip/xc-dsc/v3.20/bin/bin/../../support/dsPIC33F/gld \
  build/default/debug/_ext/1360924651/clarke_park.o \
  build/default/debug/_ext/1360924651/estim.o \
  build/default/debug/_ext/1360924651/fdweak.o \
  build/default/debug/_ext/1360924651/general.o \
  build/default/debug/_ext/1360924651/pi.o \
  build/default/debug/_ext/1360924651/svm.o \
  build/default/debug/_ext/1360926148/adc.o \
  build/default/debug/_ext/1360926148/board_service.o \
  build/default/debug/_ext/1360926148/clock.o \
  build/default/debug/_ext/1360926148/device_config.o \
  build/default/debug/_ext/1360926148/measure.o \
  build/default/debug/_ext/1360926148/port_config.o \
  build/default/debug/_ext/1360926148/pwm.o \
  build/default/debug/_ext/1360926148/timer1.o \
  build/default/debug/_ext/1360926148/uart1.o \
  build/default/debug/_ext/1960789359/singleshunt.o \
  build/default/debug/_ext/1798147462/diagnostics.o \
  build/default/debug/_ext/1472/pmsm.o \
  ../x2cscope/X2CScopeLib.X.a \
  --defsym=__MPLAB_BUILD=1 \
  --defsym=__MPLAB_DEBUG=1 \
  --defsym=__DEBUG=1 \
  -Tp33AK128MC106.gld.00 \
  --stack=16 \
  --check-sections \
  --data-init \
  --pack-data \
  --handles \
  --isr \
  --no-gc-sections \
  --stackguard=16 \
  --library-path=../x2cscope \
  --no-force-link \
  --smart-io \
  -Map=dist/default/debug/pmsm.X.debug.map \
  --report-mem \
  --memorysummary \
  dist/default/debug/memoryfile.xml \
  -start-group \
  --library=c99-pic30-elf \
  --library=m-elf \
  --library=c99-elf \
  -end-group \

Archive Members

Archive member included to satisfy reference by file (symbol)

../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o)
                              build/default/debug/_ext/1798147462/diagnostics.o (_X2CScope_Initialise)
../x2cscope/X2CScopeLib.X.a(BlockServicesX2C.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_addBlockServices)
../x2cscope/X2CScopeLib.X.a(LNet.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_initLNet)
../x2cscope/X2CScopeLib.X.a(SerialGeneric.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_initSerialGeneric)
../x2cscope/X2CScopeLib.X.a(Services.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_initServiceTable)
../x2cscope/X2CScopeLib.X.a(TableStruct.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_initTableStruct)
../x2cscope/X2CScopeLib.X.a(VersionInfo.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_initVersionInfo)
../x2cscope/X2CScopeLib.X.a(X2C.o)
                              ../x2cscope/X2CScopeLib.X.a(X2CScopeWrapper.o) (_blockFunctionTable)
../x2cscope/X2CScopeLib.X.a(Scope_Main.o)
                              ../x2cscope/X2CScopeLib.X.a(X2C.o) (_Scope_Main_Init)
../x2cscope/X2CScopeLib.X.a(CommonFcts.o)
                              ../x2cscope/X2CScopeLib.X.a(Scope_Main.o) (_getAbsValI32)

Optional library libp33AK128MC106.a not found
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(crt_start_mode_normal.AAMeo)
                              (__crt_start_mode_normal)
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(delay32.AAMeo)
                              build/default/debug/_ext/1360926148/board_service.o (___delay32)
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(crt0_extendedaa.o)
                              (__resetPRI)
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(data_init_extendedaa.o)
                              /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(crt0_extendedaa.o) (__data_init_extended)
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libm-elf.a(sqrtf.AA_o)
                              build/default/debug/_ext/1360924651/fdweak.o (_sqrtf)
/opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-elf.a(__errno_location.AA_o)
                              /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libm-elf.a(sqrtf.AA_o) (___errno_val)

Memory Usage Report

xc-dsc-ld 3.20 (B)

Default Code Model: Small
Default Data Model: Small
Default Scalar Model: Small

"program" Memory  [Origin = 0x801000, Length = 0x1f000]

section                    address   length (PC units)   length (bytes) (dec)
-------                    -------   -----------------   --------------------
.text                     0x801000               0x520           0x520  (1312)
.text                     0x801520              0x7298          0x7298  (29336)
.dinit                    0x8087b8               0x134           0x134  (308)
.text                     0x8088ec               0x5dc           0x5dc  (1500)

                   Total "program" memory used (bytes):         0x7ec8  (32456) 25%


"data" Memory  [Origin = 0x4000, Length = 0x4000]

section                    address      alignment gaps    total length  (dec)
-------                    -------      --------------    -------------------
.nbss                       0x4000                   0            0x98  (152)
.ndata                      0x4098                   0             0x4  (4)
x2cscope_data_buf           0x409c                   0          0x1324  (4900)
.bss                        0x53c0                   0          0x1400  (5120)
.data                       0x67c0                   0            0x54  (84)
.bss                        0x6814                   0            0x10  (16)

                      Total "data" memory used (bytes):         0x2824  (10276) 62%


Dynamic Memory Usage

region                     address                      maximum length  (dec)
------                     -------                      ---------------------
heap                             0                                   0  (0)
stack                       0x6824                              0x17dc  (6108)

                        Maximum dynamic memory (bytes):         0x17dc  (6108)


Interrupt Handlers:
  0x80110c __AD1CH1Interrupt
  0x801314 __PWM1Interrupt
  0x801378 __T1Interrupt


Interrupt Vector Tables (IVTs):
  __ivt_0   :  0x800000 


Info: Project is using a large data memory model when small data memory model is sufficient.

External Symbol Tables

External Symbols in Data Memory (by address):

                    0x4000                  _heartBeatCount
                    0x4004                  _thetaElectricalOpenLoop
                    0x4008                  _pwmPeriod
                     :
                    0x6800                  _compilationDate
                    0x6814                  _fdWeakParm
                    0x6820                  ___errno_val

External Symbols in Data Memory (by name):

                    0x6630                  _CtrlParm
                    0x6774                  _EstimParm
                    0x6768                  _MotorEstimParm
                     :
                    0x65b4                  _vabc
                    0x4024                  _valphabeta
                    0x4014                  _vdq

External Symbols in Program Memory (by address):

                  0x800004                  __ivt_0
                  0x801000                  __resetPRI
                  0x8010ac                  __data_init
                     :
                  0x808e74                  _initVersionInfo
                  0x808ea0                  _X2C_Init
                  0x808eb4                  _X2C_Update

External Symbols in Program Memory (by name):

                  0x807520                  _BoardService
                  0x807560                  _BoardServiceInit
                  0x807508                  _BoardServiceStepIsr
                     :
                  0x8081b0                  _sendSerialWrapper
                  0x803a28                  _sendSvNotAvailable
                  0x8013e0                  _sqrtf

Memory Configuration

Memory Configuration

Name             Origin             Length             Attributes
data             0x004000           0x004000           a !xr
FCP              0x7f3000           0x000002  
FICD             0x7f3010           0x000002  
FDEVOPT          0x7f3020           0x000002  
FWDT             0x7f3030           0x000002  
 :
reset            0x800000           0x000004  
ivt              0x800004           0x000ffc  
program          0x801000           0x01f000           xr
*default*        0x000000           0xffffffffffffffff  

Linker Script and Memory Map

Linker script and memory map

LOAD build/default/debug/_ext/1360924651/clarke_park.o
LOAD build/default/debug/_ext/1360924651/estim.o
LOAD build/default/debug/_ext/1360924651/fdweak.o
LOAD build/default/debug/_ext/1360924651/general.o
 :
LOAD ../x2cscope/X2CScopeLib.X.a
                    0x0001                  __MPLAB_BUILD = 0x1
                    0x0001                  __MPLAB_DEBUG = 0x1
                    0x0001                  __DEBUG = 0x1
LOAD p33AK128MC106
LOAD /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libfx-elf.a
                    0x7f3000                  __FCP = 0x7f3000
                    0x7f3010                  __FICD = 0x7f3010
                    0x7f3020                  __FDEVOPT = 0x7f3020
                    0x7f3030                  __FWDT = 0x7f3030
 :
                    0x801000                  __CODE_BASE = 0x801000
                    0x1f000                  __CODE_LENGTH = 0x1f000
                    0x800004                  __IVT_BASE = 0x800004
                    0x4000                  __DATA_BASE = 0x4000
                    0x4000                  __DATA_LENGTH = 0x4000
                    0x6000                  __YDATA_BASE = 0x6000
                    0x8000                  __YDATA_END = 0x8000

.reset            0x800000          0x4
                  0x800000          0x4 LONG 0x801000 ABSOLUTE (__reset)

.text             0x801000        0x520
 *(.init)
 .init            0x801000         0xac /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(crt0_extendedaa.o)
                  0x801000                  __resetPRI
                  0x801000                  __reset
 .init            0x8010ac         0x60 /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(data_init_extendedaa.o)
                  0x8010ac                  __data_init
                  0x8010ac                  __data_init_extended
 *(.user_init)
 *(.handle)
 *(.isr*)
 .isr.isr.text    0x80110c        0x2b8 build/default/debug/_ext/1472/pmsm.o
                  0x80110c                  __AD1CH1Interrupt
                  0x801314                  __PWM1Interrupt
                  0x801378                  __T1Interrupt
 .isr             0x8013c4          0x8 default_isr
                  0x8013c4                  __DefaultInterrupt
 *(.libc)
 .libc            0x8013cc         0x10 /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(delay32.AAMeo)
                  0x8013cc                  ___delay32
 *(.libm)
 *(.libdsp)
 *(.lib*)
 .libpic30_crt_start_mode
                  0x8013dc          0x4 /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libc99-pic30-elf.a(crt_start_mode_normal.AAMeo)
                  0x8013dc                  __crt_start_mode_normal
                  0x8013dc                  __crt_start_mode
 .libc.sqrtf      0x8013e0        0x140 /opt/microchip/xc-dsc/v3.20/bin/bin/../../lib/libm-elf.a(sqrtf.AA_o)
                  0x8013e0                  _sqrtf
 :