问题1 TI提供的LC4357的CMD文件,都是在FLASH中运行,调试阶段也把代码放FLASH里面了,我改了下CMD文件,调试仿真期间,可以在RAM跑了,但 有 个小问题,就是第一次进调试模式时,加载完代码,程序就自己运行了,且运行时错误的,然后我要手动点击停止,然后再重新加载一次就能正常的在RAM运行了,这个不知道是哪里的问题
问题2 程序脱机实际运行的时候,能否把代码加载到RAM里跑,我在想,这样肯定能提高代码的运行速度。如果可以的话,该怎么操作呢,而且能实现加载一部分代码到RAM的话就更好了,毕竟RAM空间比较小,只加载比较重要的一些功能代码或者算法啥的就可以了。
Susan Yang:
user18914063 说:就是第一次进调试模式时,加载完代码,程序就自己运行了,且运行时错误的,
请问是只有第一次这样?debug configuration 内的AUOO RUN是如何设置的呢?CCS版本是多少?运行时错误能否给出详细信息?
user18914063 说:如果可以的话,该怎么操作呢,而且能实现加载一部分代码到RAM的话就更好了
这个是可以实现的。
链接程序cmd文件中的MEMORY命令描述目标系统的内存映射。这些内存空间用作SECTIONS命令中语句的目标。
A SECTIONS命令描述每个命名输出节的位置,并指定将哪些输入节放入其中。
您可以在输出部分(例如.text ,.data )内添加命令来创建符号:_text_start,_text_end,_data_start或_data_end。当将数据从闪存复制到RAM时,这些符号将很有用。
在您的c或asm文件中,您需要将最初存储在闪存中的代码复制到RAM。类似下面这样
//copy the contents in .text output section from FLASH to RAM:
extern const char _text_start, _text_end; //created in linker ld file
void __main (void)
{
memcpy(&_copy_start, &_run_start, &_copy_end – &_copy_start);
return;
}
您可以参考 这个链接
,
user18914063:
RAM里面仿真跑的问题,是每次要进调试模式时,都是一加载,然后自己就开始运行了,运行是错误的,要手动停止,再加载才能正常跑
,
user18914063:
刚你发的那个链接失效了
,
Susan Yang:
我这边是可以直接打开的
/*********************************************************************** * Author: QJ Wang. qjwang@ti.com * Date: 5-25-2019 */ /* Copyright (C) 2013-2019 Texas Instruments Incorporated - http://www.ti.com/***Redistribution and use in source and binary forms, with or without*modification, are permitted provided that the following conditions*are met:**Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.**Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the*distribution.**Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR*A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT*OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,*SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT*LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,*DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY*THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT*(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE*OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ /**/ /*----------------------------------------------------------------------------*/ /* USER CODE BEGIN (0) */ /* USER CODE END *//*----------------------------------------------------------------------------*/ /* Linker Settings*/--retain="*(.intvecs)"/* USER CODE BEGIN (1) */ /* USER CODE END *//*----------------------------------------------------------------------------*/ /* Memory Map*/ MEMORY { /* USER CODE BEGIN (2) */ /* USER CODE END */VECTORS(X): origin=0x00000000 length=0x00000020 vfill = 0xffffffffFLASH0(RX): origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffffFLASH1(RX): origin=0x00200000 length=0x00200000 vfill = 0xffffffffSRAM(RWX): origin=0x08002000 length=0x0002D000STACK(RW): origin=0x08000000 length=0x00002000/* USER CODE BEGIN (3) */ /*ECC_VEC (R): origin=0xf0400000 length=0x4 ECC={algorithm=algoL2R5F021, input_range=VECTORS }ECC_FLA0 (R) : origin=0xf0400000 + 0x4 length=0x3FFFC ECC={algorithm=algoL2R5F021, input_range=FLASH0 }ECC_FLA1 (R) : origin=0xf0440000 length=0x40000 ECC={algorithm=algoL2R5F021, input_range=FLASH1 } */ #if 1ECC_VEC(R) : origin=(0xf0400000 + (start(VECTORS) >> 3))length=(size(VECTORS) >> 3)ECC={algorithm=algoL2R5F021, input_range=VECTORS}ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0)>> 3))length=(size(FLASH0)>> 3)ECC={algorithm=algoL2R5F021, input_range=FLASH0 }ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1)>> 3))length=(size(FLASH1)>> 3)ECC={algorithm=algoL2R5F021, input_range=FLASH1 } #endif /* USER CODE END */}/* USER CODE BEGIN (4) */ ECC {algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */hamming_mask = R4/* Use R4/R5 build in Mask */parity_mask= 0x0c/* Set which ECC bits are Even and Odd parity */mirroring= F021/* RM57Lx and TMS570LCx are build in F021 */ } /* USER CODE END *//*----------------------------------------------------------------------------*/ /* Section Configuration*/ SECTIONS { /* USER CODE BEGIN (5) */ /* USER CODE END */.intvecs : {} > VECTORS/* The toot directory is \Debug */flashAPI:{.\source\Fapi_UserDefinedFunctions.obj (.text).\source\bl_flash.obj (.text)--library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_L2FMC.lib" (.text)} palign=8 load = FLASH0 |FLASH1, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize).text: {} palign=8 > FLASH0 |FLASH1 /*Initialized executable code and constants*/.const: {} palign=8 load=FLASH0 |FLASH1, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize)/*Initialized constant data (e.g. const flash_sectors[..] = )*/.cinit: {} palign=8 > FLASH0 |FLASH1/*Initialized global and static variables*/.pinit: {} palign=8 > FLASH0 |FLASH1.data: {} > SRAM.bss: {} > SRAM.sysmem: {} > SRAM/* USER CODE BEGIN (6) *//* USER CODE END */ }/* USER CODE BEGIN (7) */ /* USER CODE END *//*----------------------------------------------------------------------------*/ /* Misc*//* USER CODE BEGIN (8) */ /* USER CODE END */ /*----------------------------------------------------------------------------*/
,
Susan Yang:
debug configuration 内的AUOO RUN是如何设置的呢?CCS版本是多少?运行时错误能否给出详细信息或截图?
,
user18914063:
,
user18914063:
这是我的ATUO RUN设置,CCS是9.0版本的
,
Susan Yang:
图片未能成功上传,请您以附件形式上传,谢谢
,
user18914063:
,
user18914063:
你贴出来的CMD文件,让代码在RAM中跑,那程序那边是否还要做个memcopy的调用呢
,
Susan Yang:
1 auto run 看起来设置没有问题.“运行是错误的” 具体表现是什么?
2 理论上程序还是需要调用memcopy
,
user18914063:
程序运行是错误的,这个我可能没表述清楚,我截图了,就是上面这个截图,本来加载完毕,还要点击三角形的运行按钮才开始程序运行的,但是一加载完毕,就自己开始运行了,而且看样子应该不是在正常的运行
,
user18914063:
目前我的CMD文件配置如下:
MEMORY
{
FLASH0(RX) : origin=0x00000000 length=0x00200000FLASH1(RX) : origin=0x00200000 length=0x00200000
STACKS(RW) : origin=0x08000000 length=0x00001500VECTORS (X): origin=0x08001500 length=0x00000020RAM(RW) : origin=0x08001520 length=0x0007EA80
}SECTIONS
{.intvecs : {} > VECTORS//.textalign(32) : {} > RAM//FLASH0 | FLASH1//.constalign(32) : {} > RAM//FLASH0 | FLASH1.text: {} > RAM//FLASH0 | FLASH1.const: {} > RAM//FLASH0 | FLASH1
//.constalign(32) : {} > RAM1//.cinitalign(32) : {} > RAM//FLASH0 | FLASH1//.pinitalign(32) : {} > RAM//FLASH0 | FLASH1.cinit: {} > RAM//FLASH0 | FLASH1.pinit: {} > RAM//FLASH0 | FLASH1.bss: {} > RAM.data: {} > RAM.sysmem: {} > RAM
}
这个配置,在今天上午的时候,还正常的跑过几次调试模式,后来不知道哪没对,就不行了,调试模式运行明显有问题,是不是还是CMD配置有问题?我的主要目的就是想在调试阶段让代码在RAM运行,而不是每次都烧写FLASH
,
Susan Yang:
很抱歉,之前漏掉了您的回复。请问您现在该问题如何了?