how to make a memory region non-cacheable, linkcmds section addition not working..

Chan Kim ckim at etri.re.kr
Wed Mar 2 05:18:28 UTC 2016




 

Hi, rtems users,



 I am writing a test program(an application) where I make interrupt using looped-back GPIO pins and process the interrupt.

Just to see some debug information, I wanted to locate a variable in a non-cacheable address range and the method I try to use is make a 16MB(=2^24) aligned memory region in the linkcmds.base and make that region non-cacheable by changing the pgd(page global data) table.(it's sparc architecture and I can know the actual allocated address using the variable address).



I put a section in the linkcmds like below (see .dmablock section, which is the non-cacheable area).



SECTIONS
{

....


  .bss :
  {
    __bss_start = ALIGN(0x8);
    _bss_start = .;
    bss_start = .;
    *(.bss .bss* .gnu.linkonce.b*)
    *(COMMON)
    . = ALIGN (16);
    end = .;
    _end = ALIGN(0x8);
    __end = ALIGN(0x8);
  } > ram
  . = ALIGN(0x1000000);
    .dmablock : {
        *(.dmablock)
  } > ram

  .stab . (NOLOAD) :
  {
    [ .stab ]
  }
  .stabstr . (NOLOAD) :
  {
    [ .stabstr ]
  }
}




But when I objdump the exe file, I find the dmablock section is not aligned to 0x1000000. 

(it starts from 0x60029630, I expected 0x61000000)

It looks like the ALIGN(0x1000000) is ignored. (the section is located right after bss)



Is it right method to locate the dmablock after bss? or how can I locate the dmablock after the stack?

I couldn't find the variable __stack in the rtems source code.



For reference, the beginning of the linkcmds.base file has a comment below.


 /*
 * The memory map looks like this:
 * +--------------------+ <- low memory
 * | .text              |
 * |        etext       |
 * |        ctor list   | the ctor and dtor lists are for
 * |        dtor list   | C++ support
 * |        _endtext    |
 * +--------------------+
 * | .data              | initialized data goes here
 * |        _sdata      |
 * |        _edata      |
 * +--------------------+
 * | .bss               |
 * |        __bss_start | start of bss, cleared by crt0
 * |        _end        | start of heap, used by sbrk()
 * +--------------------+
 * |    heap space      |
 * |        _ENDHEAP    |
 * |    stack space     |
 * |        __stack     | top of stack
 * +--------------------+ <- high memory
 */



Chan


More information about the users mailing list