DSP-编写注意事项

上传人:wuli****0220 文档编号:166980832 上传时间:2022-11-02 格式:DOC 页数:18 大小:995KB
返回 下载 相关 举报
DSP-编写注意事项_第1页
第1页 / 共18页
DSP-编写注意事项_第2页
第2页 / 共18页
DSP-编写注意事项_第3页
第3页 / 共18页
点击查看更多>>
资源描述
关于TMS320F28XX启动代码使用方法共18页链接WARNNING选项-w选项最好选上,有助于编译器在用户没有显式指定某一SECTION的链接方式时报warnning。The -w option can be selected in Code Composer Studio on the Project Build_Options menu, Linker tab, select the Advanced category, and then check the -w option box.内存大小端模式It is important that the large memory model be used with the C-compiler (as opposed to the small memory model). Small memory model requires certain initialized sections to be linked to non-volatile memory in the lower 64Kw of addressable space. However, no flash memory is present in this region on any current F28xx devices, and this will likely be true for future F28xx devices aswell. Therefore, large memory model should be used. In Code Composer Studio, the large memory model is on the Project Build_Options menu. Select the Compiler tab, choose the Advanced category, and check the -ml option box. For non-DSP/BIOS projects, one should include the large memory model Ccompiler runtime support library, rts2800_ml.lib, into their code project (as opposed to rts2800.lib, which is for the small memory model). For DSP/BIOS projects, DSP/BIOS will take care of including the required library. The user should not include the rts2800_ml.lib (or rts2800.lib) library into a DSP/BIOS project.Non-DSP/BIOSProjects链接位置图表 1 LINKDSP/BIOS Projects链接位置图表 2 LINKTable 2 Notes:1. The .trcdata section must be copied by the user from its load address (specified on theLoad_Address tab) to its run address (specified on the BIOS_Data tab) at runtime. See Section4.3 for details on performing this copy.2. The PIEVECT RAM is a specific block of RAM associated with the Peripheral InterruptExpansion (PIE) peripheral. On current F28xx devices, the PIE RAM is a 256x16 block startingat address 0x000D00 in data space. For other devices, confirm the address in the devicedatasheet. The memory section manager in the DSP/BIOS configuration tool should alreadyhave a pre-defined memory named PIEVECT. The .hwi_vec section must be copied by the userfrom its load address (specified on the memory section manager Load_Address Tab) to its runaddress (specified on the memory section manager BIOS_Code Tab) at runtime. See Section4.2 for details on performing this copy.3. The specific flash memory selected as the load address for this section should be the sameflash memory selected previously as the run address for the section (e.g., on the BIOS_Data,BIOS_Code, or Compiler_Sections tab).拷贝中断向量(non-DSP/BIOS only)调用InitPieVectTable函数完成中断向量拷贝,函数原型位于DSP280x_PieVect.c。拷贝硬件向量(DSP/BIOS only)图表 3 拷贝中断向量拷贝.trcdata(DSP/BIOS only)第一步:需要如下图配置。图表 4 配置编译器第二步:代码实现。图表 5 拷贝trcdata代码实现FLASH控制寄存器初始化(DSP/BIOS AND non-DSP/BIOS)图表 6 FLASH控制器初始化CAUTION:The flash control registers are protected by the Code Security Module (CSM). If the CSM is secured, you must run the flash register initialization code from secured RAM (e.g., L0 or L1 SARAM) or the initialization code will be unable to access the flash registers. Note that the CSM is always secured at device reset, although the ROM bootloader will unlock it if you are using dummy passwords of 0xFFFF.图表 7 secureRamFuncs定义图表 8 将代码从加载域拷贝到运行域拷贝到运行域提高速度(DSP/BIOS AND non-DSP/BIOS)The on-chip RAM memory on current F28xx devices provides code execution performance of 150 MIPS (millions of instructions per second) at 150 MHz on F281x devices, and 100 MIPS at 100 MHz on F280x devices. However, the on-chip flash memory on these devices provides effective code execution performance that is slightly less: roughly 90 100 MIPS on F281x devices, and roughly 85 90 MIPS on F280x devices.拷贝常量到运行域提高速度(DSP/BIOS AND non-DSP/BIOS)方法一所有const变量的运行域都在RAM,优点操作简单,缺点内存开销大。Non-DSP/BIOS Projects图表 9 常量运行域都在RAM的操作.econst是系统标识符。DSP/BIOS Projects在这个模式下,虽然也可以单独指定.econst的加载地址和运行地址,但是不会生成相应的可以被程序引用的符号,因此还是需要用户配置link文件指定。与Non-DSP/BIOS Projects相比较多出一个步骤,即需要指定用户link文件先于系统link文件编译。通过Project Build_Options, selecting the Link_Order tab,可以指定编译顺序,如下图所示。图表 10 指定用户的link文件优先于系统link文件.econst是系统标识符。方法二(DSP/BIOS and non-DSP/BIOS projects)用户指定的部分常量,通过用户link文件分配到指定的FLASH加载,在指定的RAM运行。这种方法的好处就是节省内存开销。利用DATA_SECTION关键字用户可以指定一个section,注意这个section不是.econst。将用户指定的常量的运行域指定到section。密码保护模式在开发阶段一般不需要密码保护,开发完成后为了方式嵌入式代码被非法拷贝,TMS32028xx提供了密码保护机制,就是所说的CSM模式。TMS32028xx的片内flash、OTP memory以及L0、L1 RAM都是CSM保护的。当处于有密码保护的状态时,受CSM保护的RAM之间可以互相访问,未受CSM保护的内存中的代码无法访问那些受CSM保护的区域。CSM使用16字节的密码锁,地址是0x3F7FF8至0x3F7FFF。在开发阶段,最好通过擦除FLASH的方法将密码置为空(0xFFFF就是空密码)。开发完毕后,如果需要设置密码需要进行两步操作:1、往0x3F7FF8至0x3F7FFF写入密码(不可以全为0,否则将永久锁定);2、将0x3F7F80至0x3F7FF5置为0。Non-DSP/BIOS Projects写入密码方法:用汇编语言写个简单的文件passwords.asm,用户替换0xFFFF为其它想要的密码。图表 11 汇编写CSM密码除了上述步骤外,还需要在用户link文件中指定“passwords”和“csm_rsvd”的地址,如下图所示:图表 12 用户link文件中配置地址DSP/BIOS Projects利用DSP/BIOS configuration tool定义内存地址,例如名称为PASSWORDS和CSM_RSVD。图表 13 汇编写密码图表 14 用户link定义变量地址复位后从FLASH执行程序F28xx DSP具备bootloader,能在执行完bootloader后跳转到FLASH执行,地址是0x3F7FF6。用户需要在该地址写入一条跳转指令,一般跳转到库函数执行C运行环境初始化函数_c_int00。不过,用户可以根据实际需求跳转到汇编指令处,但需要记住不可以在调用_c_int00之前跳转到C程序。DSP/BIOS和non-DSP/BIOS在操作上有所区别。non-DSP/BIOS图表 15 跳转指令DSP/BIOS禁止内部看门狗在bootloader后一般是跳转到_c_int00执行C环境初始化,其主要工作内容是将加载域中的变量值拷贝到运行域。这样在变量加大的情况下拷贝时间可能会比较长。而DSP复位后内部看门狗是默认开启的,因此有可能存在的一个问题是C环境尚未初始化之前看门狗起作用,导致无法正常进入main函数。一个简单的解决方法是在调用C环境初始化函数前将看门狗禁止掉,然后再main函数里面重新使能。这时候必须用到汇编语句,如下图所示:图表 16 禁止看门狗.
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 图纸专区 > 中学资料


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!