Forums

Linker Error When running program on FLASH

Started by sudamekedar August 29, 2003
hi,

I have developed a program for my DSP56f807evm board.
when i run that program on external RAM it runs fine, but when i try
to run it on Flash it gives linker error as

Link Error .xIntRAM
Reserved size is 0x00000e60 -- overflow 0x00000347

My linker.cmd setting for flash is :-

# .pInterruptVector (RX) : ORIGIN = 0x0000, LENGTH = 0x0086
.pInterruptVector (RX) : ORIGIN = 0x0004, LENGTH = 0x0082
.pFlash (RX) : ORIGIN = 0x0086, LENGTH = 0xEF7A
.pIntRAM (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pIntRAM_Mirror (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pBootFlash (RX) : ORIGIN = 0xF800, LENGTH = 0x0800
.xAvailable (RW) : ORIGIN = 0x0000, LENGTH = 0x0030
.xCWRegisters (RW) : ORIGIN = 0x0030, LENGTH = 0x0010
.xIntRAM (RW) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xIntRAM_Mirror (RWX) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xStack (RW) : ORIGIN = 0x0EA0, LENGTH = 0x0160
.xPeripherals (RW) : ORIGIN = 0x1000, LENGTH = 0x0800
.xReserved (R) : ORIGIN = 0x1800, LENGTH = 0x0800
.xFlash (R) : ORIGIN = 0x2000, LENGTH = 0x2000
.xExtRAM (R) : ORIGIN = 0x4000, LENGTH = 0xBF80
.xCoreRegisters (RW) : ORIGIN = 0xFF80, LENGTH = 0x0080

what changes are required in my .cmd file to incorporate this?

regards




You will have to move some of your .bss data to external xRAM, because there is
too much data, and it does not fit into internal xRAM. You can put xRAM .bss
sections into the external xRAM by doing the following in your Linker Command
File "linker.cmd":

In the linker.cmd file, in the MEMORY section:
.xExtRAM (RW) : ORIGIN = 0x4000, LENGTH = 0xBF80

In the "SECTIONS" section:
#*******************************************************************************
.DataForExtDataRAM :
{

# .bss sections

extram_data.c (.bss)

} > .xExtRAM
#*******************************************************************************

The above will put all uninitialized data (.bss) from the file "extram_data.c"
into the external xRAM area. Place as many filenames here as you need, to get
the internal xRAM usage down so it will fit into the available space (0x0E60
words). This block must be put into linker.cmd _BEFORE_ the block that puts all
the rest of the .bss data into internal xRAM, otherwise the '*' wildcard will
swallow up all of the .bss data.

In addition to this, there is another consideration you must keep in mind, when
you put .bss sections into external Data (X) RAM. The ANSI C runtime header is
supposed to initialize all .bss sections to zero. The Motorola SDK startup file
"arch.c" does this in the function archInitializeRAM(), you can see this file in
the following directory (for the 807 chip):
...\src\dsp56807evm\nos\sys
Where "..." is the base directory where you installed the SDK on your system
(C:\Development\DSP568xx\Moto_SDK in our systems here).

If you look in the "arch.c" file at the function archInitializeRAM(), you can
see that it only initializes the .bss sections for internal X RAM and internal P
RAM. For your external X RAM .bss section, you must either modify the SDK file
"arch.c" so it will initialize the external X RAM .bss section to zero, or you
must do it yourself in some startup code prior to entering the main() function.
We have chosen the second method, and an example from one of our systems is
shown below:

In the linker.cmd file, at the end of the SECTIONS section:
FExtRAM = ADDR(.xExtRAM);

In one of your application's header files:
#define EXTRAM_TEST_PAGE_SIZE 256
#define EXTRAM_TEST_TOTAL_SIZE 0xBF80
/* The location of the following array is defined in linker.cmd */
extern volatile WORD ExtRAM[];
/* Function prototypes */
void Global_Init( void ); // Global hardware and memory initialization

In your application's appconfig.c file, add this function, and call it from the
UserPreMain() function:
void Global_Init(void)
{
WORD i, temp, mask;
//
// Clear all of External RAM
//
i = 0;
temp = EXTRAM_TEST_TOTAL_SIZE;
while ( temp != 0 )
{
if ( temp > EXTRAM_TEST_PAGE_SIZE )
{
mask = EXTRAM_TEST_PAGE_SIZE;
}
else
{
mask = temp;
}
memset( ( void * )&ExtRAM[ i ], 0, mask );
i += mask;
temp -= mask;
// Update the COP Service Register to prevent a timeout
Update_COP_Service_Reg();
// Toggle the external watchdog timer output to prevent a timeout
Toggle_Ext_Watchdog_Output();
}
return;
}

(Note: Update_COP_Service_Reg() and Toggle_Ext_Watchdog_Output() are macros, and
are not shown in this example code.)

As you can see from the above example, we have chosen to zero all of the
external X RAM, instead of just the part that is used by the .bss sections. The
execution time of this startup code is immaterial, so it doesn't matter how long
it takes to zero all of this RAM. Also, we decided that it was far too much
work to attempt to put .data sections into the external X RAM chip, so this is
not allowed for in the above example code.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com

-----Original Message-----
From: sudamekedar [mailto:]
Sent: Friday, August 29, 2003 2:34 AM
To:
Subject: [motoroladsp] Linker Error When running program on FLASH hi,

I have developed a program for my DSP56f807evm board.
when i run that program on external RAM it runs fine, but when i try
to run it on Flash it gives linker error as

Link Error .xIntRAM
Reserved size is 0x00000e60 -- overflow 0x00000347

My linker.cmd setting for flash is :-

# .pInterruptVector (RX) : ORIGIN = 0x0000, LENGTH = 0x0086
.pInterruptVector (RX) : ORIGIN = 0x0004, LENGTH = 0x0082
.pFlash (RX) : ORIGIN = 0x0086, LENGTH = 0xEF7A
.pIntRAM (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pIntRAM_Mirror (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pBootFlash (RX) : ORIGIN = 0xF800, LENGTH = 0x0800
.xAvailable (RW) : ORIGIN = 0x0000, LENGTH = 0x0030
.xCWRegisters (RW) : ORIGIN = 0x0030, LENGTH = 0x0010
.xIntRAM (RW) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xIntRAM_Mirror (RWX) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xStack (RW) : ORIGIN = 0x0EA0, LENGTH = 0x0160
.xPeripherals (RW) : ORIGIN = 0x1000, LENGTH = 0x0800
.xReserved (R) : ORIGIN = 0x1800, LENGTH = 0x0800
.xFlash (R) : ORIGIN = 0x2000, LENGTH = 0x2000
.xExtRAM (R) : ORIGIN = 0x4000, LENGTH = 0xBF80
.xCoreRegisters (RW) : ORIGIN = 0xFF80, LENGTH = 0x0080

what changes are required in my .cmd file to incorporate this?

regards _____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/