This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28035: Generating relocatable object file

Part Number: TMS320F28035

Hi,

I'm working on Over The Air  firmware upgrade and I want to generate relocatable object file which can be placed in desired flash sector. Can any one help me with this...

Thanks in advance.

  • try these options in linker -ar ( --absolute_exe and --relocatable).

    Regards

    Baskaran

  • Hi,

    Thanks for the quick response. I tried it and i got these errors

    "../DSP2803x_Headers_nonBIOS.cmd", line 137: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "HRCap2RegsFile" size 0x20 page 1. Available memory ranges:
    HRCAP2 size: 0x20 unused: 0x20 max hole: 0x20
    "../DSP2803x_Headers_nonBIOS.cmd", line 145: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "SysCtrlRegsFile" size 0x20 page 1. Available memory ranges:
    SYSTEM size: 0x20 unused: 0x20 max hole: 0x20
    "../DSP2803x_Headers_nonBIOS.cmd", line 121: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "CsmRegsFile" size 0x10 page 1. Available memory ranges:
    CSM size: 0x10 unused: 0x10 max hole: 0x10
    "../DSP2803x_Headers_nonBIOS.cmd", line 149: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "NmiIntruptRegsFile" size 0x10 page 1. Available memory ranges:
    NMIINTRUPT size: 0x10 unused: 0x10 max hole: 0x10
    "../DSP2803x_Headers_nonBIOS.cmd", line 148: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "SciaRegsFile" size 0x10 page 1. Available memory ranges:
    SCIA size: 0x10 unused: 0x10 max hole: 0x10
    "../DSP2803x_Headers_nonBIOS.cmd", line 150: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "XIntruptRegsFile" size 0x10 page 1. Available memory ranges:
    XINTRUPT size: 0x10 unused: 0x10 max hole: 0x10
    "../DSP2803x_Headers_nonBIOS.cmd", line 124: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "CpuTimer1RegsFile" size 0x8 page 1. Available memory ranges:
    CPU_TIMER1 size: 0x8 unused: 0x8 max hole: 0x8
    "../DSP2803x_Headers_nonBIOS.cmd", line 125: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "CpuTimer2RegsFile" size 0x8 page 1. Available memory ranges:
    CPU_TIMER2 size: 0x8 unused: 0x8 max hole: 0x8
    "../DSP2803x_Headers_nonBIOS.cmd", line 167: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "CsmPwlFile" size 0x8 page 1. Available memory ranges:
    CSM_PWL size: 0x8 unused: 0x8 max hole: 0x8
    "../DSP2803x_Headers_nonBIOS.cmd", line 119: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "SysPwrCtrlRegsFile" size 0x3 page 1. Available memory ranges:
    SYS_PWR_CTL size: 0x3 unused: 0x3 max hole: 0x3
    "../DSP2803x_Headers_nonBIOS.cmd", line 126: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "PieCtrlRegsFile" size 0x1a page 1. Available memory ranges:
    PIE_CTRL size: 0x20 unused: 0x20 max hole: 0x20
    "../DSP2803x_Headers_nonBIOS.cmd", line 156: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "Comp2RegsFile" size 0x14 page 1. Available memory ranges:
    COMP2 size: 0x20 unused: 0x20 max hole: 0x20
    "../DSP2803x_Headers_nonBIOS.cmd", line 142: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section "GpioIntRegsFile" size 0xc page 1. Available memory ranges:
    GPIOINT size: 0x20 unused: 0x20 max hole: 0x20
    error #10010: errors encountered during linking; "ArcWeldMachine_800A_FW.out" not built

    >> Compilation failure
    makefile:157: recipe for target 'ArcWeldMachine_800A_FW.out' failed
    gmake: *** [ArcWeldMachine_800A_FW.out] Error 1
    gmake: Target 'all' not remade because of errors.

    I also tried using DSP2803x_Headers_nonBIOS.cmd file and i got similar type of errors. Should i make any changes to the linker file??

    Thanks in advance.
  • looks like it is to do with alignment. Can you check if "HRCap2RegsFile" is aligned to 64 byte boundary.

    This is related to issue you are facing - processors.wiki.ti.com/.../C28x_Compiler_-_Understanding_Linking
  • Hi,

    I have checked the HRCap2RegsFile and it is aligned to "16 byte boundary".

    Thanks.
  • i asked to align to 64-byte boundary and not 16 byte.

    Regards

    Baskaran

  • hi,

    1. The maximum boundary available is 32-byte and I tried to define 64-byte boundary in device.h header file but it is showing similar error(error #10099-D). I also tried by extending the .text section size which is showing same eror. Can you help me in aligning it to 64-byte boundary.
    2. I read the document you have referred and added -md switch to my project. Project has been build successfully but a regular (non-relocatable) .out file is generated which i tried to relocate below is the procedure which I have followed but still am unable to relocate.
    With the OUT file generated i also tried to change the entry address using hex2000 utillity in command prompt.
    "hex2000.exe -e=0x3EA000 -i project.out -o project.hex"
    But the entry address has fixed flash address which is defined in linker file [.text : > FLASHA PAGE = 0]

    Regards,
    Hema Avireni.
  • Can you try to configure the address alignment in linker command file. 

    Also attach the current changes you did to device.h and also linker command file.

  • /*
    //###########################################################################
    //
    // FILE:	F2808.cmd
    //
    // TITLE:	Linker Command File For F2808 Device
    //
    //###########################################################################
    // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $
    // $Release Date: May  8, 2015 $
    // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    */
    
    /* ======================================================
    // For Code Composer Studio V2.2 and later
    // ---------------------------------------
    // In addition to this memory linker command file,
    // add the header linker command file directly to the project.
    // The header linker command file is required to link the
    // peripheral structures to the proper locations within
    // the memory map.
    //
    // The header linker files are found in <base>\DSP2803x_Headers\cmd
    //
    // For BIOS applications add:      DSP2803x_Headers_BIOS.cmd
    // For nonBIOS applications add:   DSP2803x_Headers_nonBIOS.cmd
    ========================================================= */
    
    /* ======================================================
    // For Code Composer Studio prior to V2.2
    // --------------------------------------
    // 1) Use one of the following -l statements to include the
    // header linker command file in the project. The header linker
    // file is required to link the peripheral structures to the proper
    // locations within the memory map                                    */
    
    /* Uncomment this line to include file only for non-BIOS applications */
    /* -l DSP2803x_Headers_nonBIOS.cmd */
    
    /* Uncomment this line to include file only for BIOS applications */
    /* -l DSP2803x_Headers_BIOS.cmd */
    
    /* 2) In your project add the path to <base>\DSP2803x_headers\cmd to the
       library search path under project->build options, linker tab,
       library search path (-i).
    /*========================================================= */
    
    /* Define the memory block start/length for the F28035
       PAGE 0 will be used to organize program sections
       PAGE 1 will be used to organize data sections
    
       Notes:
             Memory blocks on F2803x are uniform (ie same
             physical memory) in both PAGE 0 and PAGE 1.
             That is the same memory region should not be
             defined for both PAGE 0 and PAGE 1.
             Doing so will result in corruption of program
             and/or data.
    
             L0 memory block is mirrored - that is
             it can be accessed in high memory or low memory.
             For simplicity only one instance is used in this
             linker file.
    
             Contiguous SARAM memory blocks or flash sectors can be
             be combined if required to create a larger memory block.
    */
    
    MEMORY
    {
    PAGE 0:    /* Program Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
       RAML0       : origin = 0x008000, length = 0x000800     /* on-chip RAM block L0 */
       RAML1       : origin = 0x008800, length = 0x000400     /* on-chip RAM block L1 */
       OTP         : origin = 0x3D7800, length = 0x000400     /* on-chip OTP */
       FLASHH      : origin = 0x3E8000, length = 0x002000     /* on-chip FLASH */
       FLASHG      : origin = 0x3EA000, length = 0x002000     /* on-chip FLASH */
       FLASHF      : origin = 0x3EC000, length = 0x002000     /* on-chip FLASH */
       FLASHE      : origin = 0x3EE000, length = 0x002000     /* on-chip FLASH */
       FLASHD      : origin = 0x3F0000, length = 0x002000     /* on-chip FLASH */
       FLASHC      : origin = 0x3F2000, length = 0x002000     /* on-chip FLASH */
       FLASHA      : origin = 0x3F6000, length = 0x001F80     /* on-chip FLASH */
       CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
       BEGIN       : origin = 0x3F7FF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to Flash" bootloader mode. */
       CSM_PWL_P0  : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */
    
       IQTABLES    : origin = 0x3FE000, length = 0x000B50     /* IQ Math Tables in Boot ROM */
       IQTABLES2   : origin = 0x3FEB50, length = 0x00008C     /* IQ Math Tables in Boot ROM */
       IQTABLES3   : origin = 0x3FEBDC, length = 0x0000AA	  /* IQ Math Tables in Boot ROM */
    
       ROM         : origin = 0x3FF27C, length = 0x000D44  /* Boot ROM */
       RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */
       VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */
    
    PAGE 1 :   /* Data Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
               /* Registers remain on PAGE1                                                  */
       BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
       RAMM0       : origin = 0x000050, length = 0x0003B0     /* on-chip RAM block M0 */
       RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
       RAML2       : origin = 0x008C00, length = 0x000400     /* on-chip RAM block L2 */
       RAML3       : origin = 0x009000, length = 0x001000     /* on-chip RAM block L3 */
       FLASHB      : origin = 0x3F4000, length = 0x002000     /* on-chip FLASH */
    
    }
    
    /* Allocate sections to memory blocks.
       Note:
             codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code
                       execution when booting to flash
             ramfuncs  user defined section to store functions that will be copied from Flash into RAM
    */
    
    SECTIONS
    {
    
    
       /* Allocate program areas: */
       .cinit              : > FLASHA      PAGE = 0
       .pinit              : > FLASHA,     PAGE = 0
       //.text               : > FLASHA      PAGE = 0
       .text               : > FLASHA|FLASHC|FLASHE      PAGE = 0 // increased this sector by combining flash sectors
       codestart           : > BEGIN       PAGE = 0
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_SIZE(_RamfuncsLoadSize),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0
    
       csmpasswds          : > CSM_PWL_P0  PAGE = 0
       csm_rsvd            : > CSM_RSVD    PAGE = 0
    
       /* Allocate uninitalized data sections: */
       .stack              : > RAMM0       PAGE = 1
     // .ebss               : > RAML2       PAGE = 1
       .ebss               : > RAML3       PAGE = 1
       .esysmem            : > RAML2       PAGE = 1
    
       /* Initalized sections go in Flash */
       /* For SDFlash to program these, they must be allocated to page 0 */
       .econst             : > FLASHA      PAGE = 0
       .switch             : > FLASHA      PAGE = 0
    
       /* Allocate IQ math areas: */
       IQmath              : > FLASHA      PAGE = 0            /* Math Code */
       IQmathTables        : > IQTABLES,   PAGE = 0, TYPE = NOLOAD
    
      /* Uncomment the section below if calling the IQNexp() or IQexp()
          functions from the IQMath.lib library in order to utilize the
          relevant IQ Math table in Boot ROM (This saves space and Boot ROM
          is 1 wait-state). If this section is not uncommented, IQmathTables2
          will be loaded into other memory (SARAM, Flash, etc.) and will take
          up space, but 0 wait-state is possible.
       */
       /*
       IQmathTables2    : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
       {
    
                  IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)
    
       }
       */
        /* Uncomment the section below if calling the IQNasin() or IQasin()
           functions from the IQMath.lib library in order to utilize the
           relevant IQ Math table in Boot ROM (This saves space and Boot ROM
           is 1 wait-state). If this section is not uncommented, IQmathTables2
           will be loaded into other memory (SARAM, Flash, etc.) and will take
           up space, but 0 wait-state is possible.
        */
        /*
        IQmathTables3    : > IQTABLES3, PAGE = 0, TYPE = NOLOAD
        {
    
                   IQmath.lib<IQNasinTable.obj> (IQmathTablesRam)
    
        }
        */
    
       /* .reset is a standard section used by the compiler.  It contains the */
       /* the address of the start of _c_int00 for C Code.   /*
       /* When using the boot ROM this section and the CPU vector */
       /* table is not needed.  Thus the default type is set here to  */
       /* DSECT  */
       .reset              : > RESET,      PAGE = 0, TYPE = DSECT
       vectors             : > VECTORS     PAGE = 0, TYPE = DSECT
    
    }
    
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
    
    
    Linker file

  • DSP2803x_Device.h

    //###########################################################################
    //
    // FILE:   DSP2803x_Device.h
    //
    // TITLE:  DSP2803x Device Definitions.
    //
    //###########################################################################
    // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $
    // $Release Date: May  8, 2015 $
    // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    
    #ifndef DSP2803x_DEVICE_H
    #define DSP2803x_DEVICE_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #define   TARGET   1
    //---------------------------------------------------------------------------
    // User To Select Target Device:
    
    
    #define   DSP28_28030PAG   0
    #define   DSP28_28030PN    0
    
    #define   DSP28_28031PAG   0
    #define   DSP28_28031PN    0
    
    #define   DSP28_28032PAG   0
    #define   DSP28_28032PN    0
    
    #define   DSP28_28033PAG   0
    #define   DSP28_28033PN    0
    
    #define   DSP28_28034PAG   0
    #define   DSP28_28034PN    0
    
    #define   DSP28_28035PAG   0
    #define   DSP28_28035PN    TARGET
    
    
    //---------------------------------------------------------------------------
    // Common CPU Definitions:
    //
    
    extern __cregister volatile unsigned int IFR;
    extern __cregister volatile unsigned int IER;
    
    #define  EINT   __asm(" clrc INTM")
    #define  DINT   __asm(" setc INTM")
    #define  ERTM   __asm(" clrc DBGM")
    #define  DRTM   __asm(" setc DBGM")
    #define  EALLOW __asm(" EALLOW")
    #define  EDIS   __asm(" EDIS")
    #define  ESTOP0 __asm(" ESTOP0")
    
    #define M_INT1  0x0001
    #define M_INT2  0x0002
    #define M_INT3  0x0004
    #define M_INT4  0x0008
    #define M_INT5  0x0010
    #define M_INT6  0x0020
    #define M_INT7  0x0040
    #define M_INT8  0x0080
    #define M_INT9  0x0100
    #define M_INT10 0x0200
    #define M_INT11 0x0400
    #define M_INT12 0x0800
    #define M_INT13 0x1000
    #define M_INT14 0x2000
    #define M_DLOG  0x4000
    #define M_RTOS  0x8000
    
    #define BIT0    0x0001
    #define BIT1    0x0002
    #define BIT2    0x0004
    #define BIT3    0x0008
    #define BIT4    0x0010
    #define BIT5    0x0020
    #define BIT6    0x0040
    #define BIT7    0x0080
    #define BIT8    0x0100
    #define BIT9    0x0200
    #define BIT10   0x0400
    #define BIT11   0x0800
    #define BIT12   0x1000
    #define BIT13   0x2000
    #define BIT14   0x4000
    #define BIT15   0x8000
    
    //---------------------------------------------------------------------------
    // For Portability, User Is Recommended To Use Following Data Type Size
    // Definitions For 16-bit and 32-Bit Signed/Unsigned Integers:
    //
    
    #ifndef DSP28_DATA_TYPES
    #define DSP28_DATA_TYPES
    typedef int             int16;
    typedef long            int32;
    typedef unsigned int    Uint16;
    typedef unsigned long   Uint32;
    typedef unsigned long int Uint64; //defiend by me
    typedef float           float32;
    typedef long double     float64;
    #endif
    
    //---------------------------------------------------------------------------
    // Include All Peripheral Header Files:
    //
    
    #include "DSP2803x_Adc.h"                // ADC Registers
    #include "DSP2803x_BootVars.h"           // Boot ROM Variables
    #include "DSP2803x_DevEmu.h"             // Device Emulation Registers
    #include "DSP2803x_Cla.h"                // Control Law Accelerator Registers
    #include "DSP2803x_Comp.h"               // Comparator Registers
    #include "DSP2803x_CpuTimers.h"          // 32-bit CPU Timers
    #include "DSP2803x_ECan.h"               // Enhanced eCAN Registers
    #include "DSP2803x_ECap.h"               // Enhanced Capture
    #include "DSP2803x_EPwm.h"               // Enhanced PWM
    #include "DSP2803x_EQep.h"               // Enhanced QEP
    #include "DSP2803x_Gpio.h"               // General Purpose I/O Registers
    #include "DSP2803x_HRCap.h"              // High Resolution Capture
    #include "DSP2803x_I2c.h"                // I2C Registers
    #include "DSP2803x_Lin.h"                // LIN Registers
    #include "DSP2803x_NmiIntrupt.h"         // NMI Interrupt Registers
    #include "DSP2803x_PieCtrl.h"            // PIE Control Registers
    #include "DSP2803x_PieVect.h"            // PIE Vector Table
    #include "DSP2803x_Spi.h"                // SPI Registers
    #include "DSP2803x_Sci.h"                // SCI Registers
    #include "DSP2803x_SysCtrl.h"            // System Control/Power Modes
    #include "DSP2803x_XIntrupt.h"           // External Interrupts
    
    
    #if (DSP28_28035PN||DSP28_28034PN||DSP28_28033PN||DSP28_28032PN||DSP28_28031PN||DSP28_28030PN)
    #define DSP28_COMP1 1
    #define DSP28_COMP2 1
    #define DSP28_COMP3 1
    #define DSP28_EPWM1 1
    #define DSP28_EPWM2 1
    #define DSP28_EPWM3 1
    #define DSP28_EPWM4 1
    #define DSP28_EPWM5 1
    #define DSP28_EPWM6 1
    #define DSP28_EPWM7 1
    #define DSP28_ECAP1 1
    #define DSP28_EQEP1 1
    #define DSP28_ECANA 1
    #define DSP28_HRCAP1 1
    #define DSP28_HRCAP2 1
    #define DSP28_SPIA  1
    #define DSP28_SPIB  1
    #define DSP28_SCIA  1
    #define DSP28_I2CA  1
    #define DSP28_LINA  1
    #endif
    
    #if (DSP28_28035PAG||DSP28_28034PAG||DSP28_28033PAG||DSP28_28032PAG||DSP28_28031PAG||DSP28_28030PAG)
    #define DSP28_COMP1 1
    #define DSP28_COMP2 1
    #define DSP28_COMP3 1
    #define DSP28_EPWM1 1
    #define DSP28_EPWM2 1
    #define DSP28_EPWM3 1
    #define DSP28_EPWM4 1
    #define DSP28_EPWM5 1
    #define DSP28_EPWM6 1
    #define DSP28_EPWM7 0
    #define DSP28_ECAP1 1
    #define DSP28_EQEP1 1
    #define DSP28_ECANA 1
    #define DSP28_HRCAP1 1
    #define DSP28_HRCAP2 1
    #define DSP28_SPIA  1
    #define DSP28_SPIB  0
    #define DSP28_SCIA  1
    #define DSP28_I2CA  1
    #define DSP28_LINA  1
    #endif
    
    // Timer definitions based on System Clock
    // 60 MHz devices 
    	#define      mSec0_5          30000           // 0.5 mS
    	#define      mSec0_75         45000           // 0.75 mS
    	#define      mSec1            60000           // 1.0 mS
    	#define      mSec2            120000          // 2.0 mS
    	#define      mSec5            300000          // 5.0 mS
    	#define      mSec7_5          450000          // 7.5 mS
    	#define      mSec10           600000          // 10 mS
    	#define      mSec20           1200000         // 20 mS
    	#define      mSec50           3000000         // 50 mS
    	#define      mSec75           4500000         // 75 mS
    	#define      mSec100          6000000         // 100 mS
    	#define      mSec200          12000000        // 200 mS
    	#define      mSec500          30000000        // 500 mS
    	#define      mSec750          45000000        // 750 mS
    	#define      mSec1000         60000000        // 1000 mS
    	#define      mSec2000         120000000       // 2000 mS
    	#define      mSec5000         300000000       // 5000 mS
    
    #ifdef __cplusplus
    }
    #endif /* extern "C" */
    
    #endif  // end of DSP2803x_DEVICE_H definition
    
    //===========================================================================
    // End of file.
    //===========================================================================
    

  • did you try making the alignment changes in linker command file ?

    Regards
    baskaran
  • Hi,
    Please let us know if you are still stuck with this issue ?