Search Results

Search results 1-2 of 2.

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

  • Hi, This is an example that shows that the optimization done by the compiler on the "const" variables is not necessary. // serial_number is placed in the flash section at FLASH_APPL_CONFIG_ADDR const uint32_t serial_number __attribute__((section(".appl_cfg"))) = 1; flash_page_erase(FLASH_APPL_CONFIG_ADDR); NRF_LOG_INFO("Serial number: %x", serial_number); The value printed is "1" and is incorrect due to the optimization made by the compiler (the compiler does not have to do such an optimization …

  • Hi, I want to prevent the compiler from optimizing for const variables. Is there an attribute that must be specified when declaring a const variable to instruct the compiler in this regard? Best regards, Neculai