本文介绍了如何访问外部SDRAM中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究TM4C1294 + ccs 6.0.1 + TI 5.1.9(编译器).

I am working on TM4C1294 + ccs 6.0.1 + TI 5.1.9(Compiler).

在8MB外部sdram中读取/写入变量的效果很好,例如g_pui16EPISdram = (uint16_t *)0x60000000; g_pui16EPISdram[SDRAM_END_ADDRESS ] = 0xdcba;但是,由于我使用属性指令"访问外部sdram,如下所示:int abab[20]__attribute__ ((section (".external")));,所以程序甚至没有执行.

Reading/Writing variables in 8MB external sdram worked fine for example g_pui16EPISdram = (uint16_t *)0x60000000; g_pui16EPISdram[SDRAM_END_ADDRESS ] = 0xdcba;However, as I use "attribute directive" for accessing to external sdram like below:int abab[20]__attribute__ ((section (".external")));, the program is not even executed.

.external"定义为.cmd:

".external" is defined .cmd :

SDRAM (RWX) : origin = 0x60000000, length = 0x00800000

SECTIONS
{
    .intvecs:   > APP_BASE
    .text   :   > FLASH
    .const  :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH

    .vtable :   > RAM_BASE
    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM
    .stack  :   > SRAM
    .external : > SDRAM
}

这是我的.map:

SEGMENT ALLOCATION MAP60000000 60000000 00000050 00000000 rw- 60000000 60000000 00000050 00000000 rw- .external

SEGMENT ALLOCATION MAP60000000 60000000 00000050 00000000 rw- 60000000 60000000 00000050 00000000 rw- .external

全球符号:按字母顺序排序address name-------- ----

GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Nameaddress name-------- ----

60000000 abab

在我的项目中,一些需要作为extern变量的结构"在一个.h中声明,并在一个.c中定义;但是,为了进行测试,我仅使用了int abab[].我试过在属性指令"之前使用/不使用外部"进行测试,简而言之,两种方法均无效.

In my project, some of "structs" ,that need to be extern variables, are declared in one .h and defined in one .c;however, for test I just simply used int abab[].I have tried to test with/without "extern" ahead of "attribute directive", in a nutshell both did not work.

如何访问/使用存储在外部sdram中的外部变量?

How can I access/use extern variables stored in the external sdram?

推荐答案

问题已解决. boot routine中需要SDRAM的EPI set-up,因为引导例程会在调用main()之前尝试初始化全局变量. #pragmaattribute指令与使用外部sdram无关紧要.

the problem has been resolved. EPI set-up for SDRAM was required in boot routine since boot routines try to initialize global variables before calling main(). #pragma and attribute directive are not really a matter for using the external sdram.

感谢您对我的问题发表评论.

Thanks for commenting on my question.

这篇关于如何访问外部SDRAM中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 15:20