Quantcast
Channel: Tools
Viewing all articles
Browse latest Browse all 91752

Forum Post: c55x: How to zero initialize .bss

$
0
0

Zero-initializing .bss is a standard function of startup code, but unfortunately not for c55x.

It can be done as follows.

 

Your linker .cmd file has something like this:

   .bss      > DARAM0

Change it to:

   .bss      { *(.bss*) } > DARAM0

 

This will auto-magically give you the symbols __bss__ and __end__, denoting the start and end of the .bss section.

With these you can simply memset the area:

void zero_init(void)
{
  extern unsigned char __bss__;
  extern unsigned char __end__;
  memset(&__bss__, 0, &__end__ - &__bss__);
}

 

Call it during startup, for example just before auto_init in boot.asm.

 

BR. Leo.


Viewing all articles
Browse latest Browse all 91752

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>