CodeWarrior and .LCF file question

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

CodeWarrior and .LCF file question

Jump to solution
3,203 Views
FlexArray
Contributor I

Using CodeWarrior 6.2 on a Coldfire V1 core. 

 

I am very new to CW ...

 

I am having  a problem using CodeWarrior to set up  memory segment that I require in the  .LCF file.

Using PE (Processor Expert), I did manage to set aside an area of RAM and call it "myram". However,  I cannot find the proper way to place my buffer into this area.  CodeWarrior always makes the data <userram> and places it in  “ .sbss “ section, thus it is initiated at start up / reset.  I spent many  hours reading but could not find the right procedure to get CodeWarrior to generate this section(below) in the .LCF file.  ( I even tried modifying startup.c,  but no luck)            

 

This is my work around, which I would like to avoid. 

 

Here is the what I have to do after each startup of CodeWarrior ,

-   I  first compile the program , CW has an error, ...unresloved reference

-   I then edit the “.lcf “ file and paste in “ the 'Myram' section below”. I place it before  .custom

-    Then  I compile again, all address are resolved,

-     This memory area is placed after the <useram> area and never gets initialized, ( Obviously it gets over-written if use new memory in the code. This is acceptable, Having an Origin using the PE would have been great but as mentioned above I could not find the proper syntax)   I initialize this area in the code.  This is for testing code. ( This information will be from another device on Rev 2 of the my PCB)

 

STEP 1

In one of the 'C'  modules ….

-          Here is the staemnt that I use place my Default_Parameters..

 

#pragma define_section data_type ".myram"  far_absolute RW

__declspec (data_type) unsigned char DEF_PARAM_buf[55];

#pragma DATA_SEG DEFAULT

 

Step 2

I then open up the LCF and place the following  into it

                >>>This is what I would like CodeWarrior to create for m <<<<

 

  .myram :

  {

    ___MYRAM_START = .;

    __START_MYRAM = .;

    *(.myram)

    . = ALIGN (0x4);

    *(COMMON)

    __END_MYRAM = .;

    ___MYRAM_END = .;

 

    . = ALIGN(0x4);

  } >> userram

 

 I have attached a jpg of the LCF placement position and the resulting MAP output.

 

Their must be a way to do this using CW. I only have to edit this at the start of each day/ or a CW Restart.

 

 Any help will be appreciated. 

 

Cheers 

 

LCFplacement.jpg

MAPresult.jpg

Message Edited by t.dowe on 2009-11-02 09:22 AM
Labels (1)
0 Kudos
1 Solution
558 Views
ProcessorExpert
Senior Contributor III

Hello,
 
here are steps to store an varibale (array) in additional memory area defined by user in Processor Expert:

1. open build options tab in the cpu bean
2. unfold the "Segment 1" group (userram) and set its size to 0x7000
3. add new memory segment by clicking on "+" button
4. put "testram" into "Name" property and start address set to 0x807000 and size to 0x1000
5. unfold "Access permission" group and set it to RWX
6. start code generation
 
The steps above generates the following code into lcf file.
 
MEMORY {
   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00007000
   testram     (RWX) : ORIGIN = 0x00807000, LENGTH = 0x00001000
}
 
As I wrote before Processor Expert provides properties only for generation code into MEMORY in lcf file.
For adding code into SECTION the user has to disable generation of lcf file and edit it manually.
 

7. set "Generate LCF file" property to "no".
8. open the lcf file for example using "View linker file" menu command from CPU bean pop-up menu
9. put the following code into SECTION and save the lcf file
 
  .testram :
  {
    * (.testram)
    . = ALIGN (0x4);
  } > testram
 

10. Open the main.c and before main function put the following code:
 
#pragma define_section mySection ".testram" far_absolute RWX
__declspec (mySection) volatile byte arrayx[4];
 
Please find attached project that I have created using steps above for CW V6.2.2.
 
best regards
Vojtech Filip
Processor Expert Support Team

 

user_ram_ac256.zip

Message Edited by t.dowe on 2009-11-20 02:18 PM

View solution in original post

0 Kudos
4 Replies
558 Views
ProcessorExpert
Senior Contributor III
Hello,
 
In general Processor Expert generates the prm (lcf) file according to the settings in "Build options" tab in CPU bean inspector window.
 
To enable/disable generation of prm (lcf) file there is the "Generate LCF file" property on "Build options" tab in CPU bean inspector window.
 
To disable generation of prm file switch "Generate LCF file" property to "no".
 
best regards
Vojtech Filip
Processor Expert Support Team
Message Edited by ProcessorExpert on 2009-11-02 12:18 PM
Message Edited by ProcessorExpert on 2009-11-02 12:18 PM
0 Kudos
558 Views
FlexArray
Contributor I

Thank you ProcessorExpert...

 

What you have suggested does eliminate the tedious step, of my 'cut an paste' into the LCF file.

 

I would like to persue this 'thread' a bit further

 

I have attched three Jpg's relative to this question,

 

What is the correct syntax in CodeWarrior to 'store data' in the defined ProcessorExpert memory Range.

 

I have tried many different ways. I could not get the V1 Coldfire example(see dseg3.jpg) to work.

 

Any information will be appreceiated.

 

 

Cheers

 

dseg1.JPG

dseg2.JPG

dseg3.JPG

Message Edited by t.dowe on 2009-11-03 09:35 AM
0 Kudos
559 Views
ProcessorExpert
Senior Contributor III

Hello,
 
here are steps to store an varibale (array) in additional memory area defined by user in Processor Expert:

1. open build options tab in the cpu bean
2. unfold the "Segment 1" group (userram) and set its size to 0x7000
3. add new memory segment by clicking on "+" button
4. put "testram" into "Name" property and start address set to 0x807000 and size to 0x1000
5. unfold "Access permission" group and set it to RWX
6. start code generation
 
The steps above generates the following code into lcf file.
 
MEMORY {
   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00007000
   testram     (RWX) : ORIGIN = 0x00807000, LENGTH = 0x00001000
}
 
As I wrote before Processor Expert provides properties only for generation code into MEMORY in lcf file.
For adding code into SECTION the user has to disable generation of lcf file and edit it manually.
 

7. set "Generate LCF file" property to "no".
8. open the lcf file for example using "View linker file" menu command from CPU bean pop-up menu
9. put the following code into SECTION and save the lcf file
 
  .testram :
  {
    * (.testram)
    . = ALIGN (0x4);
  } > testram
 

10. Open the main.c and before main function put the following code:
 
#pragma define_section mySection ".testram" far_absolute RWX
__declspec (mySection) volatile byte arrayx[4];
 
Please find attached project that I have created using steps above for CW V6.2.2.
 
best regards
Vojtech Filip
Processor Expert Support Team

 

user_ram_ac256.zip

Message Edited by t.dowe on 2009-11-20 02:18 PM
0 Kudos
558 Views
FlexArray
Contributor I

Hello ProcessorExpert,

 

I loaded your sample project, modifed my project and 'success'. This is exactly what I required.

 

I am replying to thank you for taking the time to to present the answer in a such a clear manner.

 

( At present this was the only open issue I have in the project.[ at this time], It's like an unexpected ly xmas present )

 

Cheers

 

0 Kudos