我有以下几个问题:

1、M0、M1、L0、L1、H0(SARAM)是不是既可以当做数据段,又可以当做程序段?假如可以的话,数据段和程序段的地址空间能重合吗?

如:

PAGE 0:

RAML11       : origin = 0x009000, length = 0x000500

PAGE 1:

RAML12       : origin = 0x009400, length = 0x000600

2、(接第一个问题)假如不能重合的话,是不是程序段和数据段可以任意定义?(只需保证地址不重合,总长度不超过应有的长度)在定义程序段和数据段要注意什么?

3、L0、L1、H0(SARAM)是属于双重映射,那我究竟是用低端地址还是用高端地址?还是可以混用?

如我把L1拆分成两段L11和L12作为数据段(或者程序段+数据段)(L1低端映射地址为0x009000,高端地址为0x3F9000):

PAGE 1:

RAML11       : origin = 0x009000, length = 0x000500

RAML12       : origin = 0x3F9500, length = 0x000500

或者(

PAGE 0:

RAML11       : origin = 0x009000, length = 0x000500

PAGE 1:

RAML12       : origin = 0x3F9500, length = 0x000500

)

4、当定义完M0、M1、L0、L1、H0(SARAM)为程序段或者数据段之后,M0、M1、L0、L1、H0(SARAM)应该各自放下面哪些段?有什么要求吗?

未初始化块(data)

.bss       存放全局和静态变量

.ebss     长调用的.bss(超过了64K地址限制)

.stack    存放C语言的栈

.sysmem 存放C语言的堆

.esysmem     长调用的.sysmem(超过了64K地址限制)

初始化块

.text      可执行代码和常数(program)

.switch  switch语句产生的常数表格(program/低64K数据空间)

.pinit     Tables for global constructors (C++)(program)

.cinit     用来存放对全局和静态变量的初始化常数值(program)

.const    全局和静态的const变量初始化值和字符串常数,(data)

.econst 长.const(可定位到任何地方)(data)

0

- ERIC

2018-10-24 15:57:47

评论

提交评论

MEMORY

[

PAGE 0: /* Program Memory */

/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

RAML0 : origin = 0x008000, length = 0x001000 /* on-chip RAM block L0 */

OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */

FLASHF : origin = 0x3E0000, length = 0x004000 /* on-chip FLASH */

FLASHE : origin = 0x3E4000, length = 0x003F80 /* on-chip FLASH */

FLASHD : origin = 0x3E8000, length = 0x004000 /* on-chip FLASH */

FLASHC : origin = 0x3EC000, length = 0x004000 /* on-chip FLASH */

FLASHA : origin = 0x3F4000, length = 0x003F80 /* on-chip FLASH */

CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */

BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */

CSM_PWL : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */

ROM : origin = 0x3FF000, length = 0x000FC0 /* Boot ROM */

RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */

VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

PAGE 1 : /* Data Memory */

/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */

/* Registers remain on PAGE1 */

RAMM0 : origin = 0x000000, length = 0x000400 /* on-chip RAM block M0 */

BOOT_RSVD : origin = 0x000400, length = 0x000080 /* Part of M1, BOOT rom will use this for stack */

RAMM1 : origin = 0x000480, length = 0x000380 /* on-chip RAM block M1 */

RAML1H0 : origin = 0x3F9000, length = 0x003000 /* on-chip RAM block L1 */

FLASHH : origin = 0x3D8000, length = 0x004000 /* on-chip FLASH */

FLASHG : origin = 0x3DC000, length = 0x004000 /* on-chip FLASH */

FLASHB : origin = 0x3F0000, length = 0x004000 /* on-chip FLASH */

/*RAMH0 : origin = 0x00A000, length = 0x002000*/ /* on-chip RAM block H0 */

]

/* Allocate sections to memory blocks.

Note:

codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code

execution when booting to flash

ramfuncs user defined section to store functions that will be copied from Flash into RAM

*/

SECTIONS

[

/* Allocate program areas: */

.cinit : > FLASHA, PAGE = 0

.pinit : > FLASHA, PAGE = 0

.text : > FLASHA, PAGE = 0

codestart : > BEGIN, PAGE = 0

ramfuncs : LOAD = FLASHD,

RUN = RAML0,

LOAD_START(_RamfuncsLoadStart),

LOAD_END(_RamfuncsLoadEnd),

RUN_START(_RamfuncsRunStart),

PAGE = 0

csmpasswds : > CSM_PWL, PAGE = 0

csm_rsvd : > CSM_RSVD, PAGE = 0

/* Allocate uninitalized data sections: */

.stack : > RAMM0, PAGE = 1

.ebss : > RAML1H0, PAGE = 1

.esysmem : > RAML1H0, PAGE = 1

/* Initalized sections go in Flash */

/* For SDFlash to program these, they must be allocated to page 0 */

.econst : > FLASHA, PAGE = 0

.switch : > FLASHA, PAGE = 0

/* Allocate IQ math areas: */

IQmath : > FLASHC, PAGE = 0 /* Math Code */

IQmathTables : > ROM, PAGE = 0, TYPE = NOLOAD /* Math Tables In ROM */

/* .reset is a standard section used by the compiler. It contains the */

/* the address of the start of _c_int00 for C Code. /*

/* When using the boot ROM this section and the CPU vector */

/* table is not needed. Thus the default type is set here to */

/* DSECT */

.reset : > RESET, PAGE = 0, TYPE = DSECT

vectors : > VECTORS, PAGE = 0, TYPE = DSECT

]

Eric老师,非常感谢您的回答,我还有以下几个疑问:

1、ramfuncs : LOAD = FLASHD中,FLASHD可以换成FLASHA/B/C/E/F...吗?

InitFlash、_RamfuncsRunStart和_DSP28x_usDelay在被复制到RAM之前,是存在FLASH的哪一段呢?(是不是由LOAD = FLASHD决定的?如把它改为LOAD = FLASHE就变为存在FLASHE中了。)

2、ramfuncs : LOAD = FLASHD,

RUN = RAML0,

LOAD_START(_RamfuncsLoadStart),

LOAD_END(_RamfuncsLoadEnd),

RUN_START(_RamfuncsRunStart),

PAGE = 0

可不可以写成如下格式:

ramfuncs : LOAD = FLASHD, PAGE = 0

RUN = RAML0, PAGE = 0

LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart)

3、L0、L1、H0的低端与高端映射应用时应该没有区别吧?

2018-10-24 16:11:57

评论

提交评论

Haypin,

1. 可以换。 Iniflash, usDelay在没有复制之前是存在在FlashD中,即load所在的memory。

2. 格式的话照着CMD写就行了,我们要修改的也就那些存储模块而已。你那么修改我认为也可以。

3. 关于dual mapped, 其实就是考虑到与一些老的芯片的兼容性,你可以查看下面的资料:

[2803x/2802x/280x] Dual mapped memory

Design Notes

- ERIC

2018-10-24 16:24:14

评论

提交评论

/*

// TI File $Revision: V2.0

// Checkin $Date: 2013.5.2

//###########################################################################

//

// FILE: F2809.cmd

//

// TITLE: Linker Command File For F2809 Device

//

//###########################################################################

//

// $ Revised by Haypin Tse

//

//###########################################################################

*/

/* ======================================================

// For Code Composer Studio V3.3

// ---------------------------------------

// In addition to this memory linker command file,

// add the header linker command file directly to the project.

// The header linker command file is required to link the

// peripheral structures to the proper locations within

// the memory map.

//

// The header linker files are found in \DSP280x_Headers\cmd

//

// For BIOS applications add: DSP280x_Headers_BIOS.cmd

// For nonBIOS applications add: DSP280x_Headers_nonBIOS.cmd

========================================================= */

/* ======================================================

// For Code Composer Studio prior to V2.2

// --------------------------------------

// 1) Use one of the following -l statements to include the

// header linker command file in the project. The header linker

// file is required to link the peripheral structures to the proper

// locations within the memory map */

/* Uncomment this line to include file only for non-BIOS applications */

/* -l DSP280x_Headers_nonBIOS.cmd */

/* Uncomment this line to include file only for BIOS applications */

/* -l DSP280x_Headers_BIOS.cmd */

/* 2) In your project add the path to \DSP280x_headers\cmd to the

library search path under project->build options, linker tab,

library search path (-i).

/*========================================================= */

/* Define the memory block start/length for the F2809

PAGE 0 will be used to organize program sections

PAGE 1 will be used to organize data sections

Notes:

Memory blocks on F2809 are uniform (ie same

physical memory) in both PAGE 0 and PAGE 1.

That is the same memory region should not be

defined for both PAGE 0 and PAGE 1.

Doing so will result in corruption of program

and/or data.

L0/L1 and H0 memory blocks are mirrored - that is

they can be accessed in high memory or low memory.

For simplicity only one instance is used in this

linker file.

Contiguous SARAM memory blocks or flash sectors can be

be combined if required to create a larger memory block.

*/

MEMORY

[

PAGE 0: /* Program Memory */

/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

RAMH0 : origin = 0x00A000, length = 0x002000 /* on-chip RAM block H0 */

OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */

FLASHEF : origin = 0x3E0000, length = 0x008000 /* on-chip FLASHE+F 32K */

FLASHCD : origin = 0x3E8000, length = 0x008000 /* on-chip FLASHC+D 32K */

FLASHAB : origin = 0x3F0000, length = 0x007F80 /* on-chip FLASHA+B 31K */

CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */

BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */

CSM_PWL : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */

ROM : origin = 0x3FF000, length = 0x000FC0 /* Boot ROM */

RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */

VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

PAGE 1 : /* Data Memory */

/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */

/* Registers remain on PAGE1 */

RAMM0 : origin = 0x000000, length = 0x000400 /* on-chip RAM block M0 */

BOOT_RSVD : origin = 0x000400, length = 0x000080 /* Part of M1, BOOT rom will use this for stack */

RAMM1 : origin = 0x000480, length = 0x000380 /* on-chip RAM block M1 */

RAML0L1 : origin = 0x008000, length = 0x002000 /* on-chip RAM block L0+L1 */

FLASHGH : origin = 0x3D8000, length = 0x008000 /* on-chip FLASHG+H 32K */

]

/* Allocate sections to memory blocks.

Note:

codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code

execution when booting to flash

ramfuncs user defined section to store functions that will be copied from Flash into RAM

*/

SECTIONS

[

/* Allocate Uninitialized program Sections: */

/*must be assigned to a non volatile memory like Flash/ROM*/

/* Tables for explicitly initialized global and static variables */

.cinit :LOAD = FLASHAB, PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_cinit_loadstart),

RUN_START(_cinit_runstart),

SIZE(_cinit_size)

/* Global and static const variables that are explicitly initialized and Low 64K data string literals */

.const :LOAD = FLASHAB, PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_const_loadstart),

RUN_START(_const_runstart),

SIZE(_const_size)

/* Tables for global object constructors */

.pinit :LOAD = FLASHAB,PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_pinit_loadstart),

RUN_START(_pinit_runstart),

SIZE(_pinit_size)

/* Executable code and constants */

.text :LOAD = FLASHAB,PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_text_loadstart),

RUN_START(_text_runstart),

SIZE(_text_size)

codestart : > BEGIN, PAGE = 0 /* Used by file CodeStartBranch.asm */

wddisable : > FLASHAB, PAGE = 0 /* Used by file CodeStartBranch.asm */

copysections : > FLASHAB, PAGE = 0 /* Used by file SectionCopy.asm */

ramfuncs : LOAD = FLASHAB, PAGE = 0

RUN = PRAMH0, PAGE = 0

LOAD_START(_ramfuncs_loadstart),

RUN_START(_ramfuncs_runstart),

SIZE(_ramfuncs_size)

csmpasswds : > CSM_PWL, PAGE = 0 /* Used by file CSMPasswords.asm */

csm_rsvd : > CSM_RSVD, PAGE = 0 /* Used by file CSMPasswords.asm */

/* Allocate Uninitialized program Sections(Initalized sections go in Flash) */

/* For SDFlash to program these, they must be allocated to page 0 */

/* Far constant variables */

.econst :LOAD = FLASHAB, PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_econst_loadstart),

RUN_START(_econst_runstart),

SIZE(_econst_size)

/* Tables for implementing switch statements */

.switch :LOAD = FLASHAB,PAGE = 0 /* Load section to Flash */

RUN = RAMH0, PAGE = 0 /* Run section from RAM */

LOAD_START(_switch_loadstart),

RUN_START(_switch_runstart),

SIZE(_switch_size)

/* Allocate uninitalized data sections:*/

/*only be allocated to RAM as they are variable during code execution */

ramvars : > RAML0L1, PAGE = 1 /* User Defined Variables */

.bss : > RAMM0, PAGE = 1 /* Global and static variables */

.ebss : > RAMM0, PAGE = 1 /* Far global/static variables */

.stack : > RAMM0, PAGE = 1 /* Stack Space */

.sysmem : > RAMM1, PAGE = 1 /* Memory for malloc functions */

.esysmem : > RAMM1, PAGE = 1 /* Memory for far_malloc functions */

/* Allocate IQ math areas: */

IQmath : > FLASHAB, PAGE = 0 /* Math Code */

IQmathTables : > ROM, PAGE = 0, TYPE = NOLOAD /* Math Tables In ROM */

/* .reset is a standard section used by the compiler. It contains the */

/* the address of the start of _c_int00 for C Code. /*

/* When using the boot ROM this section and the CPU vector */

/* table is not needed. Thus the default type is set here to */

/* DSECT */

.reset : > RESET, PAGE = 0, TYPE = DSECT

vectors : > VECTORS, PAGE = 0, TYPE = DSECT

]

/*

//===========================================================================

// End of file.

//===========================================================================

*/

Eric老师,这个是我自己修改的.cmd,您帮我看看需要修改下么?

在我的主函数中有:

/**************************************************************************/

#pragma DATA_SECTION(AdcResultA3, "ramvars");

#pragma DATA_SECTION(AdcResultA2, "ramvars");

#pragma CODE_SECTION(cpu_timer0_isr, "ramfuncs");

#pragma CODE_SECTION(adc_isr, "ramfuncs");

int AdcResultA3[1000];

int AdcResultA2[1000];

interrupt void cpu_timer0_isr(void);// 定时器0中断函数声明

interrupt void adc_isr(void);//采样中断函数声明

/**********************************************************************************/

那么在.cmd中:

/***************************************************/

ramfuncs : LOAD = FLASHAB, PAGE = 0

RUN = PRAMH0, PAGE = 0

LOAD_START(_ramfuncs_loadstart),

RUN_START(_ramfuncs_runstart),

SIZE(_ramfuncs_size)

/*************************************************/

上面这些代码需要去除不?我觉得已经包含在..cinit .const .pinit .text .econst .switch 里面了.而..cinit .const .pinit .text .econst .switch都被我定义复制到RAM中,然后再把ramfuncs复制到RAM中,我觉得多此一举了。请解答。谢谢

2018-10-24 16:32:59

评论

提交评论

我不知道你把这些段干嘛也要搬到RAM中,..cinit .const .pinit , 我认为没必要。像.cint这些初始化值,在跑到main之前就会把cint中的初始化值搬到相应变量中了。

所以我建议,

只把需要搬到RAM中的函数 放在ramfuncs中就行了,其他段..cinit .const .pinit .text .econst .switch 不要动。像.text段,你在实际工程中根本没有那么大的RAM空间来放这些代码.

另外DATA_SECTION, 是用来把变量映射到特殊的段中,默认变量是放在.ebss段的,当通过DATA_section可以映射到别的段。

Eric

- ERIC

2018-10-24 16:38:27

评论

提交评论

Eric 老师:

1、其他段..cinit .const .pinit .text .econst .switch 不要动。像.text段,你在实际工程中根本没有那么大的RAM空间来放这些代码.

为什么不用动呢?

2、默认变量是放在.ebss段的,当通过DATA_section可以映射到别的段。映射到别的段有什么好处呢?

2018-10-24 16:58:00

评论

提交评论

Haypin,

因为这些段中存放的是一些具体的值,比如全局变量a = 1; 则a放在RAM中,1放在.cint段中对应的Flash里面,然后当芯片上电引导后,在code start代码中会跳进一段_c_int00的初始化程序,会把1的值搬到a对应的RAM单元中。另外像一些econst常量,原理也是类似的。所以不用动,我暂时没见到有人搬移那些段的。

关于全局变量,默认我们是编译到ebss段,但是有些客户它们想把一些特定的变量放到特定的RAM中,独立开来,这种方法就有用。如果没有特殊要求,默认就可以。

Eric

- ERIC

2018-10-24 17:03:25

评论

提交评论

Eric老师,谢谢

2018-10-24 17:13:14

评论

提交评论

只有小组成员才能发言,加入小组>>

h0在c语言中可作为变量吗,请问TMS320F2809中的L0/L1/H0 SARAM双重映射数据段和程序段的地址空间能重合吗?...相关推荐

  1. c语言指针访问 静态变量_使用C中的指针访问变量的值

    c语言指针访问 静态变量 As we know that a pointer is a special type of variable that is used to store the memor ...

  2. R语言计量经济学:工具变量法(两阶段最小二乘法2SLS)线性模型分析人均食品消费时间序列数据和回归诊断

    最近我们被客户要求撰写关于计量经济学的研究报告,包括一些图形和统计输出. 简介 两阶段最小二乘法(2SLS)回归拟合的线性模型是一种常用的工具变量估计方法. 本文的主要内容是将各种标准的回归诊断扩展到 ...

  3. 在MATLAB 中st_1是变量名,在Delphi中,根据变量标识符命名规则,st80不能用一个变量命名。...

    在Delphi中,根据变量标识符命名规则,"st80"不能用一个变量命名. 更多相关问题 [单选,A型题] 胸痹表现为"心中痞,留气结在胸,胸满,胁下逆抢心", ...

  4. 【c语言】用指针变量输出一维数组中的数据

    #include<stdio.h> void main(){     int i,*m,a[5];     printf("数组:"); //普通方式输出数组的元素   ...

  5. matlab中怎么查看变量,Matlab 查看内存中的变量,清空屏幕等命令

    Matlab 查看内存中的变量,清空屏幕等命令 该文章讲述了Matlab 查看内存中的变量,清空屏幕等命令. 1. 查看内存中的变量 who whos 2. clc 清空屏幕 3. clf 清空当前的 ...

  6. matlab删除mat中的个别变量,从.mat文件中删除变量

    10GB的数据?由于MAT格式开销,更新多变量MAT文件可能会变得昂贵.考虑将数据拆分并将每个变量保存到不同的MAT文件中,必要时使用组织目录.即使您有一个方便的函数来从MAT文件中删除变量,它也将是 ...

  7. python中flag的用法_请问python中flag的意思是什么?

    您好. Flag这一变量名常常被用于命名旗标变量,或者说哨兵变量.这种变量的作用体现在帮助进行条件判断中,常常使用int类型变量中的0.1或布尔类型变量中的false(0).true(1)来表示. 试 ...

  8. java中1代表什么_请问java中81是什么意思?

    杨魅力 移位运算符就是在二进制的基础上对数字进行平移.按照平移的方向和填充数字的规则分为三种:<>(带符号右移)和>>>(无符号右移). 在移位运算时,byte.shor ...

  9. A13在c语言中是合法变量吗,C语言中局部变量和全局变量等在内存中的存放位置.doc-资源下载在线文库www.lddoc.cn...

    C语言中局部变量和全局变量_等在内存中的存放位置.doc C 语言中局部变量和全局变量 变量的存储类别static,extern,auto,register 8.8 局部变量和全局变量在讨论函数的形参 ...

最新文章

  1. Spring MVC+Spring+Mybatis实现支付宝支付功能(附完整代码)
  2. 信号转换 | 将对称方波转换成倍频PWM波形
  3. OS_FLAG.C(1)
  4. 真实临床“生态”下实效性研究的挑战和意义
  5. 小甲鱼python视频第八讲(课后习题)
  6. 集市中迷失的一代:FreeBSD核心开发者反思开源软件质量
  7. JqueryCookie
  8. 牛客网数据开发题库_牛客网SQL题库NO.32~40
  9. scala定义函数(六)
  10. 使用sql语句向SDO_Geometry插入要素
  11. 计算机之父—— 约翰·冯·诺依曼
  12. c语言中猜字母代码怎么打,C语言代码实现猜数字
  13. 开源|AAAI2021杰出论文-三维重建新探索:让自监督信号更可靠!
  14. logback系列之四:输出日志到不同文件
  15. 微信屏蔽防封跳转、域名防红系统的实现原理
  16. python扇贝单词书_扇贝单词如何创建自己的单词书
  17. 阿里巴巴为新项目收购两枚双拼域名?
  18. Lazy and Hungry
  19. 超级详细易懂的GhostNet解析
  20. QBasic语言程序设计 金怀群 pdf

热门文章

  1. 龙芯服务器稳定性,真实现状!国产龙芯水平究竟如何(续)
  2. 一文搞懂华为ML Kit拍照购,超简单集成
  3. 360天勤卸载后无法重装360安全卫士
  4. 学习latex的常见问题
  5. js中append和prepend的用法
  6. redis 底层原理实现
  7. vue 超出多行,省略,展示显示更多按钮
  8. AutoCAD的命令脚本scr入门
  9. DayDayUp:广东卫视2018.12.31—2019财经跨年《遇见2018•预见2019》重点概览【文字+视频】
  10. SwitchHosts Hosts管理工具