Linker command file

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

Linker command file

6,037 Views
RanT
Contributor I
Two questions:
1. How can I define the ".rom" section of an external lib as a seperated segment in the linker command file? (that will not include all the .rom section of the project)
2. I would like to locate two different buffers, that declared in same C file, in different memory addresses. How can I do it? (The relevant pragma does affect all the file "data" section)
Labels (1)
0 Kudos
6 Replies

490 Views
RanT
Contributor I
Please refer only to question #2 (two different buffers):
I would like to locate two different buffers (.data), that declared in same C file, in different memory address spaces.
How can I do it?
(The relevant pragma does affect all the file "data" section)
 
The target is Starcore SC140.
The CodeWarrior version is 1.0.3 build 6 (IDE 5.7.0) .
 
0 Kudos

490 Views
CrasyCat
Specialist III
Hello
 
So if it is for StarCore, you need to use an application configuration file.
Using #pragma rom_seg_name works too, but all constants within that module will be allocated in the same user defined segment.
Not sure that this is what you are looking for.
 
You define one or several  rom segments there and then you place your variables in the different segments.
 
configuration
view MyView
  section
     rom = [
                myConst1: ".MY_CONST_1",
                myConst2: ".MY_CONST_2",
               ]
  end section
  place (_tab) in myConst1
  place (_tab2) in myConst2
 
end view
end configuration
Then you place the two sections wherever you want in the linker control file.
 
Example below will place _tab at address 0x8007f000  and _tab2 at 0x80080000
.org 0x8007f000
.segment .myConst1, ".MY_CONST_1"
.org 0x80080000
.segment .myConst2, ".MY_CONST_2"
I am not sure where you have memory on your system, but this is the main idea.
Note that the constant are defined as tab and tab2 in the source code.
Compiler internally adds a _ prefix to symbol names.
 
I hope this helps.
 
CrasyCat


Message Edited by CrasyCat on 2007-05-21 02:33 PM
0 Kudos

490 Views
gene21
Contributor I

 

Hi,
I am a newbie to starcore. I would like to know how to create memory sections and place various buffers in different sections. I tried various methods including the one described in the forum (using the .appli file @  http://forums.freescale.com/freescale/board/message?board.id=CWCOMM&thread.id=4884
). I am interested in placing different uninitialized buffers (bss) present in various files in different sections. I am using 8144 system and I use only one core.Also, I currently work only on the simulator.
When I tried the method given in the above link, different segments were created but the buffers were not placed in them. These segments read zero bytes and the buffers were present in the default bss section only.
Please find attached the linker command file (common.txt) and the configuration file.
I have created two data segments mydata1 and mydata2 and am trying to place the buffers in the DDR section (see the last few lines of the attached common.txt).
Any help is greatly appreciated.

Regards,
Gene

 

 

overlay.appli.txt

common1.txt

Message Edited by t.dowe on 2009-09-04 11:09 AM
0 Kudos

490 Views
gene21
Contributor I
Hi,
    I could finally create sections using #pragmas. I got this working after disabling the global level optimizations. However, I am still unable to move the buffers to the different sections using the configuration file. Also, Can anyone tell me the difference between the .cmd file and .lcf file. I find that in some examples .lcf files are used and in some others .cmd file is used. Why is this so?

Regards
Gene
0 Kudos

490 Views
CrasyCat
Specialist III
Hello
 
1- Using an application configuration file to place a variable in a user defined section
 
Suppose you want to allocate a global variable called MyTable into a section called MyTableSec, you can create an application configuration file looking as follows:
Code:
configuration view test     section      data = [data1:"MyTableSec"]     end section        place (_MyTable) in data1 end view
   use view test
end configuration

 
The compiler adds a _ prefix to the symbol name internally. So you need to write _MyTable to allocate symbol MyTable in a  specific section.
 
2. .lcf or .cmd
 
lcf and cmd files are both used as linker command file. Extension associated with the file actually depends on who did create the file initially.
Some people prefer .cmd. Other prefer .lcf.
 
 
CrasyCat
0 Kudos

490 Views
CrasyCat
Specialist III
Hello
 
- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
  To retrieve that info:
    - Start CodeWarrior
    - Select Help -> About Freescale CodeWarrior
    - Click on "Install Products"
    - CodeWarrior version used is displayed on top in the Installed Products dialog.
 
CrasyCat
0 Kudos