[an error occurred while processing this directive]
|
Это кусок команд файла для линковщика
/* --------------- Overlay module ------------------------- */
UNION: run=0x20500 /* this is in SARAM0*/
{
.text_Module_0 : load = SARAM2, align 0x100,
{
Module_0_Start=.;
Module_0.obj(.text)
_Module_0_Length=. - Module_0_Start;
}
/*------------------------------------*/
.text_Module_1 : load = SARAM2, align 0x100,
{
Module_1_Start=.;
Module_1.obj(.text)
_Module_1_Length=. - Module_1_Start;
}
/*------------------------------------*/
.text_Module_2 : load = SARAM2, align 0x100,
{
Module_2_Start=.;
Module_2.obj(.text)
_Module_2_Length=. - Module_2_Start;
}
}/*end UNION*/
//-------------------------------
это вот в файле
asm (" .global _Module_0 ");
asm (" .label _Module_0 ");
Только эта фишка носит туда сюда сразу модули - грубо 1 Цэ файл
вы можете положить каждую функцию в отдельный файл :)
Хотя я думаю что носить по памятям модули всеже интереснее. чем отдельные функции :)
Переменной Module_x_Length можно пользоваться для вот такого перемещения
// -------- external variable ----------
extern UINT32 Module_0; // load adress
extern UINT32 Module_0_Length;
extern UINT32 Module_1; // load adress
extern UINT32 Module_1_Length;
extern UINT32 Module_2; // load adress
extern UINT32 Module_2_Length;
// ------- declaration -------------
//--------------------------------------------
UINT16 main()
{
// ---- clear run memory -> for loader demonstration ----
memset((pUINT16)0x10280,0,0x200);
// ------- transfer Module_0 code to memory & call --------
Module_loader((pUINT16)0x20500,(pUINT16)&Module_0,(UINT32)&Module_0_Length);
Module_0_Entry_point();
....
void Module_loader(pUINT16 RunAddress,pUINT16 StoreAddress,UINT32 ModuleLegth)
{
UINT32 Temp;
UINT16 Len;
pUINT16 Source, Destination;
Len=(ModuleLegth>>1)&0xffff;
Temp=(UINT32)(StoreAddress);
Source=(pUINT16)(Temp>>1);
Temp=(UINT32)(RunAddress);
Destination=(pUINT16)(Temp>>1);
memmove(Destination,Source,Len+1);
}
memmove(Destination,Source,Len+1);
в общем :)
E-mail: info@telesys.ru