Update repo
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="nmi_ex1_cpu1handling"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON_INCLUDE} -I${C2000WARE_HEADERS_INCLUDE} --define=CPU1 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON_INCLUDE} -I${C2000WARE_HEADERS_INCLUDE} --define=_FLASH --define=CPU1 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<pathVariable name="C2000WARE_COMMON_INCLUDE" path="../../../../../../device_support/f2837xd/common/include/" scope="project" />
|
||||
<pathVariable name="C2000WARE_HEADERS_INCLUDE" path="../../../../../../device_support/f2837xd/headers/include/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../nmi_ex1_cpu1handling.c" targetDirectory="" />
|
||||
</project>
|
||||
<project
|
||||
name="nmi_ex1_cpu2wdreset"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH --define=CPU2 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU2_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../nmi_ex1_cpu2wdreset.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,71 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="nmi_ex2_sysconfig_multi"
|
||||
configurations="
|
||||
FLASH,
|
||||
RAM,
|
||||
"
|
||||
device="TMS320F28377D"
|
||||
outputType="system"
|
||||
cgtVersion="20.2.1.LTS"
|
||||
>
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file path="../system.xml" action="copy" openOnCreation="true"/>
|
||||
<configuration name="FLASH"
|
||||
></configuration>
|
||||
<configuration name="RAM"
|
||||
></configuration>
|
||||
</project>
|
||||
<project
|
||||
name="nmi_ex2_sysconfig_cpu1"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="20.2.1.LTS"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json"
|
||||
>
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH --define=CPU1 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../nmi_ex2_sysconfig_cpu1.c" targetDirectory="" />
|
||||
<file action="copy" path="../nmi_ex2_sysconfig_cpu1.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
<project
|
||||
name="nmi_ex2_sysconfig_cpu2"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="20.2.1.LTS"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json"
|
||||
>
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH --define=CPU2 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/cmd/2837xD_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/cmd/2837xD_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/F2837xD/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../nmi_ex2_sysconfig_cpu2.c" targetDirectory="" />
|
||||
<file action="copy" path="../nmi_ex2_sysconfig_cpu2.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,157 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: nmi_ex1_cpu1handling.c
|
||||
//
|
||||
// TITLE: NMI Handling between CPU cores
|
||||
//
|
||||
//! \addtogroup driver_dual_example_list
|
||||
//! <h1> NMI handling</h1>
|
||||
//!
|
||||
//! This example demonstrates how to handle an NMI.
|
||||
//!
|
||||
//! The watchdog of CPU 2 is configured to reset the core once the watchdog
|
||||
//! overflows and in the CPU 1 the NMI is triggered.
|
||||
//! The NMI status is read and is verified to be due to CPU2 Watchdog reset.
|
||||
//! \b Watch \b Variables
|
||||
//! - \e pass Indicates that the CPU2 has been reset by its watchdog and an
|
||||
//! -NMI was triggered at 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "sysctl.h"
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint32_t nmistatus = 0,nmiflagstatus =0 ,nmisdflagstatus =0,nmiwdcnt =0;
|
||||
volatile uint16_t nmi_isr_called = 0,pass = 0;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
interrupt void nmi_isr(void);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
#ifdef _STANDALONE
|
||||
#ifdef _FLASH
|
||||
//
|
||||
// Send boot command to allow the CPU2 application to begin execution
|
||||
//
|
||||
Device_bootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
|
||||
#else
|
||||
//
|
||||
// Send boot command to allow the CPU2 application to begin execution
|
||||
//
|
||||
Device_bootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_RAM);
|
||||
|
||||
#endif // _FLASH
|
||||
#endif // _STANDALONE
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR)
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
SysCtl_clearAllNMIFlags();
|
||||
Interrupt_register(INT_NMI, &nmi_isr);
|
||||
|
||||
//
|
||||
//Enabling the NMI global interrupt
|
||||
//
|
||||
EALLOW;
|
||||
HWREGH(NMI_BASE + NMI_O_CFG) |= NMI_CFG_NMIE;
|
||||
EDIS;
|
||||
|
||||
Interrupt_enable(INT_NMI);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
while(nmi_isr_called != 1)
|
||||
{
|
||||
pass=0;
|
||||
}
|
||||
|
||||
if(SysCtl_isNMIShadowFlagSet(SYSCTL_NMI_CPU2WDRSN)==true)
|
||||
pass = 1;
|
||||
|
||||
SysCtl_clearAllNMIFlags();
|
||||
if(pass == 1)
|
||||
{
|
||||
Example_setResultPass();
|
||||
}
|
||||
else
|
||||
{
|
||||
Example_setResultFail();
|
||||
}
|
||||
|
||||
Example_done();
|
||||
}
|
||||
|
||||
interrupt void nmi_isr(void)
|
||||
{
|
||||
nmi_isr_called = 1;
|
||||
nmiflagstatus = SysCtl_getNMIFlagStatus();
|
||||
nmisdflagstatus = SysCtl_getNMIShadowFlagStatus();
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,126 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: nmi_ex1_cpu2wdreset.c
|
||||
//
|
||||
// TITLE: Servicing Watchdog reset nmi Example
|
||||
//
|
||||
//! \addtogroup driver_dual_example_list
|
||||
//! <h1> Watchdog Reset</h1>
|
||||
//!
|
||||
//! This example shows how to service the watchdog to reset CPU2 which
|
||||
//! will trigger an NMI in CPU1.
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - loopCount - The number of loops performed while not in ISR
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $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"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t loopCount;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Clear the counters
|
||||
//
|
||||
loopCount = 0;
|
||||
|
||||
//
|
||||
// Set the watchdog to generate an interrupt signal instead of a
|
||||
// reset signal
|
||||
//
|
||||
if(SysCtl_isWatchdogInterruptActive()==false)
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
|
||||
else
|
||||
{
|
||||
SysCtl_serviceWatchdog();
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
|
||||
}
|
||||
|
||||
//
|
||||
// Reset the watchdog counter
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
|
||||
//
|
||||
// Enable the watchdog
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Loop Forever
|
||||
//
|
||||
for(;;)
|
||||
{
|
||||
loopCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,149 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: nmi_ex2_sysconfig_cpu1.c
|
||||
//
|
||||
// TITLE: SysConfig NMI Handling between CPU cores
|
||||
//
|
||||
//! \addtogroup driver_dual_example_list
|
||||
//! <h1> NMI handling</h1>
|
||||
//!
|
||||
//! This example demonstrates how to handle an NMI.
|
||||
//!
|
||||
//! The watchdog of CPU 2 is configured to reset the core once the watchdog
|
||||
//! overflows and in the CPU 1 the NMI is triggered.
|
||||
//! The NMI status is read and is verified to be due to CPU2 Watchdog reset.
|
||||
//! \b Watch \b Variables
|
||||
//! - \e pass Indicates that the CPU2 has been reset by its watchdog and an
|
||||
//! -NMI was triggered at 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "sysctl.h"
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint32_t nmistatus = 0,nmiflagstatus =0 ,nmisdflagstatus =0,nmiwdcnt =0;
|
||||
volatile uint16_t nmi_isr_called = 0,pass = 0;
|
||||
uint16_t int_count = 0;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
interrupt void nmi_isr(void);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
#ifdef _STANDALONE
|
||||
Device_bootCPU2(BOOT_MODE_CPU2);
|
||||
#endif // _STANDALONE
|
||||
|
||||
//
|
||||
// Initialize SysConfig Configuration
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR)
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
SysCtl_clearAllNMIFlags();
|
||||
Interrupt_register(INT_NMI, &nmi_isr);
|
||||
Interrupt_enable(INT_NMI);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
while(nmi_isr_called != 1)
|
||||
{
|
||||
pass=0;
|
||||
}
|
||||
|
||||
if(SysCtl_isNMIShadowFlagSet(SYSCTL_NMI_CPU2WDRSN)==true)
|
||||
{
|
||||
pass = 1;
|
||||
}
|
||||
|
||||
int_count++;
|
||||
|
||||
SysCtl_clearAllNMIFlags();
|
||||
if(pass == 1)
|
||||
{
|
||||
Example_setResultPass();
|
||||
}
|
||||
else
|
||||
{
|
||||
Example_setResultFail();
|
||||
}
|
||||
|
||||
Example_done();
|
||||
}
|
||||
|
||||
interrupt void nmi_isr(void)
|
||||
{
|
||||
nmi_isr_called = 1;
|
||||
nmiflagstatus = SysCtl_getNMIFlagStatus();
|
||||
nmisdflagstatus = SysCtl_getNMIShadowFlagStatus();
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
|
||||
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
|
||||
* @cliArgs --device "F2837xD" --package "F2837xD_100PTP" --part "F2837xD_100PTP" --context "CPU1" --product "C2000WARE@4.02.00.00"
|
||||
* @versions {"tool":"1.13.0+2553"}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const ipc = scripting.addModule("/driverlib/ipc.js");
|
||||
const sysctl = scripting.addModule("/driverlib/sysctl.js");
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
sysctl.enableNMIGlobalInterrupt = true;
|
||||
@@ -0,0 +1,132 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: nmi_ex2_sysconfig_cpu2.c
|
||||
//
|
||||
// TITLE: SysConfig Servicing Watchdog reset nmi Example
|
||||
//
|
||||
//! \addtogroup driver_dual_example_list
|
||||
//! <h1> Watchdog Reset</h1>
|
||||
//!
|
||||
//! This example shows how to service the watchdog to reset CPU2 which
|
||||
//! will trigger an NMI in CPU1.
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - loopCount - The number of loops performed while not in ISR
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $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"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t loopCount;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize SysConfig Configuration
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Clear the counters
|
||||
//
|
||||
loopCount = 0;
|
||||
|
||||
//
|
||||
// Set the watchdog to generate an interrupt signal instead of a
|
||||
// reset signal
|
||||
//
|
||||
if(SysCtl_isWatchdogInterruptActive()==false)
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
|
||||
else
|
||||
{
|
||||
SysCtl_serviceWatchdog();
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
|
||||
}
|
||||
|
||||
//
|
||||
// Reset the watchdog counter
|
||||
//
|
||||
SysCtl_serviceWatchdog();
|
||||
|
||||
//
|
||||
// Enable the watchdog
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Loop Forever
|
||||
//
|
||||
for(;;)
|
||||
{
|
||||
loopCount++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
|
||||
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
|
||||
* @cliArgs --device "F2837xD" --package "F2837xD_100PTP" --part "F2837xD_100PTP" --context "CPU2" --product "C2000WARE@4.02.00.00"
|
||||
* @versions {"tool":"1.13.0+2553"}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const ipc = scripting.addModule("/driverlib/ipc.js");
|
||||
const watchdog = scripting.addModule("/driverlib/watchdog.js", {}, false);
|
||||
const watchdog1 = watchdog.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
watchdog1.$name = "myWATCHDOG0";
|
||||
watchdog1.enableModule = false;
|
||||
watchdog1.wdMode = "SYSCTL_WD_MODE_INTERRUPT";
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<system>
|
||||
<project configuration="@match" id="project_0" name="nmi_ex2_sysconfig_cpu1">
|
||||
</project>
|
||||
<core id="C28xx_CPU1" project="project_0"/>
|
||||
<project configuration="@match" id="project_1" name="nmi_ex2_sysconfig_cpu2">
|
||||
</project>
|
||||
<core id="C28xx_CPU2" project="project_1"/>
|
||||
<preBuildSteps>
|
||||
</preBuildSteps>
|
||||
<postBuildSteps>
|
||||
</postBuildSteps>
|
||||
|
||||
</system>
|
||||
Reference in New Issue
Block a user