[an error occurred while processing this directive]
Ответ: Точно!!!
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
миниатюрный аудио-видеорекордер mAVR

Отправлено Bill 24 июля 2002 г. 14:19
В ответ на: Вот это объяснение отправлено Илья 24 июля 2002 г. 14:06

Q. I get the following errors or line of errors when I compile:

::Can't find 0x64 words for psect rbss_0 in segment BANK0 (error)

A. All this gibberish means is that theres not enough ram to fit the variables in. In the 16F876, there are 4 banks of 96 bytes. Move some variables to another bank, by the following method:

unsigned char array_char[79]; //goes in bank0, 96 bytes excluding overhead
bank1 unsigned int array_int[40]; //goes in bank1, 96 bytes excluding overhead
bank2 unsigned long array_long[24]; //goes in bank2, 96 bytes of 32-bit longs
bank3 float array_float[30]; //goes in bank3, 96 bytes of 24-bit floats

After this, use the variables as per normal.

However, there are some issues with passing pointers. For example, a function that accepts a pointer can only accept it from the same bank. This is illustrated by the code below.

/* the following C line wouldn’t work – have to specify bank where pointer comes from, otherwise produces error “:Fixup overflow in expression”*/

//strcpy(unsigned char *to,unsigned char *from)
//works fine
strcpy(bank2 unsigned char *to,bank1 unsigned char *from)
{
while(*to++ = *from++); //copies strings
}
bank1 unsigned char x[3];
bank2 unsigned char y[3];

main()
{
x[0]=’O’;x[1]=’K’;x[2]=0; //x contains string ‘Ok’
strcpy (&y[0],&x[0]); //now array y contains string ‘Ok’
}

The following error is produced by passing pointers in different banks, so to fix it refer to the code above.

project.obj:33:Fixup overflow in expression (loc 0xFD2 (0xFCC+6), size 1, value 0xA1) (error)


Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru