Question
Using __attribute__((__section__())) stops code running?
Posted on November 23, 2012 at 03:16
Hi all,
Bit of a strange one... When i include this line in one of my C source files, my software no longer starts up after reset correctly (jumps off into no-mans land).const
unsigned
char
settings[0x4800] __attribute__((__section__(
''.settings''
), used));
With this line commented out, everything works just fine.
Anyone know why this would be the case?
Relevantsections of the linker scripts:
MEMORY
{
/* main program ram (48Kb) */
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0xC000
/* startup boot jump (20 bytes) */
MINI_BOOT (rx) : ORIGIN = 0x8000000, LENGTH = 0x14
/* manufacturing data (2028 bytes) */
MANUF_DATA (rw) : ORIGIN = 0x8000014, LENGTH = 0x2048 - 0x16
/* settings data storage (18Kb) */
SETTINGS (rw) : ORIGIN = 0x8000800, LENGTH = 0x4800
/* user data storage (2Kb) */
USER_DATA (rw) : ORIGIN = 0x8005000, LENGTH = 0x800
/* extra boot loader code (22Kb) */
BOOT_LOADER (rx) : ORIGIN = 0x8005800, LENGTH = 0x5800
/* main program flash (216Kb) */
FLASH (rwx) : ORIGIN = 0x800B000, LENGTH = 0x35000
/* end at 0x8040000 */
}
SECTIONS
{
/* FLASH **************************/
.settings :
{
. = ALIGN(4);
KEEP(*(.settings))
. = ALIGN(4);
} > SETTINGS
.user_data :
{
. = ALIGN(4);
KEEP(*(.user_data))
. = ALIGN(4);
} > USER_DATA
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector))
/* Startup code */
. = ALIGN(4);
} > FLASH
.text :
{
. = ALIGN(4);
*(.text)
/* remaining code */
*(.text.*)
/* remaining code */
*(.rodata)
/* read-only data (constants) */
*(.rodata.*)
*(.glue_7)
*(.glue_7t)
*(.vfp11_veneer)
*(.gcc_except_table)
. = ALIGN(4);
/* These are for static initializers, constructors, and destructors */
KEEP(*(.init))
KEEP(*(.fini))
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE_HIDDEN (__fini_array_end = .);
} > FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.ARM.exidx :
{
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} > FLASH
. = ALIGN(4);
_etext = .;
_sidata = _etext;
........................
Thanks in advance!