ilord

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Now work with __attribute__ #12455
    ilord
    Participant

    Thank you.

    I have another solution. This is a work sample.
    My variables:
    __attribute__((section(“.strdata”))) volatile unsigned char EEPROM_txt1[16] = “some text”;
    __attribute__((section(“.strdata”))) volatile unsigned char EEPROM_txt2[16] = “asdasdsad”;

    __attribute__((section(“.eeprom”))) volatile unsigned char EEPROM_NumberOfTable = 3;

    are placed at 0x0800E000 and 0x0800FC00

    
    
    /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator]
     * Target: STM32F030C8
     * The file is provided under the BSD license.
     */
    
    ENTRY(Reset_Handler)
    
    MEMORY
    {
    	FLASH (RX)   : ORIGIN = 0x08000000, LENGTH = 64K
    	SRAM (RWX)   : ORIGIN = 0x20000000, LENGTH = 8K
    }
    
    _estack = 0x20002000;
    
    SECTIONS
    {
    	.isr_vector :
    	{
    		. = ALIGN(4);
    		KEEP(*(.isr_vector))
    		. = ALIGN(4);
    	} > FLASH
    
    	.text :
    	{
    		. = ALIGN(4);
    		_stext = .;
    
    		*(.text)
    		*(.text*)
    		*(.rodata)
    		*(.rodata*)
    		*(.glue_7)
    		*(.glue_7t)
    
    		KEEP(*(.init))
    		KEEP(*(.fini))
    		. = ALIGN(4);
    		_etext = .;
    
    	} > FLASH
    
    	.ARM.extab :
    	{
    		. = ALIGN(4);
    		*(.ARM.extab)
    		*(.gnu.linkonce.armextab.*)
    		. = ALIGN(4);
    	} > FLASH
    
    	.exidx :
    	{
    		. = ALIGN(4);
    		PROVIDE(__exidx_start = .);
    		*(.ARM.exidx*)
    		. = ALIGN(4);
    		PROVIDE(__exidx_end = .);
    	} > FLASH
    
    	.ARM.attributes :
    	{
    		*(.ARM.attributes)
    	} > FLASH
    
    	.preinit_array :
    	{
    		PROVIDE(__preinit_array_start = .);
    		KEEP(*(.preinit_array*))
    		PROVIDE(__preinit_array_end = .);
    	} > FLASH
    
    	.init_array :
    	{
    		PROVIDE(__init_array_start = .);
    		KEEP(*(SORT(.init_array.*)))
    		KEEP(*(.init_array*))
    		PROVIDE(__init_array_end = .);
    	} > FLASH
    
    	.fini_array :
    	{
    		PROVIDE(__fini_array_start = .);
    		KEEP(*(.fini_array*))
    		KEEP(*(SORT(.fini_array.*)))
    		PROVIDE(__fini_array_end = .);
    	} > FLASH
    
    	_offset = .;
     
        .strdata :
        {
            . = . + 0x0800E000 - _offset;
            *(.strdata*)
        } > FLASH	
    		
    	_offset = .;
        
    	.eeprom :
        {
            . = . + 0x0800FC00 - _offset;
            *(.eeprom*)
        } > FLASH
    
    	. = ALIGN(4);
    	_sidata = .;
    	
    	.data : AT(_sidata)
    	{
    		. = ALIGN(4);
    		_sdata = .;
    
    		PROVIDE(__data_start__ = _sdata);
    		*(.data)
    		*(.data*)
    		. = ALIGN(4);
    		_edata = .;
    
    		PROVIDE(__data_end__ = _edata);
    	} > SRAM
    
    	.bss :
    	{
    		. = ALIGN(4);
    		_sbss = .;
    
    		PROVIDE(__bss_start__ = _sbss);
    		*(.bss)
    		*(.bss*)
    		*(COMMON)
    		. = ALIGN(4);
    		_ebss = .;
    
    		PROVIDE(__bss_end__ = _ebss);
    	} > SRAM
    
    	PROVIDE(end = .);
    
    	.heap (NOLOAD) :
    	{
    		. = ALIGN(4);
    		PROVIDE(__heap_start__ = .);
    		KEEP(*(.heap))
    		. = ALIGN(4);
    		PROVIDE(__heap_end__ = .);
    	} > SRAM
    
    	.reserved_for_stack (NOLOAD) :
    	{
    		. = ALIGN(4);
    		PROVIDE(__reserved_for_stack_start__ = .);
    		KEEP(*(.reserved_for_stack))
    		. = ALIGN(4);
    		PROVIDE(__reserved_for_stack_end__ = .);
    	} > SRAM
    }
    
    
    
    in reply to: Now work with __attribute__ #12431
    ilord
    Participant

    Update.

    I googled :

    Problem adding section to linker script

    EEPROM – Flash

    but I dont understend how write the linker script. My script:

    /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator]
     * Target: STM32F030C8
     * The file is provided under the BSD license.
     */
    
    ENTRY(Reset_Handler)
    
    MEMORY
    {
    	FLASH (RX)       : ORIGIN = 0x08000000, LENGTH = 63K
    	EEPROM_DATA (X)  : ORIGIN = 0x0800FC00, LENGTH = 1K
    	SRAM (RWX)       : ORIGIN = 0x20000000, LENGTH = 8K
    }
    
    _estack = 0x20002000;
    
    SECTIONS
    {
    	.isr_vector :
    	{
    		. = ALIGN(4);
    		KEEP(*(.isr_vector))
    		. = ALIGN(4);
    	} > FLASH
    
    	.text :
    	{
    		. = ALIGN(4);
    		_stext = .;
    
    		*(.text)
    		*(.text*)
    		*(.rodata)
    		*(.rodata*)
    		*(.glue_7)
    		*(.glue_7t)
    		KEEP(*(.init))
    		KEEP(*(.fini))
    		. = ALIGN(4);
    		_etext = .;
    
    	} > FLASH
    
    	.ARM.extab :
    	{
    		. = ALIGN(4);
    		*(.ARM.extab)
    		*(.gnu.linkonce.armextab.*)
    		. = ALIGN(4);
    	} > FLASH
    
    	.exidx :
    	{
    		. = ALIGN(4);
    		PROVIDE(__exidx_start = .);
    		*(.ARM.exidx*)
    		. = ALIGN(4);
    		PROVIDE(__exidx_end = .);
    	} > FLASH
    
    	.ARM.attributes :
    	{
    		*(.ARM.attributes)
    	} > FLASH
    
    	.preinit_array :
    	{
    		PROVIDE(__preinit_array_start = .);
    		KEEP(*(.preinit_array*))
    		PROVIDE(__preinit_array_end = .);
    	} > FLASH
    
    	.init_array :
    	{
    		PROVIDE(__init_array_start = .);
    		KEEP(*(SORT(.init_array.*)))
    		KEEP(*(.init_array*))
    		PROVIDE(__init_array_end = .);
    	} > FLASH
    
    	.fini_array :
    	{
    		PROVIDE(__fini_array_start = .);
    		KEEP(*(.fini_array*))
    		KEEP(*(SORT(.fini_array.*)))
    		PROVIDE(__fini_array_end = .);
    	} > FLASH
    
    	. = ALIGN(4);
    	_sidata = .;
    
    	.data : AT(_sidata)
    	{
    		. = ALIGN(4);
    		_sdata = .;
    
    		PROVIDE(__data_start__ = _sdata);
    		*(.data)
    		*(.data*)
    		. = ALIGN(4);
    		_edata = .;
    
    		PROVIDE(__data_end__ = _edata);
    	} > SRAM
    
    	.eeprom_data :
    	{
    		*(.eeprom_data*);
    	} > EEPROM_DATA
    
    	.bss :
    	{
    		. = ALIGN(4);
    		_sbss = .;
    
    		PROVIDE(__bss_start__ = _sbss);
    		*(.bss)
    		*(.bss*)
    		*(COMMON)
    		. = ALIGN(4);
    		_ebss = .;
    
    		PROVIDE(__bss_end__ = _ebss);
    	} > SRAM
    
    	PROVIDE(end = .);
    
    	.heap (NOLOAD) :
    	{
    		. = ALIGN(4);
    		PROVIDE(__heap_start__ = .);
    		KEEP(*(.heap))
    		. = ALIGN(4);
    		PROVIDE(__heap_end__ = .);
    	} > SRAM
    
    	.reserved_for_stack (NOLOAD) :
    	{
    		. = ALIGN(4);
    		PROVIDE(__reserved_for_stack_start__ = .);
    		KEEP(*(.reserved_for_stack))
    		. = ALIGN(4);
    		PROVIDE(__reserved_for_stack_end__ = .);
    	} > SRAM
    
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)