Where are the constant mutable variables stored in c?

In which section is a constant mutable variable stored in c.? In microcontrollers, we must put such variables in RAM. Correctly?

+3
source share
4 answers

A const volatilemeans that your C program cannot legally change it, but something else. It would be logical to put this variable in RAM, but the compiler will not complain if you report it (via the linker script or a similar option) for placement in ROM. It may also be useful to find this variable if any device with memory mapping is, for example. read-only timer counter register or ADC output register.

+7
source

Volatile , . , , .

+9
  • frame-stack

  • , -.bss

  • , -

  • -

  • -

  • Const - ROM

  • -

  • - cpu

  • Const volatile - ,

+9

const , , flash ROM. , , - , . , .

volatile , , .

+3
source

All Articles