This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

c55x: How to zero initialize .bss

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.