Reply by tms320f28234 April 4, 20092009-04-04
I am working on a project porting a medium sized legacy project from a
LF2407A to a 28335. In the legacy code, the software relies on the .bss
section being initialized to zero before the C code runs. For whatever
reason (maybe part of the original hardware design), the old software
was able to run because it assumes external memory would be initialized
before it ran.

When I use the emulator with the 28335, it appears that the loader is
indeed clearing the .bss section.

When running from EEPROM, the data in .bss is random.

What I need is to be able to run from FLASH or RAM and find an easy way
to clear out the .bss (maybe in CodeBranch.asm) before the C code has a
chance to run.

While I am aware that the code should explicitly intialize variables
rather than using some trick, it would be a fairly involved job to hunt
down every variable (and large arrays) to make sure they are initialized
properly. If there is no clean and easy way to do this, I may be forced
to.

While I could use some hard-coded memory erasure routine using by
analyzing the output map, that seems overly complicated and prone to
errors.

Is there some easy trick to get the starting and ending address of the
.bss segment short of analyzing the map file? Maybe some hiddien pragmas
or assembly language tricks to achieve this goal?

Thank you in advance.

PS - Here is a discussion of this very topic:

http://www.dsprelated.com/groups/code-comp/show/444.php


_____________________________________