Help on putting the code in SRAM - CW 5.9.0 for ColdFire

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

Help on putting the code in SRAM - CW 5.9.0 for ColdFire

1,555 Views
Remix
Contributor I
Hi, I'm working on a project with the ColdFire 5235, in wich I try to put some code running in SRAM

I declared the code that I want in sram as follows

_declspec(text2)voidSupervisioneComandi(void)

 and I put the following lines on the .lcf file

.text :       // here I want to put the code in FLASH
{
___VECTOR_RAM = .
;
.= ___VECTOR_RAM +
0x400;
.= ALIGN(0x04);
*(.text)      

*(.init)      
*(.fini)      
*(.rodata) 

__START_DATA_ROM = .

} > ram1


// here I want to put the initialized data, the ROM values to initialize the data starts from __START_DATA_ROM 
.data: AT(__START_DATA_ROM)
{
___DATA_RAM = .
;
*(
.data)
___DATA_END = .
;

} > ram2


// here I want to put the sram code; the ROM image of that code will be immediatly after the initialization data

.text2 :  AT(__START_DATA_ROM + ___DATA_END - ___DATA_RAM)
{
___SRAM_START = .;
*(.text2)
___SRAM_END = .
;
} > sram

and this works.

My problem is, I have some other files, wich code I want also to run in SRAM, but they comes from a third-part graphic library, so I am unlikely to modify directly the source code.
Putting a line like this :

.text2 :  AT(__START_DATA_ROM + ___DATA_END - ___DATA_RAM)
{
___SRAM_START = .;

*(.text2)
gdisp.c (.text) 
___SRAM_END = .
;
} > sram

 doesn't work, because the file code of gdisp.c will be first captured in the ram1 section.

In the previous command-line based compiler, I do it directly by adding a switch when compiling , but in the CodeWarrior IDE, it is possible to assign some compilation switch only to a file?

Or, is there someone havings some other hints to do this operation?

Thank you

Stefano

Labels (1)
0 Kudos
3 Replies

361 Views
CrasyCat
Specialist III
Hello
 
You need to specify the .text2 section before the .text section.
 

// here I want to put the sram code; the ROM image of that code will be immediately after the initialization data

.text2 :  AT(__START_DATA_ROM)
{
___SRAM_START = .;
gdisp.c (.text) 
*(.text2)
___SRAM_END = .
;
} > sram

.text :       // here I want to put the code in FLASH
{
___VECTOR_RAM = .;
.= ___VECTOR_RAM +
0x400;
.= ALIGN(0x04);
*(.text)      

*(.init)      
*(.fini)      
*(.rodata) 

__START_DATA_ROM = .

} > ram1


// here I want to put the initialized data, the ROM values to initialize the data starts from __START_DATA_ROM 
.data: AT(__START_DATA_ROM + SIZEOF(.text2))
{
___DATA_RAM = .
;
*(
.data)
___DATA_END = .
;

} > ram2

I did try with CodeWarrior for Coldfire V7.0 and it is working fine.

 

CrasyCat
0 Kudos

361 Views
Remix
Contributor I
Dear Cat,
I've already tryied to specify .text2 area before .text1, as you said, but the error that i got is :
 
Linker Error
Symbol not found :  __START_DATA_ROM
 
Did you declare this symbol previously in the lcf file, in some particular way?
 
My version of IDE is 5.9.0x
 
 
 
 
0 Kudos

361 Views
CrasyCat
Specialist III
Hello
 
I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.
 
CrasyCat
0 Kudos