This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Easy way to put a global C++ class into ZI segment (init to zero)?

Hi,
I am just doing some first test with C++ for my STM32F4 controller (coming from C programming - I did not use C++ for controllers before, only for Windows programming).

I want to use mainly static / global classes.

For most of these global classes, I expect all variables to be initialized to zero.

Is it possible, to locate such classes into the ZI data space, so that they are initilized to zero at startup with optimum speed?

Parents
  • I now tested it, as far as I see it, the variables of global classes are put into the RW segment, but the RW segment also is initialized to zero. (and nicely it does not matter whether I define the class variables as static or not - so I can skip the static).

    That's ok for me.

    Just I would sleep calmer, if this would be defined somehow in the documentation, but I did not find anything. So I hope this will not change in some future?

Reply
  • I now tested it, as far as I see it, the variables of global classes are put into the RW segment, but the RW segment also is initialized to zero. (and nicely it does not matter whether I define the class variables as static or not - so I can skip the static).

    That's ok for me.

    Just I would sleep calmer, if this would be defined somehow in the documentation, but I did not find anything. So I hope this will not change in some future?

Children