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.

TMS320F28027: Allocation memory sector problem

Part Number: TMS320F28027


Hi everybody.

In the .cmd linker file i have define a memory  area for EEPROM emulation named EEPROM_SECT

MEMORY
{
PAGE 0:    /* Program Memory */
           /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

   RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
   progRAM	   : origin = 0x008000, length = 0x000300	/* serve per routine settaggio flash speed che deve girare in RAM */
   OTP         : origin = 0x3D7800, length = 0x000400     /* on-chip OTP */

/* DEFINIZIONE DEI SETTORI IN USO AL BOOTLOADER */
	/* FLASH SETTORE D */
   FLASHA      : origin = 0x3F0000, length = 0x005FFA     /* on-chip FLASH */

   BOOT_VECT   : origin = 0x3F5FFA, length = 0x000002
   BOOT_VERS   : origin = 0x3F5FFC, length = 0x000002
   BOOT_CRC    : origin = 0x3F5FFF, length = 0x000001

   /* FLASH SETTORE A */
   BOOT_UID    : origin = 0x3F6000, length = 0x000001
   EEPROM_SECT : origin = 0x3F6001, length = 0x000FFF
   BOOT_IMAGE  : origin = 0x3F7000, length = 0x000F80


   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_PROG: 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 */
   dataRAM	   : origin = 0x008300, length = 0x000D00	  /* Ram da usare come Ram */

}

I created an sector denominate EepromFlashSector that i  want put in EEPROM_SECT

SECTIONS
{

   /* Allocate program areas: */
   .cinit              : > FLASHA           PAGE = 0
   .pinit              : > FLASHA,          PAGE = 0
   .text               : > FLASHA 		    PAGE = 0
   codestart           : > BEGIN            PAGE = 0
   ramfuncs            : LOAD = FLASHA,
                         RUN = progRAM,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_SIZE(_RamfuncsLoadSize),
                         RUN_START(_RamfuncsRunStart),
                         PAGE = 0

   csmpasswds          : > CSM_PWL_PROG PAGE = 0
   csm_rsvd            : > CSM_RSVD     PAGE = 0

   /* Allocate uninitalized data sections: */
   .stack              : > RAMM0        PAGE = 1
   .ebss               : > dataRAM,  /* DRAML0, */
                         START(_RamUninitializedStart),
                         SIZE(_RamUninitializedSize),
                         PAGE = 1

   .esysmem            : > dataRAM       PAGE = 1
  /* .sysmem             : > DRAML0       PAGE = 1
   .cio                : >> RAMM0 | RAMM1 | DRAML0       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)

   }
   */
   /* EEPROM SECTOR */
   EepromFlashSector   : > EEPROM_SECT PAGE = 0            /* EEPROM FILE */

   /* .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

}

IIn my code allocate a variabile on EepromFlashSector

#pragma DATA_SECTION(eepromPages, "EepromFlashSector");

EEPROMPAGE    eepromPages[EEPROM_NUM_PAGES];

My problem is that this variabile don't start at origin address of EEPROM_SECT but 64 byte later so i can't use the entire space that i have reserved for eeprom, someone can tell me what wrong so i can fill the entire eeprom space.

In the .map file under here you can see where the linker allocate the variabile 

MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
PAGE 0:
  RAMM1                 00000400   00000400  00000000  00000400  RWIX
  progRAM               00008000   00000300  0000008e  00000272  RWIX
  OTP                   003d7800   00000400  00000000  00000400  RWIX
  FLASHA                003f0000   00005ffa  00004a2a  000015d0  RWIX
  BOOT_VECT             003f5ffa   00000002  00000000  00000002  RWIX
  BOOT_VERS             003f5ffc   00000002  00000000  00000002  RWIX
  BOOT_CRC              003f5fff   00000001  00000000  00000001  RWIX
  BOOT_UID              003f6000   00000001  00000000  00000001  RWIX
  EEPROM_SECT           003f6001   00000fff  00000fb9  00000046  RWIX
  BOOT_IMAGE            003f7000   00000f80  00000000  00000f80  RWIX
  CSM_RSVD              003f7f80   00000076  00000000  00000076  RWIX
  BEGIN                 003f7ff6   00000002  00000002  00000000  RWIX
  CSM_PWL_PROG          003f7ff8   00000008  00000000  00000008  RWIX
  IQTABLES              003fe000   00000b50  00000b50  00000000  RWIX
  IQTABLES2             003feb50   0000008c  00000000  0000008c  RWIX
  IQTABLES3             003febdc   000000aa  00000000  000000aa  RWIX
  ROM                   003ff27c   00000d44  00000000  00000d44  RWIX
  RESET                 003fffc0   00000002  00000000  00000002  RWIX
  VECTORS               003fffc2   0000003e  00000000  0000003e  RWIX

PAGE 1:
  BOOT_RSVD             00000000   00000050  00000000  00000050  RWIX
  RAMM0                 00000050   000003b0  00000300  000000b0  RWIX
  DEV_EMU               00000880   00000105  00000004  00000101  RWIX
  SYS_PWR_CTL           00000985   00000003  00000003  00000000  RWIX
  FLASH_REGS            00000a80   00000060  00000008  00000058  RWIX
  CSM                   00000ae0   00000010  00000010  00000000  RWIX
  ADC_RESULT            00000b00   00000020  00000020  00000000  RWIX
  CPU_TIMER0            00000c00   00000008  00000008  00000000  RWIX
  CPU_TIMER1            00000c08   00000008  00000008  00000000  RWIX
  CPU_TIMER2            00000c10   00000008  00000008  00000000  RWIX
  PIE_CTRL              00000ce0   00000020  0000001a  00000006  RWIX
  PIE_VECT              00000d00   00000100  00000100  00000000  RWIX
  COMP1                 00006400   00000020  00000020  00000000  RWIX
  COMP2                 00006420   00000020  00000020  00000000  RWIX
  EPWM1                 00006800   00000040  00000040  00000000  RWIX
  EPWM2                 00006840   00000040  00000040  00000000  RWIX
  EPWM3                 00006880   00000040  00000040  00000000  RWIX
  EPWM4                 000068c0   00000040  00000040  00000000  RWIX
  ECAP1                 00006a00   00000020  00000020  00000000  RWIX
  GPIOCTRL              00006f80   00000040  00000040  00000000  RWIX
  GPIODAT               00006fc0   00000020  00000020  00000000  RWIX
  GPIOINT               00006fe0   00000020  0000000a  00000016  RWIX
  SYSTEM                00007010   00000020  0000001f  00000001  RWIX
  SPIA                  00007040   00000010  00000010  00000000  RWIX
  SCIA                  00007050   00000010  00000010  00000000  RWIX
  NMIINTRUPT            00007060   00000010  00000010  00000000  RWIX
  XINTRUPT              00007070   00000010  00000010  00000000  RWIX
  ADC                   00007100   00000080  00000051  0000002f  RWIX
  I2CA                  00007900   00000040  00000022  0000001e  RWIX
  dataRAM               00008300   00000d00  000006d2  0000062e  RWIX
  PARTID                003d7fff   00000001  00000001  00000000  RWIX
  CSM_PWL               003f7ff8   00000008  00000008  00000000  RWIX


SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------
ramfuncs   0    003f46ab    0000008e     RUN ADDR = 00008000
                  003f46ab    0000008a     flash.obj (ramfuncs)
                  003f4735    00000004     f2802x_usdelay.obj (ramfuncs)

.cinit     0    003f4739    0000013d     
                  003f4739    00000044     subroutine.obj (.cinit)
                  003f477d    00000042     tig.obj (.cinit)
                  003f47bf    00000041     interrupt.obj (.cinit)
                  003f4800    00000030     allarmi.obj (.cinit)
                  003f4830    00000014     application.obj (.cinit)
                  003f4844    00000010     app_spi.obj (.cinit)
                  003f4854    0000000e     rts2800_ml.lib : exit.c.obj (.cinit)
                  003f4862    00000005                    : _lock.c.obj (.cinit:__lock)
                  003f4867    00000005                    : _lock.c.obj (.cinit:__unlock)
                  003f486c    00000004     mma.obj (.cinit)
                  003f4870    00000004     sci_io.obj (.cinit)
                  003f4874    00000002     --HOLE-- [fill = 0]

EepromFlashSector 
*          0    003f6040    00000fb9     UNINITIALIZED
                  003f6040    00000fb9     eeprom.obj (EepromFlashSector)

Thanks!!!