Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: запись во флеш/чтение на atxmega32d4
Форум разработчиков электроники ELECTRONIX.ru > Сайт и форум > В помощь начинающему > Программирование
addi
Здравствуйте

Пытаюсь использовать код от Атмела под ИАР для записи/чения флеш памяти
К сожалению чтото не выходит на этапе загрузчи буфера все виснет

Вот мой код

Код
#include "sp_driver.h"
/* Temporary storage used for NVM-workaround. */
uint8_t sleepCtr;
uint8_t statusStore;
uint8_t pmicStore;
uint8_t globalInt;
uint8_t spmintStore;
unsigned short y;

#pragma vector =  NVM_SPM_vect
__interrupt void NVM_SPM_vectint(void)
{
    /* Disable the SPM interrupt */
    NVM.INTCTRL = (NVM.INTCTRL & ~NVM_SPMLVL_gm);
    /* Restore sleep settings */
    SLEEP.CTRL = sleepCtr;
    /* Restore PMIC status and control registers */
    PMIC.STATUS = statusStore;
    PMIC.CTRL = pmicStore;
    /* Restore SPM interruptsettings */
    NVM.INTCTRL = spmintStore;
    /* Restore global interrupt settings */
    SREG = globalInt;
    return;
}

/* Temporary storage used for NVM-workaround. */

/* Set interrupt vector location to boot section of flash */
void PMIC_SetVectorLocationToBoot( void )
{
    uint8_t temp = PMIC.CTRL | PMIC_IVSEL_bm;
    CCP = CCP_IOREG_gc;
    PMIC.CTRL = temp;
}

/*Set interrupt vector location to application section of flash */
void PMIC_SetVectorLocationToApplication( void )
{
    uint8_t temp = PMIC.CTRL & ~PMIC_IVSEL_bm;
    CCP = CCP_IOREG_gc;
    PMIC.CTRL = temp;
}

/* Save register settings before entering sleep mode */
void Prepare_to_Sleep( void )
{
    sleepCtr = SLEEP.CTRL;
    /* Set sleep mode to IDLE */
    SLEEP.CTRL =  0x00;
    /* Save the PMIC Status and control registers */
    statusStore = PMIC.STATUS;                                
    pmicStore = PMIC.CTRL;        
    /* Enable only the highest level of interrupts */                                    
    PMIC.CTRL = (PMIC.CTRL & ~(PMIC_MEDLVLEN_bm | PMIC_LOLVLEN_bm)) | PMIC_HILVLEN_bm;
    /* Save SREG for later use */
    globalInt = SREG;
    /* Enable global interrupts */
    sei();
    /* Save SPM interrupt settings for later */
    spmintStore = NVM.INTCTRL;
}

/* New function declarations used for the NVM-workaround */
void EraseApplicationPage(uint32_t address)
{
    /*Set the correct settings and store critical registers before NVM-workaround*/
    Prepare_to_Sleep();
    /*Assembly "function" to preform page erase*/
    SP_EraseApplicationPage(address);
}

void EraseWriteApplicationPage(uint32_t address)
{
    /*Set the correct settings and store critical registers before NVM-workaround*/
    Prepare_to_Sleep();
    /*Assembly "function" to preform page erase-write*/
    SP_EraseWriteApplicationPage(address);
}

void ClearFlashBuffer(void)
{
    /*Set the correct settings and store critical registers before NVM-workaround*/
    Prepare_to_Sleep();
    /*Assembly "function" to erase flash buffer*/
    SP_EraseFlashBuffer();
}

void LoadFlashWord(uint32_t address, uint16_t word)
{
    /*Set the correct settings and store critical registers before NVM-workaround*/
    Prepare_to_Sleep();  
    /*Assembly "function" to load flash buffer*/
       SP_LoadFlashWord(address, word);
}

void main()

{
  __enable_interrupt();
  PMIC_SetVectorLocationToBoot();
ClearFlashBuffer();
for(y=0;y<(128);y+=2)
{
  LoadFlashWord(y,0xAAAA);
  SP_WaitForSPM();
}
EraseWriteApplicationPage(16000);
if(SP_ReadByte(0x3E00)==0x55)
{
PORTD_OUT |= 0x40;
}
for(;;)
{}
}



Прошу подсказать что не так кто уже пользовал иаровский код

Заранее благодарен
_Артём_
Цитата(addi @ Oct 20 2012, 16:36) *
Код
for(y=0;y<(128);y+=2)
{
  LoadFlashWord(y,0xAAAA);
  SP_WaitForSPM();
}
EraseWriteApplicationPage(16000);
if(SP_ReadByte(0x3E00)==0x55)
{
PORTD_OUT |= 0x40;
}
for(;;)
{}
}

Что-то не понял смысла вашего кода...
Вы пишете во flash начиная с адреса 16000(0x3E80) числа 0xAAAA и потом надеетесь прочитать из 0x3E00 0x55?
addi
Цитата(_Артём_ @ Oct 20 2012, 18:16) *
Что-то не понял смысла вашего кода...
Вы пишете во flash начиная с адреса 16000(0x3E80) числа 0xAAAA и потом надеетесь прочитать из 0x3E00 0x55?


спасибо за поддержку

Это результат постоянного корректирования кода, но к сожелению чтение флеш не дает ни AA ни 55, пробовал и так и так, все FF.

Цитата(addi @ Oct 20 2012, 18:41) *
спасибо за поддержку

Это результат постоянного корректирования кода, но к сожелению чтение флеш не дает ни AA ни 55, пробовал и так и так, все FF.

попробовал на отладчике посмотреть где я останавливаюсь, оказаолось после кодманды SLEEP, т.е получается что я невыходу из слипа вследствии того что почемуто нет SP прерывания.
В инииализации микроконтролера ставлю PMIC.CNTRL = 0x04 - приоритет только hi как требуется
Не могу найти в мануале где влючаются непосредственно SP прерывания...
_Артём_
Цитата(addi @ Oct 20 2012, 17:45) *
В инииализации микроконтролера ставлю PMIC.CNTRL = 0x04 - приоритет только hi как требуется
Не могу найти в мануале где влючаются непосредственно SP прерывания...


NVM.INTCTRL
Код
    sts    NVM_INTCTRL,r20  
    /* Sleep before 2.5uS has passed */
    SLEEP
    out    RAMPZ, r23
    pop    r22
    pop    r21
    pop    r20
    ret

Но это должно уже быть сделано в апноте.
addi
Цитата(addi @ Oct 20 2012, 18:45) *
спасибо за поддержку

Это результат постоянного корректирования кода, но к сожелению чтение флеш не дает ни AA ни 55, пробовал и так и так, все FF.


попробовал на отладчике посмотреть где я останавливаюсь, оказаолось после кодманды SLEEP, т.е получается что я невыходу из слипа вследствии того что почемуто нет SP прерывания.
В инииализации микроконтролера ставлю PMIC.CNTRL = 0x04 - приоритет только hi как требуется
Не могу найти в мануале где влючаются непосредственно SP прерывания...

NVM.INTCTRL = (NVM.INTCTRL | NVM_SPMLVL_gm); в инициализации микроконтроллера тоже не выводит из сна (((

Цитата(addi @ Oct 20 2012, 18:55) *
NVM.INTCTRL = (NVM.INTCTRL | NVM_SPMLVL_gm); в инициализации микроконтроллера тоже не выводит из сна (((

моя инициализация микроконтроллера
Код
    unsigned h,n; //g=0;
  
  unsigned char k=0;
  OSC.XOSCCTRL=0x8b;
  OSC.CTRL =OSC_XOSCEN_bm;
  while (!(OSC.STATUS & OSC_XOSCRDY_bm) );
  ////////////////////////////////////////////
  OSC.PLLCTRL = 0xC4;                // Fcpu = 29.4912 Mhz
  OSC.CTRL = OSC.CTRL|0x10;       // enable
  while((OSC.STATUS & 0x10) ==0);
  ////////////////////////////////////////////
  CCP = CCP_IOREG_gc;
  //CLK.CTRL =CLK_SCLKSEL_XOSC_gc;
  CLK.CTRL =CLK_SCLKSEL_PLL_gc;
  OSC.CTRL = OSC.CTRL & 0xFE;
/////////////////////////////////////////////////
  init_timer1();
   PORTD_OUT &= ~0x40;

  PMIC.CTRL = 0x04;
  ////////////////  ////////
   PORTD_OUT &= ~0x40;

  PORTE.DIR=0xff;

  PORTE_OUT = 0xff;
  
  PORTD_DIR |= 0xC0;
  PORTD_DIR |= 0x08;
  PORTD_OUT |= 0x80;
  PWM_init2();
  NVM.INTCTRL = (NVM.INTCTRL | NVM_SPMLVL_gm);
__enable_interrupt();
_Артём_
Цитата(addi @ Oct 20 2012, 17:55) *
NVM.INTCTRL = (NVM.INTCTRL | NVM_SPMLVL_gm); в инициализации микроконтроллера тоже не выводит из сна (((

Странно...попробуйте запустить какую-нибудь другую команды при настроенном прерывании NVM.
Прерывания разрешены?
Может проблемы с расположением бута? Там ли таблица векторов находится?

Проект выложте - гадать можно долго.
addi
Цитата(_Артём_ @ Oct 20 2012, 19:02) *
Странно...попробуйте запустить какую-нибудь другую команды при настроенном прерывании NVM.
Прерывания разрешены?
Может проблемы с расположением бута? Там ли таблица векторов находится?

Проект выложте - гадать можно долго.

спасибо за поддержку, наверна все так как Вы говорите, потому как я ничего ни делал с бутом, тем более нигде никакие операции по его расположению не делал, потому что думал что стандартного xcl хватит

Высылаю проект
_Артём_
Цитата(addi @ Oct 20 2012, 18:15) *
ни делал с бутом, тем более нигде никакие операции по его расположению не делал, потому что думал что стандартного xcl хватит

Но где-то должны быть настройки линкера для бута: стандарный xcl расположит код от 0.
Посмотрите в отладчике по каким адресам таблица векторов и программа.

Цитата(addi @ Oct 20 2012, 18:15) *
Высылаю проект

Открыть не получается - мои версии ИАРа видимо устарели (6.10).
addi
Цитата(_Артём_ @ Oct 20 2012, 19:30) *
Но где-то должны быть настройки линкера для бута: стандарный xcl расположит код от 0.
Посмотрите в отладчике по каким адресам таблица векторов и программа.


Открыть не получается - мои версии ИАРа видимо устарели (6.10).

к сожалению в ИАРе опцию для задания бута не нашел, вероятно придется както редактировать сам xcl
Проект более новый, у меня 6.12
_Артём_
Цитата(addi @ Oct 20 2012, 18:40) *
к сожалению в ИАРе опцию для задания бута не нашел,

Думаю такой опции нет и никогда не было.

Цитата(addi @ Oct 20 2012, 18:40) *
вероятно придется както редактировать сам xcl

Придётся...или взять готовый у Атмела или взять пример бута для другой xmeg-и и поменять адреса в соответствии с нужным размером flash.

Цитата(addi @ Oct 20 2012, 18:40) *
вероятно придется както редактировать сам xcl Проект более новый, у меня 6.12

Как-то получилось открыть ваш выходнойц файл в симуляторе...
Программ расположена с 0, а вектора у вас переключаются на бут область.
Значит самопрограммирование работать не будет - прошивка flash возможна только из области бута.
addi
Цитата(_Артём_ @ Oct 20 2012, 19:46) *
Думаю такой опции нет и никогда не было.


Придётся...или взять готовый у Атмела или взять пример бута для другой xmeg-и и поменять адреса в соответствии с нужным размером flash.


Как-то получилось открыть ваш выходнойц файл в симуляторе...
Программ расположена с 0, а вектора у вас переключаются на бут область.
Значит самопрограммирование работать не будет - прошивка flash возможна только из области бута.

никак не могу понять куда писать адресс бута в xcl файле, там даже такого примитива нет(.....

Пожалуйста кто значет подскажите
addi
Цитата(_Артём_ @ Oct 20 2012, 19:46) *
Думаю такой опции нет и никогда не было.


Придётся...или взять готовый у Атмела или взять пример бута для другой xmeg-и и поменять адреса в соответствии с нужным размером flash.


Как-то получилось открыть ваш выходнойц файл в симуляторе...
Программ расположена с 0, а вектора у вас переключаются на бут область.
Значит самопрограммирование работать не будет - прошивка flash возможна только из области бута.

Здравствуйте!

Спасибо за Вашу поддержку, флешка теперь записывается и читается, но впоследствии мой код разросся и той конфигурацией xcl уже не хватает, а как поменять не догоняю, пожалуйста помогите.
Хотелось бы разделится пополам- пол памяти на самопрограммирование и пол памяти на сам код, т.е по 16к
Прикрепляю текущую конфигурацию

Цитата(addi @ Nov 11 2012, 13:54) *
Здравствуйте!

Спасибо за Вашу поддержку, флешка теперь записывается и читается, но впоследствии мой код разросся и той конфигурацией xcl уже не хватает, а как поменять не догоняю, пожалуйста помогите.
Хотелось бы разделится пополам- пол памяти на самопрограммирование и пол памяти на сам код, т.е по 16к
Прикрепляю текущую конфигурацию

прикрепить не получилось
Код
/*                      - lnk6s.xcl -
*
*   XLINK command file for the ICCAVR C-compiler using the -v6, -ms options.
*   Segments are defined for a generic ATmega with a maximum of 16 Mbytes
*   data address space and 8 Mbytes program address space.
*
*   Usage: xlink your_file(s) -f lnk6s
*
*   File version: $Revision: 1.11 $
*/

/*
* Modify the lines below to alter the size of the RSTACK, CSTACK and HEAP
* segments. These need to be fine-tuned to suit your specific application.
*/
//-D_..X_CSTACK_SIZE=100 /* 4096 bytes for auto variables and saved registers. */
//-D_..X_RSTACK_SIZE=100  /* 512 bytes for return addresses, equivalent to */
                        /* 128 levels of calls, including interrupts. */
//-D_..X_HEAP_SIZE=1000   /* 4096 bytes of heap. */
//-D_..X_NEAR_HEAP_SIZE=1000    /* 4096 bytes of heap. */
//-D_..X_FAR_HEAP_SIZE=8000     /* 32768 bytes of heap. */
//- D_..X_HUGE_HEAP_SIZE=8000    /* 32768 bytes of heap. */

/*
*   The following segments are used by the compiler:
*
*   Program address space read-only segments (internal Flash)
*   =========================================================
*   segment     address range  max size (dec)
*   -------     -------------  --------------
*   INTVEC         0 -     1F   32 bytes
*   TINY_F         0 -     FF  256 bytes
*   SWITCH         0 -   FFFF   64 Kbytes
*   DIFUNCT        0 -   FFFF   64 Kbytes
*   NEAR_F         0 -   FFFF   64 Kbytes
*   CODE           0 -  1FFFF  128 kbytes
*   FARCODE        0 - 7FFFFF    8 Mbytes
*   FAR_F          0 - 7FFFFF    8 Mbytes
*   INITTAB        0 - 7FFFFF    8 Mbytes
*   HUGE_F         0 - 7FFFFF    8 Mbytes
*   TINY_ID        0 - 7FFFFF    8 Mbytes
*   NEAR_ID        0 - 7FFFFF    8 Mbytes
*   FAR_ID         0 - 7FFFFF    8 Mbytes
*   HUGE_ID        0 - 7FFFFF    8 Mbytes
*
*   Data address space read/write segments
*   ==============================================================
*   segment     address range  max size (dec)
*   -------     -------------  --------------
*   TINY_Z        60 -     FF  160 bytes
*   TINY_N        60 -     FF  160 bytes
*   TINY_I        60 -     FF  160 bytes
*   CSTACK        60 -   FFFF   64 kbytes
*   HEAP          60 -   FFFF   64 kbytes
*   NEAR_HEAP     60 -   FFFF   64 kbytes
*   FAR_HEAP      60 - FFFFFF   16 Mbytes
*   HUGE_HEAP     60 - FFFFFF   16 Mbytes
*   RSTACK        60 -   FFFF   64 kbytes
*   NEAR_Z        60 -   FFFF   64 kbytes
*   NEAR_I        60 -   FFFF   64 kbytes
*   NEAR_N        60 -   FFFF   64 kbytes
*   NEAR_C        60 -   FFFF   64 kbytes
*   FAR_Z         60 - FFFFFF   16 Mbytes
*   FAR_I         60 - FFFFFF   16 Mbytes
*   FAR_N         60 - FFFFFF   16 Mbytes
*   FAR_C         60 - FFFFFF   16 Mbytes
*   HUGE_Z        60 - FFFFFF   16 Mbytes
*   HUGE_I        60 - FFFFFF   16 Mbytes
*   HUGE_N        60 - FFFFFF   16 Mbytes
*   HUGE_C        60 - FFFFFF   16 Mbytes
*
*  String literals and constant objects are placed in the NEAR_C segment,
*  unless the -y command line option is given. If it was given, string
*  literals and constant objects will be placed in the NEAR_ID segment which
*  is initialized by cstartup.
*
*  The address ranges given in the table above specify the "hard" limits
*  where a given segment may be placed, e.g. it is not possible to place the
*  TINY_F segment anywhere outside of the given range 0-FF.
*/

/* Define CPU */
-ca90

/*************************************************************/
/* Segments in program address space (internal Flash memory) */
/*************************************************************/
-D_..X_INTVEC_SIZE=1F4   // 4 bytes * 125 vectors
-D_..X_APPLICATION_SECTION_START=81F4
-D_..X_APPLICATION_SECTION_SIZE=E0C
-D_..X_APPLICATION_START=(_..X_APPLICATION_SECTION_START+_..X_INTVEC_SIZE)
-D_..X_APPLICATION_END=(_..X_APPLICATION_SECTION_START+_..X_APPLICATION_SECTION_SIZE-1)


-D_..X_APPLICATION_SIZE=8000
-D_..X_BOOT_SIZE=1000
-D_..X_APPLICATION_TABLE_SIZE=1000





-D_..X_FLASH_END=(_..X_APPLICATION_SIZE+_..X_BOOT_SIZE-1)

-D_..X_APPLICATION_TABLE_START=(_..X_APPLICATION_END+1)
-D_..X_APPLICATION_TABLE_END=(_..X_FLASH_END-_..X_BOOT_SIZE)
-D_..X_BOOT_START=(_..X_APPLICATION_TABLE_END+1)
-D_..X_BOOT_END=_..X_FLASH_END

-D_..X_FLASH_NEND=_..X_FLASH_END  // End of flash memory
/*
* Reset and interrupt vectors.
*
* The reset vector and interrupt vectors must be placed at address 0
* and forwards. This definition allows for up to 23 interrupt vectors
* and the reset vector.
*/
-Z(CODE)INTVEC=8000-81F4
-h(CODE)8000-81F4 /*Fill unused interrupt vector's with RETI*/
//-Z(CODE)INTVEC=8000-81F4




/*
* __tinyflash declared objects.
*
* Constant objects that have been declared with the __tinyflash keyword
* will be placed in this segment. The code generated is almost the same
* as for objects declared with __flash, the exception is that a __tinyflash
* pointer is one byte instead of two.
*/
//-Z(CODE)TINY_F=0-FF

/*
* Compiler generated segments
*
* There are currently three compiler generated segments. These are used
* for storing information that is vital for the operation of the program.
*
* The first segment is the SWITCH segment which contains data statements
* used in the switch library routines. These tables are encoded in such a
* way as to use as little space as possible.
*
* The second segment, INITTAB, contains the segment initialization
* description blocks that are used by the __segment_init function which is
* called by cstartup. This table consists of a number of SegmentInitBlock_Type
* objects. This type is declared in the segment_init.h file located in the
* AVR\SRC\LIB directory.
*
* Tha last segment is only used when a source file has been compiled
* in EC++ mode and the file contained global objects (class instances).
* The segment will then contain a number of function pointers that
* point to constructor methods that should be executed for each object.
*/
-Z(CODE)SWITCH,DIFUNCT=_..X_APPLICATION_START-_..X_APPLICATION_END

/*
* __flash declared objects.
*
* Constant objects that have been declared with the __flash keyword will
* be placed in this segment.
*/
//-Z(CODE)NEAR_F=0-FFFF

/*
* Program code, __nearfunc declared functions
*
* Code that comes from __nearfunc declared functions is placed in the CODE
* segment. This segment must be placed in the first 128 Kbytes of flash
* memory. The reason for this is that function pointers to __nearfunc
* functions are 2 bytes large. All function pointers are word pointers.
*/
-Z(CODE)CODE=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END

/*
* Initialization data for the FAR_I segments
*
* If any non-zero initialized variables exist in the application the
* corresponding _ID segment will contain the initial values of those
* variables. The cstartup module will initialize the _I segments at
* system start up by calling the __segment_init function.
*
* FAR_ID must have the same offset
* from a 64 Kbyte boundary as FAR_I
*
*/
-Z(FARCODE)FAR_ID=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END


/*
* Program code, __farfunc declared functions
*
* Code that comes from __farfunc declared functions is placed in the FARCODE
* segment. This segment can be placed anywhere in the flash memory. Function
* pointers to __farfunc functions are 3 bytes large. All function pointers
* are word pointers.
*/
-Z(CODE)FARCODE=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END

/*
* __farflash declared objects.
*
* Constant objects that have been declared with the __farflash keyword will
* be placed in this segment. The objects are limited to 32 Kbytes in size
* and by using the FARCODE segment type XLINK guarantees that no object in
* the segment spans over a 64K boundary.
*/
-Z(FARCODE)FAR_F=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END

/*
* __hugeflash declared objects.
*
* Constant objects that have been declared with the __hugeflash keyword will
* be placed in this segment.
*/
-Z(CODE)HUGE_F,INITTAB=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END

/*
* Initialization data for the TINY_I, NEAR_I and HUGE_I segments
*
* If any non-zero initialized variables exist in the application the
* corresponding _ID segment will contain the initial values of those
* variables. The cstartup module will initialize the _I segments at
* system start up by calling the __segment_init function.
*/
-Z(CODE)TINY_ID,NEAR_ID,HUGE_ID=_..X_APPLICATION_SECTION_START-_..X_APPLICATION_END
-Z(CODE)CHECKSUM#_..X_APPLICATION_END

/***************************************************************************/
/* Segments in data address space (internal or external SRAM/EPROM/EEPROM) */
/***************************************************************************/


//////////////////////////////////////////////////////////////////////////////
// Data (SRAM, external ROM or external NV RAM) memory
-D_..X_SRAM_BASE=2000    // Start of ram memory
-D_..X_SRAM_TBASE=0      // Start of tiny ram memory
-D_..X_SRAM_TSIZE=0      // Size of the tiny ram memory
-D_..X_SRAM_END=3FFF     // End of ram memory
//-D_..X_CSTACK_BASE=_..X_SRAM_BASE
//-D_..X_CSTACK_END=_..X_SRAM_END
//-D_..X_RSTACK_BASE=_..X_SRAM_BASE
//-D_..X_RSTACK_END=_..X_SRAM_END


//////////////////////////////////////////////////////////////////////////////
// Internal EEPROM
-D_..X_EEPROM_END=7FF   // End of eeprom memory
-D_..X_EEPROM_START=0



/*
* __tiny declared objects
*
* These three segments contain objects that haven been declared with the
* __tiny keyword. After cstartup has run, the _I segment has been initialized
* with the values in the _ID segment and the _Z segment has been cleared so
* that it contains all zeros.
*/
-Z(DATA)TINY_I,TINY_Z,TINY_N=_..X_SRAM_TBASE:+_..X_SRAM_TSIZE

/*
* Data stack
*
* The data stack is used for auto variables, function parameters, and
* temporary storage. It is therefore important that the size of the data
* stack is large enough. However, a too large stack will waste valuable
* RAM space. To determine approximately how much data stack that is needed
* for an application, perform a trial link with the list file option 'o'
* present, e.g. -xmos. This will tell XLINK to generate a stack usage tree
* in the map file. The values in the map file could then be used as an
* approximation. Please note that the given value does not include stack
* used by interrupts and assembler functions written by the end user. It is
* therefore neccesary to add a small safety margin to the value given by
* XLINK.
*/
-Z(DATA)CSTACK+_..X_CSTACK_SIZE=_..X_CSTACK_BASE-_..X_CSTACK_END

/*
* The malloc HEAP segment
*
* If the application uses malloc or calloc the memory is allocated from this
* segment. It is therefore important that the segment is placed so that a
* default pointer can point to it. Since this linker file assumes that the
* small memory model is used the heap must be placed in the range 0 ... FFFF.
*
* The library technology that is used is such that if no calls are made to
* malloc, calloc, or realloc, this segment will not be included. It is
* therefore safe to include it in all your linker files.
*/
//-Z(DATA)HEAP+_..X_HEAP_SIZE=_..X_SRAM_BASE-_..X_SRAM_END
//-Z(DATA)NEAR_HEAP+_..X_NEAR_HEAP_SIZE=_..X_SRAM_BASE-_..X_SRAM_END
//-Z(DATA)FAR_HEAP+_..X_FAR_HEAP_SIZE=_..X_SRAM_BASE-_..X_SRAM_END
//-Z(DATA)HUGE_HEAP+_..X_HUGE_HEAP_SIZE=_..X_SRAM_BASE-_..X_SRAM_END

/*
* Return address stack
*
* The return address stack is used to store the return address when a CALL,
* RCALL, ICALL, or EICALL instruction is executed. Each call will use three
* bytes of return address stack. An interrupt will also place a return
* address on this stack. Use the same technique as for the data stack to
* determine the size of the return address stack. Note however that if the
* cross-call optimization has been used (-z9 and not --no_cross_call) the
* value given by XLINK can be off by as much as a factor of five depending on
* how many times the cross-call optimizer has been run (--cross_call_passes).
*/
-Z(DATA)RSTACK+_..X_RSTACK_SIZE=_..X_RSTACK_BASE-_..X_RSTACK_END

/*
* __near declared objects
*
* These three segments contain objects that haven been declared with the
* __near keyword. After cstartup has run the, _I segment has been initialized
* with the values in the _ID segment and the _Z segment has been cleared so
* that it contains all zeros.
*/
-Z(DATA)NEAR_I,NEAR_Z,NEAR_N=_..X_SRAM_BASE-_..X_SRAM_END
-Z(DATA)IOSTREAM_N#_..X_SRAM_BASE-_..X_SRAM_END

//////////////////////////////////////////////////////////////////////////////
// Internal EEPROM

-Z(XDATA)EEPROM_I,EEPROM_N=_..X_EEPROM_START-_..X_EEPROM_END

/*
* __near declared constant objects
*
* This segment contains data that should be placed in an EXTERNAL ROM.
* The data stored in this segment include constant __near declared objects
* as well as string literals and aggregate initializers. The need for a _C
* segment can be eliminated by using the -y and --initializers_in_flash
* command line options. The use of these options will increase the size of
* the _I and _F segments.
*/
//-Z(CONST)NEAR_C=60-FFFF

/*
* __far declared objects
*
* These three segments contain objects that haven been declared with the
* __far keyword. After cstartup has run the _I segment has been initialized
* with the values in the _ID segment and the _Z segment has been cleared so
* that it contains all zeros.
*
* FAR_I must have the same offset
* from a 64 Kbyte boundary as FAR_ID
*
*/
-Z(FARDATA)FAR_I,FAR_Z,FAR_N=_..X_SRAM_BASE-_..X_SRAM_END

/*
* __far declared constant objects
*
* This segment contains data that should be placed in an EXTERNAL ROM.
* The data stored in this segment include constant __far declared objects.
* The need for a _C segment can be eliminated by using the -y and
* --initializers_in_flash command line options. The use of these options
* will increase the size of the _I and _F segments.
*/
//-Z(FARCONST)FAR_C=60-FFFFFF

/*
* __huge declared objects
*
* These three segments contain objects that haven been declared with the
* __huge keyword. After cstartup has run the _I segment has been initialized
* with the values in the _ID segment and the _Z segment has been cleared so
* that it contains all zeros.
*/
-Z(DATA)HUGE_I,HUGE_Z,HUGE_N=_..X_SRAM_BASE-_..X_SRAM_END

/*
* __huge declared constant objects
*
* This segment contains data that should be placed in an EXTERNAL rom.
* The data stored in this segment include constant __huge declared objects.
* The need for a _C segment can be eliminated by using the -y and
* --initializers_in_flash command line options. The use of these options
* will increase the size of the _I and _F segments.
*/
//-Z(CONST)HUGE_C=60-FFFFFF

/*
* Select reduced "printf" support to reduce library size.
* See configuration section in manual concerning printf/sprintf.
*/

/*Dlib*/
//-e_PrintfSmall=_Printf

/*Clib*/
//-e_small_write=_formatted_write
//-e_small_write_P=_formatted_write_P

/*
* Disable floating-point support in "scanf" to reduce library size.
* See configuration section in manual concerning scanf/sscanf */

/*Dlib*/
//-e_ScanfSmall=_Scanf

/*Clib*/
//-e_medium_read=_formatted_read
//-e_medium_read_P=_formatted_read_P

/* Suppress one warning which is not relevant for this processor */
-w29

/* Code will now reside in file aout.a90 or aout.d90, unless -o is specified */
/* .d90 is the default if debug system is linked (option -r) */
/* .a90 is the default without debugging. Default format is -Fmotorola */
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.