DSPRelated.com
Forums

Moving one bss var into .xExt_Ram

Started by Jacob Christ December 7, 2002

What exactly do you mean by this? Isn't the bss section
uninitialized data? Why would you need to copy anything?

Jacob

--- In , "jdw_atx <jdw_atx@y...>"
<jdw_atx@y...> wrote:
(snip)
> However, based on your LCF, it doesn't look like you ever actually
> copy the data to the .xExtRAM segment at runtime. Instead, it just
> looks like you do a straight load to Program ROM and that's it.



Jacob,

Yes, it is uninitialized data and you're right you don't need to copy
it to anything. That's why I was questioning why he had the mirrored
segment and the regular segment in MEMORY at all because normally
that's only employed when wanting to do ROM-->RAM copying but that
wasn't the case so I was just pointing that out. That's all I was
trying to say and I hope I didn't confuse anybody.

Regards,
John Whitney

--- In , "Jacob Christ <jacob@p...>"
<jacob@p...> wrote:
>
> What exactly do you mean by this? Isn't the bss section
> uninitialized data? Why would you need to copy anything?
>
> Jacob
>
> --- In , "jdw_atx <jdw_atx@y...>"
> <jdw_atx@y...> wrote:
> (snip)
> > However, based on your LCF, it doesn't look like you ever
actually
> > copy the data to the .xExtRAM segment at runtime. Instead, it
just
> > looks like you do a straight load to Program ROM and that's it.


In addition to what Jacob has quite correctly pointed out, 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, in the MEMORY section:
.xExtRAM (RW) : ORIGIN = 0x8000, LENGTH = 0x7F80
.xExtRAM_Mirror (RWX) : ORIGIN = 0x8000, LENGTH = 0x7F80

In the linker.cmd file, in 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 0x7F80
/* 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.

I hope the members of this group find this information to be useful.

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: Jacob Christ <> [mailto:]
Sent: Tuesday, December 10, 2002 7:35 AM
To:
Subject: [motoroladsp] Re: Moving one bss var into .xExt_Ram
What exactly do you mean by this? Isn't the bss section
uninitialized data? Why would you need to copy anything?

Jacob

--- In , "jdw_atx <jdw_atx@y...>"
<jdw_atx@y...> wrote:
(snip)
> However, based on your LCF, it doesn't look like you ever actually
> copy the data to the .xExtRAM segment at runtime. Instead, it just
> looks like you do a straight load to Program ROM and that's it.
_____________________________________
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/