[an error occurred while processing this directive]
Ой, я как-то нарывался на эту ошибку. В службе поддержки посоветовали объявить переменные в другом *.c файле(+)
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Вопрос 08 июля 2003 г. 12:14
В ответ на: Hitech PICC18 в psect bss кончилось место(+) отправлено abivan 08 июля 2003 г. 10:47

В общем привожу свое письмо (на ломаном английском) :

/////////////// мое письмо ///////////////
Hi!
I think compiler (linker) PICC-18 v8.20PL4 has a memory allocation error.
See attached example for processor 18F242.
I can't declare variable (union) :

typedef union __table6 {
unsigned char c[ 56];
} table6;
table6 t6;
in my program because linker shows :
"Can't find 0x101 words (0x101 withtotal) for psect bss in segment RAM (error)".
But there is enought RAM for allocation "table6 t6" !

But I can declare other variable (array) with the same size :
unsigned char dummy[ sizeof(table6)] ;

I think this is a memory allocation error.

Best regards.
Tester.


///////////// прикрепленный файл с примером /////////////////
/* Program for processor 18F242
When I declare variable (see line 59):

table6 t6;

compiler (linker) picc18.exe shows :
Can't find 0x101 words (0x101 withtotal) for psect bss in segment RAM
(error).

But there are enought bytes RAM memory!!!!

When I declare variable with the same size (see line 63):
unsigned char dummy[ sizeof(table6)] ;
compiler (linker) works properly

I think this is a memory allocation error.
*/


#include "pic18.h"

#define MAX_BUFFER 125

typedef union __buf_union {
unsigned char c[ MAX_BUFFER];
} buf_union;

typedef struct __table2 {
unsigned char t[ 8] ;
} table2 ;

typedef struct __table3 {
unsigned char t[ 2];
} table3;

typedef union __table4 {
char c[32];
} table4 ;

typedef union __table5 {
char c[32];
} table5;

typedef union __table6 {
unsigned char c[ 56];
} table6;

volatile buf_union buffer; // ЎгдҐа ®Ў¬Ґ­

table2 t2;
table3 t3;
table4 t4;
table5 t5;


// NB!
// I can't uncomment declaration "table6 t6"
table6 t6;

// but I can uncomment declaration "unsigned char dummy[
sizeof(table6)]"
// it has the same size !!!
// unsigned char dummy[ sizeof(table6)] ;


volatile unsigned int foo ;
void main( void)
{
foo = sizeof( table6) ;

INTCON = 0;
do {
} while( 1);
}


//////////////////////////////////////////////////////////////
А вот что они мне написали в ответ :

This is a limitation in the way the compiler works. It is present to
drastically reduce code size. The bss psects are limited to one bank in
size (100h), although you may have as many of them as you like. Objects
that
are placed into the bss psect are uninitialised objects which are
multi-byte
in length. Note that you can still define single objects larger than
on bank in size; they are placed in a different psect. Char objects are
also placed elsewhere.

To get around this you can place variable definitions over multiple
files.
Since this only affects globally defined objects, this does not need to
alter the way the program is structured.


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

Ответы



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

E-mail: info@telesys.ru