项目创建之后,会自动生成一个28335_RAM_lnk.cmd文件,该文件是我们进行仿真调试的时候,将程序放入RAM中运行的CMD文件,如果需要烧写到Flash中,则需要修改对应的地址,因此,可以更改cmd中对应的地址位置或者我们重新创建一个烧写Flash对应的cmd文件。
我们可以从其他项目例程中拷贝一个往Flash中烧写的cmd文件,同一芯片往flash中烧写的cmd文件都相同,因此直接拷贝一个过来(一般名称为F28335.cmd),名称可以自己进行修改,或者自己创建一个xxx.cmd文件,将如下内容拷贝进去:
注意:以下内容只试用于TMS320F28335!
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 */
RAML1 : origin = 0x009000, length = 0x001000/* on-chip RAM block L1 */
RAML2 : origin = 0x00A000, length = 0x001000/* on-chip RAM block L2 */
RAML3 : origin = 0x00B000, length = 0x001000/* on-chip RAM block L3 */
FLASHH : origin = 0x300000, length = 0x008000/* on-chip FLASH */
FLASHG : origin = 0x308000, length = 0x008000/* on-chip FLASH */
FLASHF : origin = 0x310000, length = 0x008000/* on-chip FLASH */
FLASHE : origin = 0x318000, length = 0x008000/* on-chip FLASH */
FLASHD : origin = 0x320000, length = 0x008000/* on-chip FLASH */
FLASHC : origin = 0x328000, length = 0x008000/* on-chip FLASH */
FLASHB : origin = 0x330000, length = 0x008000/* on-chip FLASH */
FLASHA : origin = 0x338000, length = 0x007F80/* on-chip FLASH */
CSM_RSVD : origin = 0x33FF80, length = 0x000076/* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x33FFF6, length = 0x000002/* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x33FFF8, length = 0x000008/* Part of FLASHA. CSM password locations in FLASHA */
OTP : origin = 0x380400, length = 0x000400/* on-chip OTP */
ADC_CAL : origin = 0x380080, length = 0x000009/* ADC_cal function in Reserved memory */
IQTABLES : origin = 0x3FE000, length = 0x000b50/* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008c/* IQ Math Tables in Boot ROM */
FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0/* FPU Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44/* 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 */
BOOT_RSVD : origin = 0x000000, length = 0x000050/* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0/* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400/* on-chip RAM block M1 */
RAML4 : origin = 0x00C000, length = 0x001000/* on-chip RAM block L1 */
RAML5 : origin = 0x00D000, length = 0x001000/* on-chip RAM block L1 */
RAML6 : origin = 0x00E000, length = 0x001000/* on-chip RAM block L1 */
RAML7 : origin = 0x00F000, length = 0x001000/* on-chip RAM block L1 */
}
/* 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 : > FLASHB PAGE = 0
.pinit : > FLASHB PAGE = 0
.text : > FLASHB PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : > FLASHB PAGE = 0
csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML5 PAGE = 1
.esysmem : > RAMM1 PAGE = 1/* Initalized sections go in Flash *//* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHB PAGE = 0
.switch : > FLASHB PAGE = 0/* Allocate IQ math areas: */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/
创建完成cmd文件之后,在CCS6.0中(或之后的版本)右键点击之前的28335_RAM_lnk.cmd文件,选择Exculde from Build命令,则该文件不参与编译,检查烧写所用的cmd文件,如果没有参与编译,则取消勾选Exculde from Build命令,使该文件参与编译。
两个cmd文件只能选择其中一个参与编译,否则编译器有可能无法识别具体的操作空间而出错。
3.增加代码跳转文件
同时我们还需要在原有的调试程序项目中添加跳转代码文件DSP2833x_CodeStartBranch.asm,在处理器完成引导后跳转到用户应用过程入口。
同一芯片对应的DSP2833x_CodeStartBranch.asm文件也相同,因此我们可以从其他例程中拷贝或者自己添加该文件,文件内容如下:
注意:以下内容只试用于TMS320F28335!
;// TI File $Revision: /main/1 $
;// Checkin $Date: August 18, 200613:45:55 $
;//###########################################################################
;//
;// FILE: DSP2833x_CodeStartBranch.asm
;//
;// TITLE: Branch for redirecting code execution after boot.
;//
;// For these examples, code_start is the first code that is executed after
;// exiting the boot ROM code.
;//
;// The codestart section in the linker cmd fileis used to physically place
;// this code at the correct memory location. This section should be placed
;// at the location the BOOT ROM will re-direct the code to. For example,
;// for boot to FLASH this code will be located at 0x3f7ff6.
;//
;// In addition, the example DSP2833x projects are setup such that the codegen
;// entry point is also set to the code_start label. This is done by linker
;// option -e in the project build options. When the debugger loads the code,
;// it will automatically set the PC to the "entry point" address indicated by
;// the -e linker option. In this case the debugger is simply assigning the PC,
;// it isnot the same as a full reset of the device.
;//
;// The compiler may warn that the entry point for the project is other then
;// _c_init00. _c_init00 is the C environment setup andis run before
;// main() is entered. The code_start code will re-direct the execution
;// to _c_init00 and thus there is no worry and this warning can be ignored.
;//
;//###########################################################################
;// $TI Release: DSP2833x/DSP2823x C/C++ Header Files V1.31 $
;// $Release Date: August 4, 2009 $
;//###########################################################################
***********************************************************************
WD_DISABLE .set 1 ;set to1to disable WD, else set to0
.ref _c_int00
.global code_start
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for28x object code
EALLOW ;Enable EALLOW protectedregisteraccess
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bitin WDCR to disable WD
EDIS ;Disable EALLOW protectedregisteraccess
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end wd_disable
.end
;//===========================================================================
;// Endoffile.
;//===========================================================================