Copying EWL function to RAM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Copying EWL function to RAM

跳至解决方案
762 次查看
happyhands
Contributor I

Hello,

 

I have successfully copied and ran functions to RAM.  I am using a MCF51AC256 (ColdFire v1) and one of my RAM functions uses a division but the corresponding EWL __ldivu__ function is still in rom.  To put it in ram, I have tried to use the linker LCF file like this:

 

 

  .data : AT(___ROM_AT)
  {

 

 

   ...

 

 

    __START_SDATA = .;
    *(.sdata)
    *(.ram_code)
    OBJECT (__ldivu__, CF_runtime.c)
    . = ALIGN (0x4);
    __END_SDATA = .;

    ___DATA_END = .;
    __SDA_BASE = .;
    . = ALIGN (0x4);
  } >> userram

 

 

But it said it can't find __ldivu__.  I also tried:

 

 

CF_runtime.c (.text)

 

 

But it said it can't find CF_runtime.c even if the right path is listed in the ColdFire Linker Tool Settings Command Options.

I also tried the same thing with CF_runtime.o and librt.a

 

How do I tell the linker to put an EWL function into RAM?

 

Thank you

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
487 次查看
CrasyCat
Specialist III

Hello

 

There are 2 problems here.

 

1- Inside of the .lcf file you need to use the function linkage name.

    The compiler internally adds a _ prefix to all objects with global scope.

    So the linkage name for function __ldivu__ is ___ldivu__ (3 leading underscore characters).

 

2- As the function is stored in the library file you need to reference the library name in the OBJECT command.

    Please check the .xMAP file to retrieve the exact name of the library you are using.

 

The OBJECT command should then look as follows (provided you are linking the library librt.a to your application):

         OBJECT( ___ldivu__, librt.a)


 

CrasyCat

在原帖中查看解决方案

0 项奖励
回复
2 回复数
488 次查看
CrasyCat
Specialist III

Hello

 

There are 2 problems here.

 

1- Inside of the .lcf file you need to use the function linkage name.

    The compiler internally adds a _ prefix to all objects with global scope.

    So the linkage name for function __ldivu__ is ___ldivu__ (3 leading underscore characters).

 

2- As the function is stored in the library file you need to reference the library name in the OBJECT command.

    Please check the .xMAP file to retrieve the exact name of the library you are using.

 

The OBJECT command should then look as follows (provided you are linking the library librt.a to your application):

         OBJECT( ___ldivu__, librt.a)


 

CrasyCat

0 项奖励
回复
487 次查看
happyhands
Contributor I

Thank you.

 

The linker does recongize it now.  It says "___ldivu__(.text) in file librt.a was already linked in", but I'll take care of that.

 

Cheers

0 项奖励
回复