[an error occurred while processing this directive]
Ответ: от буржуазных Кейлистов..... Можно, но через Ж.....
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

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

Отправлено ValterG 05 декабря 2002 г. 11:29
В ответ на: Как в Кейле С51 определить константу по определенному адресу в памяти программ отправлено Karloson 05 декабря 2002 г. 10:45

C51: LOCATING INITIALIZED VARIABLES AT ABSOLUTE ADDRESSES
QUESTION

I want to locate some intialized constants and variables in memory, but I can't initialize and locate them with the _at_ keyword. What's wrong?

ANSWER

C51 does not allow you to both locate a variable using the _at_ keyword and initialize it. You may use the linker to locate the variable.

For example, if you want to locate an initialized constant array into code space...

1. Declare your array as such:

char const code My_Array[] = {
1,2,3,4,5
};


2. Go to your linker map file a see what the segment name is for this array. Note that during this process you will probably get a warning about an unused function or something similar. This is because the compiler is expecting your array to be a function since you specified that it is in code space. Don't worry about this warning.

3. Use the BL51 CODE directive or the LX51 SEGMENTS directive to specify the location of the constant segment. If the C source file name is TEMP.C the constant segment is named ?CO?TEMP. The entry ?CO?TEMP(0x5000) in the linker directive locates the segment to absolute memory address 5000h.

If you use uVision2 and BL51 enter ?CO?TEMP(0x5000) under Options for Target - BL51 Locate - Code:. For LX51, enter ?CO?TEMP(0x5000) under Options for Target - LX51 Locate - User Segments.

SEE ALSO

http://www.keil.com/support/docs/130.htm
http://www.keil.com/support/docs/937.htm

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

Ответы



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

E-mail: info@telesys.ru