zoukankan      html  css  js  c++  java
  • Linker scripts之MEMORY

    1  MEMORY command

      The MEMORY command describes the location and size of blocks of memory in the target. You can use it to describe which memory regions may be used by the linker, and which memory regions it must avoid. 

      A linker script may contain at most one use of the MEMORY command. However, you can define as many blocks of memory within it as you wish. The syntax is:

         MEMORY
           {
             name [(attr)] : ORIGIN = origin, LENGTH = len
             ...
           }

      The name is used to refer to the region. We can add later alias names to existing memory regions with REGION_ALIAS command.

      The attr string must consist only of the following characters:

        'R', Read-only section;  'W', Read/write section;  'X', Executable section 

      The origin is for the start address of the memory region. The keyword ORIGIN may be abbreviated to org or o (but not, for example, ORG).

      The len is an expression for the size in bytes of the memory region. As with the origin expression, the expression must be numerical only and must evaluate to a constant. The keyword LENGTH may be abbreviated to len or l.

    2  Example

         MEMORY
           {
             rom (rx)  : ORIGIN = 0, LENGTH = 256K
             ram (!rx) : org = 0x40000000, l = 4M
           }

      There are two memory regions available for allocation: one starting at `0' for 256 kilobytes, and the other starting at `0x40000000' for four megabytes. The linker will place into the `rom' memory region every section which is not explicitly mapped into a memory region, and is either read-only or executable. The linker will place other sections which are not explicitly mapped into a memory region into the `ram' memory region.

  • 相关阅读:
    [敏捷软工团队博客]Beta阶段项目展示
    [敏捷软工团队博客]Beta阶段使用指南
    [敏捷软工团队博客]Beta阶段测试报告
    [敏捷软工团队博客]Beta阶段发布声明
    [Beta]the Agiles Scrum Meeting 12
    [Beta]the Agiles Scrum Meeting 11
    [Beta]the Agiles Scrum Meeting 10
    [Beta]the Agiles Scrum Meeting 9
    [Beta]the Agiles Scrum Meeting 8
    2020BUAA-个人博客-案例分析
  • 原文地址:https://www.cnblogs.com/mengdie/p/4364135.html
Copyright © 2011-2022 走看看