This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
编译器使用keil v5,程序编译后,debug模式下,程序可以正常运行,显示_c_int00入口地址0x20。断电重启后,程序无法运行。sys_link.cmd使用的是halcogen自动生成的。
FLASH 0x00000000 0x00300000
{
VECTORS 0x00000000 0x00000020
{
*.o (intvecs, +First)
}
FLASH0 0x00000020 0x0017FFE0
{
*.o (reset, +First)
*(InRoot$$Sections)
.ANY3 (+RO)
}
FLASH1 0x00180000 0x00180000
{
.ANY2 (+RO)
}
ARM_LIB_STACK 0x08000000 EMPTY 0x00001500
{
}
RAM 0x08001500 0x0003EB00
{
.ANY (+RW +ZI)
}
}
Hi Chao tian,
请参照如下步骤建立基于HALCoGen的uVision的工程项目,然后测试一下是否正常,从而验证一下你的操作是否正确:
For new HALCoGen projects:
1. Open HALCoGen and create a new project.
2. Select the device family and a device.
3. Enter the project name.
4. Select ARM Tools from the drop-down list.
5. Continue to build the project as described in the HALCoGen documentation.
For existing HALCoGen projects:
1. Use the menu Tools – ARM Tools.
2. Continue to build the project as described in the HALCoGen documentation.
The code output can be imported into μVision.
Importing HALCoGen Code into μVision
1. Create a new folder. For example, TMS570S20216SZWT.
2. Copy the generated code into this folder.
3. Open μVision and create a new project using that folder.
4. Select the correct device from the dialog Select Device for Target.
In this example, use the device TMS570S20216.
5. Click OK.
6. μVision asks whether to add the Startup Code to the project. Click the button No.
7. In the μVision window Project, right click Source Group 1 and choose Add Files to Group.
8. Add all C files with the exception of the operation system files OS_xxx.C.
9. Add all assembler source files, *.ASM, with the exception of the operating system files OS_xxx.ASM.
10. Open the dialog
Options for Target – Linker, disable Use Memory Layout from Target Dialog, and include the linker scatter file SYS_LINK.CMD.
11. To suppress warnings, right-click the file SYS_CORE.ASM and choose Options for File.
12. Select the tab Asm and enter --diag_suppress 1786 in the field Misc Controls.
13. Build the target in μVision.
14. Add the missing code for notifications as indicated by error messages and rebuild the project.
The location of the expected user code is labeled with the comments
/* USER CODE BEGIN (n) */ and
/* USER CODE END */.
(n) – enumerates the user code blocks within a module.
我一直是按照这个教程来做的,我觉得问题出在
FLASH0 0x00000020 0x0017FFE0
{
*.o (reset, +First)
*(InRoot$$Sections)
.ANY3 (+RO)
}
重启上电后,reset指令在0x20开始的地址,cpu上电后是从0开始执行。
我用iar试了,上电后可以正常运行程序。
Hi Chao tian,
用IAR试可以正常运行,应该说明程序没什么问题,有可能是keil里下载配置的问题,你可以确认一下代码有没有下载成功。对于MCU而言,程序都是从0开始执行的,而以上配置0-0x20存放的中断向量,程序正常运行仍能进入_c_int00入口,应该没问题。你的猜测是?另外,我们通常是使用HalCoGen配合CCS来使用的。