由三部分组成:
输入/输出定义:这一部分,可以通过ccs的“Build Option........”菜单设置
。obj 链接的目标文件
。lib 链接的库文件
。map 生成的交叉索引文件
。out 生成的可执行代码
MEMORY命令:描述系统实际的硬件资源
SECTION命令:描述“段”如何定位
例子
.cmd文件
-c
-o hello.out
-m hello.map
-stack 100
-l rts2xx.lib
MEMORY
{
PAGE 0: VECT:origin=0x8000,length 0x040
PAGE 0: PROG:origin=0x8040,length 0x6000
PAGE 1: DATA:origin=0x8000,length 0x400
}
SECTIONS
{
.vextors >VECT PAGE 0
.text >PROG PAGE 0
.bss >DATA PAGE 1
.const >DATA PAGE 1
}
存储模型:c程序的代码和数据如何定位
系统定义
.cinit 存放程序中的变量初值和常量
.const 存放程序中的字符常量、浮点常量和用const声明的常量
.switch 存放程序中switch语句的跳转地址表
.text 存放程序代码
.bss 为程序中的全局和静态变量保留存储空间
.far 为程序中用far声明的全局和静态变量保留空间
.stack 为程序系统堆栈保留存储空间,用于保存返回地址、函数间的参数传递、存储局部变量和保存中间结果
.sysmem 用于程序中的malloc 、calloc 、和realoc 函数动态分配存储空间
用户定义:
#pragma CODE_SECTION(symbol."section name")
#pragma DATA_SECTION(symbol,"section name")
///////////////////////////////////////////////////////////////////////////////////////////////////////
DSP新手请教个CMD 的问题
各位大虾,小弟是新手,请问这CMD 什么问题啊?我只用的一个普通的C语言 PRINTF 程序。
MEMORY
{PAGE 0 :ROM: o=0200h, l=5000h // 不知道为什么这个L小了,老是出错,大了就好了
PAGE 1: RAM: o=0200h, l=5000h
}
SECTIONS
{ .text:>ROM PAGE 0
.bss:> RAM PAGE 1
.const:>RAM PAGE 1
.cio:>RAM PAGE 1
.cinit:>ROM PAGE 0
.stack:>RAM PAGE 1
.sysmem:>RAM PAGE 1
}
错误是这么提示的,怎么改啊??
>> warning: creating .stack section with default size of 400 (hex) words.
Use
-stack option to change the default size.
>> warning: creating .sysmem section with default size of 400 (hex) words.
Use -heap option to change the default size.
另外: 为什么一定要有。STACK。SYSMEM。CIO 这些分配啊, 我看书上很多都没有分配这些段啊, 但是我不分配,就出错提示要分配这些段????
//WINTECH的cmd文件及与程序中内存的链接方法
/* ======================================================================== */
/* NAME */
/* link_dm643.cmd */
/* DESCRIPTION */
/* Linker-command file for the RF5 application */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2005 Wintech Digital System Technology Corp. */
/* All Rights Reserved. */
/* ======================================================================== */
-l vphone_dm643cfg.cmd
_H263ENC_IH263ENC = _H263ENC_TI_IH263ENC;
_H263DEC_IH263DEC = _H263DEC_TI_IH263DEC;
SECTIONS
{
H263ENC: > SDRAM, align=0x1000
{
*(h263encp)
*(h263enc)
*(h263share)
*(h263decp)
*(h263dec)
}
}
-l ../all_lib_files/h263_enc_720_480_cat.lib
-l ../all_lib_files/h263_dec_720_480_cat.lib
-l ../all_lib_files/vdpvport.l64
-l ../all_lib_files/vdp643bsl.lib
-l ../../c6400/dsplib/lib/dsp64x.lib
-l ../all_lib_files/dm643_edma_aic23.l64
-l ../all_lib_files/c6x1x_edma_mcasp.l64
-l ../../referenceframeworks/lib/algrf.l64
-l ../../referenceframeworks/lib/chan.l64
-l ../../referenceframeworks/lib/icc.l64
-l ../../referenceframeworks/lib/scom.l64
-l ../../referenceframeworks/lib/sscr.l64
-l ../../referenceframeworks/lib/utl.l64
-l ../all_lib_files/dm643.lib
-l ../../c6000/ndk/lib/c6400_l/netctrl.lib
-l ../../c6000/ndk/lib/hal/evmdm642_l/hal_eth_dm642.lib
-l ../../c6000/ndk/lib/hal/evmdm642_l/hal_ser_stub.lib
-l ../../c6000/ndk/lib/hal/evmdm642_l/hal_timer.lib
-l ../../c6000/ndk/lib/hal/evmdm642_l/hal_userled.lib
-l ../../c6000/ndk/lib/c6400_l/nettool.lib
-l ../../c6000/ndk/lib/c6400_l/stack.lib
-l ../../c6000/ndk/lib/c6400_l/os.lib
-l img64x.lib
-l ../../referenceframeworks/lib/acpy2_64x.l64
-l ../../referenceframeworks/lib/dman.l64
-l ../../c6400/dsplib/lib/dsp64x.lib
-l img64x.lib
-l ../all_lib_files/h323_rtp.lib
-l ../all_lib_files/h323_core.lib
-l ../all_lib_files/h323_low.lib
-l ../all_lib_files/h323_hjgl.lib
-l ../all_lib_files/UB_Live_H264BP_Dec.l64
-l ../all_lib_files/UB_Live_H264BP_DM643_Enc.l64
-l ../all_lib_files/UB_Live_ImageTools_DM643.l64
-l ../all_lib_files/wtosd.lib
-l ../all_lib_files/G723_DM643.lib
-l ../all_lib_files/G729_DM643.lib
SECTIONS
{
.user_data_int > ISRAM
.cache_align > ISRAM
.text:_CSL6400_LIB_ > ISRAM
.text:_CSL642_LIB_ > ISRAM
.text:_DAT_copy > ISRAM
.text:_DAT_copy2d > ISRAM
.text:_DAT_wait > ISRAM
.text:_EDMA_intAlloc > ISRAM
.text:_DAT_open > ISRAM
.text:_DAT_close > ISRAM
.user_data_ext > SDRAM
/* the tables should be placed in external RAM */
.h264encTables > SDRAM
.h264decTables > SDRAM
}
/* ======================================================================== */
/* End of file: link_dm643.cmd */
/* ------------------------------------------------------------------------ */
/* Copyright (c) 2005 Wintech Digital System Technology Corp. */
/* All Rights Reserved. */
/* ======================================================================== */
//程序中的引用部分
static unsigned char Y_out[FRAME_BUF_SIZE<<2];
static unsigned char Cb_out[FRAME_BUF_SIZE<<1];
static unsigned char Cr_out[FRAME_BUF_SIZE<<1];
#pragma DATA_SECTION(YArray_temp4, ".user_data_ext")
#pragma DATA_SECTION(CbArray_temp4, ".user_data_ext")
#pragma DATA_SECTION(CrArray_temp4, ".user_data_ext")
#pragma DATA_ALIGN(YArray_temp4, 128);
#pragma DATA_ALIGN(CbArray_temp4, 128);
#pragma DATA_ALIGN(CrArray_temp4, 128);
unsigned char YArray_temp4[(FRM_WIDTH*FRM_HEIGHT*4)<<2];
unsigned char CbArray_temp4[(FRM_WIDTH*FRM_HEIGHT)*4];
unsigned char CrArray_temp4[(FRM_WIDTH*FRM_HEIGHT)*4];
#pragma DATA_SECTION( Y_out, ".user_data_ext" )
#pragma DATA_ALIGN( Y_out, 128)
#pragma DATA_SECTION( Cb_out, ".user_data_ext" )
#pragma DATA_ALIGN( Cb_out, 128)
#pragma DATA_SECTION( Cr_out, ".user_data_ext" )
#pragma DATA_ALIGN( Cr_out, 128)