title: Static variable doesn't initialize to given value
body: <p>I have a <strong>static</strong> "init" variable to run a function once on startup, <em>(RTOS)</em> but it seems to initialize to a random value. If I remove the <strong>static</strong> tag, everything works great. <em>(Except for the obvious issue of it running the init function every pass.)</em> Could anyone give more insight as to why this isn't working or perhaps a better way to achieve this?</p>
  
  <p>Example code:</p>
  
  <pre><code>void ManageStructures()
  {
      // Variable declarations/definitions
      static uint8_t StructInitialized;
      // Have also tried "static uint8_t StructInitialized = 0", neither worked
  
      // Function prototypes
      void InitStruct();
  
      if (!StructInitialized)
      {
          StructInitialized= 1;
          InitStruct();
      }
      Test = StructInitialized;
  </code></pre>
  
  <p><strong>edit</strong>: I apologize for the lack of information. This is for a company and I am trying to stay within the bounds of our public information policy. The MCU is a STM32F7 series using the "Ac6 STM32 MCU GCC" toolchain. I am not well versed in compiler operations so it may take me longer to find answers to the compiler or makefile related questions.</p>
  
  <p><strong>edit</strong>: It has become clear that this is an issue with the compiler or linker scripts and not my code. That being said, it has also become abundantly clear that I need to learn more about toolchains, linker scripts, and compilers in general before getting to the root of this issue. I'll return to this question once I have become familiar enough to give valuable feedback or answer it myself. Thank you everyone for the feedback and direction!</p>