Using AHBSRAM in LPC1768
I run out of memory in the SRAM memory segment and would also like to use AHBSRAM for my variables. The memory section is already defined in the memory map file, but it is not used by the default memory placement file, the flash_placement.xml. I've imported the placement file into the project and added a new memory segment, but I don't know how to proceed with the program sections and if any startup code must be changed, too.
-
The simplest thing to do is just to move program sections from the RAM segment to the AHBSRAM segment as required - you shouldn't need to modify any startup code if you do this.
It gets much harder when you start to split up program sections between segments as there is no automatic way of doing this. See http://rowley.zendesk.com/entries/46162-place-code-and-data-into-different-sections for a description of how you place code and data into different sections. The startup code will need to be modified in this case if you create a new "initialised" section such as .bss.
-
The same case but with LPC4088: RAM - 64K, AHBSRAM - 32K. AHBSRAM used by heap and stacks and RAM used by variables etc.
RAM used almost completely 62/64K and AHBSRAM less than half: 14/32K (8+2+4)K for heap/stacks
Code located and executed from FLASH (not from RAM). I need to allocate next buffer: like that:
static uint8_t fakeBuffer[1024*4]; It's (by default) shall be places into .bss section.
How I can use AHBSRAM that has 18K free (not reserved by heap/stack sections). I've tried to create additional section for AHBSRAM (like my_bss) and than use something like:
static uint8_t fakeBuffer[1024*4] __attribute__ ((section(".my_bss")));
But still problem.
See my xml file with section placement:
<!DOCTYPE Linker_Placement_File>
<Root name="Rowley Section Placement" >
<MemorySegment name="$(FLASH2_NAME:FLASH2);$(FLASH_NAME:FLASH)" >
<ProgramSection alignment="4" load="Yes" name=".text2" />
<ProgramSection alignment="4" load="Yes" name=".rodata2" />
<ProgramSection alignment="4" load="Yes" runin=".data2_run" name=".data2" />
</MemorySegment>
<MemorySegment name="$(FLASH_NAME:FLASH)" >
<ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START:)"/>
<ProgramSection alignment="4" load="Yes" name=".init" />
<ProgramSection alignment="4" load="Yes" name=".text" />
<ProgramSection alignment="4" load="Yes" name=".dtors" />
<ProgramSection alignment="4" load="Yes" name=".ctors" />
<ProgramSection alignment="4" load="Yes" name=".rodata" />
<ProgramSection alignment="4" load="Yes" name=".constdata" />
<ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end"/>
<ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
<ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
<ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
</MemorySegment>
<MemorySegment name="$(RAM2_NAME:RAM2);$(RAM_NAME:RAM)" >
<ProgramSection alignment="4" load="No" name=".data2_run" />
<ProgramSection alignment="4" load="No" name=".bss2" />
</MemorySegment>
<MemorySegment name="$(AHBSRAM_NAME:AHBSRAM);$(RAM_NAME:RAM)" >
<ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
<ProgramSection alignment="4" size="__STACKSIZE__" load="No" name=".stack" />
<ProgramSection alignment="4" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
</MemorySegment>
<MemorySegment name="$(RAM_NAME:RAM)" >
<ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START:)"/>
<ProgramSection alignment="4" load="No" name=".fast_run" />
<ProgramSection alignment="4" load="No" name=".data_run" />
<ProgramSection alignment="4" load="No" name=".bss" />
<ProgramSection alignment="4" load="No" name=".non_init" />
<ProgramSection alignment="4" load="No" name=".tbss"/>
<ProgramSection alignment="4" load="No" name=".tdata_run"/>
</MemorySegment>
</Root>
Please sign in to leave a comment.
Comments
3 comments