Powerpc ROM to RAM linker question.

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

Powerpc ROM to RAM linker question.

Jump to solution
1,627 Views
MartenH
Contributor I

Hi,

I'm trying to do something I thought was very simple, have the .data segment load address placed in ROM, but the execution address in RAM. I've done a slightly modified script from the examples.

 

I'm not using the all the __start, __init_hardware, etc things, instead I have adpated the script to the old way of doing things (for me anyway), ie code that copies from address __DATA_ROM to __DATA_RAM with size __DATA_RAM - __DATA_END.

 

The script is attempting to place the load address of .data in flash, and the execution address of .data in sram.

My problem is however that the linker seems to ignore the "LOAD(ADDR(__DATA_ROM))" part of the script. Loading the .elf will place data directly into the execution address. I had expected the __DATA_ROM to be loaded with the .data section.

So, to my questions

  1. I'm I misunderstanding the way LOAD() works?
  2. Used to ld (binutils) so I started looking in the lines of "section : { *(.data) } > ram AT> sram" and found  "sectionName : [AT (loadAddress)] {contents} > segmentName", page 206 in the "CodeWarrior Development Studio for Power Architecture® Processors Build Tools Reference". However, I've tried every possible way to get the linker to accept the AT but it just complains that it expects a "{". So, is this at all supported? (documention problem?)


Cheers,

/M


Labels (1)
0 Kudos
Reply
1 Solution
743 Views
CrasyCat
Specialist III

Hello

 

Look at options  -romaddr & -rambuffer.

 

But you will need to add a function which is actually initializing the global data to your application.

 

Implementation of this function is linker specific, so you cannot keep it generic.

 

CrasyCat

View solution in original post

0 Kudos
Reply
4 Replies
743 Views
CrasyCat
Specialist III

Hello

 

According to my understanding you want to get initialization value for global variable allocated in flash and copied over to RAM at start up.

 

Am I right?

 

If this is what you intend to do, make sure to generate a ROM Image for your application.

In this purpose you need to check Generate ROM Image in EPPC Linker panel.

 

If you have created your project using the wizard, the ROM Version build target has the appropriate settings.

Note that you will need to invoke the function __init_data implemented in __start.c to set the variables to their initialization value (i.e. copy values from ROM to RAM).

 

CrasyCat

0 Kudos
Reply
743 Views
MartenH
Contributor I

Hi

 

According to my understanding you want to get initialization value for global variable allocated in flash and copied over to RAM at start up.

 

Am I right?
Yes

 

If this is what you intend to do, make sure to generate a ROM Image for your application.

In this purpose you need to check Generate ROM Image in EPPC Linker panel.

 

I was not clear in my previous post. I do not use the ColdWarrior IDE at all, just the command line tools. The reason for not using __start is that I support mulitple compilers in my environment and I want to keep linkfiles and startup code as common as possible.  Does the "Generate ROM Image in EPPC Linker panel" set any options to the linker?

Cheers,

/M

 

 

0 Kudos
Reply
744 Views
CrasyCat
Specialist III

Hello

 

Look at options  -romaddr & -rambuffer.

 

But you will need to add a function which is actually initializing the global data to your application.

 

Implementation of this function is linker specific, so you cannot keep it generic.

 

CrasyCat

0 Kudos
Reply
743 Views
MartenH
Contributor I

Thanks, the options did the trick.

0 Kudos
Reply