Copying EWL function to RAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copying EWL function to RAM

Jump to solution
599 Views
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

Labels (1)
0 Kudos
1 Solution
324 Views
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

View solution in original post

0 Kudos
2 Replies
325 Views
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 Kudos
324 Views
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 Kudos