Exclude variable from initialization

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Exclude variable from initialization

      I have a couple of variables in my program that need to survive a reset. Thus, I did:

      C Source Code

      1. volatile uint32_t _px __attribute((section (".non_init")));
      In flash_placement.xml, I added the section:

      XML Source Code

      1. <ProgramSection alignment="4" load="No" name=".non_init" />
      I am using the GNU linker.

      However, the variable seems to be zeroed at startup. I can find the .non_init section in the map file and it contains my variable.

      How can I solve this?
    • Hello,

      Thank you from your inquiry.
      The use of the section here appears to be correct. So it should be working.
      You should have the file thumb_crt0.s in your project. Here you can verify which sections are zeroed at startup and which are not.
      Is non_init zeroed here as well?

      Best regards,
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.