完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有以下几个问题: 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) |
|
相关推荐
8 个讨论
|
|
Haypin,
M0、M1、L0、L1、H0(SARAM),包括flash,都可以作为数据空间或程序空间,表示他们能够被数据总线访问或程序总线访问。 1、M0、M1、L0、L1、H0(SARAM)是不是既可以当做数据段,又可以当做程序段?假如可以的话,数据段和程序段的地址空间能重合吗? 你可以这些编写,编译不会报错,但这样子会导致程序运行出错,比如你要该程序单元放代码,却同时映射给数据段放变量,当变量初始化后,里面的代码会被冲刷掉。所以CMD文件中的存储块memory block都不要重合。 2、(接第一个问题)假如不能重合的话,是不是程序段和数据段可以任意定义?(只需保证地址不重合,总长度不超过应有的长度)在定义程序段和数据段要注意什么? 不能重合,另外纠正一下,不是叫数据段,因为段的定义是在下面的SECTION里面的,上面的PAGE0、1是定义memory block,即将存储划分成各个块。接下来再将段映射到对应的块中。总体来讲没有太多限制,像地址不重合,别超出实际应用的物理寻址范围,另外memory block可以很灵活,你可以拆分成非常小,也可以将几个RAM融合在一起。当某个段映射到该memory block时,要保证该memory block足够空间。 3、L0、L1、H0(SARAM)是属于双重映射,那我究竟是用低端地址还是用高端地址?还是可以混用? 如我把L1拆分成两段L11和L12作为数据段(或者程序段+数据段)(L1低端映射地址为0x009000,高端地址为0x3F9000). 没试过,但我认为可以,不过你这么操作,一部分映射到低地址,一部分映射到高地址,有什么目的吗? 4、当定义完M0、M1、L0、L1、H0(SARAM)为程序段或者数据段之后,M0、M1、L0、L1、H0(SARAM)应该各自放下面哪些段?有什么要求吗? 初始化段都要放在PAGE0,那些非初始化段就都要放在PAGE1。其他没什么限制。其实这个更多的是体现在Flash的cmd上,因为初始化的段表示有初始值,这时候就必须放到PAGE0中的Flash块中。 Eric - ERIC |
|
|
|
|
|
guigui_7044 发表于 2018-10-24 14: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的低端与高端映射应用时应该没有区别吧? |
|
|
|
|
|
Haypin, 1. 可以换。 Iniflash, usDelay在没有复制之前是存在在FlashD中,即load所在的memory。 2. 格式的话照着CMD写就行了,我们要修改的也就那些存储模块而已。你那么修改我认为也可以。 3. 关于dual mapped, 其实就是考虑到与一些老的芯片的兼容性,你可以查看下面的资料: [2803x/2802x/280x] Dual mapped memory Design Notes - ERIC |
|
|
|
|
|
guigui_7044 发表于 2018-10-24 15: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 // // 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 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中,我觉得多此一举了。请解答。谢谢 |
|
|
|
|
|
我不知道你把这些段干嘛也要搬到RAM中,..cinit .const .pinit , 我认为没必要。像.cint这些初始化值,在跑到main之前就会把cint中的初始化值搬到相应变量中了。 所以我建议, 只把需要搬到RAM中的函数 放在ramfuncs中就行了,其他段..cinit .const .pinit .text .econst .switch 不要动。像.text段,你在实际工程中根本没有那么大的RAM空间来放这些代码. 另外DATA_SECTION, 是用来把变量映射到特殊的段中,默认变量是放在.ebss段的,当通过DATA_section可以映射到别的段。 Eric - ERIC |
|
|
|
|
|
guigui_7044 发表于 2018-10-24 15:28 Eric 老师: 1、其他段..cinit .const .pinit .text .econst .switch 不要动。像.text段,你在实际工程中根本没有那么大的RAM空间来放这些代码. 为什么不用动呢? 2、默认变量是放在.ebss段的,当通过DATA_section可以映射到别的段。映射到别的段有什么好处呢? |
|
|
|
|
|
rxb88 发表于 2018-10-24 15:47 Haypin, 因为这些段中存放的是一些具体的值,比如全局变量a = 1; 则a放在RAM中,1放在.cint段中对应的Flash里面,然后当芯片上电引导后,在code start代码中会跳进一段_c_int00的初始化程序,会把1的值搬到a对应的RAM单元中。另外像一些econst常量,原理也是类似的。所以不用动,我暂时没见到有人搬移那些段的。 关于全局变量,默认我们是编译到ebss段,但是有些客户它们想把一些特定的变量放到特定的RAM中,独立开来,这种方法就有用。如果没有特殊要求,默认就可以。 Eric - ERIC |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
334 浏览 1 评论
528 浏览 2 评论
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
773 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
649 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1126 浏览 1 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
56浏览 29评论
124浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
251浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
200浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
56浏览 13评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 20:35 , Processed in 1.133954 second(s), Total 76, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号