Using AHBSRAM in LPC1768

Comments

3 comments

  • Avatar
    Jon Elliott

    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.

    0
    Comment actions Permalink
  • Avatar
    Sergiy Ulyashyn

    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>

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    Sergiy, you don't appear to have placed the .my_bss section in your section placement file.

    0
    Comment actions Permalink

Please sign in to leave a comment.