URL: https://www.overclockers.at/coding-stuff/ld-bestimmte-variablen-aus-bestimmten-compilation-units-in-bestimmte-memory-segments_263591/page_1 - zur Vollversion wechseln!
ich arbeite mit einem microcontroller dessen ram im address space nicht durchgehend ist. ich habe eine memory area von 0x20000000 - 0x20007FFF und eine area von 0x20038000 - 0x2003BC00.
Code:/* Specify the memory areas */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x5A000 /* 360K */ RAM (xrw) : ORIGIN = 0x20000008, LENGTH = 0x7FF8 /* 32K */ RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K RAM_2B (xrw) : ORIGIN = 0x20038000, LENGTH = 0x3C00 /* 15K, public area of SRAM_2B AN5185:1.5 AN5451:4.2*/ } /* Define output sections */ SECTIONS { /* ... */ /* Initialized data sections goes into RAM, load LMA copy after code */ .data : { . = ALIGN(4); _sdata = .; /* create a global symbol at data start */ *(.data) /* .data sections */ *(.data*) /* .data* sections */ *(.RamFunc) /* .RamFunc sections */ *(.RamFunc*) /* .RamFunc* sections */ . = ALIGN(4); _edata = .; /* define a global symbol at data end */ } >RAM AT> FLASH /* Uninitialized data section */ . = ALIGN(4); .bss : { /* This is used by the startup in order to initialize the .bss section */ _sbss = .; /* define a global symbol at bss start */ __bss_start__ = _sbss; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = _ebss; } >RAM /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack : { . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(8); } >RAM /* ... */ .sram2b : { . = ALIGN(4); _ssram2b = .; _esram2b = .; } > RAM_2B /* public space of SRAM2B */ }
das problem hier ist dass ich gern objekte in das segment legen würde die in autogenerated code definiert sind. wenn ich den code update wird das immer überschrieben und ich müsst das attribute manuell dazuschreiben. offensichtlich keine optimale option.Code:__attribute__ ((section(".sram2b"))) Foo foo();
overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025