打印

如何用scatter实现ro和rw执行域的链接

[复制链接]
2585|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
bigfacecat|  楼主 | 2008-7-1 15:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
BIOSROM 0x20000
{
    ;//********** ******* ************************
    ;//*            CODE SECTION
    ;//*******************************************

    BIOS_RESET 0x20000 FIXED
    {
      bios_bootload.o (+RO, +First) 
      BIOSInit.o (+RO)
      * (+RO)   
    } 

RAM_OS 0x6e000
    {    
          * (+RW, +ZI)
    } 
}

我的写法导致编译器死掉,这是为啥?

我是想让生成的可执行文件中RAM_OS数据连到BIOS_RESET 之后,请高手指点!

相关帖子

沙发
bigfacecat|  楼主 | 2008-7-1 17:09 | 只看该作者

呜呜

为啥没有人回复哦

使用特权

评论回复
板凳
阿南| | 2008-7-1 17:58 | 只看该作者

楼主你用的是NXP和MDK吗?不好意思我没用过,帮不了你.

知道的兄弟,请帮下忙吧,谢谢啦

使用特权

评论回复
地板
bigfacecat|  楼主 | 2008-7-2 08:43 | 只看该作者

我用的是ADS编译器

我用的是ADS编译器
知道的XDJM帮忙下哦

使用特权

评论回复
5
Ice_River| | 2008-7-2 10:49 | 只看该作者

编译器死掉!?


ADS下的分散加载文件应用实例
load_region_name  start_address | "+"offset  [attributes] [max_size]
{
    execution_region_name  start_address | "+"offset  [attributes][max_size]
    {
     module_select_pattern  ["("("+" input_section_attr | input_section_pattern)
            (][","] "+" input_section_attr | "," input_section_pattern)) * ")"]
    }
}
load_region:       加载区,用来保存永久性数据(程序和只读变量)的区域;
execution_region:  执行区,程序执行时,从加载区域将数据复制到相应执行区后才能被正确执行;
load_region_name:  加载区域名,用于“Linker”区别不同的加载区域,最多31个字符;
start_address:     起始地址,指示区域的首地址;
+offset:           前一个加载区域尾地址+offset 做为当前的起始地址,且“offset”应为“0”或“4”的倍数;
attributes:        区域属性,可设置如下属性:
                    PI       与地址无关方式存放;
                    RELOC    重新部署,保留定位信息,以便重新定位该段到新的执行区;
                    OVERLAY  覆盖,允许多个可执行区域在同一个地址,ADS不支持;
                    ABSOLUTE 绝对地址(默认);
max_size:          该区域的大小;
execution_region_name:执行区域名;
start_address:     该执行区的首地址,必须字对齐;
+offset:          前一个执行区域尾地址+offset 做为当前的起始地址,且“offset”应为“0”或“4”的倍数;attributes:       区域属性,可设置如下属性:
                    PI          与地址无关,该区域的代码可任意移动后执行;
                    OVERLAY     覆盖;
                    ABSOLUTE    绝对地址(默认);
                    FIXED       固定地址;
                    UNINIT      不用初始化该区域的ZI段;
module_select_pattern: 目标文件滤波器,支持通配符“*”和“?”;
                        *.o匹配所有目标,* (或“.ANY”)匹配所有目标文件和库。
input_section_attr:    每个input_section_attr必须跟随在“+”后;且大小写不敏感;
                        RO-CODE 或 CODE
                        RO-DATA 或 CONST
                        RO或TEXT, selects both RO-CODE and RO-DATA
                        RW-DATA
                        RW-CODE
                        RW 或 DATA, selects both RW-CODE and RW-DATA
                        ZI 或 BSS
                        ENTRY, that is a section containing an ENTRY point.
                        FIRST,用于指定存放在一个执行区域的第一个或最后一个区域;
                        LAST,同上;
input_section_pattern: 段名;
汇编中指定段:
     AREA    vectors, CODE, READONLY
C中指定段:
#pragma arm section [sort_type][[=]"name"]] [,sort_type="name"]*
sort_type:      code、rwdata、rodata、zidata
                如果“sort_type”指定了但没有指定“name”,那么之前的修改的段名将被恢复成默认值。
#pragma arm section     // 恢复所有段名为默认设置。
应用:
    #pragma arm section rwdata = "SRAM",zidata = "SRAM"
        static OS_STK  SecondTaskStk[256];              // “rwdata”“zidata”将定位在“sram”段中。
    #pragma arm section                                 // 恢复默认设置
分散加载文件中定义如下:
    Exec_Sram  0x80000000  0x40000
    {
        * (sram)
    }
“PI” 属性使用示例:
LR_1 0x010000 PI                ; The first load region is at 0x010000.
{
    ER_RO +0                    ; The PI attribute is inherited from parent.
                                ; The default execution address is 0x010000, but the code can be moved.
    {
        *(+RO)                  ; All the RO sections go here.
    }
    ER_RW +0 ABSOLUTE           ; PI attribute is overridden by ABSOLUTE.
    {
        *(+RW)                  ; The RW sections are placed next. They cannot be moved.
    }
    ER_ZI +0                    ; ER_ZI region placed after ER_RW region.
    {
        *(+ZI)                  ; All the ZI sections are placed consecutively here.
    }
}
LR_1 0x010000                   ; The first load region is at 0x010000.
{
    ER_RO +0                    ; Default ABSOLUTE attribute is inherited from parent. The execution address
                                ; is 0x010000. The code and ro data cannot be moved.
    {
        *(+RO)                  ; All the RO sections go here.
    }
    ER_RW 0x018000 PI           ; PI attribute overrides ABSOLUTE
    {
        *(+RW)                  ; The RW sections are placed at 0x018000 and they can be moved.
    }
    ER_ZI +0                    ; ER_ZI region placed after ER_RW region.
    {
        *(+ZI)                  ; All the ZI sections are placed consecutively here.
    }
}

使用特权

评论回复
6
bigfacecat|  楼主 | 2008-7-2 17:25 | 只看该作者

谢谢大哥

谢谢大哥
能不能辛苦再帮我看看我的写法有没有问题
ADS每次快链接完的时候,就飞了,程序窗口就不见了。
。。。。
好奇怪额

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

46

帖子

0

粉丝