DSPRelated.com
Forums

.cinit directive detail !

Started by Saqib Ali February 22, 2003
hi

where should the .cinit section should be stored ? in
ROM or RAM . If i am not wrong the .cinit section
contain uninitialized global variables ...

Thank you
Saqib



Hello Saqib

I am sure your question is not wether or not .cinit will *work* from either
ROM or RAM (because it will), but rather which is more efficient. Basicaly
I am going to read into your original (yet very legitimate) question and
after you read this you will have the answer you seek and be ready to
investigate and solve even deeper questions :-)

When an initialized variable is created, the variables assigned value must
be copied from some kind of constant storage. In a standalone system, this
would be a ROM, while for an EMU initialized system (RAM) you can load the
values from your hard disk directly into RAM.

The .cinit section might however be better described as a long list of
initializers. Basicaly each .cinit structure looks very much like a
bootloader section, containing three items. If I was to break it out as
memory it would look something like this.

0x00000001 ; number of items to copy
0x00809800 ; start address to copy to
0x12345678 ; value(s) to copy to address

0x00000003 ; number of items to copy
0x00809801 ; start address to copy to
0x11111111 ; value(s) to copy to address
0x22222222 ;
0x33333333 ;

0x00000000 ; 0 items to copy (terminate)
0x00809801 ; dont care
0x11111111 ; dont care
0x22222222 ; etc...
0x33333333 ;

In the end, each value is copied to what I like to call its 'runtime
location', creating a 'runtime image' just before execution begins. That is
to say, at the point where 'main' begins.

So basicaly we need some kind of loader that will copy each value to its
respective run time location. If you extract the code for c_int00 (in
boot.obj) you will find the .cinit section loader and you will find that
this loader is only called if a particular condition exists. If you can, it
would also not hurt to try single stepping through this code.

Interestingly, the EEPROM bootloader qualifies as a smart loader and can do
this as well, so it is possible to use the RAM model with a boot rom and
avoid the c_int00 cinit section copy.

Im sure this is as clear as mud now!

Awaiting your next question

Best regards,
Keith Larson

==================================================
At 02:34 PM 2/22/03 -0800, you wrote:
hi

where should the .cinit section should be stored ? in ROM or RAM . If i am
not wrong the .cinit section contain uninitialized global variables ...

Thank you
Saqib

+-----------+
|Keith Larson |
|Member Group Technical Staff |
|Texas Instruments Incorporated |
| |
| 281-274-3288 |
| |
| www.micro.ti.com/~klarson |
|-----------+
| TMS320C3x/C4x/VC33 Applications |
| |
| TMS320VC33 |
| The lowest cost and lowest power 500 w/Mflop |
| floating point DSP on the planet! |
+-----------+