Other Parts Discussed in Thread: C2000WARE, SYSCONFIG
如题,我的程序就是当CPU2被CPU1从FLASH中启动时,CPU1把IPC_FLAG循环置一,CPU2的中断处理函数就是LED灯闪烁。当运行完CPU1程序之后,点击运行CPU2程序的时候可以看见实验现象。但是重新上电之后就没有这个实验现象了,是因为我的CPU2没有启动起来吗?
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.
如题,我的程序就是当CPU2被CPU1从FLASH中启动时,CPU1把IPC_FLAG循环置一,CPU2的中断处理函数就是LED灯闪烁。当运行完CPU1程序之后,点击运行CPU2程序的时候可以看见实验现象。但是重新上电之后就没有这个实验现象了,是因为我的CPU2没有启动起来吗?
您好,
请参考双核LED示例led_ex1_blinky ,允许CPU01主系统启动CPU02控制系统:
device_bootCPU2 (C1C2_brom_bootmode_boot_from_flash);
c2000ware多核开发指南7. Examples from C2000ware — C2000 Multicore Development Guide
我用device_bootCPU2 (C1C2_brom_bootmode_boot_from_flash);启动不了CPU2,用IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);可以启动,但是就是会出现我标题里面的问题。我的CPU1代码如下:////#############################################################################
////
//// FILE: empty_sysconfig_cpu1.c
////
//// TITLE: SysConfig Empty Project
////
//// CPU1 Empty Project Example
////
//// This example is an empty project setup for SysConfig development for CPU1.
////
////#############################################################################
////
////
//// $Copyright:
//// Copyright (C) 2013-2024 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.
//// $
////#############################################################################
//
////
//// Included Files
////
//#include "driverlib.h"
//#include "device.h"
//
////
//// Main
////
//void main(void)
//{
//
//}
//
////
//// End of File
////
#include "device.h"
//#include "F28x_Project.h"
#include "board.h"
#include <driverlib.h>
/**
* main.c
*/
void main(void)
{
Device_init(); // Initialize device clock and peripherals
Device_initGPIO(); // Initialize GPIO and configure the GPIO pin as a push-pull output
Interrupt_initModule(); // Initialize PIE and clear PIE registers. Disables CPU interrupts.
IER = 0x0000; //CPU级中断使能
IFR = 0x0000; //清除CPU级中断标志
Interrupt_initVectorTable(); // Initialize the PIE vector table with pointers to ISR
//IPC初始化
// Initialize SysConfig Settings
//
Board_init();
// GpioDataRegs.GPDSET.bit.GPIO99=1;
// Device_bootCPU2(BOOT_MODE_CPU2);//启动CPU2,不行,用这个函数会
// GpioDataRegs.GPDSET.bit.GPIO99=1;
// Clear any IPC flags if set already
//
//#ifdef _STANDALONE
#ifdef _FLASH
// Send boot command to allow the CPU02 application to begin execution
//IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);//这是bit-field库
IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
#else
// Send boot command to allow the CPU02 application to begin execution
//IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
#endif
//#endif
IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU1_L_CPU2_R, CPU1_to_CPU2_IPC_FLAG31);//阻塞直到CPU2也运行到这个函数?
// IpcRegs.IPCSET.bit.IPC0=1;
EINT; // Enable Global Interrupt (INTM)
ERTM; // Enable real-time interrupt (DBGM)
// IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_DISABLE,
// 0, 0, 0);
for (;;)
{
IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_DISABLE,
0, 0, 0);
DEVICE_DELAY_US(1000000);//driverlib的延时函数
GPIO_writePin(myGPIO133, 1);
DEVICE_DELAY_US(1000000);//driverlib的延时函数
GPIO_togglePin(133);
}
}
您好,
建议先直接测试c2000ware中的示例代码。
请检查工程配置为Flash active.
(+) [FAQ] [常见问题解答] 闪存 - 如何将应用程序从 RAM 配置修改为flash配置? - C2000︎ 微控制器论坛 - C2000 微控制器 - E2E
设计支持
您好,
在 CPU1_FLASH_STANDALONE build 配置中,定义了两个符号:_STANDALONE 和 _FLASH。
使用该代码,CPU2 从 Flash Sector0 启动
是测试这个链接 ipc_ex3_basic_sysconfig 的工程吗,在CCS中 import工程,重新编译一下。
现在是这么个情况:我的启动代码是这样,目前就是 IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH); //这行会被执行 用这个启动的话,代码烧录进去,然后断掉调试器,没有反应,重启也没反应。IPC_setBootMode(IPC_CPU1_L_CPU2_R, C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);用这行代码的话,就是代码烧录进去,断掉调试器就有实验现象,但是重启就不行了,就没反应了。这是为什么呢?
这个帖子没有参考价值,因为我调用的就是IPC_setBootMode,但是代码烧录进去,断掉调试器就有实验现象,但是重启就不行了,就没反应。调用Device_bootCPU2和IPCBootCPU2就是代码烧录进去也没实验现象,能否提出具体的可行措施,我已经卡在这里一个月了