0

I have foo[NUMBYTES] __attribute__((section(".bar")));

Why using this attribute .bar section? Because foo[] provides already some memory space. Is this for easy memory management?

1 Answers1

1

For bare metal code that run without an operating system, the section attribute ,__attribute__((section(".bar"))), is often used to:

  • Place symbols (data or functions) in a special memory space, such as RAM, FLASH or EEPROMs built into microcontrollers.
  • Place symbols at a special address, e.g. placing the interrupt vector table at the start of FLASH for ARM Cortex-M processors.
  • Group related symbols continuously, e.g. the Linux kernel groups initialization code that is only needed at boot together (see init section in linux/init.h) so it can free them later to save RAM.

Search your linker script for references to the named section (.bar) and you could probably make a good guess for its use.

scottt
  • 7,008
  • 27
  • 37