[an error occurred while processing this directive] [an error occurred while processing this directive]
Ответ:
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено Kuka 07 декабря 2001 г. 10:49
В ответ на: То есть,ответа не знаете? отправлено Я 06 декабря 2001 г. 19:56

Linker Location Controls
The second method of referencing explicit memory location is to declare the
variables in a stand-alone C module, and use the location directives of the BL51
Linker/Locator to specify an absolute memory address.
In the following example, assume that we have a structure called
alarm_control that we want to reside at address 2000h in xdata. We start by
entering a source file named ALMCTRL.C that contains only the declaration for
this structure.
.
.
.
struct alarm_st {
unsigned int alarm_number;
unsigned char enable flag;
unsigned int time_delay;
unsigned char status;
};
xdata struct alarm_st alarm_control;
.
.
.
The Cx51 compiler generates an object file for ALMCTRL.C and includes a
segment for variables in the xdata memory area. Because it is the only variable
declared in this module, alarm_control is the only variable in that segment.
The name of the segment is ?XD?ALMCTRL. The Lx51 Linker/Locator allows
you to specify the base address of any segment by using the location directives.
For BL51 you must use the XDATA directive, since the alarm_control
variable was declared to reside in xdata:
BL51 … almctrl.obj XDATA(?XD?ALMCTRL(2000h)) …
For LX51 the SEGMENTS directive is used to locate the segment in xdata
space:
LX51 … almctrl.obj SEGMENTS(?XD?ALMCTRL(X:0x2000)) …
This instructs the linker to locate the segment named ?XD?ALMCTRL at
address 2000h in the xdata memory area.
In the same way you may also locate segments in the other memory areas like
code, xdata, pdata, idata, and data. Refer to the A51 Macro Assembler User’s
Guide for more information about the Linker/Locator.

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

Ответы



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

E-mail: info@telesys.ru