Update repo

This commit is contained in:
hangpersonal committed 2026-08-30 23:04:35 -07:00
1 parent 749dab5721
commit ce65a0f59a
14950 files changed
+4408250 -1

No files matched your search

@@ -0,0 +1,40 @@
<projectSpec>
<project
name="sysctl_ex1_missing_clock_detection"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="sysconfig;C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
postBuildStep="
echo &quot;========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) =============&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../sysctl_ex1_missing_clock_detection.c" targetDirectory="" />
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,40 @@
<projectSpec>
<project
name="sysctl_ex2_xclkout_config"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="sysconfig;C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
postBuildStep="
echo &quot;========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) =============&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../sysctl_ex2_xclkout_config.c" targetDirectory="" />
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,255 @@
//#############################################################################
//
// FILE: sysctl_ex1_missing_clock_detection.c
//
// TITLE: Missing clock detection
//
//! \addtogroup driver_example_list
//! <h1> Missing clock detection (MCD) </h1>
//!
//! This example demonstrates the missing clock detection functionality and
//! the way to handle it.
//! Once the MCD is simulated by disconnecting the OSCCLK to the MCD module
//! an NMI would be generated. This NMI determines that an MCD was generated
//! due to a clock failure which is handled in the ISR.
//!
//! Before an MCD the clock frequency would be as per device initialization (200Mhz).
//! Post MCD the frequency would move to 10Mhz or INTOSC1.
//!
//! The example also shows how we can lock the PLL after missing clock,
//! detection, by first explicitly switching the clock source to INTOSC1,
//! resetting the missing clock detect circuit and then re-locking the PLL.
//! Post a re-lock the clock frequency would be 200Mhz but using the INTOSC1 as
//! clock source.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - \b fail - Indicates that a missing clock was either not detected or was
//! not handled correctly.
//! - \b mcd_clkfail_isr - Indicates that the missing clock failure caused an
//! NMI to be triggered and called an the ISR to handle it.
//! - \b mcd_detect - Indicates that a missing clock was detected.
//! - \b result - Status of a successful handling of missing clock detection
//!
//
//#############################################################################
//
// C2000Ware v5.04.00.00
//
// Copyright (C) 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
//
bool mcd_detect;
uint16_t nmistatus = 0;
uint32_t mcd_clkfail_isr = 0;
//
// Defines
//
#define PASS 0
#define FAIL 1
uint32_t result = FAIL;
//
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
// PLLSYSCLK = 10MHz (INT_OSC1) * 80 (IMULT) / (2 (REFDIV) * 2 (ODIV) * 1(SYSDIV))
//
#define DEVICE_SETCLOCK_INTOSC (SYSCTL_OSCSRC_OSC1 | SYSCTL_IMULT(80) | \
SYSCTL_REFDIV(2) | SYSCTL_ODIV(2) | \
SYSCTL_SYSDIV(1) | SYSCTL_PLL_ENABLE)
//
// Function Prototypes
//
__interrupt void nmi_isr(void);
//
// Main
//
void main(void)
{
uint32_t fail = 0;
//
// 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();
//
// Re-map NMI signal to call the ISR function in this
// example
//
SysCtl_clearAllNMIFlags();
Interrupt_register(INT_NMI, &nmi_isr);
//
// Enabling the NMI global interrupt
//
SysCtl_enableNMIGlobalInterrupt();
Interrupt_enable(INT_NMI);
//
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM)
//
EINT;
ERTM;
//
// Check the PLL System clock before the Missing clock detection
// is simulated. It should be same as that set by Device_init().
//
if(SysCtl_getClock(DEVICE_OSCSRC_FREQ) != DEVICE_SYSCLK_FREQ)
fail++;
//
// Enable the missing clock detection (MCD) Logic as a precaution.
// The is continuously active, unless the MCD was disabled previously
//
SysCtl_enableMCD();
//
// Simulate a missing clock detection
//
SysCtl_disconnectMCDClockSource();
//
// Wait till the NMI is fired on clock failure
//
while(mcd_clkfail_isr != 0x1U);
//
// A missing clock was detected
//
if(mcd_detect != true)
fail++;
//
// Check if the NMI triggered was due to a clock failure
//
if((nmistatus & SYSCTL_NMI_CLOCKFAIL) != SYSCTL_NMI_CLOCKFAIL)
fail++;
//
// Check the PLL System clock after the Missing clock detection
// is simulated. It should be equal to INTOSC1(10Mhz).
//
if(SysCtl_getClock(DEVICE_OSCSRC_FREQ) != SYSCTL_DEFAULT_OSC_FREQ)
fail++;
//
// To lock the PLL after missing clock detection, we first explicitly
// switch the clock source to INTOSC1, reset the missing clock detect
// circuit and then re-lock the PLL.
//
// Configure oscillator source to INTOSC1
//
SysCtl_selectOscSource(SYSCTL_OSCSRC_OSC1);
//
// Re-connect missing clock detection clock source to stop simulating clock
// failure
//
SysCtl_connectMCDClockSource();
//
// Reset the missing clock detection logic after clock failure
//
SysCtl_resetMCD();
//
// Set up PLL control and clock dividers using INTOSC1 as clock source
//
SysCtl_setClock(DEVICE_SETCLOCK_INTOSC);
//
// Check the PLL System clock after the Missing clock detection
// is cleared and handled using INTOSC1 as clock source.
//
if(SysCtl_getClock(SYSCTL_DEFAULT_OSC_FREQ) != DEVICE_SYSCLK_FREQ)
fail++;
//
// Status of a successful handling of missing clock detection
//
if (fail)
{
result = FAIL;
}
else
{
result = PASS;
}
while(1);
}
//
// NMI ISR - The interrupt service routine called when the NMI
// is generated on clock failure detection
//
__interrupt void nmi_isr(void)
{
mcd_clkfail_isr = 0x1U;
mcd_detect = SysCtl_isMCDClockFailureDetected();
nmistatus = SysCtl_getNMIFlagStatus();
SysCtl_clearAllNMIFlags();
}
//
// End of File
//
@@ -0,0 +1,100 @@
//#############################################################################
//
// FILE: sysctl_ex2_xclkout_config.c
//
// TITLE: XCLKOUT Configuration
//
//! \addtogroup driver_example_list
//! <h1> XCLKOUT (External Clock Output) Configuration </h1>
//!
//! This example demonstrates how to configure the XCLKOUT pin for observing
//! internal clocks through an external pin, for debugging and testing purposes.
//!
//! In this example, we are using INTOSC1 as the XCLKOUT clock source and
//! configuring the divider as 8.
//! Expected frequency of XCLKOUT = (INTOSC1 freq)/8 = 10/8 = 1.25MHz
//!
//! View the XCLKOUT on GPIO73 using an oscilloscope.
//
//#############################################################################
//
// C2000Ware v5.04.00.00
//
// Copyright (C) 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)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Select the clock source for XCLKOUT. Refer to the enum SysCtl_ClockOut
// for other clock sources.
//
SysCtl_selectClockOutSource(SYSCTL_CLOCKOUT_INTOSC1);
//
// Configure the XCLOUT clock divider. The divider can be /1, /2, /4 or /8.
//
SysCtl_setXClk(SYSCTL_XCLKOUT_DIV_8);
//
// Configure GPIO73 as XCLKOUT pin.
//
GPIO_setPinConfig(GPIO_73_XCLKOUT);
//
// Loop Forever. The Clock can be viewed on the configured GPIO pin.
//
while(1);
}
//
// End of File
//