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,100 @@
//#############################################################################
//
// FILE: can_cpu1_allocate_to_cpu2.c
//
// TITLE: CPU1 Allocate CAN Peripheral to CPU2 example
//
//! \addtogroup driver_dual_example_list
//! <h1> NMI handling</h1>
//!
//! This example demonstrates how to allocate CAN peripheral to CPU2.
//!
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2022 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)
{
//
// Configure PLL, disable WD, enable peripheral clocks.
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Hand-over the CAN module access to CPU2
//
SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL8_CAN, 1, SYSCTL_CPUSEL_CPU2);
//
// Configuring the GPIOs for CAN.
//
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
//
// Initialize interrupt controller and vector table.
//
Interrupt_initModule();
Interrupt_initVectorTable();
while(1)
{
//
// Forever Loop
//
}
}
//
// End of File
//
@@ -0,0 +1,221 @@
//#############################################################################
//
// FILE: can_ex1_cpu2_loopback.c
//
// TITLE: CPU2 CAN Loopback example
//
//! \addtogroup driver_dual_example_list
//! <h1> Watchdog Reset</h1>
//!
//! This example sets up the CAN controller in External Loopback test mode using CPU2
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - msgCount - A counter for the number of successful messages received
//! - txMsgData - An array with the data being sent
//! - rxMsgData - An array with the data that was received
//!
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2022 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"
//
// Defines
//
#define MSG_DATA_LENGTH 2
#define TX_MSG_OBJ_ID 1
#define RX_MSG_OBJ_ID 2
//
// Globals
//
volatile unsigned long msgCount = 0;
uint16_t txMsgData[2];
uint16_t rxMsgData[2];
//
// Main
//
void main(void)
{
//
// Configure PLL, disable WD, enable peripheral clocks.
//
Device_init();
//
// Initialize interrupt controller and vector table.
//
Interrupt_initModule();
Interrupt_initVectorTable();
//
// Initialize the CAN controller
//
CAN_initModule(CANA_BASE);
//
// Set up the CAN bus bit rate to 500kHz
// Refer to the Driver Library User Guide for information on how to set
// tighter timing control. Additionally, consult the device data sheet
// for more information about the CAN module clocking.
//
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
//
// Enable CAN test mode with external loopback
//
CAN_enableTestMode(CANA_BASE, CAN_TEST_EXL);
//
// Initialize the transmit message object used for sending CAN messages.
// Message Object Parameters:
// Message Object ID Number: 1
// Message Identifier: 0x1
// Message Frame: Standard
// Message Type: Transmit
// Message ID Mask: 0x0
// Message Object Flags: Transmit Interrupt
// Message Data Length: 4 Bytes
//
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_TX_INT_ENABLE,
MSG_DATA_LENGTH);
//
// Initialize the receive message object used for receiving CAN messages.
// Message Object Parameters:
// Message Object ID Number: 2
// Message Identifier: 0x1
// Message Frame: Standard
// Message Type: Receive
// Message ID Mask: 0x0
// Message Object Flags: Receive Interrupt
// Message Data Length: 4 Bytes (Note that DLC field is a "don't care"
// for a Receive mailbox
//
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
MSG_DATA_LENGTH);
//
// Initialize the transmit message object data buffer to be sent
//
txMsgData[0] = 0x12;
txMsgData[1] = 0x34;
//
// Start CAN module operations
//
CAN_startModule(CANA_BASE);
//
// Loop Forever - Send and Receive data continuously
//
for(;;)
{
//
// Send CAN message data from message object 1
//
CAN_sendMessage(CANA_BASE, 1, MSG_DATA_LENGTH, txMsgData);
//
// Delay before receiving the data
//
DEVICE_DELAY_US(500000);
//
// Read CAN message object 2 and check for new data
//
if (CAN_readMessage(CANA_BASE, 2, rxMsgData))
{
//
// Check that received data matches sent data.
// Device will halt here during debug if data doesn't match.
//
if((txMsgData[0] != rxMsgData[0]) ||
(txMsgData[1] != rxMsgData[1]))
{
asm(" ESTOP0");
}
else
{
//
// Increment message received counter
//
msgCount++;
}
}
else
{
//
// Device will halt here during debug if no new data was received.
//
asm(" ESTOP0");
}
//
// Increment the value in the transmitted message data.
//
txMsgData[0] += 0x01;
txMsgData[1] += 0x01;
//
// Reset data if exceeds a byte
//
if(txMsgData[0] > 0xFF)
{
txMsgData[0] = 0;
}
if(txMsgData[1] > 0xFF)
{
txMsgData[1] = 0;
}
}
}
//
// End of File
//
@@ -0,0 +1,390 @@
//#############################################################################
//
// FILE: can_ex1_cpu2_loopback_interrupts.c
//
// TITLE: CAN External Loopback with Interrupts For CPU2 Example
//
//! \addtogroup driver_example_list
//! <h1> CAN External Loopback with Interrupts </h1>
//!
//! This example sets up the CAN controller in External Loopback test mode
//! using CPU2. The CAN peripheral is configured to transmit
//! messages with a specific CAN ID. A message is then transmitted once per
//! second, using a simple delay loop for timing. The message that is sent is
//! a 4 byte message that contains an incrementing pattern. A CAN interrupt
//! handler is used to confirm message transmission and count the number of
//! messages that have been sent.
//!
//! This example sets up the CAN controller in External Loopback test mode.
//! Data transmitted is visible on the CANTXA pin and is received internally
//! back to the CAN Core. Please refer to details of the External Loopback
//! Test Mode in the CAN Chapter in the Technical Reference Manual. Refer
//! to [Programming Examples and Debug Strategies for
//! the DCAN Module](www.ti.com/lit/SPRACE5) for useful information about
//! this example
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - txMsgCount - A counter for the number of messages sent
//! - rxMsgCount - A counter for the number of messages received
//! - txMsgData - An array with the data being sent
//! - rxMsgData - An array with the data that was received
//! - errorFlag - A flag that indicates an error has occurred
//!
//
//#############################################################################
//
//
// $Copyright:
// Copyright (C) 2022 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"
//
// Defines
//
#define MSG_DATA_LENGTH 4
#define TX_MSG_OBJ_ID 1
#define RX_MSG_OBJ_ID 2
//
// Globals
//
volatile uint32_t txMsgCount = 0;
volatile uint32_t rxMsgCount = 0;
volatile uint32_t errorFlag = 0;
uint16_t txMsgData[4];
uint16_t rxMsgData[4];
//
// Function Prototypes
//
__interrupt void canISR(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize the CAN controller
//
CAN_initModule(CANA_BASE);
//
// Set up the CAN bus bit rate to 500kHz
// Refer to the Driver Library User Guide for information on how to set
// tighter timing control. Additionally, consult the device data sheet
// for more information about the CAN module clocking.
//
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
//
// Enable interrupts on the CAN peripheral.
//
CAN_enableInterrupt(CANA_BASE, CAN_INT_IE0 | CAN_INT_ERROR |
CAN_INT_STATUS);
//
// 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();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
// This registers the interrupt handler in PIE vector table.
//
Interrupt_register(INT_CANA0, &canISR);
//
// Enable the CAN interrupt signal
//
Interrupt_enable(INT_CANA0);
CAN_enableGlobalInterrupt(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
//
// Enable CAN test mode with external loopback
//
CAN_enableTestMode(CANA_BASE, CAN_TEST_EXL);
//
// Initialize the transmit message object used for sending CAN messages.
// Message Object Parameters:
// Message Object ID Number: 1
// Message Identifier: 0x1
// Message Frame: Standard
// Message Type: Transmit
// Message ID Mask: 0x0
// Message Object Flags: Transmit Interrupt
// Message Data Length: 4 Bytes
//
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_TX_INT_ENABLE,
MSG_DATA_LENGTH);
//
// Initialize the receive message object used for receiving CAN messages.
// Message Object Parameters:
// Message Object ID Number: 2
// Message Identifier: 0x1
// Message Frame: Standard
// Message Type: Receive
// Message ID Mask: 0x0
// Message Object Flags: Receive Interrupt
// Message Data Length: 4 Bytes (Note that DLC field is a "don't care"
// for a Receive mailbox
//
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
MSG_DATA_LENGTH);
//
// Initialize the transmit message object data buffer to be sent
//
txMsgData[0] = 0x12;
txMsgData[1] = 0x34;
txMsgData[2] = 0x56;
txMsgData[3] = 0x78;
//
// Start CAN module operations
//
CAN_startModule(CANA_BASE);
//
// Loop Forever - A new message will be sent once per second.
//
for(;;)
{
//
// Check the error flag to see if errors occurred
//
if(errorFlag)
{
asm(" ESTOP0");
}
//
// Verify that the number of transmitted messages equal the number of
// messages received before sending a new message
//
if(txMsgCount == rxMsgCount)
{
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH,
txMsgData);
}
else
{
errorFlag = 1;
}
//
// Delay 1 second before continuing
//
DEVICE_DELAY_US(1000000);
//
// Increment the value in the transmitted message data.
//
txMsgData[0] += 0x01;
txMsgData[1] += 0x01;
txMsgData[2] += 0x01;
txMsgData[3] += 0x01;
//
// Reset data if exceeds a byte
//
if(txMsgData[0] > 0xFF)
{
txMsgData[0] = 0;
}
if(txMsgData[1] > 0xFF)
{
txMsgData[1] = 0;
}
if(txMsgData[2] > 0xFF)
{
txMsgData[2] = 0;
}
if(txMsgData[3] > 0xFF)
{
txMsgData[3] = 0;
}
}
}
//
// CAN ISR - The interrupt service routine called when a CAN interrupt is
// triggered. It checks for the cause of the interrupt, and
// maintains a count of all messages that have been transmitted.
//
__interrupt void
canISR(void)
{
uint32_t status;
//
// Read the CAN interrupt status to find the cause of the interrupt
//
status = CAN_getInterruptCause(CANA_BASE);
//
// If the cause is a controller status interrupt, then get the status
//
if(status == CAN_INT_INT0ID_STATUS)
{
//
// Read the controller status. This will return a field of status
// error bits that can indicate various errors. Error processing
// is not done in this example for simplicity. Refer to the
// API documentation for details about the error status bits.
// The act of reading this status will clear the interrupt.
//
status = CAN_getStatus(CANA_BASE);
//
// Check to see if an error occurred.
//
if(((status & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 7) &&
((status & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 0))
{
//
// Set a flag to indicate some errors may have occurred.
//
errorFlag = 1;
}
}
//
// Check if the cause is the transmit message object 1
//
else if(status == TX_MSG_OBJ_ID)
{
//
// Getting to this point means that the TX interrupt occurred on
// message object 1, and the message TX is complete. Clear the
// message object interrupt.
//
CAN_clearInterruptStatus(CANA_BASE, TX_MSG_OBJ_ID);
//
// Increment a counter to keep track of how many messages have been
// sent. In a real application this could be used to set flags to
// indicate when a message is sent.
//
txMsgCount++;
//
// Since the message was sent, clear any error flags.
//
errorFlag = 0;
}
//
// Check if the cause is the receive message object 2
//
else if(status == RX_MSG_OBJ_ID)
{
//
// Get the received message
//
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
//
// Getting to this point means that the RX interrupt occurred on
// message object 2, and the message RX is complete. Clear the
// message object interrupt.
//
CAN_clearInterruptStatus(CANA_BASE, RX_MSG_OBJ_ID);
//
// Increment a counter to keep track of how many messages have been
// received. In a real application this could be used to set flags to
// indicate when a message is received.
//
rxMsgCount++;
//
// Since the message was received, clear any error flags.
//
errorFlag = 0;
}
//
// If something unexpected caused the interrupt, this would handle it.
//
else
{
//
// Spurious interrupt handling can go here.
//
}
//
// Clear the global interrupt flag for the CAN interrupt line
//
CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
//
// Acknowledge this interrupt located in group 9
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
}
//
// End of File
//
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="can_cpu1_allocate_to_cpu2"
device="TMS320F28388D"
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} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../can_cpu1_allocate_to_cpu2.c" targetDirectory="" />
</project>
<project
name="can_ex1_cpu2_loopback"
device="TMS320F28388D"
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} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../can_ex1_cpu2_loopback.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,49 @@
<projectSpec>
<project
name="can_cpu1_allocate_to_cpu2"
device="TMS320F28388D"
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} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../can_cpu1_allocate_to_cpu2.c" targetDirectory="" />
</project>
<project
name="can_ex2_cpu2_loopback_interrupts"
device="TMS320F28388D"
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} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../can_ex2_cpu2_loopback_interrupts.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,50 @@
<projectSpec>
<project
name="cla_ex1_asin_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define RAM --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_CLA_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="../cla_ex1_asin_cpu1.c" targetDirectory="" />
</project>
<project
name="cla_ex1_asin_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define RAM --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_CLA_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_CLA_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../cla_ex1_asin.cla" targetDirectory="" />
<file action="copy" path="../cla_ex1_asin_cpu2.c" targetDirectory="" />
<file action="copy" path="../cla_ex1_asin_shared.h" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,50 @@
<projectSpec>
<project
name="cla_ex2_iir2p2z_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define RAM --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_CLA_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="../cla_ex2_iir2p2z_cpu1.c" targetDirectory="" />
</project>
<project
name="cla_ex2_iir2p2z_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define RAM --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --float_operations_allowed=32 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_CLA_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_CLA_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../cla_ex2_iir2p2z.cla" targetDirectory="" />
<file action="copy" path="../cla_ex2_iir2p2z_cpu2.c" targetDirectory="" />
<file action="copy" path="../cla_ex2_iir2p2z_shared.h" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,144 @@
//#############################################################################
//
// FILE: cla_ex1_asin.cla
//
// TITLE: Arc Sine example
//
//#############################################################################
///
// 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 "cla_ex1_asin_shared.h"
//
// function definitions
//
//Task 1 : Calculate asin(X)
// Description:
// Step(1): Calculate absolute of the input X
//
// Step(2): Use the upper 6-bits of input "X" value as an
// index into the table to obtain the coefficients
// for a second order equation:
//
// _FPUasinTable:
// CoeffA0[0]
// CoeffA1[0]
// CoeffA2[0]
// .
// .
// CoeffA0[63]
// CoeffA1[63]
// CoeffA2[63]
//
// Step(3): Calculate the angle using the following equation:
//
// arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
// arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
//
// Step(4): The final angle is determined as follows:
//
// if( X < 0 )
// Angle = -Angle
__attribute__((interrupt)) void Cla1Task1 ( void )
{
//Local Variables
int xTblIdx; //integer valued Table index
float A0,A1,A2; //Table coefficients
float *entry;
float result;
//Preprocessing
__mdebugstop();
xTblIdx = fVal * TABLE_SIZE_M_1; //convert table index to u16-bits
xTblIdx = xTblIdx * 3; //Table is ordered as 3 32-bit coefficients, the
//index points to these triplets, hence the *3*sizeof(float)
entry = &CLAasinTable[xTblIdx];
A0 = *entry++;
A1 = *entry++;
A2 = *entry;
result = A0 + fVal*(A1 + A2*fVal);
//Post processing
if(fVal < 0)
{
result = - result;
}
fResult = result;
}
__attribute__((interrupt)) void Cla1Task2 ( void )
{
}
__attribute__((interrupt)) void Cla1Task3 ( void )
{
}
__attribute__((interrupt)) void Cla1Task4 ( void )
{
}
__attribute__((interrupt)) void Cla1Task5 ( void )
{
}
__attribute__((interrupt)) void Cla1Task6 ( void )
{
}
__attribute__((interrupt)) void Cla1Task7 ( void )
{
}
__attribute__((interrupt)) void Cla1Task8 ( void )
{
}
//
// End of file
//
@@ -0,0 +1,135 @@
//###########################################################################
//
// FILE: cla_ex1_asin_cpu1.c
//
// TITLE: CLA Arcsine Example.
//
//! \addtogroup driver_dual_example_list
//! <h1>CLA \f$arcsine(x)\f$ using a lookup table (cla_asin_cpu01)</h1>
//!
//! In this example, cpu1 will be used to initialize the clocks
//! Task 1 of the CLA on cpu2 will calculate the arcsine of
//! an input argument in the range (-1.0 to 1.0) using a lookup table.
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//!
//! \b Memory \b Allocation \n
//! - CLA1 Math Tables (RAMLS0)
//! - CLAasinTable - Lookup table
//! - CLA1 to CPU Message RAM
//! - fResult - Result of the lookup algorithm
//! - CPU to CLA1 Message RAM
//! - fVal - Sample input to the lookup algorithm
//!
//! \b Watch \b Variables \n
//! - fVal - Argument to task 1
//! - fResult - Result of \f$arcsin(fVal)\f$
//!
//
//#############################################################################
//
// 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"
#include "ipc.h"
//
// Function Prototypes
//
void initCpuXCla1(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Disable global interrupts.
//
DINT;
//
// 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();
//
// Sync with CPU2 using IPC flag 31
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global real-time interrupt DBGM
while(1);
}
//
// End of file
//
@@ -0,0 +1,500 @@
//###########################################################################
//
// FILE: cla_ex1_asin_cpu2.c
//
// TITLE: CLA Arcsine Example.
//! \addtogroup driver_dual_example_list
//! <h1> CLA Arcsine Example.</h1>
//! Dual Core arcsine example. This example demonstrates how to run CLA tasks
//! on cpu2.cla1
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//
//#############################################################################
//
// 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"
#include "ipc.h"
#include "cla_ex1_asin_shared.h"
//
// Defines
//
#define WAITSTEP asm(" RPT #255 || NOP")
//
// Globals
//
//Task 1 (C) Variables
// NOTE: Do not initialize the Message RAM variables globally, they will be
// reset during the message ram initialization phase in the CLA memory
// configuration routine
//
#ifdef __cplusplus
#pragma DATA_SECTION("CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION("Cla1ToCpuMsgRAM");
float fResult;
#else
#pragma DATA_SECTION(fVal,"CpuToCla1MsgRAM");
float fVal;
#pragma DATA_SECTION(fResult,"Cla1ToCpuMsgRAM");
float fResult;
#endif //__cplusplus
float y[BUFFER_SIZE];
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//The Exponential table
//
#ifdef __cplusplus
#pragma DATA_SECTION("CLADataLS0")
#else
#pragma DATA_SECTION(CLAasinTable,"CLADataLS0")
#endif //__cplusplus
float CLAasinTable[]={
0.0, 1.0, 0.0,
0.000000636202, 0.999877862610, 0.007815361896,
0.000005099694, 0.999510644409, 0.015647916155,
0.000017268312, 0.998895919094, 0.023514960332,
0.000041121765, 0.998029615282, 0.031434003631,
0.000080794520, 0.996905974725, 0.039422875916,
0.000140631089, 0.995517492804, 0.047499840611,
0.000225244584, 0.993854840311, 0.055683712914,
0.000339579512, 0.991906765146, 0.063993984848,
0.000488979852, 0.989659972212, 0.072450958820,
0.000679263611, 0.987098979366, 0.081075891529,
0.000916805182, 0.984205946802, 0.089891150305,
0.001208627040, 0.980960476685, 0.098920384204,
0.001562502549, 0.977339379243, 0.108188712551,
0.001987071928, 0.973316400729, 0.117722933997,
0.002491973784, 0.968861907789, 0.127551759665,
0.003087995053, 0.963942521723, 0.137706074532,
0.003787242692, 0.958520694794, 0.148219231941,
0.004603341138, 0.952554219267, 0.159127386977,
0.005551660294, 0.945995657913, 0.170469875522,
0.006649579796, 0.938791682505, 0.182289647088,
0.007916796475, 0.930882303984, 0.194633761132,
0.009375683410, 0.922199974574, 0.207553958472,
0.011051710808, 0.912668537890, 0.221107321885,
0.012973941175, 0.902201997769, 0.235357042896,
0.015175614174, 0.890703070035, 0.250373315541,
0.017694840102, 0.878061473098, 0.266234382514,
0.020575425537, 0.864151902887, 0.283027765009,
0.023867860513, 0.848831624374, 0.300851714968,
0.027630504055, 0.831937595031, 0.319816937941,
0.031931014547, 0.813283013821, 0.340048646894,
0.036848083955, 0.792653161200, 0.361689022958,
0.042473551274, 0.769800358920, 0.384900179460,
0.048914992206, 0.744437830278, 0.409867752228,
0.056298910750, 0.716232177740, 0.436805274317,
0.064774696786, 0.684794109766, 0.465959540059,
0.074519565699, 0.649666934178, 0.497617226179,
0.085744766889, 0.610312179660, 0.532113122767,
0.098703445606, 0.566091493186, 0.569840443472,
0.113700678529, 0.516243664372, 0.611263845480,
0.131106395009, 0.459855210927, 0.656936015611,
0.151372169232, 0.395822366759, 0.707518998893,
0.175053263659, 0.322801460177, 0.763811905770,
0.202837883870, 0.239143420888, 0.826787304376,
0.235586468765, 0.142806299514, 0.897639596948,
0.274385149825, 0.031236880585, 0.977850174820,
0.320619535938, -0.098791845166, 1.069276441800,
0.376078169620, -0.251407364538, 1.174275392129,
0.443100143614, -0.431959397725, 1.295878193174,
0.524789871827, -0.647485610469, 1.438041695773,
0.625336471263, -0.907400624736, 1.606018804842,
0.750500589935, -1.224540947101, 1.806917563896,
0.908377657341, -1.616794995066, 2.050569262035,
1.110633894185, -2.109729648039, 2.350920816737,
1.374584721437, -2.740985157716, 2.728353889708,
1.726848242753, -3.567962877198, 3.213722960014,
2.210117561056, -4.682006534082, 3.855770086891,
2.896554011854, -6.236312386687, 4.735651038017,
3.916505715382, -8.505488022524, 5.997790945975,
5.526855868703, -12.026617159136, 7.922628470498,
8.298197116322, -17.983705080358, 11.123941286820,
13.741706072449, -29.488929624542, 17.203344479111,
27.202707817485, -57.466598393615, 31.741016484669,
83.158101335898, -171.803399517566, 90.149831709374
};
float asin_expected[BUFFER_SIZE]={
1.570796, 1.393789, 1.320141, 1.263401, 1.215375,
1.172892, 1.134327, 1.098718, 1.065436, 1.034046,
1.004232, 0.9757544, 0.9484279, 0.9221048, 0.8966658,
0.8720123, 0.8480621, 0.8247454, 0.8020028, 0.7797828,
0.7580408, 0.7367374, 0.7158381, 0.6953120, 0.6751316,
0.6552721, 0.6357113, 0.6164289, 0.5974064, 0.5786270,
0.5600753, 0.5417370, 0.5235988, 0.5056486, 0.4878751,
0.4702678, 0.4528166, 0.4355124, 0.4183464, 0.4013104,
0.3843968, 0.3675981, 0.3509074, 0.3343180, 0.3178237,
0.3014185, 0.2850964, 0.2688521, 0.2526802, 0.2365756,
0.2205333, 0.2045484, 0.1886164, 0.1727327, 0.1568929,
0.1410927, 0.1253278, 0.1095943, 0.09388787, 0.07820469,
0.06254076, 0.04689218, 0.03125509, 0.01562564
};
uint16_t pass=0;
uint16_t fail=0;
//
// Function Prototypes
//
void runTest(void);
void configClaMemory(void);
void initCpu2Cla1(void);
__interrupt void cla1Isr1();
__interrupt void cla1Isr2();
__interrupt void cla1Isr3();
__interrupt void cla1Isr4();
__interrupt void cla1Isr5();
__interrupt void cla1Isr6();
__interrupt void cla1Isr7();
__interrupt void cla1Isr8();
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
// This is configured by CPU1
//
// 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();
//
// Configure the CLA memory spaces first followed by
// the CLA task vectors.
//
configClaMemory();
initCpu2Cla1();
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//
// Run the test
//
runTest();
}
//
// runTest - Run CLA test
//
void runTest(void)
{
int16_t i, error;
for(i = 0; i < BUFFER_SIZE; i++)
{
fVal= (float)(BUFFER_SIZE - i)/(float)BUFFER_SIZE;
//
// Force Task 1 and wait
//
asm(" IACK #0x0001");
asm(" RPT #3 || NOP");
while(CLA_getTaskRunStatus(CLA1_BASE, CLA_TASK_1))
{
}
WAITSTEP;
y[i] = fResult;
error = fabsf(asin_expected[i]-y[i]);
if(error < 0.001f)
{
pass++;
}
else
{
fail++;
}
}
while(1);
}
//
// configClaMemory - Configure CLA memory
//
void configClaMemory(void)
{
//
// Sync with CPU1 using IPC flag 31
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
#ifdef _FLASH
extern uint32_t Cla1funcsRunStart, Cla1funcsLoadStart, Cla1funcsLoadSize;
//
// Copy over code from FLASH to RAM
//
memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,
(uint32_t)&Cla1funcsLoadSize);
#endif //_FLASH
#ifdef CPU2
//
// Enable CPU2 clocking at the sys clock level
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CLA1);
#endif //CPU2
//
// Initialize and wait for CLA1ToCPUMsgRAM
//
MemCfg_initSections(MEMCFG_SECT_MSGCLA1TOCPU);
while(!MemCfg_getInitStatus(MEMCFG_SECT_MSGCLA1TOCPU))
{
}
//
// Initialize and wait for CPUToCLA1MsgRAM
//
MemCfg_initSections(MEMCFG_SECT_MSGCPUTOCLA1);
while(!MemCfg_getInitStatus(MEMCFG_SECT_MSGCPUTOCLA1))
{
}
//
// Select LS5RAM to be the programming space for the CLA
// First configure the CLA to be the master for LS5 and then
// set the space to be a program block
//
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM);
//
// Next configure LS0RAM and LS1RAM as data spaces for the CLA
// First configure the CLA to be the master for LS0(1) and then
// set the spaces to be code blocks
//
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS0, MEMCFG_CLA_MEM_DATA);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_DATA);
}
//
// initCpu2Cla1 - Initialize CLA1 task vectors and end of task ISRs
//
void initCpu2Cla1(void)
{
//
// Compute all CLA task vectors
// On Type-1 CLAs the MVECT registers accept full 16-bit task addresses as
// opposed to offsets used on older Type-0 CLAs
//
// Adding a pragma to suppress the warnings when casting the CLA tasks'
// function pointers to uint16_t. Compiler believes this to be improper
// although the CLA only has 16-bit addressing.
//
#pragma diag_suppress=770
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (uint16_t)&Cla1Task1);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_2, (uint16_t)&Cla1Task2);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_3, (uint16_t)&Cla1Task3);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_4, (uint16_t)&Cla1Task4);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_5, (uint16_t)&Cla1Task5);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_6, (uint16_t)&Cla1Task6);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_7, (uint16_t)&Cla1Task7);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_8, (uint16_t)&Cla1Task8);
#pragma diag_warning=770
//
// Enable the IACK instruction to start a task on CLA in software
// for all 8 CLA tasks. Also, globally enable all 8 tasks (or a
// subset of tasks) by writing to their respective bits in the
// MIER register
//
CLA_enableIACK(CLA1_BASE);
CLA_enableTasks(CLA1_BASE, 0x00FF);
//
// Configure the vectors for the end-of-task interrupt for all
// 8 tasks
//
Interrupt_register(INT_CLA1_1, cla1Isr1);
Interrupt_register(INT_CLA1_2, cla1Isr2);
Interrupt_register(INT_CLA1_3, cla1Isr3);
Interrupt_register(INT_CLA1_4, cla1Isr4);
Interrupt_register(INT_CLA1_5, cla1Isr5);
Interrupt_register(INT_CLA1_6, cla1Isr6);
Interrupt_register(INT_CLA1_7, cla1Isr7);
Interrupt_register(INT_CLA1_8, cla1Isr8);
//
// Enable CLA interrupts at the group and subgroup levels
//
Interrupt_enable(INT_CLA1_1);
Interrupt_enable(INT_CLA1_2);
Interrupt_enable(INT_CLA1_3);
Interrupt_enable(INT_CLA1_4);
Interrupt_enable(INT_CLA1_5);
Interrupt_enable(INT_CLA1_6);
Interrupt_enable(INT_CLA1_7);
Interrupt_enable(INT_CLA1_8);
IER |= INTERRUPT_CPU_INT11;
}
//
// cla1Isr1 - CLA1 ISR 1
//
__interrupt void cla1Isr1 ()
{
//
// Acknowledge the end-of-task interrupt for task 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
// asm(" ESTOP0");
}
//
// cla1Isr2 - CLA1 ISR 2
//
__interrupt void cla1Isr2 ()
{
asm(" ESTOP0");
}
//
// cla1Isr3 - CLA1 ISR 3
//
__interrupt void cla1Isr3 ()
{
asm(" ESTOP0");
}
//
// cla1Isr4 - CLA1 ISR 4
//
__interrupt void cla1Isr4 ()
{
asm(" ESTOP0");
}
//
// cla1Isr5 - CLA1 ISR 5
//
__interrupt void cla1Isr5 ()
{
asm(" ESTOP0");
}
//
// cla1Isr6 - CLA1 ISR 6
//
__interrupt void cla1Isr6 ()
{
asm(" ESTOP0");
}
//
// cla1Isr7 - CLA1 ISR 7
//
__interrupt void cla1Isr7 ()
{
asm(" ESTOP0");
}
//
// cla1Isr8 - CLA1 ISR 8
//
__interrupt void cla1Isr8 ()
{
//
// Acknowledge the end-of-task interrupt for task 8
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
// asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,135 @@
//#############################################################################
//
// FILE: cla_ex1_asin_shared.h
//
// TITLE: CLA arcsine example header file
//
//#############################################################################
//
// 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.
// $
//#############################################################################
#ifndef CLA_ASIN_SHARED_H
#define CLA_ASIN_SHARED_H
//
// Included Files
//
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//
// Defines
//
#define BUFFER_SIZE 64
#define TABLE_SIZE 64
#define TABLE_SIZE_M_1 TABLE_SIZE-1
#define PIBYTWO 1.570796327
#define PI 3.141592653589
#define INV2PI 0.159154943
//
// Globals
//
//Task 1 (C) Variables
//
extern float y[]; //Result vector
extern float fVal; //Holds the input argument to the task
extern float fResult; //The arsine of the input argument
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//
extern float CLAasinTable[]; //The arcsine lookup table
//
// Function Prototypes
//
// The following are symbols defined in the CLA assembly code
// Including them in the shared header file makes them
// .global and the main CPU can make use of them.
//
//
//CLA C Tasks
//
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#ifdef __cplusplus
}
#endif // extern "C"
#endif // CLA_EX1_ASIN_SHARED_H
//
// End of file
//
@@ -0,0 +1,165 @@
//#############################################################################
//
// FILE: cla_ex2_iir2p2z.cla
//
// TITLE: 2-Pole 2-Zero IIR Filter Example
//
//#############################################################################
//
// 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 "cla_ex2_iir2p2z_shared.h"
//
// Globals
//
// Note that the globals defined in the .cla source are global to the cla source
// file. i.e. they may be shared across tasks. All of the data shared between
// the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
// CLA code.
//
float W2[2]; //w2(n) and w2(n-1)
float W1[2]; //w1(n) and w1(n-1)
//
// function definitions
//
//Task 1 : 2p2z IIR Transposed Direct Form II Filter
// ALGORITHM:
//
// Difference Equation :
//
// The operations for each biquad, in order, is as follows
// 1. yn = xn*b(0) + q4
// 2. q3 = xn*b(1) + yn*a(1) + q2
// 3. q4 = q3
// 4. q1 = xn*b(2) + yn*a(2)
// 5. q2 = q1
// where
// yn =output sample of the filter at index n
// xn =input sample of the filter at index n
// qx =intermediate values stored in the delay buffer
//
// Transfer Function :
// The difference equation is split up into multiple Second-Order Sections(SOS)
// Each SOS represents a Biquad with the following transfer function
// -1 -2
// Y(z) b(0) + b(1) z + b(2) z
// ----- = -----------------------
// X(z) -1 -2
// a(0) + a(1) z + a(2) z
//
// For a detailed treatment of Direct II Forms see
// [1]Digital Signal Processing, Proakis, J. G. and Manolakis, D. G. - Chapter 7
// [2]Understanding Digital Signal Processing 3rd ed, Lyons, R. G.
//
// Network Diagram :
//
// xn------>(x)--->(+)--------------->yn
// | ^ ^ |
// | | |q4 |
// | b(0) (z) |
// | ^ |
// | |q3 |
// |-->(x)--->(+)<-----(x)---|
// | ^ ^ ^ |
// | | |q2 | |
// | b(1) (z) a(1) |
// | ^ |
// | |q1 |
// --->(x)--->(+)<-----(x)----
// ^ ^
// | |
// b(2) a(2)
interrupt void Cla1Task1 ( void )
{
//Local Variables
//Code
__mdebugstop();
yn = xn*S1_B[0] + W2[1];
W2[0] = xn*S1_B[1] + yn*S1_A[1] + W1[1];
W2[1] = W2[0];
W1[0] = xn*S1_B[2] + yn*S1_A[2];
W1[1] = W1[0];
// __mnop();
// __mnop();
// __mnop();
}
interrupt void Cla1Task2 ( void )
{
}
interrupt void Cla1Task3 ( void )
{
}
interrupt void Cla1Task4 ( void )
{
}
interrupt void Cla1Task5 ( void )
{
}
interrupt void Cla1Task6 ( void )
{
}
interrupt void Cla1Task7 ( void )
{
}
//Task 8 will initialize the variables used in Task 1
interrupt void Cla1Task8 ( void )
{
W2[0] = 0; W2[1] = 0;
W1[0] = 0; W1[1] = 0;
}
//
// End of file
//
@@ -0,0 +1,142 @@
//###########################################################################
//
// FILE: cla_ex2_iir2p2z_cpu1.c
//
// TITLE: CLA IIR2p2Z Example for F2837xD.
//
//! \addtogroup driver_dual_example_list
//! <h1>CLA 2 Pole 2 Zero Infinite Impulse Response Filter (cla_iir2p2z_cpu01)</h1>
//!
//! This example implements a Transposed Direct Form II IIR filter, commonly
//! known as a Biquad. The input vector is a software simulated noisy signal
//! that is fed to the biquad one sample at a time, filtered and then stored
//! in an output buffer for storage.
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//!
//! \b Memory \b Allocation \n
//! - CLA1 Data RAM 1 (RAML2)
//! - S1_A - Feedback coefficients
//! - S1_B - Feedforward coefficients
//! - CLA1 to CPU Message RAM
//! - yn - Output of the Biquad
//! - CPU to CLA1 Message RAM
//! - xn - Sample input to the filter
//!
//! \b Watch \b Variables \n
//! - fBiquadOutput
//! - pass
//! - fail
//!
//
//#############################################################################
//
// 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"
#include "ipc.h"
//
// Globals
//
uint16_t pass=0;
uint16_t fail=0;
//
// Function Prototypes
//
void initCpuXCla1(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Disable global interrupts.
//
DINT;
//
// 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();
//
// Sync with CPU2 using IPC flag 31
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global real-time interrupt DBGM
while(1);
}
//
// End of file
//
@@ -0,0 +1,515 @@
//###########################################################################
//
// FILE: cla_ex2_iir2p2z_cpu2.c
//
// TITLE: CLA 2-pole 2-zero IIR Filter Example for F2837xD.
//! \addtogroup driver_dual_example_list
//! <h1> CLA 2-pole 2-zero IIR Filter Example for F2837xD. </h1>
//! Dual Core iir2p2z example. This example demonstrates how to run CLA tasks
//! on cpu2.cla1
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//
//#############################################################################
//
// 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"
#include "ipc.h"
#include "cla_ex2_iir2p2z_shared.h"
//
// Defines
//
#define NUM_SAMPLES 128
#define WAITSTEP asm(" RPT #255 || NOP")
//
// Globals
//
//Task 1 (C) Variables
//
#ifdef __cplusplus
#pragma DATA_SECTION("CLADataLS0")
float S1_B[]={0.02008, 0.04017, 0.02008};
#pragma DATA_SECTION("CLADataLS0")
float S1_A[]={-1.0, 1.56102, -0.64135};
#pragma DATA_SECTION("CLADataLS0")
float S2_B[]={0, 0, 0};
#pragma DATA_SECTION("CLADataLS0")
float S2_A[]={0, 0, 0};
#pragma DATA_SECTION("CLADataLS0")
float S3_B[]={0, 0, 0};
#pragma DATA_SECTION("CLADataLS0")
float S3_A[]={0, 0, 0};
#pragma DATA_SECTION("CpuToCla1MsgRAM")
float xn;
#pragma DATA_SECTION("Cla1ToCpuMsgRAM")
float yn;
#else
#pragma DATA_SECTION(S1_B,"CLADataLS0")
float S1_B[]={0.02008, 0.04017, 0.02008};
#pragma DATA_SECTION(S1_A,"CLADataLS0")
float S1_A[]={-1.0, 1.56102, -0.64135};
#pragma DATA_SECTION(S2_B,"CLADataLS0")
float S2_B[]={0, 0, 0};
#pragma DATA_SECTION(S2_A,"CLADataLS0")
float S2_A[]={0, 0, 0};
#pragma DATA_SECTION(S3_B,"CLADataLS0")
float S3_B[]={0, 0, 0};
#pragma DATA_SECTION(S3_A,"CLADataLS0")
float S3_A[]={0, 0, 0};
#pragma DATA_SECTION(xn,"CpuToCla1MsgRAM")
float xn;
#pragma DATA_SECTION(yn,"Cla1ToCpuMsgRAM")
float yn;
#endif //__cplusplus
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//
float fBiquadOutput[NUM_SAMPLES];
float fAdcInput[NUM_SAMPLES] = {
0, 0.4359, -0.4129, 0.2482,
0.4182, -0.3455, 0.4780, 0.3674,
-0.2347, 0.6724, 0.2939, -0.0858,
0.8178, 0.2100, 0.0914, 0.9045,
0.1283, 0.2836, 0.9279, 0.0604,
0.4755, 0.8888, 0.0156, 0.6506,
0.7929, 0, 0.7929, 0.6506,
0.0156, 0.8888, 0.4755, 0.0604,
0.9279, 0.2836, 0.1283, 0.9045,
0.0914, 0.2100, 0.8178, -0.0858,
0.2939, 0.6724, -0.2347, 0.3674,
0.4780, -0.3455, 0.4182, 0.2482,
-0.4129, 0.4359, 0.0000, -0.4359,
0.4129, -0.2482, -0.4182, 0.3455,
-0.4780, -0.3674, 0.2347, -0.6724,
-0.2939, 0.0858, -0.8178, -0.2100,
-0.0914, -0.9045, -0.1283, -0.2836,
-0.9279, -0.0604, -0.4755, -0.8888,
-0.0156, -0.6506, -0.7929, 0,
-0.7929, -0.6506, -0.0156, -0.8888,
-0.4755, -0.0604, -0.9279, -0.2836,
-0.1283, -0.9045, -0.0914, -0.2100,
-0.8178, 0.0858, -0.2939, -0.6724,
0.2347, -0.3674, -0.4780, 0.3455,
-0.4182, -0.2482, 0.4129, -0.4359,
-0.0000, 0.4359, -0.4129, 0.2482,
0.4182, -0.3455, 0.4780, 0.3674,
-0.2347, 0.6724, 0.2939, -0.0858,
0.8178, 0.2100, 0.0914, 0.9045,
0.1283, 0.2836, 0.9279, 0.0604,
0.4755, 0.8888, 0.0156, 0.6506,
0.7929, 0, 0.7929, 0.6506
};
float iir_expected[NUM_SAMPLES]={
0, 0.008754415, 0.02288298, 0.02726187,
0.03795755, 0.05661327, 0.06815149, 0.08971455,
0.1159805, 0.1349670, 0.1645004, 0.1938129,
0.2159233, 0.2481003, 0.2754995, 0.2969926,
0.3276609, 0.3500223, 0.3688507, 0.3954768,
0.4113952, 0.4267188, 0.4478308, 0.4569381,
0.4684406, 0.4831003, 0.4855416, 0.4930161,
0.5005732, 0.4967500, 0.4999563, 0.5000126,
0.4904927, 0.4891656, 0.4816235, 0.4671103,
0.4610198, 0.4461307, 0.4274355, 0.4164503,
0.3948304, 0.3728325, 0.3569719, 0.3295808,
0.3051807, 0.2846532, 0.2527421, 0.2268174,
0.2020469, 0.1670849, 0.1404567, 0.1120952,
0.07568341, 0.04909494, 0.01802110, -0.01820113,
-0.04409146, -0.07679208, -0.1112392, -0.1358536,
-0.1689253, -0.2001516, -0.2229802, -0.2550509,
-0.2818236, -0.3024068, -0.3320566, -0.3534117,
-0.3713224, -0.3971615, -0.4124396, -0.4272688,
-0.4480195, -0.4568799, -0.4682287, -0.4828069,
-0.4852195, -0.4927015, -0.5002885, -0.4965075,
-0.4997604, -0.4998623, -0.4903836, -0.4890918,
-0.4815782, -0.4670869, -0.4610124, -0.4461341,
-0.4274456, -0.4164638, -0.3948451, -0.3728467,
-0.3569847, -0.3295917, -0.3051894, -0.2846599,
-0.2527469, -0.2268206, -0.2020488, -0.1670859,
-0.1404569, -0.1120951, -0.07568294, -0.04909432,
-0.01802043, 0.01820178, 0.04409203, 0.07679256,
0.1112396, 0.1358539, 0.1689255, 0.2001518,
0.2229803, 0.2550510, 0.2818236, 0.3024068,
0.3320566, 0.3534117, 0.3713224, 0.3971614,
0.4124396, 0.4272687, 0.4480195, 0.4568799,
0.4682287, 0.4828069, 0.4852195, 0.4927014
};
uint16_t pass=0;
uint16_t fail=0;
//
// Function Prototypes
//
void runTest(void);
void configClaMemory(void);
void initCpu2Cla1(void);
__interrupt void cla1Isr1();
__interrupt void cla1Isr2();
__interrupt void cla1Isr3();
__interrupt void cla1Isr4();
__interrupt void cla1Isr5();
__interrupt void cla1Isr6();
__interrupt void cla1Isr7();
__interrupt void cla1Isr8();
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
// This is configured by CPU1
//
// 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();
//
// Configure the CLA memory spaces first followed by
// the CLA task vectors.
//
configClaMemory();
initCpu2Cla1();
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//
// Run the test
//
runTest();
while(1);
}
//
// runTest - Run CLA test
//
void runTest(void)
{
int16_t i;
float fError[NUM_SAMPLES];
//
// Force Task 8 and wait
//
asm(" IACK #0x0080");
asm(" RPT #3 || NOP");
while(CLA_getTaskRunStatus(CLA1_BASE, CLA_TASK_8))
{
}
WAITSTEP;
for(i = 0; i < NUM_SAMPLES; i++)
{
xn = fAdcInput[i];
//
// Force Task 1 and wait
//
asm(" IACK #0x0001");
asm(" RPT #3 || NOP");
while(CLA_getTaskRunStatus(CLA1_BASE, CLA_TASK_1))
{
}
WAITSTEP;
fBiquadOutput[i] = yn;
fError[i] = fabsf(iir_expected[i]-fBiquadOutput[i]);
if(fError[i] < 0.001f)
{
pass++;
}
else
{
fail++;
}
}
}
//
// configClaMemory - Configure CLA memory
//
void configClaMemory(void)
{
//
// Sync with CPU2 using IPC flag 31
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
#ifdef _FLASH
extern uint32_t Cla1funcsRunStart, Cla1funcsLoadStart, Cla1funcsLoadSize;
//
// Copy over code from FLASH to RAM
//
memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,
(uint32_t)&Cla1funcsLoadSize);
#endif //_FLASH
#ifdef CPU2
//
// Enable CPU2 clocking at the sys clock level
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CLA1);
#endif //CPU2
//
// Initialize and wait for CLA1ToCPUMsgRAM
//
MemCfg_initSections(MEMCFG_SECT_MSGCLA1TOCPU);
while(!MemCfg_getInitStatus(MEMCFG_SECT_MSGCLA1TOCPU))
{
}
//
// Initialize and wait for CPUToCLA1MsgRAM
//
MemCfg_initSections(MEMCFG_SECT_MSGCPUTOCLA1);
while(!MemCfg_getInitStatus(MEMCFG_SECT_MSGCPUTOCLA1))
{
}
//
// Select LS5RAM to be the programming space for the CLA
// First configure the CLA to be the master for LS5 and then
// set the space to be a program block
//
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM);
//
// Next configure LS0RAM and LS1RAM as data spaces for the CLA
// First configure the CLA to be the master for LS0(1) and then
// set the spaces to be code blocks
//
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS0, MEMCFG_CLA_MEM_DATA);
MemCfg_setLSRAMMasterSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMMASTER_CPU_CLA1);
MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_DATA);
}
//
// initCpu2Cla1 - Initialize CLA1 task vectors and end of task ISRs
//
void initCpu2Cla1(void)
{
//
// Compute all CLA task vectors
// On Type-1 CLAs the MVECT registers accept full 16-bit task addresses as
// opposed to offsets used on older Type-0 CLAs
//
// Adding a pragma to suppress the warnings when casting the CLA tasks'
// function pointers to uint16_t. Compiler believes this to be improper
// although the CLA only has 16-bit addressing.
//
#pragma diag_suppress=770
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (uint16_t)&Cla1Task1);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_2, (uint16_t)&Cla1Task2);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_3, (uint16_t)&Cla1Task3);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_4, (uint16_t)&Cla1Task4);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_5, (uint16_t)&Cla1Task5);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_6, (uint16_t)&Cla1Task6);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_7, (uint16_t)&Cla1Task7);
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_8, (uint16_t)&Cla1Task8);
#pragma diag_warning=770
//
// Enable the IACK instruction to start a task on CLA in software
// for all 8 CLA tasks. Also, globally enable all 8 tasks (or a
// subset of tasks) by writing to their respective bits in the
// MIER register
//
CLA_enableIACK(CLA1_BASE);
CLA_enableTasks(CLA1_BASE, 0x00FF);
//
// Configure the vectors for the end-of-task interrupt for all
// 8 tasks
//
Interrupt_register(INT_CLA1_1, cla1Isr1);
Interrupt_register(INT_CLA1_2, cla1Isr2);
Interrupt_register(INT_CLA1_3, cla1Isr3);
Interrupt_register(INT_CLA1_4, cla1Isr4);
Interrupt_register(INT_CLA1_5, cla1Isr5);
Interrupt_register(INT_CLA1_6, cla1Isr6);
Interrupt_register(INT_CLA1_7, cla1Isr7);
Interrupt_register(INT_CLA1_8, cla1Isr8);
//
// Enable CLA interrupts at the group and subgroup levels
//
Interrupt_enable(INT_CLA1_1);
Interrupt_enable(INT_CLA1_2);
Interrupt_enable(INT_CLA1_3);
Interrupt_enable(INT_CLA1_4);
Interrupt_enable(INT_CLA1_5);
Interrupt_enable(INT_CLA1_6);
Interrupt_enable(INT_CLA1_7);
Interrupt_enable(INT_CLA1_8);
IER |= INTERRUPT_CPU_INT11;
}
//
// cla1Isr1 - CLA1 ISR 1
//
__interrupt void cla1Isr1()
{
//
// Acknowledge the end-of-task interrupt for task 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
// asm(" ESTOP0");
}
//
// cla1Isr2 - CLA1 ISR 2
//
__interrupt void cla1Isr2()
{
asm(" ESTOP0");
}
//
// cla1Isr3 - CLA1 ISR 3
//
__interrupt void cla1Isr3()
{
asm(" ESTOP0");
}
//
// cla1Isr4 - CLA1 ISR 4
//
__interrupt void cla1Isr4()
{
asm(" ESTOP0");
}
//
// cla1Isr5 - CLA1 ISR 5
//
__interrupt void cla1Isr5()
{
asm(" ESTOP0");
}
//
// cla1Isr6 - CLA1 ISR 6
//
__interrupt void cla1Isr6()
{
asm(" ESTOP0");
}
//
// cla1Isr7 - CLA1 ISR 7
//
__interrupt void cla1Isr7()
{
asm(" ESTOP0");
}
//
// cla1Isr8 - CLA1 ISR 8
//
__interrupt void cla1Isr8()
{
//
// Acknowledge the end-of-task interrupt for task 8
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
// asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,146 @@
//#############################################################################
//
// FILE: cla_ex2_iir2p2z_shared.h
//
// TITLE: CLA IIR 2-pole 2-zero filter
//
//#############################################################################
//
// 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.
// $
//###########################################################################
#ifndef CLA_IIR2P2Z_SHARED_H
#define CLA_IIR2P2Z_SHARED_H
//
// Included Files
//
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//
// Defines
//
#define BUFFER_SIZE 64
#define TABLE_SIZE 64
#define TABLE_SIZE_M_1 (TABLE_SIZE-1)
#define PIBYTWO 1.570796327
#define PI 3.141592653589
#define INV2PI 0.159154943
//
// Globals
//
//
//Task 1 (C) Variables
//
#define NUM_SAMPLES 128
extern float S1_B[];
extern float S1_A[];
extern float S2_B[];
extern float S2_A[];
extern float S3_B[];
extern float S3_A[];
extern float xn; //Sample input
extern float yn; //Sample output
extern float fAdcInput[];
extern float fBiquadOutput[];
extern float fAdcInput[];
//
//Task 2 (C) Variables
//
//
//Task 3 (C) Variables
//
//
//Task 4 (C) Variables
//
//
//Task 5 (C) Variables
//
//
//Task 6 (C) Variables
//
//
//Task 7 (C) Variables
//
//
//Task 8 (C) Variables
//
//
//Common (C) Variables
//
//
// Function Prototypes
//
// The following are symbols defined in the CLA assembly code
// Including them in the shared header file makes them
// .global and the main CPU can make use of them.
//
//
//CLA C Tasks
//
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#ifdef __cplusplus
}
#endif // extern "C"
#endif // CLA_EX2_IIR2P2Z_SHARED_H_
//
// End of file
//
@@ -0,0 +1,47 @@
<projectSpec>
<project
name="dcsm_ex1_cpu1_access_control"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_lnk_DCSM_cpu1.cmd" targetDirectory="" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" />
<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="../dcsm_ex1_cpu1_access_control.c" targetDirectory="" />
<file action="copy" path="../dcsm_ex1_f2838x_dcsm_z1otp.asm" targetDirectory="" />
<file action="copy" path="../dcsm_ex1_f2838x_dcsm_z2otp.asm" targetDirectory="" />
</project>
<project
name="dcsm_ex1_cpu2_memory_access"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../dcsm_ex1_cpu2_memory_access.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,211 @@
//#############################################################################
//
// FILE: dcsm_ex1_cpu1_access_control.c
//
// TITLE: DCSM CPU1 Access control Example
//
//! \addtogroup driver_dual_example_list
//! <h1> DCSM Memory Access control by CPU1</h1>
//!
//! This example demonstrates how to configure the 1st Zone Select Block
//! in the OTP needed to allocate CPU2's LS4-LS5 to zone 1 & CPU2's
//! LS6-LS7 to zone 2, later accessed by CPU2.
//!
//! Zone1 | Zone2
//! |
//! CPU2's LS4-LS5 | CPU2's LS6-LS7
//! |
//!
//! In this example, zoning of memories is done by the OTP programming whose
//! values are configured in dcsm_ex1_f2838x_dcsm_zxotp.asm while the securing
//! functionalities are done through this file.
//! It demonstrates how to control the access of the memories which would
//! later be accessed by CPU2.
//! This would even do a dummy read of the password needed by CPU2 to
//! unsecure the memory. The communication between the 2 CPUs are done
//! using IPC ( Inter process communication) through a sync function.
//! This enables the CPU Core to wait until the expected task is
//! completed on the other core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - \b result - Status of Memory Access control by CPU1
//! - \b set_error - Count of errors occurring during the execution of the
//! example.
//!
//! \note Before running the example, the below configuration is expected to
//! be done through the dcsm_ex1_f2838x_dcsm_zxotp.asm :
//!
//! - Allocate CPU2's LS4-LS5 to zone 1 , LS6-LS7 to zone 2
//! ZSBx_Z1_GRABRAM3R 0x0000A500
//! ZSBx_Z2_GRABRAM3R 0x00005A00
//! - Password of zone 1 is 0xFFFFFFFF4D7FFFFFFFFFFFFFFFFFFFFF
//! - Password of zone 2 is 0xFFFFFFFF1F7FFFFFFFFFFFFFFFFFFFFF
//
//#############################################################################
//
//
//
// 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"
//
// Defines
//
#define PASS 0
#define FAIL 1
uint32_t result = FAIL;
//
// Main
//
void main(void)
{
//
//Variable showing the error occurred while testing DCSM
//
uint16_t set_error=0;
DCSM_SecurityStatus status1;
//
//Variable to check the status of the CPU2's Ram module allocated to zone
//
DCSM_MemoryStatus mem_status;
//
//Initialize device clock and peripherals
//
Device_init();
//
//Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
//Synchronize CPU1 and CPU2 cores - CPU1 device init and
//CPU2 boot complete
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG12);
//
//Synchronize CPU1 and CPU2 cores - Unlocking
//of all zones by CPU2 complete
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
//
//Getting the default status of the zone 1
//
status1 = DCSM_getZone1CSMSecurityStatus();
if(status1!=DCSM_STATUS_UNSECURE) set_error++;
//
//Since this example writes/reads to CPU2's LS4 & LS6 RAM
//memories, only the status of these RAMs are checked.
//
//Getting the default status of the CPU2's RAMLS4 allocation
//
mem_status = DCSM_getRAMZone(DCSM_RAMLS4,DCSM_CPUSEL_CPU2);
if(mem_status!=DCSM_MEMORY_ZONE1) set_error++;
//
//Getting the default status of the CPU2's RAMLS6 allocation
//
mem_status = DCSM_getRAMZone(DCSM_RAMLS6,DCSM_CPUSEL_CPU2);
if(mem_status!=DCSM_MEMORY_ZONE2) set_error++;
//
//Synchronize CPU1 and CPU2 cores - CPU2 has finished writing
//to the memories
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
//
//Synchronize CPU1 and CPU2 cores - CPU2's memories are secure
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG12);
//
//Getting the status of zone1 after locking it
//
status1 = DCSM_getZone1CSMSecurityStatus();
if(status1!=DCSM_STATUS_SECURE) set_error++;
//
//Perform dummy read of the Zone 1 CSM password before
//the CPU2 writes to the CSM key to unlock the memories
//
DCSM_readZone1CSMPwd();
//
//Synchronize CPU1 and CPU2 cores - CPU1 Dummy read of the
//Zone 1 CSM password before the CPU2 writes to the CSM key complete
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
//
//Status of Memory Access control by CPU1
//
if (set_error)
{
result = FAIL;
}
else
{
result = PASS;
}
while(1);
}
//
// End of File
//
@@ -0,0 +1,244 @@
//#############################################################################
//
// FILE: dcsm_ex1_cpu2_memory_access.c
//
// TITLE: DCSM CPU2 Secure Memory Access
//
//! \addtogroup driver_dual_example_list
//! <h1> DCSM Memory Access by CPU2 </h1>
//!
//! This example demonstrates how the access of the memory is affected
//! when the memories are secured by CPU1.
//! CPU1 allocate CPU2's LS4-LS5 to zone 1 & CPU2's LS6-LS7 to zone 2 using
//! the 1st Zone Select Block.
//!
//! Zone1 | Zone2
//! |
//! CPU2's LS4-LS5 | CPU2's LS6-LS7
//! |
//!
//! It writes some data in the zones and checks after the CPU1 does a memory
//! locking and matches with the data set . Further, once the CPU2 unlocks the
//! memories, it matches with the data set written before CPU1 lock.
//! Ideally after locking, zone1 should not be readable(or reads a 0 value)
//! and zone2 that is not secured matches the written data set.
//! It demonstrates how to lock and and unlock zone by showing where to put
//! the password and how to check if it is secured or unsecured.
//!
//! The communication between the 2 CPUs are handled using IPC
//!(Inter process communication) through a synch function.
//! This enables the CPU Core to wait until the expected task is
//! completed on the other core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - \b result - Status of CPU2's secure memory access
//! - \b set_error, error_not_locked ,error_not_unlocked ,error1 - Count of
//! errors occurring during the execution of the example.
//! - \b Zone1_Locked_Array - Array demonstrating secured memory
//! - \b Unsecure_mem_Array - Array demonstrating Unsecured memory
//!
//
//#############################################################################
//
//
//
// 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"
//
// Defines
//
#define PASS 0
#define FAIL 1
uint16_t Zone1_Locked_Array[256]; // Mapped to LS4 RAM
uint16_t Unsecure_mem_Array[256]; // Mapped to LS6 RAM
DCSM_CSMPasswordKey csmK_z1; //Zone1 key
DCSM_CSMPasswordKey csmK_z2; //Zone2 key
#pragma DATA_SECTION(Zone1_Locked_Array,"ZONE1_RAM");
#pragma DATA_SECTION(Unsecure_mem_Array,"UNSECURE_RAM");
#pragma DATA_SECTION(csmK_z1,"CSMKEY_RAM");
#pragma DATA_SECTION(csmK_z2,"CSMKEY_RAM");
uint32_t result = FAIL;
//
// Main
//
void main(void)
{
//
//Variables showing the error occurred while testing DCSM
//
uint16_t i=0,error_not_locked=0,error_not_unlocked=0,error1=0,set_error=0;
DCSM_SecurityStatus status1;
//
//Synchronize CPU1 and CPU2 cores - CPU1 device init and CPU2
//boot complete
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG12);
//
//Updating the Zone1 key value
//
csmK_z1.csmKey0 = 0xFFFFFFFF;
csmK_z1.csmKey1 = 0x4D7FFFFF;
csmK_z1.csmKey2 = 0xFFFFFFFF;
csmK_z1.csmKey3 = 0xFFFFFFFF;
//
//Updating the Zone2 key value
//
csmK_z2.csmKey0 = 0xFFFFFFFF;
csmK_z2.csmKey1 = 0x1F7FFFFF;
csmK_z2.csmKey2 = 0xFFFFFFFF;
csmK_z2.csmKey3 = 0xFFFFFFFF;
//
//Unlocking the zone1 using the key since the password maybe
//different from the default
//
DCSM_writeZone1CSM(&csmK_z1);
//
//Unlocking the zone2 using the key since the password maybe
//different from the default
//
DCSM_writeZone2CSM(&csmK_z2);
//
//Synchronize CPU1 and CPU2 cores - CPU2 has finished device zone unlock
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG11);
//
//Initialize device clock and peripherals
//
Device_init();
//
//Updating the arrays one which belong to zone1 and other
//which belongs to zone2
//
for(i=1;i<256;i++)
{
Unsecure_mem_Array[i] = i;
Zone1_Locked_Array[i] = i;
}
//
//Synchronize CPU1 and CPU2 cores - CPU1 has finished checking
//status of Zones
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG11);
//
//Locking the zone1
//
DCSM_secureZone1();
//
//Synchronize CPU1 and CPU2 cores - CPU1 has finished checking
//status of Zones
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG12);
//
//Read both the arrays. One which is not secured would be
//readable unlike the other secured one that wouldn't be.
//
for(i=1;i<256;i++)
{
if(Unsecure_mem_Array[i] != i) error1++;
if(Zone1_Locked_Array[i] == i) error_not_locked++ ;
}
//
//Synchronize CPU1 and CPU2 cores - CPU1 dummy read of the
//Zone1 CSM Password complete
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG11);
//
//Unlocking the zone1 by writing the Zone1 CSM key
//
DCSM_writeZone1CSM(&csmK_z1);
//
//Getting the status of zone 1 after unlocking it .
//
status1 = DCSM_getZone1CSMSecurityStatus();
if(status1!=DCSM_STATUS_UNSECURE) set_error++;
//
//Since the zone1 has been unlocked both should be readable
//
for(i=1;i<256;i++)
{
if(Unsecure_mem_Array[i] != i) error1++;
if(Zone1_Locked_Array[i] != i) error_not_unlocked++ ;
}
//
//Status of CPU2's secure memory access
//
if (error1 | error_not_unlocked | set_error | error_not_locked)
{
result = FAIL;
}
else
{
result = PASS;
}
while(1);
}
//
// End of File
//
@@ -0,0 +1,154 @@
;;#############################################################################
;;
;; FILE: dcsm_ex1_f2838x_dcsm_z1otp.asm
;;
;; TITLE: Dual Code Security Module Zone 1 OTP for CPU2's Access control by CPU1
;;
;; DESCRIPTION:
;;
;; This file is used by the example dcsm_ex1_secure_memory_partition
;; to specify Z1 DCSM OTP and zone select block values to program.
;;
;; It configures the 1st Zone Select Block(ZSB) in the OTP to change the
;; zone passwords and allocates CPU2's LS4-LS5 to zone 1.
;;
;; !!IMPORTANT!! The below memory sections are mapped to OTP (one-time
;; programmable) memory with the *lnk_DCSM_cpu1.cmd linker command file. In order
;; to program the below memory sections, user should uncomment the .long words
;; of each section and change the value to what is desired. Additionally, the
;; corresponding section of *lnk_DCSM_cpu1.cmd should no longer be labeled as a
;; dummy section. Remove ", type = DSECT" in SECTIONS from the memory section
;; that is being programmed.
;;
;;
;; !!IMPORTANT!! The "dcsm_z1otp_link_pointer" section contains the
;; Z1 LINKPOINTER which determines the location of the Z1 Zone Select block.
;; If the LINKPOINTER is changed, then the "dcsm_zsel_z1" section
;; in the *lnk_DCSM_cpu1.cmd command linker file must also change to an
;; address decoded from the value specified in the Z1-LINKPOINTER location.
;; In this example, the "dcsm_zsel_z1" section maps to ZSB1.
;;
;; The "dcsm_zsel_z1" section contains the actual Z1 Zone Select Block
;; values that will be linked and programmed into to the DCSM Z1 OTP Zone
;; Select block in OTP. In this example, the values seen for the CSMPSWD*
;; & GRABRAM* are of the ZSB1 CSMPSWD (these values must be known in order to
;; unlock the CSM module) & for the memory allocations resp.
;;
;; It is recommended that all values be left as default expected by TRM during code
;; development. These default values do not activate code security and dummy
;; reads of the Z1 DCSM PWL registers is all that is required to unlock the
;; CSM. When code development is complete, modify values to activate the
;; code security module.
;;
;; ******************************WARNING***************************************
;; It is recommended not to program 0xFFFFFFFF to user OTP locations, if users
;; intend to comeback and re-program any of the bits to '0' in future. If user
;; programs 0xFFFFFFFF to any of the OTP locations then the ECC locations would
;; get programmed to a non erased state and users won't be able to comeback
;; and re-program the OTP location to another value. Please refer to DCSM
;; chapter of device TRM for more details on ECC for the locations in DCSM.
;;
;; Hence TI ships this example commenting out the initialization of all the
;; below locations.
;;#############################################################################
;;
;// 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.
;// $
;;#############################################################################
.sect "dcsm_z1otp_link_pointer"
.retain
;; .long 0x00003FFF ;Z1OTP_LINKPOINTER1
;; .long 0x00003FFF ;Z1OTP_LINKPOINTER2
;; .long 0x00003FFF ;Z1OTP_LINKPOINTER3
.sect "dcsm_z1otp_jlm_enable"
.retain
;; .long 0xFFFF000F ;Z1OTP_JLM_ENABLE
.sect "dcsm_z1otp_gpreg"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_GPREG1
;; .long 0xFFFFFFFF ;Z1OTP_GPREG2
;; .long 0xFFFFFFFF ;Z1OTP_GPREG3
;; .long 0xFFFFFFFF ;Z1OTP_GPREG4
.sect "dcsm_z1otp_pswd_lock"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_PSWDLOCK
.sect "dcsm_z1otp_crc_lock"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_CRCLOCK
.sect "dcsm_z1otp_jtag_pswdh"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_JTAGPSWDH0
;; .long 0xFFFFFFFF ;Z1OTP_JTAGPSWDH1
.sect "dcsm_z1otp_cmac_key"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_CMACKEY0
;; .long 0xFFFFFFFF ;Z1OTP_CMACKEY1
;; .long 0xFFFFFFFF ;Z1OTP_CMACKEY2
;; .long 0xFFFFFFFF ;Z1OTP_CMACKEY3
.sect "dcsm_zsel_z1"
.retain
;; .long 0xFFFFFFFF ;Z1OTP_CSMPSWD0 (LSW of 128-bit password)
;; .long 0x4D7FFFFF ;Z1OTP_CSMPSWD1
;; .long 0xFFFFFFFF ;Z1OTP_CSMPSWD2
;; .long 0xFFFFFFFF ;Z1OTP_CSMPSWD3 (MSW of 128-bit password)
;; .long 0x0AAAAAAA ;Z1OTP_GRABSECT1
;; .long 0x0AAAAAAA ;Z1OTP_GRABSECT2
;; .long 0x0AAAAAAA ;Z1OTP_GRABSECT3
;; .long 0x000AAAAA ;Z1OTP_GRABRAM1
;; .long 0x0AAAAA0A ;Z1OTP_GRABRAM2
;; .long 0x000AA5AA ;Z1OTP_GRABRAM3
;; .long 0xFFFFFFFF ;Z1OTP_EXEONLYSECT1
;; .long 0xFFFFFFFF ;Z1OTP_EXEONLYSECT2
;; .long 0xFFFFFFFF ;Z1OTP_EXEONLYRAM1
;; .long 0xFFFFFFFF ;Reserved
;; .long 0xFFFFFFFF ;Z1OTP_JTAGPSWDL0
;; .long 0xFFFFFFFF ;Z1OTP_JTAGPSWDL1
;;----------------------------------------------------------------------
;; For code security operation,after development has completed, prior to
;; production, all other zone select block locations should be programmed
;; to 0x0000 for maximum security.
;;#############################################################################
;; End of file
;;#############################################################################
@@ -0,0 +1,151 @@
;;#############################################################################
;;
;; FILE: dcsm_ex1_f2838x_dcsm_z2otp.asm
;;
;; TITLE: Dual Code Security Module Zone 2 OTP for CPU2's Access control by CPU1
;;
;; DESCRIPTION:
;;
;; This file is used by the example dcsm_ex1_secure_memory_partition
;; to specify Z2 DCSM OTP and zone select block values to program.
;;
;; It configures the 1st Zone Select Block(ZSB) in the OTP to change the
;; zone passwords and allocates CPU2's LS6-LS7 to zone 2.
;;
;; !!IMPORTANT!! The below memory sections are mapped to OTP (one-time
;; programmable) memory with the *lnk_DCSM_cpu1.cmd linker command file. In order
;; to program the below memory sections, user should uncomment the .long words
;; of each section and change the value to what is desired. Additionally, the
;; corresponding section of *lnk_DCSM_cpu1.cmd should no longer be labeled as a
;; dummy section. Remove ", type = DSECT" in SECTIONS from the memory section
;; that is being programmed.
;;
;;
;; !!IMPORTANT!! The "dcsm_z2otp_link_pointer" section contains the
;; Z2 LINKPOINTER which determines the location of the Z2 Zone Select block.
;; If the LINKPOINTER is changed, then the "dcsm_zsel_z2" section
;; in the *lnk_DCSM_cpu1.cmd command linker file must also change to an
;; address decoded from the value specified in the Z2-LINKPOINTER location.
;; In this example, the "dcsm_zsel_z2" section maps to ZSB1.
;;
;; The "dcsm_zsel_z2" section contains the actual Z2 Zone Select Block
;; values that will be linked and programmed into to the DCSM Z2 OTP Zone
;; Select block in OTP. In this example, the values seen for the CSMPSWD*
;; & GRABRAM* are of the ZSB1 CSMPSWD (these values must be known in order to
;; unlock the CSM module) & for the memory allocations resp.
;;
;; It is recommended that all values be left as default expected by TRM during code
;; development. These default values do not activate code security and dummy
;; reads of the Z2 DCSM PWL registers is all that is required to unlock the
;; CSM. When code development is complete, modify values to activate the
;; code security module.
;;
;; ******************************WARNING***************************************
;; It is recommended not to program 0xFFFFFFFF to user OTP locations, if users
;; intend to comeback and re-program any of the bits to '0' in future. If user
;; programs 0xFFFFFFFF to any of the OTP locations then the ECC locations would
;; get programmed to a non erased state and users won't be able to comeback
;; and re-program the OTP location to another value. Please refer to DCSM
;; chapter of device TRM for more details on ECC for the locations in DCSM.
;;
;; Hence TI ships this example commenting out the initialization of all the
;; below locations.
;;#############################################################################
;;
;// 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.
;// $
;;#############################################################################
.sect "dcsm_z2otp_link_pointer"
.retain
;; .long 0x00003FFF ;Z2OTP_LINKPOINTER1
;; .long 0x00003FFF ;Z2OTP_LINKPOINTER2
;; .long 0x00003FFF ;Z2OTP_LINKPOINTER3
;; Uncomment these lines to allow programming of Zone2 Link pointer which has to
;; be done in either multiples of 64-bits or 128-bits.
.sect "dcsm_rsvd_z2"
.retain
;; .long 0xFFFFFFFF ;Reserved
.sect "dcsm_z2otp_gpreg"
.retain
;; .long 0xFFFFFFFF ;Z2OTP_GPREG1
;; .long 0xFFFFFFFF ;Z2OTP_GPREG2
;; .long 0xFFFFFFFF ;Z2OTP_GPREG3
;; .long 0xFFFFFFFF ;Z2OTP_GPREG4
.sect "dcsm_z2otp_pswd_lock"
.retain
;; .long 0xFFFFFFFF ;Z2OTP_PSWDLOCK
.sect "dcsm_z2otp_crc_lock"
.retain
;; .long 0xFFFFFFFF ;Z2OTP_CRCLOCK
;; Uncomment these lines to allow programming of Zone2 PSWDLOCK & CRCLOCK
;; which has to be done in either multiples of 64-bits or 128-bits.
.sect "dcsm_rsvd1_z2"
.retain
; .long 0xFFFFFFFF ;Reserved
; .long 0xFFFFFFFF ;Reserved
.sect "dcsm_zsel_z2"
.retain
;; .long 0xFFFFFFFF ;Z2OTP_CSMPSWD0 (LSW of 128-bit password)
;; .long 0x1F7FFFFF ;Z2OTP_CSMPSWD1
;; .long 0xFFFFFFFF ;Z2OTP_CSMPSWD2
;; .long 0xFFFFFFFF ;Z2OTP_CSMPSWD3 (MSW of 128-bit password)
;; .long 0x0AAAAAAA ;Z2OTP_GRABSECT1
;; .long 0x0AAAAAAA ;Z2OTP_GRABSECT2
;; .long 0x0AAAAAAA ;Z2OTP_GRABSECT3
;; .long 0x000AAAAA ;Z2OTP_GRABRAM1
;; .long 0x0AAAAA0A ;Z2OTP_GRABRAM2
;; .long 0x000A5AAA ;Z2OTP_GRABRAM3
;; .long 0xFFFFFFFF ;Z2OTP_EXEONLYSECT1
;; .long 0xFFFFFFFF ;Z2OTP_EXEONLYSECT2
;; .long 0xFFFFFFFF ;Z2OTP_EXEONLYRAM1
;; .long 0xFFFFFFFF ;Reserved
;; .long 0xFFFFFFFF ;Z2OTP_JTAGPSWDL0
;; .long 0xFFFFFFFF ;Z2OTP_JTAGPSWDL1
;;----------------------------------------------------------------------
;; For code security operation,after development has completed, prior to
;; production, all other zone select block locations should be programmed
;; to 0x0000 for maximum security.
;;#############################################################################
;; End of file
;;#############################################################################
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="dma_ex1_shared_periph_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -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 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -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 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../dma_ex1_shared_periph_cpu1.c" targetDirectory="" />
</project>
<project
name="dma_ex1_shared_periph_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -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=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -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=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../dma_ex1_shared_periph_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,71 @@
<projectSpec>
<project
name="dma_ex2_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.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="dma_ex2_sysconfig_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../dma_ex2_sysconfig_cpu1.c" targetDirectory="" />
<file action="copy" path="../dma_ex2_sysconfig_cpu1.syscfg" targetDirectory="" />
</project>
<project
name="dma_ex2_sysconfig_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../dma_ex2_sysconfig_cpu2.c" targetDirectory="" />
<file action="copy" path="../dma_ex2_sysconfig_cpu2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,345 @@
//#############################################################################
//
// FILE: dma_ex1_shared_periph_cpu1.c
//
// TITLE: DMA Transfer for Shared Peripheral Example
//
//! \addtogroup driver_dual_example_list
//! <h1> DMA Transfer Shared Peripheral </h1>
//!
//! This example shows how to initiate a DMA transfer on CPU1 from a shared
//! peripheral which is owned by CPU2. In this specific example, a timer ISR
//! is used on CPU2 to initiate a SPI transfer which will trigger the CPU1 DMA.
//! CPU1's DMA will then in turn update the ePWM1 CMPA value for the PWM which
//! it owns. The PWM output can be observed on the GPIO pins.
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//!
//! \b Watch \b Pins
//! - GPIO0 and GPIO1 - ePWM output can be viewed with 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"
#include "ipc.h"
//
// Defines
//
//#define USE_DMA_INTERRUPT
//
// Globals
//
uint16_t newCMPValue;
#pragma DATA_SECTION(newCMPValue, "ramgs1");
//
// Function Prototypes
//
void Example_deviceInit(void);
void initEPWM1(void);
void setupDMA(void);
#ifdef USE_DMA_INTERRUPT
__interrupt void dmaISR(void);
#endif
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
// Give peripheral/RAM ownership to CPU2
//
Example_deviceInit();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Initialize GPIO and configure the GPIOs 0 and 1 as ePWM outputs
//
Device_initGPIO();
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
GPIO_setPinConfig(GPIO_0_EPWM1A);
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
GPIO_setPinConfig(GPIO_1_EPWM1B);
//
// 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();
//
// Configure ePWM1 and the DMA
//
initEPWM1();
setupDMA();
//
// Send IPC to CPU2 telling it to proceed with configuring the SPI
//
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG1);
//
// Enable DMA interrupt
//
#ifdef USE_DMA_INTERRUPT
Interrupt_enable(INT_DMA_CH5);
Interrupt_register(INT_DMA_CH5, &dmaISR);
#endif
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop indefinitely
//
for(;;)
{
NOP;
}
}
//
// Example_deviceInit function
// This example uses custom Device_init function since CPU2 owns some of the
// peripherals
//
void Example_deviceInit(void)
{
//
// Disable the watchdog
//
SysCtl_disableWatchdog();
#ifdef _FLASH
//
// Copy time critical code and flash setup code to RAM. This includes the
// following functions: InitFlash();
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
// are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
#endif
//
// Set up PLL control and clock dividers
//
SysCtl_setClock(DEVICE_SETCLOCK_CFG);
//
// Make sure the LSPCLK divider is set to the default (divide by 4)
//
SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_4);
// These asserts will check that the #defines for the clock rates in
// device.h match the actual rates that have been configured. If they do
// not match, check that the calculations of DEVICE_SYSCLK_FREQ,
// DEVICE_LSPCLK_FREQ and DEVICE_AUXCLK_FREQ are accurate. Some
// examples will not perform as expected if these are not correct.
//
ASSERT(SysCtl_getClock(DEVICE_OSCSRC_FREQ) == DEVICE_SYSCLK_FREQ);
ASSERT(SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ) == DEVICE_LSPCLK_FREQ);
//
// Give control of SPIA and GS1 to CPU2
//
SysCtl_selectCPUForPeripheralInstance(SYSCTL_CPUSEL6_SPI, SYSCTL_CPUSEL_CPU2);
MemCfg_setGSRAMControllerSel(MEMCFG_SECT_GS1, MEMCFG_GSRAMCONTROLLER_CPU2);
//
// Send IPC flag to CPU2 signaling the completion of system initialization
//
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Turn on the required peripherals
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_DMA);
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
}
//
// initEPWM1 - Function to Initialize ePWM1
//
void initEPWM1(void)
{
//
// Disable sync (freeze clock to PWM as well)
//
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
//
// Set-up TBCLK
//
EPWM_setTimeBasePeriod(EPWM1_BASE, 6000);
EPWM_setPhaseShift(EPWM1_BASE, 0U);
EPWM_setTimeBaseCounter(EPWM1_BASE, 0U);
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP_DOWN);
EPWM_disablePhaseShiftLoad(EPWM1_BASE);
//
// Set ePWM clock pre-scaler
//
EPWM_setClockPrescaler(EPWM1_BASE,
EPWM_CLOCK_DIVIDER_4,
EPWM_HSCLOCK_DIVIDER_4);
//
// Set up shadowing
//
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE,
EPWM_COUNTER_COMPARE_A,
EPWM_COMP_LOAD_ON_CNTR_ZERO);
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE,
EPWM_COUNTER_COMPARE_B,
EPWM_COMP_LOAD_ON_CNTR_ZERO);
//
// Setup compare
//
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 3000U);
//
// Set actions
//
EPWM_setActionQualifierAction(EPWM1_BASE,
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
EPWM_setActionQualifierAction(EPWM1_BASE,
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
EPWM_setActionQualifierAction(EPWM1_BASE,
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
EPWM_setActionQualifierAction(EPWM1_BASE,
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
//
// Enable sync and clock to PWM
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
}
//
// setupDMA - Function to Setup DMA
//
void setupDMA(void)
{
const void *destAddr, *srcAddr;
//
// Initialize DMA
//
DMA_initController();
destAddr = (const void *)(EPWM1_BASE + EPWM_O_CMPA + 1);
srcAddr = (const void *)&newCMPValue;
//
// Setup DMA to transfer a single 16-bit word. The DMA is setup to run
// continuously so that an interrupt is not required to restart the RUN
// bit. The DMA trigger is SPIA-FFTX.
//
DMA_configAddresses(DMA_CH5_BASE, destAddr, srcAddr);
DMA_configBurst(DMA_CH5_BASE, 1, 1, 1);
DMA_configTransfer(DMA_CH5_BASE, 1, 1, 1);
DMA_configWrap(DMA_CH5_BASE, 0xFFFF, 0, 0xFFFF, 0);
DMA_configMode(DMA_CH5_BASE, DMA_TRIGGER_SPIATX, DMA_CFG_ONESHOT_ENABLE |
DMA_CFG_CONTINUOUS_ENABLE |
DMA_CFG_SIZE_16BIT);
DMA_setInterruptMode(DMA_CH5_BASE, DMA_INT_AT_END);
DMA_enableTrigger(DMA_CH5_BASE);
DMA_enableInterrupt(DMA_CH5_BASE);
DMA_startChannel(DMA_CH5_BASE);
}
//
// dmaISR - DMA Interrupt Service Routine (uncomment to enable DMA ISR)
//
#ifdef USE_DMA_INTERRUPT
__interrupt void dmaISR(void)
{
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
}
#endif
//
// End of File
//
@@ -0,0 +1,372 @@
//#############################################################################
//
// FILE: dma_ex1_shared_periph_cpu2.c
//
// TITLE: DMA Transfer for Shared Peripheral Example (CPU2)
//! <h1> DMA Transfer for Shared Peripheral Example \(CPU2\) </h1>
//!
//! This example shows how to initiate a DMA transfer on CPU1 from a shared
//! peripheral which is owned by CPU2. In this specific example, a timer ISR
//! is used on CPU2 to initiate a SPI transfer which will trigger the CPU1 DMA.
//! CPU1's DMA will then in turn update the ePWM1 CMPA value for the PWM which
//! it owns. The PWM output can be observed on the GPIO pins.
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//
//#############################################################################
//
// 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"
#include "ipc.h"
//
// Globals
//
uint16_t newCMPValue;
#pragma DATA_SECTION(newCMPValue, "ramgs1");
uint16_t direction = 1;
//
// Function Prototypes
//
void initSpi(void);
void loadBuffer(void);
void Example_deviceInit(void);
void initCPUTimer(uint32_t);
void configCPUTimer(uint32_t, float, float);
__interrupt void cpuTimer1ISR(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Example_deviceInit();
newCMPValue = 3000; // Set CMP value
//
// 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();
//
// Wait for IPC from CPU1 confirming DMA is configured before initializing
// SPI. Note that because of the way the TXFIFO interrupt is configured a
// DMA transfer will be triggered immediately after the SPI is released
// from reset.
//
IPC_waitForFlag(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
//
// Configure the SPI
//
initSpi();
//
// Setup CPU Timer 1 to interrupt every 10 ms
//
initCPUTimer(CPUTIMER1_BASE);
configCPUTimer(CPUTIMER1_BASE, DEVICE_SYSCLK_FREQ, 10000);
CPUTimer_startTimer(CPUTIMER1_BASE);
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file.
//
Interrupt_register(INT_TIMER1, &cpuTimer1ISR);
//
// Enable CPU Timer 1 interrupt
//
Interrupt_enable(INT_TIMER1);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop indefinitely
//
for(;;)
{
NOP;
}
}
//
// Example_deviceInit function
// This example uses custom Device_init function since CPU2 owns some of the
// peripherals
//
void Example_deviceInit(void)
{
//
// Disable the watchdog
//
SysCtl_disableWatchdog();
#ifdef _FLASH
//
// Copy time critical code and flash setup code to RAM. This includes the
// following functions: InitFlash();
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
// are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
#endif
//
// Wait for IPC flag from CPU1
//
IPC_waitForFlag(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
//
// Turn on required peripherals
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
}
//
// initSpi - Function to Setup SPI for FIFO mode
//
void initSpi(void)
{
//
// Must put SPI into reset before configuring it
//
SPI_disableModule(SPIA_BASE);
//
// SPI configuration. Use a 500kHz SPICLK and 16-bit word size.
//
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,
SPI_MODE_CONTROLLER, 500000, 16);
SPI_enableLoopback(SPIA_BASE);
SPI_enableModule(SPIA_BASE);
//
// FIFO configuration
//
SPI_enableFIFO(SPIA_BASE);
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_RXFF | SPI_INT_TXFF);
SPI_setFIFOInterruptLevel(SPIA_BASE, SPI_FIFO_TX2, SPI_FIFO_RX2);
//
// A DMA transfer will be triggered here!
//
//
// Load the SPI FIFO Tx Buffer
//
loadBuffer();
//
// Disable the clock to prevent continuous transfer/DMA triggers. Note that
// this method of disabling the clock should not be used if actual data is
// being transmitted.
//
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
}
//
// loadBuffer - Function to load SPI Tx FIFO Buffer
//
void loadBuffer(void)
{
//
// Fill up the FIFO buffer
//
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
}
//
// initCPUTimer - This function initializes a CPU Timer to a known state.
//
void
initCPUTimer(uint32_t cpuTimer)
{
//
// Initialize timer period to maximum
//
CPUTimer_setPeriod(cpuTimer, 0xFFFFFFFF);
//
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Make sure timer is stopped
//
CPUTimer_stopTimer(cpuTimer);
//
// Reload all counter registers with period value
//
CPUTimer_reloadTimerCounter(cpuTimer);
}
//
// configCPUTimer - This function initializes the selected timer to the
// period specified by the "freq" and "period" parameters. The "freq" is
// entered as Hz and the period in microseconds. The timer is held in the
// stopped state after configuration.
//
void
configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
uint32_t temp;
//
// Initialize timer period:
//
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(cpuTimer, temp - 1);
//
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Initializes timer control register. The timer is stopped, reloaded,
// free run disabled, and interrupt enabled.
//
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
}
//
// cpuTimer1ISR - CPU Timer 1 ISR
//
__interrupt void cpuTimer1ISR(void)
{
//
// Re-enable SPI clock to allow DMA trigger
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
//
// Wait for interrupt flag. This is when the DMA trigger will occur.
//
while((SPI_getInterruptStatus(SPIA_BASE) & SPI_INT_TXFF) == 0)
{
}
//
// Reload the SPI TX buffer and clear interrupt flag
//
loadBuffer();
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_TXFF);
//
// Disable the clock to prevent continuous transfer/DMA triggers. Note that
// this method of disabling the clock should not be used if actual data is
// being transmitted.
//
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
//
// Update next value to be transferred to the ePWM
//
if(newCMPValue >= 4500)
{
direction = 0;
}
else if(newCMPValue <= 1500)
{
direction = 1;
}
if(!direction)
{
newCMPValue -= 50;
}
else
{
newCMPValue += 50;
}
}
//
// End of File
//
@@ -0,0 +1,193 @@
//#############################################################################
//
// FILE: dma_ex2_sysconfig_cpu1.c
//
// TITLE: SysConfig DMA Transfer for Shared Peripheral Example
//
//! \addtogroup driver_dual_example_list
//! <h1> DMA Transfer Shared Peripheral </h1>
//!
//! This example shows how to initiate a DMA transfer on CPU1 from a shared
//! peripheral which is owned by CPU2. In this specific example, a timer ISR
//! is used on CPU2 to initiate a SPI transfer which will trigger the CPU1 DMA.
//! CPU1's DMA will then in turn update the ePWM1 CMPA value for the PWM which
//! it owns. The PWM output can be observed on the GPIO pins.
//! It is recommended to run the c28x1 core first, followed by the C28x2 core.
//!
//! \b Watch \b Pins
//! - GPIO0 and GPIO1 - ePWM output can be viewed with 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"
#include "ipc.h"
#include "board.h"
//
// Defines
//
//#define USE_DMA_INTERRUPT
//
// Globals
//
uint16_t newCMPValue;
#pragma DATA_SECTION(newCMPValue, "ramgs1");
//
// Function Prototypes
//
void setupDMA(void);
#ifdef USE_DMA_INTERRUPT
__interrupt void dmaISR(void);
#endif
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
// Give peripheral/RAM ownership to CPU2
//
//Example_deviceInit();
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();
//
// Initialize SysConfig Settings
//
Board_init();
//
// Set IPC_FLAG31 from local CPU1 to remote CPU2
//
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Boot CPU2 core
//
Device_bootCPU2(BOOT_MODE_CPU2);
//
// Configure the DMA (mostly done in SysConfig)
//
setupDMA();
//
// Send IPC to CPU2 telling it to proceed with configuring the SPI
//
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG1);
//
// Enable DMA interrupt
//
#ifdef USE_DMA_INTERRUPT
Interrupt_enable(INT_DMA_CH5);
Interrupt_register(INT_DMA_CH5, &dmaISR);
#endif
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop indefinitely
//
for(;;)
{
NOP;
}
}
//
// setupDMA - Function to Setup DMA
//
void setupDMA(void)
{
//
// Setup DMA to transfer a single 16-bit word. The DMA is setup to run
// continuously so that an interrupt is not required to restart the RUN
// bit. The DMA trigger is SPIA-FFTX. This is mostly done in SysConfig.
//
const void *destAddr, *srcAddr;
//
// Initialize DMA
//
//DMA_initController();
destAddr = (const void *)(EPWM1_BASE + EPWM_O_CMPA + 1);
srcAddr = (const void *)&newCMPValue;
DMA_configAddresses(DMA_CH5_BASE, destAddr, srcAddr);
}
//
// dmaISR - DMA Interrupt Service Routine (uncomment to enable DMA ISR)
//
#ifdef USE_DMA_INTERRUPT
__interrupt void dmaISR(void)
{
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
}
#endif
//
// End of File
//
@@ -0,0 +1,56 @@
/**
* 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 "F2838x" --package "337bga" --part "F2838x_337bga" --context "CPU1" --product "C2000WARE@4.02.00.00"
* @versions {"tool":"1.13.0+2553"}
*/
/**
* Import the modules used in this configuration.
*/
const dma = scripting.addModule("/driverlib/dma.js", {}, false);
const dma1 = dma.addInstance();
const epwm = scripting.addModule("/driverlib/epwm.js", {}, false);
const epwm1 = epwm.addInstance();
const ipc = scripting.addModule("/driverlib/ipc.js");
const memcfg = scripting.addModule("/driverlib/memcfg.js");
const sync = scripting.addModule("/driverlib/sync.js");
const sysctl = scripting.addModule("/driverlib/sysctl.js");
/**
* Write custom configuration values to the imported modules.
*/
dma1.$name = "myDMA5";
dma1.dmaBase = "DMA_CH5_BASE";
dma1.enableTriggers = true;
dma1.triggerSource = "DMA_TRIGGER_SPIATX";
dma1.continuousModeConfig = "DMA_CFG_CONTINUOUS_ENABLE";
dma1.destAddressVariable = "destAddr";
dma1.destBurstStep = 1;
dma1.srcBurstStep = 1;
dma1.srcTransferStep = 1;
dma1.destTransferStep = 1;
dma1.oneShotConfig = "DMA_CFG_ONESHOT_ENABLE";
dma1.useInterrupts = true;
dma1.interruptMode = "DMA_INT_AT_END";
dma1.enableInterrupts = true;
dma1.startChannel = true;
epwm1.epwmTimebase_period = 6000;
epwm1.epwmTimebase_counterMode = "EPWM_COUNTER_MODE_UP_DOWN";
epwm1.epwmTimebase_clockDiv = "EPWM_CLOCK_DIVIDER_4";
epwm1.epwmTimebase_hsClockDiv = "EPWM_HSCLOCK_DIVIDER_4";
epwm1.epwmCounterCompare_cmpA = 3000;
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_UP_CMPA = "EPWM_AQ_OUTPUT_HIGH";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_DOWN_CMPA = "EPWM_AQ_OUTPUT_LOW";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_B_ON_TIMEBASE_UP_CMPA = "EPWM_AQ_OUTPUT_LOW";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_B_ON_TIMEBASE_DOWN_CMPA = "EPWM_AQ_OUTPUT_HIGH";
epwm1.$name = "my_EPWM1";
epwm1.epwm.$assign = "EPWM1";
epwm1.epwm.epwmaPin.$assign = "GPIO0";
epwm1.epwm.epwmbPin.$assign = "GPIO1";
memcfg.config_MEMCFG_SECT_GS1 = "MEMCFG_GSRAMMASTER_CPU2";
sysctl.cpuSel_SPIA = "SYSCTL_CPUSEL_CPU2";
sysctl.enable_SYSCTL_PERIPH_CLK_TBCLKSYNC = true;
@@ -0,0 +1,268 @@
//#############################################################################
//
// FILE: dma_ex2_sysconfig_cpu2.c
//
// TITLE: SysConfig DMA Transfer for Shared Peripheral Example (CPU2)
//
// This example shows how to initiate a DMA transfer on CPU1 from a shared
// peripheral which is owned by CPU2. In this specific example, a timer ISR
// is used on CPU2 to initiate a SPI transfer which will trigger the CPU1 DMA.
// CPU1's DMA will then in turn update the ePWM1 CMPA value for the PWM which
// it owns. The PWM output can be observed on the GPIO pins.
// It is recommended to run the c28x1 core first, followed by the C28x2 core.
//
//#############################################################################
//
// 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"
#include "ipc.h"
#include "board.h"
//
// Globals
//
uint16_t newCMPValue;
#pragma DATA_SECTION(newCMPValue, "ramgs1");
uint16_t direction = 1;
//
// Function Prototypes
//
void loadBuffer(void);
void configCPUTimer(uint32_t, float, float);
__interrupt void cpuTimer1ISR(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Wait for IPC flag from CPU1
//
IPC_waitForFlag(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
newCMPValue = 3000; // Set CMP value
//
// 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();
//
// Initialize SysConfig Settings
//
Board_init();
//
// Wait for IPC from CPU1 confirming DMA is configured before initializing
// SPI. Note that because of the way the TXFIFO interrupt is configured a
// DMA transfer will be triggered immediately after the SPI is released
// from reset.
//
IPC_waitForFlag(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
//
// Fill the SPI buffer
//
loadBuffer();
//
// Setup CPU Timer 1 to interrupt every 10 ms
//
configCPUTimer(CPUTIMER1_BASE, DEVICE_SYSCLK_FREQ, 10000);
CPUTimer_startTimer(CPUTIMER1_BASE);
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file.
//
Interrupt_register(INT_TIMER1, &cpuTimer1ISR);
//
// Enable CPU Timer 1 interrupt
//
Interrupt_enable(INT_TIMER1);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop indefinitely
//
for(;;)
{
NOP;
}
}
//
// loadBuffer - Function to load SPI Tx FIFO Buffer
//
void loadBuffer(void)
{
//
// Fill up the FIFO buffer
//
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
HWREGH(SPIA_BASE + SPI_O_TXBUF) = 0xAAAA;
}
//
// configCPUTimer - This function initializes the selected timer to the
// period specified by the "freq" and "period" parameters. The "freq" is
// entered as Hz and the period in microseconds. The timer is held in the
// stopped state after configuration.
//
void
configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
uint32_t temp;
//
// Initialize timer period:
//
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(cpuTimer, temp - 1);
//
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Initializes timer control register. The timer is stopped, reloaded,
// free run disabled, and interrupt enabled.
//
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
}
//
// cpuTimer1ISR - CPU Timer 1 ISR
//
__interrupt void cpuTimer1ISR(void)
{
//
// Re-enable SPI clock to allow DMA trigger
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
//
// Wait for interrupt flag. This is when the DMA trigger will occur.
//
while((SPI_getInterruptStatus(SPIA_BASE) & SPI_INT_TXFF) == 0)
{
}
//
// Reload the SPI TX buffer and clear interrupt flag
//
loadBuffer();
SPI_clearInterruptStatus(SPIA_BASE, SPI_INT_TXFF);
//
// Disable the clock to prevent continuous transfer/DMA triggers. Note that
// this method of disabling the clock should not be used if actual data is
// being transmitted.
//
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_SPIA);
//
// Update next value to be transferred to the ePWM
//
if(newCMPValue >= 4500)
{
direction = 0;
}
else if(newCMPValue <= 1500)
{
direction = 1;
}
if(!direction)
{
newCMPValue -= 50;
}
else
{
newCMPValue += 50;
}
}
//
// End of File
//
@@ -0,0 +1,44 @@
/**
* 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 "F2838x" --package "337bga" --part "F2838x_337bga" --context "CPU2" --product "C2000WARE@4.02.00.00"
* @versions {"tool":"1.13.0+2553"}
*/
/**
* Import the modules used in this configuration.
*/
const cputimer = scripting.addModule("/driverlib/cputimer.js", {}, false);
const cputimer1 = cputimer.addInstance();
const ipc = scripting.addModule("/driverlib/ipc.js");
const spi = scripting.addModule("/driverlib/spi.js", {}, false);
const spi1 = spi.addInstance();
const sysctl = scripting.addModule("/driverlib/sysctl.js");
/**
* Write custom configuration values to the imported modules.
*/
cputimer1.$name = "myCPUTIMER1";
cputimer1.cputimerBase = "CPUTIMER1_BASE";
cputimer1.timerPeriod = 4294967295;
cputimer1.enableInterrupt = true;
spi1.$name = "mySPI0";
spi1.mode = "SPI_MODE_MASTER";
spi1.emulationMode = "SPI_EMULATION_STOP_AFTER_TRANSMIT";
spi1.bitRate = 500000;
spi1.enabledFIFOInterrupts = ["SPI_INT_RXFF","SPI_INT_TXFF"];
spi1.txFifo = "SPI_FIFO_TX2";
spi1.rxFifo = "SPI_FIFO_RX2";
spi1.loopback = true;
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
* re-solve from scratch.
*/
spi1.spi.$suggestSolution = "SPIA";
spi1.spi.spi_simoPin.$suggestSolution = "GPIO16";
spi1.spi.spi_somiPin.$suggestSolution = "GPIO17";
spi1.spi.spi_clkPin.$suggestSolution = "GPIO18";
spi1.spi.spi_stenPin.$suggestSolution = "GPIO19";
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<system>
<project configuration="@match" id="project_0" name="dma_ex2_sysconfig_cpu1">
</project>
<core id="C28xx_CPU1" project="project_0"/>
<project configuration="@match" id="project_1" name="dma_ex2_sysconfig_cpu2">
</project>
<core id="C28xx_CPU2" project="project_1"/>
<preBuildSteps>
</preBuildSteps>
<postBuildSteps>
</postBuildSteps>
</system>
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="emif_ex1_16bit_asram_dual_access_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../emif_ex1_16bit_asram_dual_access_cpu1.c" targetDirectory="" />
</project>
<project
name="emif_ex1_16bit_asram_dual_access_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.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 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../emif_ex1_16bit_asram_dual_access_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,297 @@
//#############################################################################
//
// FILE: emif_ex1_16bit_asram_dual_access_cpu1.c
//
// TITLE: EMIF1 ASYNC module accessing 16bit ASRAM through CPU1 and CPU2.
//
//! \addtogroup driver_example_list
//! <h1> EMIF1 ASYNC module accessing 16bit ASRAM through CPU1 and CPU2. </h1>
//!
//! This example configures EMIF1 in 16bit ASYNC mode and uses CS2 as chip
//! enable. The EMIF1 ownership is passed between CPU1 and CPU2 to access
//! different memory regions. Initially CPU2 grabs and configures the EMIF1,
//! thereafter both CPU1 and CPU2 grabs EMIF1 to access different memory regions
//! in external memory.
//!
//! \b External \b Connections \n
//! - External ASRAM memory (CY7C1041CV33 -10ZSXA) daughter card
//!
//! \b Watch \b Variables \n
//! - \b testStatusGlobalCPU1 - Equivalent to \b TEST_PASS if test finished
//! correctly, else the value is set to \b TEST_FAIL
//! - \b errCountGlobalCPU1 - Error counter
//!
//
//#############################################################################
//
//
//
// 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 "device.h"
#include "driverlib.h"
//
// Defines
//
#define TEST_PASS 0xABCDABCDU
#define TEST_FAIL 0xDEADDEADU
//
// Defines for external memory addresses to be be accessed. The ASRAM memory
// size used for this example is 256K x 16. CPU1 accesses upper 128K x 16
// memory range.
//
#define ASRAM_CS2_START_ADDR_CPU1 0x120000U
#define ASRAM_CS2_SIZE 0x20000U
//
// Define for memory R/W iterations
//
#define MEM_RW_ITER 0x2U
//
// Globals
//
uint16_t errCountGlobalCPU1 = 0U;
uint32_t testStatusGlobalCPU1;
uint32_t i, iter;
//
// Function Prototypes
//
void setupEMIF1Pinmux256KAsync16Bit(void);
uint16_t readWriteMemCPU1(uint32_t startAddr, uint32_t memSize);
//
// Main
//
void main(void)
{
uint16_t errCountLocal;
testStatusGlobalCPU1 = TEST_FAIL;
//
// Initialize device clock and peripherals.
//
Device_init();
//
// Disable all the interrupts.
//
DINT;
//
// Setup GPIO by disabling pin locks and enabling pullups.
//
Device_initGPIO();
//
// 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();
//
// Configure EMIF1 Pins.
//
setupEMIF1Pinmux256KAsync16Bit();
//
// Sync CPU1 and CPU2.
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
for(iter = 0; iter < MEM_RW_ITER; iter++)
{
//
// Grab EMIF1 for CPU1.
//
while(HWREGH(EMIF1CONFIG_BASE + MEMCFG_O_EMIF1MSEL) !=
EMIF_MASTER_CPU1_G)
{
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU1_G);
}
//
// Check basic RD/WR access to CS2 space.
//
errCountLocal = readWriteMemCPU1(ASRAM_CS2_START_ADDR_CPU1,
ASRAM_CS2_SIZE);
errCountGlobalCPU1 = errCountGlobalCPU1 + errCountLocal;
//
// Release EMI1
//
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU1_NG);
}
if(errCountGlobalCPU1 == 0x0U)
{
testStatusGlobalCPU1 = TEST_PASS;
}
else
{
testStatusGlobalCPU1 = TEST_FAIL;
}
while(1);
}
//
// Setup EMIF1 Pinmux 256K Async 16Bit - This function configures pins
// for 16-bit 256x16 size Asynchronous EMIF1.
//
void setupEMIF1Pinmux256KAsync16Bit(void)
{
uint16_t i;
//
// Selecting control pins.
//
GPIO_setPinConfig(GPIO_34_EMIF1_CS2N);
GPIO_setPinConfig(GPIO_31_EMIF1_WEN);
GPIO_setPinConfig(GPIO_37_EMIF1_OEN);
GPIO_setPinConfig(GPIO_36_EMIF1_WAIT);
GPIO_setPinConfig(GPIO_33_EMIF1_RNW);
//
// Selecting 18 address lines.
//
GPIO_setPinConfig(GPIO_92_EMIF1_BA1);
GPIO_setPinConfig(GPIO_38_EMIF1_A0);
GPIO_setPinConfig(GPIO_39_EMIF1_A1);
GPIO_setPinConfig(GPIO_40_EMIF1_A2);
GPIO_setPinConfig(GPIO_41_EMIF1_A3);
GPIO_setPinConfig(GPIO_44_EMIF1_A4);
GPIO_setPinConfig(GPIO_45_EMIF1_A5);
GPIO_setPinConfig(GPIO_46_EMIF1_A6);
GPIO_setPinConfig(GPIO_47_EMIF1_A7);
GPIO_setPinConfig(GPIO_48_EMIF1_A8);
GPIO_setPinConfig(GPIO_49_EMIF1_A9);
GPIO_setPinConfig(GPIO_50_EMIF1_A10);
GPIO_setPinConfig(GPIO_51_EMIF1_A11);
GPIO_setPinConfig(GPIO_52_EMIF1_A12);
GPIO_setPinConfig(GPIO_86_EMIF1_A13);
GPIO_setPinConfig(GPIO_87_EMIF1_A14);
GPIO_setPinConfig(GPIO_88_EMIF1_A15);
GPIO_setPinConfig(GPIO_89_EMIF1_A16);
//
// Selecting 16 data lines.
//
GPIO_setPinConfig(GPIO_69_EMIF1_D15);
GPIO_setPinConfig(GPIO_70_EMIF1_D14);
GPIO_setPinConfig(GPIO_71_EMIF1_D13);
GPIO_setPinConfig(GPIO_72_EMIF1_D12);
GPIO_setPinConfig(GPIO_73_EMIF1_D11);
GPIO_setPinConfig(GPIO_74_EMIF1_D10);
GPIO_setPinConfig(GPIO_75_EMIF1_D9);
GPIO_setPinConfig(GPIO_76_EMIF1_D8);
GPIO_setPinConfig(GPIO_77_EMIF1_D7);
GPIO_setPinConfig(GPIO_78_EMIF1_D6);
GPIO_setPinConfig(GPIO_79_EMIF1_D5);
GPIO_setPinConfig(GPIO_80_EMIF1_D4);
GPIO_setPinConfig(GPIO_81_EMIF1_D3);
GPIO_setPinConfig(GPIO_82_EMIF1_D2);
GPIO_setPinConfig(GPIO_83_EMIF1_D1);
GPIO_setPinConfig(GPIO_85_EMIF1_D0);
//
// Setup async mode and enable pull-ups for Data pins.
//
for(i=69; i<=85;i++)
{
if(i != 84)
{
GPIO_setPadConfig(i, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(i, GPIO_QUAL_ASYNC);
}
}
}
//
// Read Write Memory - This function performs simple read/write word accesses
// to memory.
//
uint16_t readWriteMemCPU1(uint32_t startAddr, uint32_t memSize)
{
static uint16_t iterCnt = 0;
uint16_t memReadData;
uint16_t memWriteData;
uint16_t *memPtr;
uint32_t i;
iterCnt++;
memPtr = (uint16_t *)startAddr;
//
// Write data to memory.
//
memWriteData = 0x0101U;
for(i = 0U; i < memSize; i++)
{
*memPtr++ = memWriteData;
memWriteData += (0x0001U + iterCnt);
}
//
// Verify data written to memory.
//
memWriteData = 0x0101U;
memPtr = (uint16_t *)startAddr;
for(i = 0U; i < memSize; i++)
{
memReadData = *memPtr;
if(memReadData != memWriteData)
{
return(1U);
}
memPtr++;
memWriteData += (0x0001U + iterCnt);
}
return(0U);
}
//
// End of File
//
@@ -0,0 +1,256 @@
//#############################################################################
//
// FILE: emif_ex1_16bit_asram_dual_access_cpu2.c
//
// TITLE: EMIF1 ASYNC module accessing 16bit ASRAM through CPU1 and CPU2.
//
//! \addtogroup driver_example_list
//! <h1> EMIF1 ASYNC module accessing 16bit ASRAM trhough CPU1 and CPU2. </h1>
//!
//! This example configures EMIF1 in 16bit ASYNC mode and uses CS2 as chip
//! enable. The EMIF1 ownership is passed between CPU1 and CPU2 to access
//! different memory regions. Initially CPU2 grabs and configures the EMIF1,
//! thereafter both CPU1 and CPU2 grabs EMIF1 to access different memory regions
//! in external memory.
//!
//! \b External \b Connections \n
//! - External ASRAM memory (CY7C1041CV33 -10ZSXA) daughter card
//!
//! \b Watch \b Variables \n
//! - \b testStatusGlobalCPU2 - Equivalent to \b TEST_PASS if test finished
//! correctly, else the value is set to \b TEST_FAIL
//! - \b errCountGlobalCPU2 - Error counter
//!
//
//#############################################################################
//
//
//
// 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 "device.h"
#include "driverlib.h"
//
// Defines
//
#define TEST_PASS 0xABCDABCDU
#define TEST_FAIL 0xDEADDEADU
//
// Defines for external memory addresses to be be accessed. The ASRAM memory
// size used for this example is 256K x 16. CPU2 accesses lower 128K x 16
// memory range.
//
#define ASRAM_CS2_START_ADDR_CPU2 0x100000U
#define ASRAM_CS2_SIZE 0x20000U
//
// Define for memory R/W iterations
//
#define MEM_RW_ITER 0x2U
//
// Globals
//
uint16_t errCountGlobalCPU2 = 0U;
uint32_t testStatusGlobalCPU2;
uint32_t i, iter;
//
// Function Prototypes
//
uint16_t readWriteMemCPU2(uint32_t startAddr, uint32_t memSize);
//
// Main
//
void main(void)
{
uint16_t errCountLocal;
EMIF_AsyncTimingParams tparam;
testStatusGlobalCPU2 = TEST_FAIL;
//
// Initialize device clock and peripherals.
//
Device_init();
//
// Disable all the interrupts.
//
DINT;
//
// 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();
//
// Grab EMIF1 For CPU2.
//
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU2_G);
//
// Configure to run EMIF1 on full Rate. (EMIF1CLK = CPU1SYSCLK)
//
SysCtl_setEMIF1ClockDivider(SYSCTL_EMIF1CLK_DIV_1);
//
// Configures Normal Asynchronous Mode of Operation.
//
EMIF_setAsyncMode(EMIF1_BASE, EMIF_ASYNC_CS2_OFFSET,
EMIF_ASYNC_NORMAL_MODE);
//
// Disables Extended Wait Mode.
//
EMIF_disableAsyncExtendedWait(EMIF1_BASE, EMIF_ASYNC_CS2_OFFSET);
//
// Configure EMIF1 Data Bus Width.
//
EMIF_setAsyncDataBusWidth(EMIF1_BASE, EMIF_ASYNC_CS2_OFFSET,
EMIF_ASYNC_DATA_WIDTH_16);
//
// Configure the access timing for CS2 space.
//
tparam.rSetup = 0;
tparam.rStrobe = 3;
tparam.rHold = 0;
tparam.turnArnd = 0;
tparam.wSetup = 0;
tparam.wStrobe = 1;
tparam.wHold = 0;
EMIF_setAsyncTimingParams(EMIF1_BASE, EMIF_ASYNC_CS2_OFFSET, &tparam);
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU1_NG);
//
// Sync CPU1 and CPU2.
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG11);
for(iter = 0; iter < MEM_RW_ITER; iter++)
{
//
// Grab EMIF1 For CPU2.
//
while(HWREGH(EMIF1CONFIG_BASE + MEMCFG_O_EMIF1MSEL) !=
EMIF_MASTER_CPU2_G)
{
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU2_G);
}
//
// Check basic RD/WR access to CS2 space.
//
errCountLocal = readWriteMemCPU2(ASRAM_CS2_START_ADDR_CPU2,
ASRAM_CS2_SIZE);
errCountGlobalCPU2 = errCountGlobalCPU2 + errCountLocal;
//
// Release EMIF1
//
EMIF_selectMaster(EMIF1CONFIG_BASE, EMIF_MASTER_CPU1_NG);
}
if(errCountGlobalCPU2 == 0x0U)
{
testStatusGlobalCPU2 = TEST_PASS;
}
else
{
testStatusGlobalCPU2 = TEST_FAIL;
}
while(1);
}
//
// Read Write Memory - This function performs simple read/write word accesses
// to memory.
//
uint16_t readWriteMemCPU2(uint32_t startAddr, uint32_t memSize)
{
static uint16_t iterCnt = 0;
uint16_t memReadData;
uint16_t memWriteData;
uint16_t *memPtr;
uint32_t i;
iterCnt++;
memPtr = (uint16_t *)startAddr;
//
// Write data to memory.
//
memWriteData = 0x1111U;
for(i = 0U; i < memSize; i++)
{
*memPtr++ = memWriteData;
memWriteData += (0x1111U + iterCnt);
}
//
// Verify data written to memory.
//
memWriteData = 0x1111U;
memPtr = (uint16_t *)startAddr;
for(i = 0U; i < memSize; i++)
{
memReadData = *memPtr;
if(memReadData != memWriteData)
{
return(1U);
}
memPtr++;
memWriteData += (0x1111U + iterCnt);
}
return(0U);
}
//
// End of File
//
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="empty_c28x_dual_driverlib_project_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../empty_c28x_dual_driverlib_main_cpu1.c" targetDirectory="" />
</project>
<project
name="empty_c28x_dual_driverlib_project_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../empty_c28x_dual_driverlib_main_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,71 @@
<projectSpec>
<project
name="empty_c28x_dual_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.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="empty_c28x_dual_sysconfig_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../empty_c28x_dual_sysconfig_cpu1.c" targetDirectory="" />
<file action="copy" path="../empty_c28x_dual_sysconfig_cpu1.syscfg" targetDirectory="" />
</project>
<project
name="empty_c28x_dual_sysconfig_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../empty_c28x_dual_sysconfig_cpu2.c" targetDirectory="" />
<file action="copy" path="../empty_c28x_dual_sysconfig_cpu2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,65 @@
//#############################################################################
//
// FILE: empty_c28x_dual_driverlib_main_cpu1.c
//
// TITLE: Empty Project
//! \addtogroup driver_dual_example_list
//! <h1> CPU1 Empty Project Example >/h1>
//!
//! This example is an empty project setup for Driverlib development for CPU1.
//
//#############################################################################
//
//
//
// 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)
{
}
//
// End of File
//
@@ -0,0 +1,66 @@
//#############################################################################
//
// FILE: empty_c28x_dual_driverlib_main_cpu2.c
//
// TITLE: Empty Project
//! \addtogroup driver_dual_example_list
//!
//! <h1> CPU2 Empty Project Example </h1>
//!
//! This example is an empty project setup for Driverlib development for CPU2.
//
//#############################################################################
//
//
//
// 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)
{
}
//
// End of File
//
@@ -0,0 +1,65 @@
//#############################################################################
//
// FILE: empty_c28x_dual_sysconfig_cpu1.c
//
// TITLE: SysConfig Empty Project
//
// CPU1 Empty Project Example
//
// This example is an empty project setup for Driverlib development for CPU1.
//
//#############################################################################
//
//
//
// 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)
{
}
//
// End of File
//
@@ -0,0 +1,65 @@
//#############################################################################
//
// FILE: empty_c28x_dual_sysconfig_cpu2.c
//
// TITLE: SysConfig Empty Project
//
// CPU2 Empty Project Example
//
// This example is an empty project setup for Driverlib development for CPU2.
//
//#############################################################################
//
//
//
// 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)
{
}
//
// End of File
//
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<system>
<project configuration="@match" id="project_0" name="empty_c28x_dual_sysconfig_cpu1">
</project>
<core id="C28xx_CPU1" project="project_0"/>
<project configuration="@match" id="project_1" name="empty_c28x_dual_sysconfig_cpu2">
</project>
<core id="C28xx_CPU2" project="project_1"/>
<preBuildSteps>
</preBuildSteps>
<postBuildSteps>
</postBuildSteps>
</system>
@@ -0,0 +1,117 @@
<projectSpec>
<project
name="flash_kernel_c28x_dual_ex1_c28x1"
device = "TMS320F28388D"
cgtVersion= "22.6.0.LTS"
enableHexTool="True"
linkerCommandFile=""
outputFormat="ELF"
postBuildStep="&quot;${CG_TOOL_HEX}&quot; &quot;${BuildArtifactFileName}&quot; -boot -sci8 -a -o &quot;${BuildArtifactFileBaseName}.txt&quot;"
>
<configuration name="CPU1_RAM" compilerBuildOptions="
--opt_level=off
-I${C2000WARE_DLIB_ROOT}
-I${C2000WARE_DLIB_INC}
-I${Flash_EXAMPLE_ROOT}
-I${FlashAPI_INCLUDE_ROOT}
-I${BootROM_INCLUDE_ROOT}
-I${PROJECT_ROOT}/device
-v28
-ml
-mt
--cla_support=cla1
--float_support=fpu32
--idiv_support=none
--tmu_support=tmu0
--vcu_support=vcu2
--define=CPU1
--diag_warning=225
--diag_suppress=10063
--display_error_number"
linkerBuildOptions="--entry_point code_start --stack_size=0x200"
hexBuildOptions="--boot --sci8 --ascii --outfile=${BuildArtifactFileBaseName}.txt" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_DLIB_INC" path="../../../../driverlib/inc" scope="project" />
<pathVariable name="Flash_EXAMPLE_ROOT" path = "../../../../examples/c28x/flash" scope ="project" />
<pathVariable name="FlashAPI_INCLUDE_ROOT" path="../../../../../../libraries/flash_api/f2838x/c28x/include/FlashAPI" scope="project" />
<pathVariable name="BootROM_INCLUDE_ROOT" path="../../../../../../libraries/boot_rom/f2838x/revA/rom_sources/cpu1/F2838x_ROM/bootROM/include" 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="link" path="../../../../../../driverlib/f2838x/driverlib/interrupt.c" />
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/gpio.c" />
<file action="copy" path = "../../../../../../device_support/f2838x/common/cmd/flash_programming_cpu1tocpu2_RAM_2838.cmd"/>
<file action="copy" path = "../f2838x_codestartbranch_cpu1.asm"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu1.c"/>
<file action="copy" path = "../hw_sysctl.h"/>
<file action="copy" path = "../sysctl.h"/>
<file action="copy" path = "../sysctl.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_boot_cpu1.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_get_function_cpu1.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_boot_cpu1.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_erase_cpu1.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_erase_cpu1.h"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_verify_cpu1.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_verify_cpu1.h"/>
<file action="copy" path = "../f2838x_kernel_commands_cpu1.h"/>
<file action="link" path = "../../../../../../libraries/flash_api/f2838x/c28x/lib/F2838x_C28x_FlashAPI.lib"/>
<file action="link" path = "../../../../../../libraries/boot_rom/f2838x/revA/rom_symbol_libs/cpu1/bootROM/F2838xCPU1_BootROM_Symbols.lib"/>
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" />
</project>
<project
name="flash_kernel_c28x_dual_ex1_c28x2"
device = "TMS320F28388D"
cgtVersion= "20.2.1.LTS"
enableHexTool="True"
linkerCommandFile=""
outputFormat="ELF"
postBuildStep="&quot;${CG_TOOL_HEX}&quot; &quot;${BuildArtifactFileName}&quot; -boot -sci8 -a -o &quot;${BuildArtifactFileBaseName}.txt&quot;"
>
<configuration name="CPU2_RAM" compilerBuildOptions="
--opt_level=off
-I${C2000WARE_DLIB_ROOT}
-I${C2000WARE_DLIB_INC}
-I${Flash_EXAMPLE_ROOT}
-I${FlashAPI_INCLUDE_ROOT}
-I${BootROM_INCLUDE_ROOT}
-I${PROJECT_ROOT}/device
-v28
-ml
-mt
--cla_support=cla1
--float_support=fpu32
--idiv_support=none
--tmu_support=tmu0
--vcu_support=vcu2
--define=CPU2
--diag_warning=225
--diag_suppress=10063
--display_error_number"
linkerBuildOptions="--entry_point code_start --stack_size=0x200"
hexBuildOptions="--boot --sci8 --ascii --outfile=${BuildArtifactFileBaseName}.txt" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
<pathVariable name="C2000WARE_DLIB_INC" path="../../../../driverlib/inc" scope="project" />
<pathVariable name="Flash_EXAMPLE_ROOT" path = "../../../../examples/c28x/flash" scope ="project" />
<pathVariable name="FlashAPI_INCLUDE_ROOT" path="../../../../../../libraries/flash_api/f2838x/c28x/include/FlashAPI" scope="project" />
<pathVariable name="BootROM_INCLUDE_ROOT" path="../../../../../../libraries/boot_rom/f2838x/revA/rom_sources/cpu1/F2838x_ROM/bootROM/include" 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/flash_programming_cpu2_RAM_2838.cmd"/>
<file action="copy" path = "../cpu2bootrom.h"/>
<file action="copy" path = "../f2838x_kernel_commands_cpu2.h"/>
<file action="copy" path = "../f2838x_codestartbranch_cpu2.asm"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_boot_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_sci_get_function_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_boot_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_erase_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_erase_cpu2.h"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_verify_cpu2.c"/>
<file action="copy" path = "../flash_kernel_c28x_dual_ex1_verify_cpu2.h"/>
<file action="link" path = "../../../../../../libraries/flash_api/f2838x/c28x/lib/F2838x_C28x_FlashAPI.lib"/>
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" />
</project>
</projectSpec>
@@ -0,0 +1,247 @@
//###########################################################################
//
// FILE: cpu2bootrom.h
//
// TITLE: CPU2 BootROM Definitions.
//
//###########################################################################
// $TI Release: $
//
//###########################################################################
#ifndef CPU2_BOOTROM_H_
#define CPU2_BOOTROM_H_
//
// Included Files
//
#include <stdint.h>
#include "hw_types.h"
#include "hw_memmap.h"
#include "hw_sysctl.h"
#include "hw_ipc.h"
#include "sysctl.h"
#include "cpu.h"
#include "flash.h"
#include "pin_map.h"
#include "gpio.h"
//
// Read IPCBOOTMODE Boot Mode Bit Field
//
#define HWREAD_IPCBOOTMODE_BOOTMODE (HWREG(IPC_CPU2TOCPU1_BASE + IPC_O_CPU1TOCPU2IPCBOOTMODE) & 0xFFU)
#define HWREAD_IPCBOOTMODE_DEVICE_FREQ ((HWREG(IPC_CPU2TOCPU1_BASE + IPC_O_CPU1TOCPU2IPCBOOTMODE) & 0xFF00UL) >> 0x8U)
#define HWREAD_IPCBOOTMODE_COPY_LENGTH ((HWREG(IPC_CPU2TOCPU1_BASE + IPC_O_CPU1TOCPU2IPCBOOTMODE) & 0xF0000UL) >> 0x10U)
#define HWREAD_IPCBOOTMODE_KEY ((HWREG(IPC_CPU2TOCPU1_BASE + IPC_O_CPU1TOCPU2IPCBOOTMODE) & 0xFF000000UL) >> 0x18U)
#define IPCBOOTMODE_KEY 0x5AU
#define IPCBOOTMODE_COPY_LENGTH_MAX 0xAU //1000 words
#define IPCBOOTMODE_DEVICE_FREQ_MIN 0xAU //10MHz
#define IPCBOOTMODE_DEVICE_FREQ_MAX 0xD2U //210MHz
//
// CPU2 Boot States
//
#define CPU2BROM_READBOOTMODE 0xA5F0U
#define CPU2BROM_WAITFORCOMMAND 0xA5F3U
#define CPU2BROM_RUNBOOTMODE 0xA5FCU
#define CPU2BROM_BRANCHTOAPPLICATION 0xA5F9U
//
// Boot Mode Options
//
//
// Wait Boot Option
//
#define WAIT_FOR_COMMAND 0x0U
#define CPU2BROM_RETURN_TO_WAITFORCOMMAND 0xFFFFFFFFUL
//
// Flash Boot Options
//
#define FLASH_BOOT 0x03U //Start of BANK 0 Sector 0
#define FLASH_BOOT_ALT1 0x23U //Start of BANK 0 Sector 4
#define FLASH_BOOT_ALT2 0x43U //Start of BANK 0 Sector 8
#define FLASH_BOOT_ALT3 0x63U //Start of BANK 0 Sector 13
//
// RAM Boot Options
//
#define RAM_BOOT 0x05U //Start of M0 RAM
//
// Secure Flash Boot Options
//
#define SECURE_FLASH_BOOT 0x0AU //Start of BANK 0 Sector 0
#define SECURE_FLASH_BOOT_ALT1 0x2AU //Start of BANK 0 Sector 4
#define SECURE_FLASH_BOOT_ALT2 0x4AU //Start of BANK 0 Sector 8
#define SECURE_FLASH_BOOT_ALT3 0x6AU //Start of BANK 0 Sector 13
#define SECURE_FLASH_BOOT_PASS 0x00U
#define SECURE_FLASH_BOOT_FAIL 0xFFFFFFFFUL
//
// User OTP Boot Option
//
#define USER_OTP_BOOT 0x0BU
//
// CPU1-to-CPU2 IPC Msg Copy to RAM and Boot
//
#define IPC_MSG_COPY_BOOT 0x0CU //Copies to M1RAM
#define IPC_MSG_COPY_BOOT_MIN_LENGTH 0x0U
#define IPC_MSG_COPY_BOOT_MAX_LENGTH 0xAU
//
// Fixed Boot Entry Points (Addresses)
//
//
// Flash (secure and unsecure) Entry Points
//
#define FLASH_ENTRY_POINT 0x080000UL //BANK0 Sector 0
#define FLASH_ENTRY_POINT_ALT1 0x088000UL //BANK0 Sector 4
#define FLASH_ENTRY_POINT_ALT2 0x0A8000UL //BANK0 sector 8
#define FLASH_ENTRY_POINT_ALT3 0x0BE000UL //BANK0 sector 13
//
// RAM Boot: M0 RAM Entry Point
//
#define M0RAM_ENTRY_POINT 0x000000UL //M0 start address
//
// IPC Message Copy Boot
// CPU1-to-CPU2 Message RAM 1 Address
// M1 RAM Entry Point
//
#define CPU1_TO_CPU2_MESSAGE_RAM 0x03A400UL // CPU1TOCPU2MSGRAM1 start address
#define M1RAM_ENTRY_POINT 0x000400UL //M1 start address
//
// User OTP Entry Point
//
#define USER_OTP_ENTRY_POINT 0x078000UL
//
// CPU2 Boot ROM Boot Status Bit Fields
//
#define CPU2_BOOTROM_BOOTSTS_MASK 0x000000FFUL
#define CPU2_BOOTROM_BOOTSTS_SYSTEM_START_BOOT 0x00000001UL
#define CPU2_BOOTROM_BOOTSTS_IN_FLASH_BOOT 0x00000002UL
#define CPU2_BOOTROM_BOOTSTS_IN_SECURE_FLASH_BOOT 0x00000003UL
#define CPU2_BOOTROM_BOOTSTS_IN_IPC_MSG_RAM_BOOT 0x00000004UL
#define CPU2_BOOTROM_BOOTSTS_IN_RAM_BOOT 0x00000005UL
#define CPU2_BOOTROM_BOOTSTS_IN_OTP_BOOT 0x00000006UL
#define CPU2_BOOTROM_BOOTSTS_IN_WAIT_BOOT 0x00000007UL
#define CPU2_BOOTROM_BOOTSTS_WAITING_FOR_FLAG 0x00000008UL
//
// CPU2 Boot ROM Health Status Bit Fields
//
#define CPU2_BOOTROM_HEALTH_STATUS_MASK 0xFFFFFF00UL
#define CPU2_BOOTROM_RESC_HANDLED 0x00001000UL
#define CPU2_BOOTROM_HANDLED_XRSN 0x00002000UL
#define CPU2_BOOTROM_HANDLED_POR 0x00004000UL
#define CPU2_BOOTROM_HANDLED_HWBIST 0x00008000UL
#define CPU2_BOOTROM_RAM_INIT_COMPLETE 0x00020000UL
#define CPU2_BOOTROM_GOT_AN_INVALID_IPC_BOOT_VALUE 0x00040000UL
#define CPU2_BOOTROM_MSG_RAM_COPY_LENGTH_INVALID 0x00080000UL
#define CPU2_BOOTROM_FAILED_SECURE_FLASH_CMAC 0x00200000UL
#define CPU2_BOOTROM_GOT_AN_ERAD_NMI 0x00400000UL
#define CPU2_BOOTROM_GOT_ITRAP 0x00800000UL
#define CPU2_BOOTROM_GOT_A_PIE_MISMATCH 0x01000000UL
#define CPU2_BOOTROM_GOT_A_RL_NMI 0x02000000UL
#define CPU2_BOOTROM_GOT_A_PIE_VECTOR_NMI 0x04000000UL
#define CPU2_BOOTROM_GOT_A_HWBIST_NMI 0x08000000UL
#define CPU2_BOOTROM_GOT_A_FLASH_UNCERR_NMI 0x10000000UL
#define CPU2_BOOTROM_GOT_A_RAM_UNCERR_NMI 0x20000000UL
#define CPU2_BOOTROM_GOT_A_MCLK_NMI 0x40000000UL
#define CPU2_BOOTROM_BOOT_COMPLETE 0x80000000UL
//
// CPU2 to CPU1 Error IPC Commands
//
#define CPU2TOCPU1_BOOTROM_COMMAND_ILLEGAL 0x00000000UL
#define CPU2TOCPU1_BOOTROM_BOOT_CMD_INVALID 0xFFFFFFFFUL
#define CPU2TOCPU1_BOOTROM_IN_ITRAP 0xFFFFFFFEUL
#define CPU2TOCPU1_BOOTROM_NMI 0xFFFFFFFAUL
#define CPU2TOCPU1_BOOTROM_FAILED_CMAC 0xFFFFFFF9UL
//
// Boot Escape/Patch Point OTP Addresses
//
#define OTP_BOOT_ESCAPE_TABLE_END 0x703ECUL
#define CPU2BROM_TI_OTP_ESCAPE_POINT_15 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-28U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_14 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-26U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_13 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-24U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_12 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-22U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_11 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-20U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_10 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-18U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_9 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-16U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_8 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-14U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_7 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-12U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_6 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-10U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_5 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-8U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_4 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-6U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_3 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-4U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_2 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-2U))
#define CPU2BROM_TI_OTP_ESCAPE_POINT_1 (HWREG((OTP_BOOT_ESCAPE_TABLE_END)-0U))
//
// Flash Configuration
//
#define CPU2_FLASH_PSLEEP_25MHZ_TIMEOUT_VALUE 63U //Loop = ~28 cycles @ 25MHz (Loop timeout value = (70us * freq)/28)
#define CPU2_FLASH_PSLEEP_50MHZ_TIMEOUT_VALUE 90U //Loop = ~28 cycles @ 50MHz (Loop timeout value = (50us * freq)/28)
#define CPU2_FLASH_PSLEEP_100MHZ_TIMEOUT_VALUE 179U //Loop = ~28 cycles @ 100MHz(Loop timeout value = (50us * freq)/28)
#define CPU2_FLASH_PSLEEP_150MHZ_TIMEOUT_VALUE 268U //Loop = ~28 cycles @ 150MHz(Loop timeout value = (50us * freq)/28)
#define CPU2_FLASH_PSLEEP_210MHZ_TIMEOUT_VALUE 375U //Loop = ~28 cycles @ 210MHz(Loop timeout value = (50us * freq)/28)
#define CPU2_FLASH_PSLEEP_25MHZ_VALUE (0x138U * 2U)
#define CPU2_FLASH_PSLEEP_50MHZ_VALUE (0x271U * 2U)
#define CPU2_FLASH_PSLEEP_100MHZ_VALUE (0x4E2U * 2U)
#define CPU2_FLASH_PSLEEP_150MHZ_VALUE (0x753U * 2U)
#define CPU2_FLASH_PSLEEP_210MHZ_VALUE (0xA41U * 2U)
#define CPU2_FLASH_DEFAULT_PSLEEP (0xA41U * 2U)
#define CPU2_FLASH_DEFAULT_RWAIT 0x3U
//
// Misc
//
#define CPU2_IPC_SUCCESS 0x0U
#define CPU2_IPC_FAILURE 0x1U
#define CPU2_NO_IPC_MSG 0x0U
#define NO_ADDRESS_DATA 0x0U
//
// Function prototypes
//
extern __interrupt void CPU2BROM_itrapISR(void);
extern __interrupt void CPU2BROM_nmiHandler(void);
extern __interrupt void CPU2BROM_pieVectorMismatchHandler(void);
extern uint32_t CPU2BROM_sendErrorIPC(uint32_t errorCommand, uint32_t address);
extern uint32_t CPU2BROM_startSystemBoot(void);
extern void CPU2BROM_setupDeviceSystems(void);
extern void CPU2BROM_verifyBootCommand(void);
extern void CPU2BROM_performCopyToRAM(uint32_t entryAddress, uint16_t copyLength);
extern void CPU2BROM_setIPCBootStatus(void);
extern uint32_t CPU2BROM_calculateCMAC(volatile uint32_t startAddress,
volatile uint32_t endAddress,
volatile uint32_t signatureAddress);
//
// Globals
//
typedef uint16_t (*uint16fptr)();
extern uint16fptr GetWordData;
#endif //CPU2_BOOTROM_H_
//
// End of file
//
@@ -0,0 +1,905 @@
/********************************************************************/
/* f28388d_cpu1.gel */
/* Version 2.00.0 */
/* */
/* This GEL file is to be used with the TMS320F28388d DSP. */
/* Changes may be required to support specific hardware designs. */
/* */
/* Code Composer Studio supports six reserved GEL functions that */
/* automatically get executed if they are defined. They are: */
/* */
/* StartUp() - Executed whenever CCS is invoked */
/* OnReset() - Executed after Debug->Reset CPU */
/* OnRestart() - Executed after Debug->Restart */
/* OnPreFileLoaded() - Executed before File->Load Program */
/* OnFileLoaded() - Executed after File->Load Program */
/* OnTargetConnect() - Executed after Debug->Connect */
/* */
/********************************************************************/
StartUp()
{
}
OnReset(int nErrorCode)
{
*(int *)0x5FB00 = 0; /* Disable Flash ECC */
*(int *)0x7029 = 0x68; /* Disable WD */
InitDCSM();
Device_Config();
APLL_Config();
CLA_Clock_Enable();
ERAD_Clock_Enable();
/* If CPU2 isn't out of reset, boot CPU2 to wait boot */
if(*(unsigned long *) 0x0005D122 == 0x1)
{
CPU2_releaseAndBootToWaitBoot();
}
/* If CM isn't out of reset, boot CM to wait boot */
if(*(unsigned long *) 0x0005DC00 == 0x1)
{
CM_releaseAndBootToWaitBoot();
}
if (GEL_IsInRealtimeMode()) /* If in real-time-mode */
{
}
else /* Put device into C28x Mode */
{
C28x_Mode();
}
}
OnRestart(int nErrorCode)
{
/* CCS will call OnRestart() when you do a Debug->Restart and */
/* after you load a new file. Between running interrupt based */
/* programs, this function will clear interrupts and help keep */
/* the processor from going off into invalid memory. */
if (GEL_IsInRealtimeMode()) /* If in real-time-mode */
{
}
else /* Put device into C28x Mode */
{
C28x_Mode();
}
IER = 0;
IFR = 0;
}
OnPreFileLoaded()
{
GEL_Reset();
}
OnFileLoaded(int nErrorCode, int bSymbolsOnly)
{
if (!bSymbolsOnly) {
Device_Cal();
}
}
OnTargetConnect()
{
*(int *)0x5F412 =0x000F; /* RAM INIT FOR M0/M1/D0/D1 Memory */
*(int *)0x5F432 =0x00FF; /* RAM INIT FOR LS0..LS7 Memory */
*(int *)0x5F452 =0xFFFF; /* RAM INIT FOR GS0..GS15 Memory */
if (GEL_IsInRealtimeMode()) /* If in real-time-mode */
{
}
else /* Put device into C28x Mode */
{
C28x_Mode();
}
F28388d_Memory_Map(); /* Initialize the CCS memory map */
/* Check to see if CCS has been started-up with the DSP already */
/* running in real-time mode. The user can add whatever */
/* custom initialization stuff they want to each case. */
if (GEL_IsInRealtimeMode()) /* Do real-time mode target initialization */
{
}
else /* Do stop-mode target initialization */
{
GEL_Reset(); /* Reset DSP */
}
/* If CPU2 isn't out of reset, boot CPU2 to wait boot */
if(*(unsigned long *) 0x0005D122 == 0x1)
{
CPU2_releaseAndBootToWaitBoot();
}
/* If CM isn't out of reset, boot CM to wait boot */
if(*(unsigned long *) 0x0005DC00 == 0x1)
{
CM_releaseAndBootToWaitBoot();
}
}
/********************************************************************/
/* These functions are useful to engage/disengage realtime */
/* emulation mode during debug. They save the user from having to */
/* manually perform these steps in CCS. */
/********************************************************************/
menuitem "Realtime Emulation Control";
hotmenu Run_Realtime_with_Reset()
{
GEL_Reset(); /* Reset the DSP */
ST1 = ST1 & 0xFFFD; /* clear DBGM bit in ST1 */
GEL_EnableRealtime(); /* Enable Realtime mode */
GEL_Run(); /* Run the DSP */
}
hotmenu Run_Realtime_with_Restart()
{
GEL_Restart(); /* Reset the DSP */
ST1 = ST1 & 0xFFFD; /* clear DBGM bit in ST1 */
GEL_EnableRealtime(); /* Enable Realtime mode */
GEL_Run(); /* Run the DSP */
}
hotmenu Full_Halt()
{
GEL_DisableRealtime(); /* Disable Realtime mode */
GEL_Halt(); /* Halt the DSP */
}
hotmenu Full_Halt_with_Reset()
{
GEL_DisableRealtime(); /* Disable Realtime mode */
GEL_Halt(); /* Halt the DSP */
GEL_Reset(); /* Reset the DSP */
}
menuitem "CPU2 and CM Control"
hotmenu CPU2_onlyReleaseFromReset()
{
*(unsigned long *) 0x0005D122 = 0xA5A50000; //Bring CPU2 out of reset.
/* while(!(*(unsigned long *) 0x0005D122 == 0x00000000)); */ //Wait for CPU2 to go out of reset.
GEL_TextOut("\n CPU2 is out of reset.\n");
}
hotmenu CM_onlyReleaseFromReset()
{
*(unsigned long *) 0x0005DC00 = 0xA5A50000; //Bring CM out of reset.
/* while(!(*(unsigned long *) 0x0005DC00 == 0x00000002)); */ //Wait for CM to go out of reset.
GEL_TextOut("\n CM is out of reset.\n");
}
hotmenu CPU2_releaseAndBootToWaitBoot()
{
*(unsigned long *)0x5CE22 = 0x5A00D200; //CPU1TOCPU2IPCBOOTMODE
*(unsigned long *)0x5CE04 = 0x1; //Set flag0 of CPU1TOCPU2IPCSET
*(unsigned long *) 0x0005D122 = 0xA5A50000; //Bring CPU2 out of reset.
/* while(!(*(unsigned long *) 0x0005D122 == 0x00000000)); */ //Wait for CPU2 to go out of reset.
GEL_TextOut("\n CPU2 is out of reset and configured to wait boot.\n (If you connected previously, may have to resume CPU2 to reach wait boot loop.)\n");
}
hotmenu CM_releaseAndBootToWaitBoot()
{
*(unsigned long *)0x5CE62 = 0x5A007D00; //CPU1TOCMIPCBOOTMODE
*(unsigned long *)0x5CE44 = 0x1; //Set flag0 of CPU1TOCMIPCSET
*(unsigned long *) 0x0005DC00 = 0xA5A50000; //Bring CM out of reset.
/* while(!(*(unsigned long *) 0x0005DC00 == 0x00000002)); */ //Wait for CM to go out of reset.
GEL_TextOut("\n CM is out of reset and configured to wait boot.\n (If you connected previously, may have to resume CM to reach wait boot loop.)\n");
}
hotmenu CPU1_setCPU1TOCPU2IPCFLG0()
{
*(unsigned long *)0x5CE04 = 0x1; //Set flag0 of CPU1TOCPU2IPCSET
GEL_TextOut("\n CPU1TOCPU2IPCFLG0 is set. \n");
}
hotmenu CPU1_setCPU1TOCMIPCFLG0()
{
*(unsigned long *)0x5CE44 = 0x1; //Set flag0 of CPU1TOCMIPCSET
GEL_TextOut("\n CPU1TOCMIPCFLG0 is set. \n");
}
hotmenu CPU2_configureBootModeToRAM()
{
*(unsigned long *)0x5CE22 = 0x5A00D205; //CPU1TOCPU2IPCBOOTMODE
GEL_TextOut("\n CPU2 IPCBOOTMODE is configured to RAM boot. \n");
}
hotmenu CM_configureBootModeToRAM()
{
*(unsigned long *)0x5CE62 = 0x5A007D05; //CPU1TOCMIPCBOOTMODE
GEL_TextOut("\n CM IPCBOOTMODE is configured to RAM boot. \n");
}
/*********************************************************************/
/* F28388d Memory Map */
/* */
/*********************************************************************/
menuitem "Initialize Memory Map";
hotmenu F28388d_Memory_Map()
{
/* GEL_MapReset(); */
GEL_MapOn();
/* Program memory maps */
GEL_MapAddStr(0x00000000,0, 0x400, "R|W|AS2",0); /* M0 RAM (with ECC) (2 KByte) */
GEL_MapAddStr(0x00000400,0, 0x400, "R|W|AS2",0); /* M1 RAM (with ECC) (2 KByte) */
GEL_MapAddStr(0x00000D00,0, 0x100, "R|W|AS2",0); /* PIE Vector Table */
GEL_MapAddStr(0x00008000,0, 0x800, "R|W|AS2",0); /* LS0 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00008800,0, 0x800, "R|W|AS2",0); /* LS1 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00009000,0, 0x800, "R|W|AS2",0); /* LS2 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00009800,0, 0x800, "R|W|AS2",0); /* LS3 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000A000,0, 0x800, "R|W|AS2",0); /* LS4 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000A800,0, 0x800, "R|W|AS2",0); /* LS5 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000B000,0, 0x800, "R|W|AS2",0); /* LS6 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000B800,0, 0x800, "R|W|AS2",0); /* LS7 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000C000,0, 0x800, "R|W|AS2",0); /* D0 RAM (with ECC or PARITY) (4KBytes) */
GEL_MapAddStr(0x0000C800,0, 0x800, "R|W|AS2",0); /* D1 RAM (with ECC or PARITY) (4KBytes) */
GEL_MapAddStr(0x0000D000,0, 0x1000, "R|W|AS2",0); /* GS0 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0000E000,0, 0x1000, "R|W|AS2",0); /* GS1 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0000F000,0, 0x1000, "R|W|AS2",0); /* GS2 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00010000,0, 0x1000, "R|W|AS2",0); /* GS3 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00011000,0, 0x1000, "R|W|AS2",0); /* GS4 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00012000,0, 0x1000, "R|W|AS2",0); /* GS5 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00013000,0, 0x1000, "R|W|AS2",0); /* GS6 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00014000,0, 0x1000, "R|W|AS2",0); /* GS7 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00015000,0, 0x1000, "R|W|AS2",0); /* GS8 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00016000,0, 0x1000, "R|W|AS2",0); /* GS9 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00017000,0, 0x1000, "R|W|AS2",0); /* GS10 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00018000,0, 0x1000, "R|W|AS2",0); /* GS11 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00019000,0, 0x1000, "R|W|AS2",0); /* GS12 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001A000,0, 0x1000, "R|W|AS2",0); /* GS13 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001B000,0, 0x1000, "R|W|AS2",0); /* GS14 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001C000,0, 0x1000, "R|W|AS2",0); /* GS15 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0003A400,0, 0x400, "R|W|AS2",0); /* CPU1TOCPU2MSGRAM1 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x00070000,0, 0x400, "R|AS2",0); /* TI OTP CPU1BANK0 (2 KBytes) */
GEL_MapAddStr(0x00078000,0, 0x400, "R|AS2",0); /* USER OTP CPU1BANK0 (2 KBytes) */
GEL_MapAddStr(0x00080000,0, 0x40000, "R|AS2",0); /* FLASH CPU1BANK0 (512 KBytes) */
GEL_MapAddStr(0x00100000,0, 0x100000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (2 MBytes) CS2n - ASYNC Access */
GEL_MapAddStr(0x00200000,0, 0x100000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (2 MBytes) CS2n - ASYNC Access OR SDRAM(2MB) */
GEL_MapAddStr(0x00300000,0, 0x80000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (1 MBytes) CS3n - ASYNC Access */
GEL_MapAddStr(0x00380000,0, 0x60000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (0.75 MBytes) CS4n - ASYNC Access */
GEL_MapAddStr(0x003E0000,0, 0x8000, "R|AS2",0); /* Secure ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x003E8000,0, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (master) (64 KBytes) */
GEL_MapAddStr(0x003F0000,0, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x003F8000,0, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (64 KBytes) */
/* Data memory maps */
GEL_MapAddStr(0x00000000,1, 0x400, "R|W|AS2",0); /* M0 RAM (with ECC) (2 KByte) */
GEL_MapAddStr(0x00000400,1, 0x400, "R|W|AS2",0); /* M1 RAM (with ECC) (2 KByte) */
GEL_MapAddStr(0x00000800,1, 0x200, "R|W|AS2",0); /* C28 Emulation & Test Regs */
GEL_MapAddStr(0x00000B00,1, 0x80, "R|W|AS2",0); /* ADC Result Regs */
GEL_MapAddStr(0x00000C00,1, 0x18, "R|W|AS2",0); /* CPU Timer Regs */
GEL_MapAddStr(0x00000CE0,1, 0x20, "R|W|AS2",0); /* PIE Regs */
GEL_MapAddStr(0x00000D00,1, 0x100, "R|W|AS2",0); /* PIE Vector Table */
GEL_MapAddStr(0x00000F00,1, 0x100, "R|W|AS2",0); /* FPU Regs */
GEL_MapAddStr(0x00001000,1, 0x200, "R|W|AS2",0); /* DMA Regs */
GEL_MapAddStr(0x00001200,1, 0x100, "R|W|AS2",0); /* VCU Regs */
GEL_MapAddStr(0x00001400,1, 0x80, "R|W|AS2",0); /* CPU1 CLA1 Regs */
GEL_MapAddStr(0x00001480,1, 0x80, "R|W|AS2",0); /* CPU1.CLA1toCPU1 MSG RAM (with PARITY) (256 bytes) */
GEL_MapAddStr(0x00001500,1, 0x80, "R|W|AS2",0); /* CPU1toCPU1.CLA1 MSG RAM (with PARITY) (256 bytes) */
GEL_MapAddStr(0x00001680,1, 0x80, "R|W|AS2",0); /* CLA1TODMA MSG RAM (with PARITY) (256 bytes) */
GEL_MapAddStr(0x00001700,1, 0x80, "R|W|AS2",0); /* DMATOCLA1 MSG RAM (with PARITY) (256 bytes) */
GEL_MapAddStr(0x00002000,1, 0x1000, "R|W|AS2",0); /* EMIF-2 (8 Kbytes) CS2n - ASYNC Access */
GEL_MapAddStr(0x00003000,1, 0x1000, "R|W|AS2",0); /* Configurable Logic Registers (Tiles 1 to 8) (8 KBytes) */
GEL_MapAddStr(0x00004000,1, 0x2000, "R|W|AS2",0); /* Control Peripheral Registers (16 Kbytes) */
GEL_MapAddStr(0x00006000,1, 0x1000, "R|W|AS2",0); /* High Speed Serial Port Registers (8 KBytes) */
GEL_MapAddStr(0x00007000,1, 0x1000, "R|W|AS2",0); /* System Configuration Registers (2 KBytes) */
GEL_MapAddStr(0x00008000,1, 0x800, "R|W|AS2",0); /* LS0 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00008800,1, 0x800, "R|W|AS2",0); /* LS1 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00009000,1, 0x800, "R|W|AS2",0); /* LS2 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x00009800,1, 0x800, "R|W|AS2",0); /* LS3 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000A000,1, 0x800, "R|W|AS2",0); /* LS4 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000A800,1, 0x800, "R|W|AS2",0); /* LS5 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000B000,1, 0x800, "R|W|AS2",0); /* LS6 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000B800,1, 0x800, "R|W|AS2",0); /* LS7 RAM (with PARITY) (4KBytes) */
GEL_MapAddStr(0x0000C000,1, 0x800, "R|W|AS2",0); /* D0 RAM (with ECC or PARITY) (4KBytes) */
GEL_MapAddStr(0x0000C800,1, 0x800, "R|W|AS2",0); /* D1 RAM (with ECC or PARITY) (4KBytes) */
GEL_MapAddStr(0x0000D000,1, 0x1000, "R|W|AS2",0); /* GS0 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0000E000,1, 0x1000, "R|W|AS2",0); /* GS1 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0000F000,1, 0x1000, "R|W|AS2",0); /* GS2 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00010000,1, 0x1000, "R|W|AS2",0); /* GS3 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00011000,1, 0x1000, "R|W|AS2",0); /* GS4 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00012000,1, 0x1000, "R|W|AS2",0); /* GS5 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00013000,1, 0x1000, "R|W|AS2",0); /* GS6 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00014000,1, 0x1000, "R|W|AS2",0); /* GS7 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00015000,1, 0x1000, "R|W|AS2",0); /* GS8 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00016000,1, 0x1000, "R|W|AS2",0); /* GS9 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00017000,1, 0x1000, "R|W|AS2",0); /* GS10 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00018000,1, 0x1000, "R|W|AS2",0); /* GS11 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00019000,1, 0x1000, "R|W|AS2",0); /* GS12 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001A000,1, 0x1000, "R|W|AS2",0); /* GS13 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001B000,1, 0x1000, "R|W|AS2",0); /* GS14 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x0001C000,1, 0x1000, "R|W|AS2",0); /* GS15 RAM (with PARITY) (8KBytes) */
GEL_MapAddStr(0x00038000,1, 0x400, "R|W|AS2",0); /* CMTOCPU1MSGRAM0 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x00038400,1, 0x400, "R|W|AS2",0); /* CMTOCPU1MSGRAM1 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x00039000,1, 0x400, "R|W|AS2",0); /* CPU1TOCMSGRAM0 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x00039400,1, 0x400, "R|W|AS2",0); /* CPU1TOCMSGRAM1 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x0003A000,1, 0x400, "R|W|AS2",0); /* CPU1TOCPU2MSGRAM0 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x0003A400,1, 0x400, "R|W|AS2",0); /* CPU1TOCPU2MSGRAM1 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x0003B000,1, 0x400, "R|W|AS2",0); /* CPU2TOCPU1MSGRAM0 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x0003B400,1, 0x400, "R|W|AS2",0); /* CPU2TOCPU1MSGRAM1 Message RAM (with PARITY) (2 KBytes) */
GEL_MapAddStr(0x00040000,1, 0x8000, "R|W|AS4",0); /* Peripheral Space */
GEL_MapAddStr(0x00048800,1, 0x1800, "R|W|AS4",0); /* Peripheral Space */
GEL_MapAddStr(0x0004A800,1, 0x13F00, "R|W|AS4",0); /* Peripheral Space */
GEL_MapAddStr(0x0005E7C0,1, 0x1840, "R|W|AS4",0); /* Peripheral Space */
GEL_MapAddStr(0x00070000,1, 0x400, "R|AS2",0); /* TI OTP CPU1BANK0 (2 KBytes) */
GEL_MapAddStr(0x00078000,1, 0x400, "R|AS2",0); /* USER OTP CPU1BANK0 (2 KBytes) */
GEL_MapAddStr(0x00080000,1, 0x40000, "R|AS2",0); /* FLASH CPU1BANK0 (512 KBytes) */
GEL_MapAddStr(0x01070000,1, 0x80, "R|AS2",0); /* TIOTP ECC CPU1BANK0 (2 KBytes) */
GEL_MapAddStr(0x01071000,1, 0x80, "R|AS2",0); /* USER OTP ECC CPU1BANK0 (256 Bytes) */
GEL_MapAddStr(0x01080000,1, 0x8000, "R|AS2",0); /* FLASH ECC CPU1BANK0 (256 Bytes) */
GEL_MapAddStr(0x00100000,1, 0x100000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (2 MBytes) CS2n - ASYNC Access */
GEL_MapAddStr(0x00200000,1, 0x100000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (2 MBytes) CS2n - ASYNC Access OR SDRAM(2MB) */
GEL_MapAddStr(0x00300000,1, 0x80000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (1 MBytes) CS3n - ASYNC Access */
GEL_MapAddStr(0x00380000,1, 0x60000, "R|W|AS2",0); /* EMIF-1 (Prog + Data) (0.75 MBytes) CS4n - ASYNC Access */
GEL_MapAddStr(0x003E0000,1, 0x8000, "R|AS2",0); /* Secure ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x003E8000,1, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x003F0000,1, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x003F8000,1, 0x8000, "R|AS2",0); /* Boot ROM (with PARITY) (64 KBytes) */
GEL_MapAddStr(0x80000000,1, 0x10000000, "R|W|AS2",0); /* EMIF-1 (Data Only) (0.5 GBytes) CS0n - SDRAM Access */
GEL_MapAddStr(0x90000000,1, 0x10000000, "R|W|AS2",0); /* EMIF-2 (Data) (0.5 GBytes) CS0n - SDRAM Access */
GEL_MapAddStr(0x01000D00,1, 0x200, "R|W|AS2",0); /* Redundant PIE Vector Table */
/* Peripheral memory maps */
GEL_MapAddStr(0x00048000,3, 0x800, "R|W|AS4",0); /* CANA Registers (4 KBytes) */
GEL_MapAddStr(0x0004A000,3, 0x800, "R|W|AS4",0); /* CANB Registers (4 KBytes) */
GEL_MapAddStr(0x0005E700,3, 0xC0, "R|W|AS4",0); /* DCC Registers (0.125 KBytes each) */
GEL_TextOut("\nMemory Map Initialization Complete\n");
}
/********************************************************************/
/* The ESTOP0 fill functions are useful for debug. They fill the */
/* RAM with software breakpoints that will trap runaway code. */
/********************************************************************/
hotmenu Fill_F28388d_RAM_with_ESTOP0()
{
GEL_MemoryFill(0x000000,1,0x000800,0x7625); /* Fill M0/M1 */
GEL_MemoryFill(0x008000,1,0x000800,0x7625); /* Fill L0 */
GEL_MemoryFill(0x008800,1,0x001000,0x7625); /* Fill L1/L2 */
GEL_MemoryFill(0x009800,1,0x001000,0x7625); /* Fill L3/L4 */
GEL_MemoryFill(0x00A800,1,0x001000,0x7625); /* Fill L5/L6 */
GEL_MemoryFill(0x00B800,1,0x000800,0x7625); /* Fill L7 */
GEL_MemoryFill(0x00C000,1,0x001000,0x7625); /* Fill D0/D1 */
GEL_MemoryFill(0x00D000,1,0x010000,0x7625); /* Fill G0-G15 */
}
/********************************************************************/
/* TI OTP and USER OTP Memory Dump */
/********************************************************************/
menuitem "OTP Dump";
hotmenu OTP_Dump()
{
GEL_MemorySave(0x00070000,1, 0x400, "TI_OTP_CPU1Bank0.dat");
GEL_MemorySave(0x00078000,1, 0x400, "USER_OTP_CPU1Bank0.dat");
GEL_TextOut("\n**********************************************************************
\nTI OTP and USER OTP Memory Dump Complete!
\nFile Output Directory: <CCS Install Directory>\\ccs<version>\\eclipse
\n (e.g. C:\\ti\\ccsv6\\eclipse)
\n**********************************************************************\n");
}
/********************************************************************/
menuitem "Watchdog";
hotmenu Disable_WD()
{
*0x7029 = *0x7029 | 0x0068; /* Set the WDDIS bit */
*0x7025 = 0x0055; /* Service the WD */
*0x7025 = 0x00AA; /* once to be safe. */
GEL_TextOut("\nWatchdog Timer Disabled");
}
/********************************************************************/
menuitem "Addressing Modes";
hotmenu C28x_Mode()
{
ST1 = ST1 & (~0x0100); /* AMODE = 0 */
ST1 = ST1 | 0x0200; /* OBJMODE = 1 */
}
hotmenu C24x_Mode()
{
ST1 = ST1 | 0x0100; /* AMODE = 1 */
ST1 = ST1 | 0x0200; /* OBJMODE = 1 */
}
hotmenu C27x_Mode()
{
ST1 = ST1 & (~0x0100); /* AMODE = 0 */
ST1 = ST1 & (~0x0200); /* OBJMODE = 0 */
}
/********************************************************************/
/* CLA Clock Enable */
/* Allows debugger to enable CLA breakpoints (esp. after Reset) */
/********************************************************************/
menuitem "CLA Clock Enable"
hotmenu CLA_Clock_Enable()
{
*0x5D322|= 0x1; /* Set PCLKCR0 bit 0 */
}
/********************************************************************/
/* ERAD Clock Enable */
/* Allows debugger to enable HW breakpoints */
/********************************************************************/
menuitem "ERAD Clock Enable"
hotmenu ERAD_Clock_Enable()
{
*0x5D323|= 0x0100; /* Set PCLKCR0 bit 24 */
}
/********************************************************************/
/* Load the Device Calibration values from TI OTP */
/********************************************************************/
menuitem "Device Calibration"
hotmenu Device_Cal()
{
/* Currently disabled until trims are established */
}
/********************************************************************/
/* Load the APLL Configuration values from TI OTP */
/********************************************************************/
menuitem "APLL Configuration"
hotmenu APLL_Config()
{
//
// Check APLL key and trim APLL
//
if((*(unsigned int *)0x70234) == 0x5A5A)
{
// APLLREFTRIM
*(unsigned int *)0x5D7F0 = *(unsigned int *)(*(unsigned long *)0x70240);
// SYSAPLLLDOTRIM, SYSAPLLOSCTRIM
*(unsigned int *)0x5D7F1 = (*(unsigned int *)((*(unsigned long *)0x70240) + 1)) & 0xFF;
*(unsigned int *)0x5D7F2 = ((*(unsigned int *)((*(unsigned long *)0x70240) + 1)) & 0x700) >> 0x8;
// AUXAPLLLDOTRIM, AUXAPLLOSCTRIM
*(unsigned int *)0x5D7F3 = (*(unsigned int *)((*(unsigned long *)0x70240) + 2)) & 0xFF;
*(unsigned int *)0x5D7F4 = ((*(unsigned int *)((*(unsigned long *)0x70240) + 2)) & 0x700) >> 0x8;
}
//
// Configure APLL when key is set
// (Analogsubsys SYSAPLCONFIGx/AUXAPLLCONFIGx registers)
//
if((*(unsigned int *)0x70237) == 0x5A5A)
{
*(unsigned int *)0x5D7C0 = *(unsigned int *)(*(unsigned long *)0x70246);
*(unsigned int *)0x5D7D8 = *(unsigned int *)(*(unsigned long *)0x70246);
*(unsigned int *)0x5D7C1 = *(unsigned int *)((*(unsigned long *)0x70246) + 1);
*(unsigned int *)0x5D7D9 = *(unsigned int *)((*(unsigned long *)0x70246) + 1);
*(unsigned int *)0x5D7C2 = *(unsigned int *)((*(unsigned long *)0x70246) + 2);
*(unsigned int *)0x5D7DA = *(unsigned int *)((*(unsigned long *)0x70246) + 2);
*(unsigned int *)0x5D7C3 = *(unsigned int *)((*(unsigned long *)0x70246) + 3);
*(unsigned int *)0x5D7DB = *(unsigned int *)((*(unsigned long *)0x70246) + 3);
*(unsigned int *)0x5D7C4 = *(unsigned int *)((*(unsigned long *)0x70246) + 4);
*(unsigned int *)0x5D7DC = *(unsigned int *)((*(unsigned long *)0x70246) + 4);
*(unsigned int *)0x5D7C5 = *(unsigned int *)((*(unsigned long *)0x70246) + 5);
*(unsigned int *)0x5D7DD = *(unsigned int *)((*(unsigned long *)0x70246) + 5);
*(unsigned int *)0x5D7C6 = *(unsigned int *)((*(unsigned long *)0x70246) + 6);
*(unsigned int *)0x5D7DE = *(unsigned int *)((*(unsigned long *)0x70246) + 6);
*(unsigned int *)0x5D7C7 = *(unsigned int *)((*(unsigned long *)0x70246) + 7);
*(unsigned int *)0x5D7DF = *(unsigned int *)((*(unsigned long *)0x70246) + 7);
*(unsigned int *)0x5D7C8 = *(unsigned int *)((*(unsigned long *)0x70246) + 8);
*(unsigned int *)0x5D7E0 = *(unsigned int *)((*(unsigned long *)0x70246) + 8);
*(unsigned int *)0x5D7C9 = *(unsigned int *)((*(unsigned long *)0x70246) + 9);
*(unsigned int *)0x5D7E1 = *(unsigned int *)((*(unsigned long *)0x70246) + 9);
}
}
/********************************************************************/
/* EMU Boot Mode - Set Boot Mode During Debug */
/********************************************************************/
menuitem "EMU Boot Mode Select"
hotmenu EMU_BOOT_RAM()
{
*(unsigned long *)0xD00 = 0x5AFFFFFF;
*0xD04 = 0x0005;
}
hotmenu EMU_BOOT_FLASH()
{
*(unsigned long *)0xD00 = 0x5AFFFFFF;
*0xD04 = 0x0003;
}
/********************************************************************/
/* Initialize DCSM */
/********************************************************************/
menuitem "DCSM"
hotmenu InitDCSM()
{
int i;
unsigned long LinkPointer;
int bitpos = 13;
int zerofound = 0;
unsigned long Z1_ZSB = 0;
unsigned long Z2_ZSB = 0;
unsigned long z1_key1 = 0;
unsigned long z2_key1 = 0;
GEL_TextOut("\n... DCSM Initialization Start ... \n");
XAR0 = *(unsigned long *)0x78000; // Read Z1 Linkpointer1
XAR0 = *(unsigned long *)0x78002; // Read Z1 Linkpointer2
XAR0 = *(unsigned long *)0x78004; // Read Z1 Linkpointer3
XAR0 = *(unsigned long *)0x78200; // Read Z2 Linkpointer1
XAR0 = *(unsigned long *)0x78202; // Read Z2 Linkpointer2
XAR0 = *(unsigned long *)0x78204; // Read Z2 Linkpointer3
XAR0 = *(unsigned long *)0x703F0; // Read SECDC
XAR0 = *(unsigned long *)0x78006; // Read Z1 JLMENABLE
XAR0 = *(unsigned long *)0x78010; // Read Z1 PSWDLOCK
XAR0 = *(unsigned long *)0x78012; // Read Z1 CRCLOCK
XAR0 = *(unsigned long *)0x78008; // Read Z1 GPREG1
XAR0 = *(unsigned long *)0x7800A; // Read Z1 GPREG2
XAR0 = *(unsigned long *)0x7800C; // Read Z1 GPREG3
XAR0 = *(unsigned long *)0x7800E; // Read Z1 GPREG4
XAR0 = *(unsigned long *)0x78014; // Read Z1 JTAGSWDH0
XAR0 = *(unsigned long *)0x78016; // Read Z1 JTAGSWDH1
XAR0 = *(unsigned long *)0x78210; // Read Z2 PSWDLOCK
XAR0 = *(unsigned long *)0x78212; // Read Z2 CRCLOCK
XAR0 = *(unsigned long *)0x78208; // Read Z2 GPREG1
XAR0 = *(unsigned long *)0x7820A; // Read Z2 GPREG2
XAR0 = *(unsigned long *)0x7820C; // Read Z2 GPREG3
XAR0 = *(unsigned long *)0x7820E; // Read Z2 GPREG4
// Gather Z1 ZSB
LinkPointer = *(unsigned long *)0x5F000; /* Read Z1-Linkpointer out of Z1-LINKPOINTER register */
LinkPointer = LinkPointer << 18; /* Bits 31 - 14 as most-significant 0 are invalid LinkPointer options */
while ((zerofound == 0) && (bitpos > -1))
{
if ((LinkPointer & 0x80000000) == 0)
{
zerofound = 1;
Z1_ZSB = (unsigned long *)(0x78000 + ((bitpos + 2)*0x20));
}
else
{
bitpos--;
LinkPointer = LinkPointer << 1;
}
}
if (zerofound == 0)
{
Z1_ZSB = (unsigned long *)0x78020;
}
bitpos = bitpos + 1;
// Get Default Key for Z1
if(bitpos == 0)
{
z1_key1 = 0x4d7fffff; //Z1-ZSB0-CSMPSWD1
}
if(bitpos == 1)
{
z1_key1 = 0x5f7fffff; //Z1-ZSB1-CSMPSWD1
}
if(bitpos == 2)
{
z1_key1 = 0x1dffffff; //Z1-ZSB2-CSMPSWD1
}
if(bitpos == 3)
{
z1_key1 = 0xaf7fffff; //Z1-ZSB3-CSMPSWD1
}
if(bitpos == 4)
{
z1_key1 = 0x1bffffff; //Z1-ZSB4-CSMPSWD1
}
if(bitpos == 5)
{
z1_key1 = 0x17ffffff; //Z1-ZSB5-CSMPSWD1
}
if(bitpos == 6)
{
z1_key1 = 0xbd7fffff; //Z1-ZSB6-CSMPSWD1
}
if(bitpos == 7)
{
z1_key1 = 0x9f7fffff; //Z1-ZSB7-CSMPSWD1
}
if(bitpos == 8)
{
z1_key1 = 0x2bffffff; //Z1-ZSB8-CSMPSWD1
}
if(bitpos == 9)
{
z1_key1 = 0x27ffffff; //Z1-ZSB9-CSMPSWD1
}
if(bitpos == 10)
{
z1_key1 = 0x7b7fffff; //Z1-ZSB10-CSMPSWD1
}
if(bitpos == 11)
{
z1_key1 = 0xc9ffffff; //Z1-ZSB11-CSMPSWD1
}
if(bitpos == 12)
{
z1_key1 = 0x7d7fffff; //Z1-ZSB12-CSMPSWD1
}
if(bitpos == 13)
{
z1_key1 = 0x6f7fffff; //Z1-ZSB13-CSMPSWD1
}
if(bitpos == 14)
{
z1_key1 = 0x33ffffff; //Z1-ZSB14-CSMPSWD1
}
// Gather Z2 ZSB
bitpos = 13;
zerofound = 0;
LinkPointer = *(unsigned long *)0x5F080; /* Read Z2-Linkpointer out of Z2-LINKPOINTER register */
LinkPointer = LinkPointer << 18; /* Bits 31 - 14 as most-significant 0 are invalid LinkPointer options */
while ((zerofound == 0) && (bitpos > -1))
{
if ((LinkPointer & 0x80000000) == 0)
{
zerofound = 1;
Z2_ZSB = (unsigned long *)(0x78200 + ((bitpos + 2)*0x20));
}
else
{
bitpos--;
LinkPointer = LinkPointer << 1;
}
}
if (zerofound == 0)
{
Z2_ZSB = (unsigned long *)0x78220;
}
bitpos = bitpos + 1;
// Get default key for Z2
if(bitpos == 0)
{
z2_key1 = 0x1f7fffff; //Z2-ZSB0-CSMPSWD1
}
if(bitpos == 1)
{
z2_key1 = 0xe57fffff; //Z2-ZSB1-CSMPSWD1
}
if(bitpos == 2)
{
z2_key1 = 0x4fffffff; //Z2-ZSB2-CSMPSWD1
}
if(bitpos == 3)
{
z2_key1 = 0xe37fffff; //Z2-ZSB3-CSMPSWD1
}
if(bitpos == 4)
{
z2_key1 = 0x57ffffff; //Z2-ZSB4-CSMPSWD1
}
if(bitpos == 5)
{
z2_key1 = 0x5bffffff; //Z2-ZSB5-CSMPSWD1
}
if(bitpos == 6)
{
z2_key1 = 0xf17fffff; //Z2-ZSB6-CSMPSWD1
}
if(bitpos == 7)
{
z2_key1 = 0x3b7fffff; //Z2-ZSB7-CSMPSWD1
}
if(bitpos == 8)
{
z2_key1 = 0x8fffffff; //Z2-ZSB8-CSMPSWD1
}
if(bitpos == 9)
{
z2_key1 = 0x6bffffff; //Z2-ZSB9-CSMPSWD1
}
if(bitpos == 10)
{
z2_key1 = 0x377fffff; //Z2-ZSB10-CSMPSWD1
}
if(bitpos == 11)
{
z2_key1 = 0x9bffffff; //Z2-ZSB11-CSMPSWD1
}
if(bitpos == 12)
{
z2_key1 = 0x2f7fffff; //Z2-ZSB12-CSMPSWD1
}
if(bitpos == 13)
{
z2_key1 = 0xcb7fffff; //Z2-ZSB13-CSMPSWD1
}
if(bitpos == 14)
{
z2_key1 = 0x97ffffff; //Z2-ZSB14-CSMPSWD1
}
// Zone 1 ZSB
XAR0 = *(unsigned long *)(Z1_ZSB + 0x8); // GRABSECT1
XAR0 = *(unsigned long *)(Z1_ZSB + 0xA); // GRABSECT2
XAR0 = *(unsigned long *)(Z1_ZSB + 0xC); // GRABSECT3
XAR0 = *(unsigned long *)(Z1_ZSB + 0xE); // GRABRAM1
XAR0 = *(unsigned long *)(Z1_ZSB + 0x10); // GRABRAM2
XAR0 = *(unsigned long *)(Z1_ZSB + 0x12); // GRABRAM3
XAR0 = *(unsigned long *)(Z1_ZSB + 0x14); // EXEONLYSECT1
XAR0 = *(unsigned long *)(Z1_ZSB + 0x16); // EXEONLYSECT2
XAR0 = *(unsigned long *)(Z1_ZSB + 0x18); // EXEONLYRAM1
XAR0 = *(unsigned long *)(Z1_ZSB + 0x1C); // JTAGPSWDL0
XAR0 = *(unsigned long *)(Z1_ZSB + 0x1E); // JTAGPSWDL1
// Zone 2 ZSB
XAR0 = *(unsigned long *)(Z2_ZSB + 0x8); // GRABSECT1
XAR0 = *(unsigned long *)(Z2_ZSB + 0xA); // GRABSECT2
XAR0 = *(unsigned long *)(Z2_ZSB + 0xC); // GRABSECT3
XAR0 = *(unsigned long *)(Z2_ZSB + 0xE); // GRABRAM1
XAR0 = *(unsigned long *)(Z2_ZSB + 0x10); // GRABRAM2
XAR0 = *(unsigned long *)(Z2_ZSB + 0x12); // GRABRAM3
XAR0 = *(unsigned long *)(Z2_ZSB + 0x14); // EXEONLYSECT1
XAR0 = *(unsigned long *)(Z2_ZSB + 0x16); // EXEONLYSECT2
XAR0 = *(unsigned long *)(Z2_ZSB + 0x18); // EXEONLYRAM1
// BLOCKED State to LOCKED State
XAR0 = *(unsigned long *)(Z1_ZSB + 0x0); // CSMPSWD0
XAR0 = *(unsigned long *)(Z1_ZSB + 0x2); // CSMPSWD1
XAR0 = *(unsigned long *)(Z1_ZSB + 0x4); // CSMPSWD2
XAR0 = *(unsigned long *)(Z1_ZSB + 0x6); // CSMPSWD3
XAR0 = *(unsigned long *)(Z2_ZSB + 0x0); // CSMPSWD0
XAR0 = *(unsigned long *)(Z2_ZSB + 0x2); // CSMPSWD1
XAR0 = *(unsigned long *)(Z2_ZSB + 0x4); // CSMPSWD2
XAR0 = *(unsigned long *)(Z2_ZSB + 0x6); // CSMPSWD3
// Check if unsecure (z1)
if(((*(unsigned long *)(0x5F018)) & 0x200000) == 0)
{
*(unsigned long *)0x0005F010 = 0xFFFFFFFF; // LOAD CSMKEY0
*(unsigned long *)0x0005F012 = z1_key1; // LOAD CSMKEY1
*(unsigned long *)0x0005F014 = 0xFFFFFFFF; // LOAD CSMKEY2
*(unsigned long *)0x0005F016 = 0xFFFFFFFF; // LOAD CSMKEY3
}
// Check if unsecure (z2)
if(((*(unsigned long *)(0x5F098)) & 0x200000) == 0)
{
*(unsigned long *)0x0005F090 = 0xFFFFFFFF; // LOAD CSMKEY0
*(unsigned long *)0x0005F092 = z2_key1; // LOAD CSMKEY1
*(unsigned long *)0x0005F094 = 0xFFFFFFFF; // LOAD CSMKEY2
*(unsigned long *)0x0005F096 = 0xFFFFFFFF; // LOAD CSMKEY3
}
GEL_TextOut("\n... DCSM Initialization Done ...\n");
}
hotmenu unlockDCSM()
{
// Check if unsecure (z1)
if(((*(unsigned long *)(0x5F018)) & 0x200000) == 0)
{
*(unsigned long *)0x0005F010 = 0xFFFFFFFF; // LOAD CSMKEY0
*(unsigned long *)0x0005F012 = 0x4d7fffff; // LOAD CSMKEY1
*(unsigned long *)0x0005F014 = 0xFFFFFFFF; // LOAD CSMKEY2
*(unsigned long *)0x0005F016 = 0xFFFFFFFF; // LOAD CSMKEY3
}
// Check if unsecure (z2)
if(((*(unsigned long *)(0x5F098)) & 0x200000) == 0)
{
*(unsigned long *)0x0005F090 = 0xFFFFFFFF; // LOAD CSMKEY0
*(unsigned long *)0x0005F092 = 0x1f7fffff; // LOAD CSMKEY1
*(unsigned long *)0x0005F094 = 0xFFFFFFFF; // LOAD CSMKEY2
*(unsigned long *)0x0005F096 = 0xFFFFFFFF; // LOAD CSMKEY3
}
GEL_TextOut("\n... DCSM Unlock Done ...\n");
}
/********************************************************************/
/* Configure Device DCx Registers */
/********************************************************************/
menuitem "Device Configuration"
hotmenu Device_Config()
{
*(unsigned long *)0x0005D008 = *(unsigned long *)0x00070212; // LOAD PARTIDL Value
*(unsigned long *)0x0005D00A = *(unsigned long *)0x00070214; // LOAD PARTIDH Value
/* Always enabled */
*(unsigned long *)0x0005D012 = 0xFFFFFFFF; // LOAD DC1 Value
*(unsigned long *)0x0005D014 = 0xFFFFFFFF; // LOAD DC2 Value
*(unsigned long *)0x0005D016 = 0xFFFFFFFF; // LOAD DC3 Value
*(unsigned long *)0x0005D018 = 0xFFFFFFFF; // LOAD DC4 Value
*(unsigned long *)0x0005D01A = 0xFFFFFFFF; // LOAD DC5 Value
*(unsigned long *)0x0005D01C = 0xFFFFFFFF; // LOAD DC6 Value
*(unsigned long *)0x0005D01E = 0xFFFFFFFF; // LOAD DC7 Value
*(unsigned long *)0x0005D020 = 0xFFFFFFFF; // LOAD DC8 Value
*(unsigned long *)0x0005D022 = 0xFFFFFFFF; // LOAD DC9 Value
*(unsigned long *)0x0005D024 = 0xFFFFFFFF; // LOAD DC10 Value
*(unsigned long *)0x0005D028 = 0xFFFFFFFF; // LOAD DC12 Value
*(unsigned long *)0x0005D02A = 0xFFFFFFFF; // LOAD DC13 Value
*(unsigned long *)0x0005D02C = 0xFFFFFFFF; // LOAD DC14 Value
*(unsigned long *)0x0005D02E = 0xFFFFFFFF; // LOAD DC15 Value
*(unsigned long *)0x0005D030 = 0xFFFFFFFF; // LOAD DC16 Value
*(unsigned long *)0x0005D032 = 0xFFFFFFFF; // LOAD DC17 Value
*(unsigned long *)0x0005D034 = 0xFFFFFFFF; // LOAD DC18 Value
*(unsigned long *)0x0005D03C = 0xFFFFFFFF; // LOAD DC22 Value
*(unsigned long *)0x0005D03E = 0xFFFFFFFF; // LOAD DC23 Value
*(unsigned long *)0x0005D040 = 0xFFFFFFFF; // LOAD DC24 Value
*(unsigned long *)0x0005D042 = 0xFFFFFFFF; // LOAD DC25 Value
*(unsigned long *)0x0005D046 = 0xFFFFFFFF; // LOAD DC27 Value
*(unsigned long *)0x0005D144 = 0xFFFFFFFF; // LOAD CPU1ROM DC3 Value
*(unsigned long *)0x0005D146 = 0xFFFFFFFF; // LOAD CPU1ROM DC4 Value
*(unsigned long *)0x0005D154 = 0xFFFFFFFF; // LOAD CPU2ROM DC3 Value
*(unsigned long *)0x0005D156 = 0xFFFFFFFF; // LOAD CPU2ROM DC4 Value
/* Configured via TI OTP */
*(unsigned long *)0x0005D010 = (0xFFFF0000 | (*(unsigned int *)0x00070218)); // LOAD DC0 Value
*(unsigned long *)0x0005D026 = (0xFFFF0000 | (*(unsigned int *)0x00070219)); // LOAD DC11 Value
*(unsigned long *)0x0005D036 = (0xFFFF0000 | (*(unsigned int *)0x0007021A)); // LOAD DC19 Value
*(unsigned long *)0x0005D038 = (0xFFFF0000 | (*(unsigned int *)0x0007021B)); // LOAD DC20 Value
*(unsigned long *)0x0005D03A = (0xFFFF0000 | (*(unsigned int *)0x0007021C)); // LOAD DC21 Value
*(unsigned long *)0x0005D044 = (0xFFFF0000 | (*(unsigned int *)0x0007021D)); // LOAD DC26 Value
*(unsigned long *)0x0005D060 = (0xFFFF0000 | (*(unsigned int *)0x0007021E)); // LOAD PERCNF1 Value
*(unsigned long *)0x0005D140 = (0xFFFF0000 | (*(unsigned int *)0x0007021F)); // LOAD CPU1ROM DC1 Value
*(unsigned long *)0x0005D142 = (0xFFFF0000 | (*(unsigned int *)0x00070220)); // LOAD CPU1ROM DC2 Value
*(unsigned long *)0x0005D150 = (0xFFFF0000 | (*(unsigned int *)0x00070221)); // LOAD CPU2ROM DC1 Value
*(unsigned long *)0x0005D152 = (0xFFFF0000 | (*(unsigned int *)0x00070222)); // LOAD CPU2ROM DC2 Value
/* Lock DCx registers */
*(unsigned int *)0x0005D002 |= 0x1;
}
/*** End of file ***/
@@ -0,0 +1,222 @@
;//###########################################################################
;//
;// FILE: f2838x_codestartbranch_cpu1.asm
;//
;// TITLE: Branch for redirecting code execution after boot.
;//
;// For these examples, code_start is the first code that is executed after
;// exiting the boot ROM code.
;//
;// The codestart section in the linker cmd file is used to physically place
;// this code at the correct memory location. This section should be placed
;// at the location the BOOT ROM will re-direct the code to. For example,
;// for boot to FLASH this code will be located at 0x3f7ff6.
;//
;// In addition, the example F2838x projects are setup such that the codegen
;// entry point is also set to the code_start label. This is done by linker
;// option -e in the project build options. When the debugger loads the code,
;// it will automatically set the PC to the "entry point" address indicated by
;// the -e linker option. In this case the debugger is simply assigning the PC,
;// it is not the same as a full reset of the device.
;//
;// The compiler may warn that the entry point for the project is other then
;// _c_init00. _c_init00 is the C environment setup and is run before
;// main() is entered. The code_start code will re-direct the execution
;// to _c_init00 and thus there is no worry and this warning can be ignored.
;//
;//###########################################################################
;//
;// 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.
;// $
;//###########################################################################
***********************************************************************
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
.ref main
.global code_start
.global _ExitBoot
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
.retain
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot._asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
;LB _c_int00 ;Branch to start of boot._asm in RTS library
LCR main
; Cleanup and exit. At this point the EntryAddr
; is located in the ACC register
BF _ExitBoot,UNC
.endif
;end wd_disable
;-----------------------------------------------
; _ExitBoot
;-----------------------------------------------
;-----------------------------------------------
;This module cleans up after the boot loader
;
; 1) Make sure the stack is deallocated.
; SP = 0x400 after exiting the boot
; loader
; 2) Push 0 onto the stack so RPC will be
; 0 after using LRETR to jump to the
; entry point
; 2) Load RPC with the entry point
; 3) Clear all XARn registers
; 4) Clear ACC, P and XT registers
; 5) LRETR - this will also clear the RPC
; register since 0 was on the stack
;-----------------------------------------------
_ExitBoot:
__stack: .usect ".stack",0
;-----------------------------------------------
; Insure that the stack is deallocated
;-----------------------------------------------
MOV SP,#__stack
;-----------------------------------------------
; Clear the bottom of the stack. This will endup
; in RPC when we are finished
;-----------------------------------------------
MOV *SP++,#0
MOV *SP++,#0
;-----------------------------------------------
; Load RPC with the entry point as determined
; by the boot mode. This address will be returned
; in the ACC register.
;-----------------------------------------------
PUSH ACC
POP RPC
;-----------------------------------------------
; Put registers back in their reset state.
;
; Clear all the XARn, ACC, XT, and P and DP
; registers
;
; NOTE: Leave the device in C28x operating mode
; (OBJMODE = 1, AMODE = 0)
;-----------------------------------------------
ZAPA
MOVL XT,ACC
MOVZ AR0,AL
MOVZ AR1,AL
MOVZ AR2,AL
MOVZ AR3,AL
MOVZ AR4,AL
MOVZ AR5,AL
MOVZ AR6,AL
MOVZ AR7,AL
MOVW DP, #0
;------------------------------------------------
; Restore ST0 and ST1. Note OBJMODE is
; the only bit not restored to its reset state.
; OBJMODE is left set for C28x object operating
; mode.
;
; ST0 = 0x0000 ST1 = 0x0A0B
; 15:10 OVC = 0 15:13 ARP = 0
; 9: 7 PM = 0 12 XF = 0
; 6 V = 0 11 M0M1MAP = 1
; 5 N = 0 10 reserved
; 4 Z = 0 9 OBJMODE = 1
; 3 C = 0 8 AMODE = 0
; 2 TC = 0 7 IDLESTAT = 0
; 1 OVM = 0 6 EALLOW = 0
; 0 SXM = 0 5 LOOP = 0
; 4 SPA = 0
; 3 VMAP = 1
; 2 PAGE0 = 0
; 1 DBGM = 1
; 0 INTM = 1
;-----------------------------------------------
MOV *SP++,#0
MOV *SP++,#0x0A0B
POP ST1
POP ST0
;------------------------------------------------
; Jump to the EntryAddr as defined by the
; boot mode selected and continue execution
;-----------------------------------------------
LRETR
;eof ----------
.end
;//===========================================================================
;// End of file.
;//===========================================================================
@@ -0,0 +1,221 @@
;//###########################################################################
;//
;// FILE: f2838x_codestartbranch_cpu2.asm
;//
;// TITLE: Branch for redirecting code execution after boot.
;//
;// For these examples, code_start is the first code that is executed after
;// exiting the boot ROM code.
;//
;// The codestart section in the linker cmd file is used to physically place
;// this code at the correct memory location. This section should be placed
;// at the location the BOOT ROM will re-direct the code to. For example,
;// for boot to FLASH this code will be located at 0x3f7ff6.
;//
;// In addition, the example F2838x projects are setup such that the codegen
;// entry point is also set to the code_start label. This is done by linker
;// option -e in the project build options. When the debugger loads the code,
;// it will automatically set the PC to the "entry point" address indicated by
;// the -e linker option. In this case the debugger is simply assigning the PC,
;// it is not the same as a full reset of the device.
;//
;// The compiler may warn that the entry point for the project is other then
;// _c_init00. _c_init00 is the C environment setup and is run before
;// main() is entered. The code_start code will re-direct the execution
;// to _c_init00 and thus there is no worry and this warning can be ignored.
;//
;//###########################################################################
;//
;// 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.
;// $
;//###########################################################################
***********************************************************************
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
.ref main
.global code_start
.global _ExitBoot
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
.retain
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot._asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
;LB _c_int00 ;Branch to start of boot._asm in RTS library
LCR main
.endif
;end wd_disable
;end wd_disable
;-----------------------------------------------
; _ExitBoot
;-----------------------------------------------
;-----------------------------------------------
;This module cleans up after the boot loader
;
; 1) Make sure the stack is deallocated.
; SP = 0x400 after exiting the boot
; loader
; 2) Push 0 onto the stack so RPC will be
; 0 after using LRETR to jump to the
; entry point
; 2) Load RPC with the entry point
; 3) Clear all XARn registers
; 4) Clear ACC, P and XT registers
; 5) LRETR - this will also clear the RPC
; register since 0 was on the stack
;-----------------------------------------------
_ExitBoot:
__stack: .usect ".stack",0
;-----------------------------------------------
; Insure that the stack is deallocated
;-----------------------------------------------
MOV SP,#__stack
;-----------------------------------------------
; Clear the bottom of the stack. This will endup
; in RPC when we are finished
;-----------------------------------------------
MOV *SP++,#0
MOV *SP++,#0
;-----------------------------------------------
; Load RPC with the entry point as determined
; by the boot mode. This address will be returned
; in the ACC register.
;-----------------------------------------------
PUSH ACC
POP RPC
;-----------------------------------------------
; Put registers back in their reset state.
;
; Clear all the XARn, ACC, XT, and P and DP
; registers
;
; NOTE: Leave the device in C28x operating mode
; (OBJMODE = 1, AMODE = 0)
;-----------------------------------------------
ZAPA
MOVL XT,ACC
MOVZ AR0,AL
MOVZ AR1,AL
MOVZ AR2,AL
MOVZ AR3,AL
MOVZ AR4,AL
MOVZ AR5,AL
MOVZ AR6,AL
MOVZ AR7,AL
MOVW DP, #0
;------------------------------------------------
; Restore ST0 and ST1. Note OBJMODE is
; the only bit not restored to its reset state.
; OBJMODE is left set for C28x object operating
; mode.
;
; ST0 = 0x0000 ST1 = 0x0A0B
; 15:10 OVC = 0 15:13 ARP = 0
; 9: 7 PM = 0 12 XF = 0
; 6 V = 0 11 M0M1MAP = 1
; 5 N = 0 10 reserved
; 4 Z = 0 9 OBJMODE = 1
; 3 C = 0 8 AMODE = 0
; 2 TC = 0 7 IDLESTAT = 0
; 1 OVM = 0 6 EALLOW = 0
; 0 SXM = 0 5 LOOP = 0
; 4 SPA = 0
; 3 VMAP = 1
; 2 PAGE0 = 0
; 1 DBGM = 1
; 0 INTM = 1
;-----------------------------------------------
MOV *SP++,#0
MOV *SP++,#0x0A0B
POP ST1
POP ST0
;------------------------------------------------
; Jump to the EntryAddr as defined by the
; boot mode selected and continue execution
;-----------------------------------------------
LRETR
;eof ----------
.end
;//===========================================================================
;// End of file.
;//===========================================================================
@@ -0,0 +1,98 @@
//###########################################################################
//
// FILE: f2838x_kernel_commands_cpu1.h
//
// TITLE: User kernel commands
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef F2838X_KERNEL_COMMANDS_CPU1_H_
#define F2838X_KERNEL_COMMANDS_CPU1_H_
//
// Defines
//
#define DFU_CPU1 0x0100
#define DFU_CPU2 0x0200
#define ERASE_CPU1 0x0300
#define ERASE_CPU2 0x0400
#define VERIFY_CPU1 0x0500
#define VERIFY_CPU2 0x0600
#define CPU1_UNLOCK_Z1 0x000A
#define CPU1_UNLOCK_Z2 0x000B
#define CPU2_UNLOCK_Z1 0x000C
#define CPU2_UNLOCK_Z2 0x000D
#define RUN_CPU1 0x000E
#define RESET_CPU1 0x000F
#define RUN_CPU1_BOOT_CPU2 0x0004
#define RESET_CPU1_BOOT_CPU2 0x0007
#define RUN_CPU2 0x0010
#define RESET_CPU2 0x0020
#define DFU_CM 0x0050
#define ERASE_CM 0x0060
#define VERIFY_CM 0x0070
#define CM_UNLOCK_Z1 0x0080
#define CM_UNLOCK_Z2 0x0090
#define RUN_CM 0x00A0
#define RESET_CM 0x00B0
#undef NO_ERROR
#define NO_ERROR 0x1000
#define BLANK_ERROR 0x2000
#define VERIFY_ERROR 0x3000
#define PROGRAM_ERROR 0x4000
#define COMMAND_ERROR 0x5000
#define UNLOCK_ERROR 0x6000
#define INCORRECT_DATA_BUFFER_LENGTH 0x7000
#define INCORRECT_ECC_BUFFER_LENGTH 0x8000
#define DATA_ECC_BUFFER_LENGTH_MISMATCH 0x9000
#define FLASH_REGS_NOT_WRITABLE 0xA000
#define FEATURE_NOT_AVAILABLE 0xB000
#define INVALID_ADDRESS 0xC000
#define INVALID_CPUID 0xD000
#define FAILURE 0xE000
#define NOT_RECOGNIZED 0xF000
#define ACK 0x2D
#define NAK 0xA5
#define DEFAULT_BAUD 0x2580
#define checksum_enable 1
#endif /* F2838X_KERNEL_COMMANDS_CPU1_H_ */
@@ -0,0 +1,98 @@
//###########################################################################
//
// FILE: f2838x_kernel_commands_cpu2.h
//
// TITLE: User kernel commands
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef F2838X_KERNEL_COMMANDS_CPU2_H_
#define F2838X_KERNEL_COMMANDS_CPU2_H_
//
// Defines
//
#define DFU_CPU1 0x0100
#define DFU_CPU2 0x0200
#define ERASE_CPU1 0x0300
#define ERASE_CPU2 0x0400
#define VERIFY_CPU1 0x0500
#define VERIFY_CPU2 0x0600
#define CPU1_UNLOCK_Z1 0x000A
#define CPU1_UNLOCK_Z2 0x000B
#define CPU2_UNLOCK_Z1 0x000C
#define CPU2_UNLOCK_Z2 0x000D
#define RUN_CPU1 0x000E
#define RESET_CPU1 0x000F
#define RUN_CPU1_BOOT_CPU2 0x0004
#define RESET_CPU1_BOOT_CPU2 0x0007
#define RUN_CPU2 0x0010
#define RESET_CPU2 0x0020
#define DFU_CM 0x0050
#define ERASE_CM 0x0060
#define VERIFY_CM 0x0070
#define CM_UNLOCK_Z1 0x0080
#define CM_UNLOCK_Z2 0x0090
#define RUN_CM 0x00A0
#define RESET_CM 0x00B0
#undef NO_ERROR
#define NO_ERROR 0x1000
#define BLANK_ERROR 0x2000
#define VERIFY_ERROR 0x3000
#define PROGRAM_ERROR 0x4000
#define COMMAND_ERROR 0x5000
#define UNLOCK_ERROR 0x6000
#define INCORRECT_DATA_BUFFER_LENGTH 0x7000
#define INCORRECT_ECC_BUFFER_LENGTH 0x8000
#define DATA_ECC_BUFFER_LENGTH_MISMATCH 0x9000
#define FLASH_REGS_NOT_WRITABLE 0xA000
#define FEATURE_NOT_AVAILABLE 0xB000
#define INVALID_ADDRESS 0xC000
#define INVALID_CPUID 0xD000
#define FAILURE 0xE000
#define NOT_RECOGNIZED 0xF000
#define ACK 0x2D
#define NAK 0xA5
#define DEFAULT_BAUD 0x2580
#define checksum_enable 1
#endif /* F2838X_KERNEL_COMMANDS_H_ */
@@ -0,0 +1,599 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_boot_cpu1.c
//
// TITLE: Boot Source Code
//! <h1> Boot Source Code </h1>
//! Functions:
//!
//! void copyData(void)
//! uint32_t getLongData(void)
//! void readReservedFn(void)
//
//###########################################################################
//
// 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 "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "cpu1bootrom.h"
#include "F021_F2838x_C28x.h"
#include "f2838x_kernel_commands_cpu1.h"
#include <assert.h>
//
// Defines
//
#define BUFFER_SIZE 0x80 // Must be a multiple
// of 128 bits, or 8 words,
// BUFFER_SIZE % 8 == 0
//
// Globals
//
extern uint16fptr getWordData; // getWordData is a pointer to the function that
// interfaces to the peripheral. Each loader assigns
// this pointer to it's particular GetWordData
// function.
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
unsigned char erasedAlready[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
//
// Function Prototypes
//
extern void sciSendChecksum(void);
uint32_t getLongData(void);
void copyData(void);
void readReservedFn(void);
uint32_t findSector(uint32_t address);
uint16_t findSize(uint32_t address);
void setFlashAPIError(Fapi_StatusType status);
void exampleError(Fapi_StatusType status);
//
// copyData - This routine copies multiple blocks of data from the host
// to the specified RAM locations. There is no error
// checking on any of the destination addresses.
// That is it is assumed all addresses and block size
// values are correct.
//
// Multiple blocks of data are copied until a block
// size of 00 00 is encountered.
//
void copyData()
{
struct HEADER
{
uint16_t BlockSize;
uint32_t DestAddr;
} BlockHeader;
uint16_t Buffer[BUFFER_SIZE];
uint16_t miniBuffer[8]; //useful for 8-word access to flash with
uint16_t i = 0;
uint16_t j = 0;
uint16_t k = 0;
uint32_t sectorAddress;
uint16_t sectorSize;
uint16_t wordData;
uint16_t wordsWritten = 0;
int fail = 0;
assert(BUFFER_SIZE % 8 == 0);
if(statusCode.status != NO_ERROR)
{
fail++;
}
//
// Reset erase status of all flash sectors
//
for(i = 0; i < 14; i++)
{
erasedAlready[i] = 0;
}
//
// Send checksum to satisfy before we begin
//
#if checksum_enable
sciSendChecksum();
#endif
//
// Get the size in words of the first block
//
BlockHeader.BlockSize = (*getWordData)();
//
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
//
EALLOW;
while(BlockHeader.BlockSize != (uint16_t)0x0000)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
BlockHeader.DestAddr = getLongData();
for(i = 0; i < BlockHeader.BlockSize; i += 0)
{
if(BlockHeader.BlockSize < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
//
// BlockHeader.BlockSize >= BUFFER_SIZE
//
else
{
//
// less than one BUFFER_SIZE left
//
if((BlockHeader.BlockSize - i) < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize - i; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
}
//
// increment i outside here so it doesn't affect loop above
//
i += j;
//
// fill the rest with 0xFFFF
//
for(; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
else
{
//
// fill up like normal, up to BUFFER_SIZE
//
for(j = 0; j < BUFFER_SIZE; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
}
}
for(k = 0; k < (BUFFER_SIZE / 8); k++)
{
miniBuffer[0] = Buffer[k * 8 + 0];
miniBuffer[1] = Buffer[k * 8 + 1];
miniBuffer[2] = Buffer[k * 8 + 2];
miniBuffer[3] = Buffer[k * 8 + 3];
miniBuffer[4] = Buffer[k * 8 + 4];
miniBuffer[5] = Buffer[k * 8 + 5];
miniBuffer[6] = Buffer[k * 8 + 6];
miniBuffer[7] = Buffer[k * 8 + 7];
if(wordsWritten < BlockHeader.BlockSize)
{
if(fail == 0)
{
//
//clean out flash banks if needed
//
sectorAddress = findSector(BlockHeader.DestAddr);
if(sectorAddress != 0xdeadbeef)
{
sectorSize = findSize(sectorAddress);
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32_t *)sectorAddress);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
oReturnCheck = Fapi_doBlankCheck((uint32_t *)sectorAddress,
sectorSize,
&oFlashStatusWord);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success || oFlashStatus != 0)
{
//
//first fail
//
if(fail == 0)
{
statusCode.status = BLANK_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
}
if(fail == 0)
{
//
//program 8 words at once, 128-bits
//
oReturnCheck = Fapi_issueProgrammingCommand((uint32_t *)BlockHeader.DestAddr,
miniBuffer,
sizeof(miniBuffer),
0,
0,
Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success || oFlashStatus != 0)
{
//
// first fail
//
if(fail == 0)
{
statusCode.status = PROGRAM_ERROR;
statusCode.address = BlockHeader.DestAddr;
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
for(j = 0; j < 8; j += 2)
{
if(fail == 0)
{
uint32_t toVerify = miniBuffer[j+1];
toVerify = toVerify << 16;
toVerify |= miniBuffer[j];
oReturnCheck = Fapi_doVerify((uint32_t *)(BlockHeader.DestAddr+j),
1,
(uint32_t *)(&toVerify),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
//
// first fail
//
if(fail == 0)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
//
// FMSTAT not checked for Verify
//
statusCode.flashAPIFsmStatus = 0;
}
fail++;
}
}
} //for j; for Fapi_doVerify
}
BlockHeader.DestAddr += 0x8;
wordsWritten += 0x8;
} //for(int k); loads miniBuffer with Buffer elements
#if checksum_enable
sciSendChecksum();
#endif
}
//
//get the size of the next block
//
BlockHeader.BlockSize = (*getWordData)();
wordsWritten = 0;
}
EDIS;
return;
}
//
// uint32_t findSector(uint32_t address) - This routine finds what sector the mentioned address
// is a part of.
//
uint32_t findSector(uint32_t address)
{
if((address >= Bzero_Sector0_start) && (address < Bzero_Sector1_start) &&
(erasedAlready[0] == 0))
{
erasedAlready[0] = 1;
return (uint32_t)Bzero_Sector0_start;
}
else if((address >= Bzero_Sector1_start) &&
(address < Bzero_Sector2_start) && (erasedAlready[1] == 0))
{
erasedAlready[1] = 1;
return (uint32_t)Bzero_Sector1_start;
}
else if((address >= Bzero_Sector2_start) &&
(address < Bzero_Sector3_start) && (erasedAlready[2] == 0))
{
erasedAlready[2] = 1;
return (uint32_t)Bzero_Sector2_start;
}
else if((address >= Bzero_Sector3_start) &&
(address < Bzero_Sector4_start) && (erasedAlready[3] == 0))
{
erasedAlready[3] = 1;
return (uint32_t)Bzero_Sector3_start;
}
else if((address >= Bzero_Sector4_start) &&
(address < Bzero_Sector5_start) && (erasedAlready[4] == 0))
{
erasedAlready[4] = 1;
return (uint32_t)Bzero_Sector4_start;
}
else if((address >= Bzero_Sector5_start) &&
(address < Bzero_Sector6_start) && (erasedAlready[5] == 0))
{
erasedAlready[5] = 1;
return (uint32_t)Bzero_Sector5_start;
}
else if((address >= Bzero_Sector6_start) &&
(address < Bzero_Sector7_start) && (erasedAlready[6] == 0))
{
erasedAlready[6] = 1;
return (uint32_t)Bzero_Sector6_start;
}
else if((address >= Bzero_Sector7_start) &&
(address < Bzero_Sector8_start) && (erasedAlready[7] == 0))
{
erasedAlready[7] = 1;
return (uint32_t)Bzero_Sector7_start;
}
else if((address >= Bzero_Sector8_start) &&
(address < Bzero_Sector9_start) && (erasedAlready[8] == 0))
{
erasedAlready[8] = 1;
return (uint32_t)Bzero_Sector8_start;
}
else if((address >= Bzero_Sector9_start) &&
(address < Bzero_Sector10_start) && (erasedAlready[9] == 0))
{
erasedAlready[9] = 1;
return (uint32_t)Bzero_Sector9_start;
}
else if((address >= Bzero_Sector10_start) &&
(address < Bzero_Sector11_start) && (erasedAlready[10] == 0))
{
erasedAlready[10] = 1;
return (uint32_t)Bzero_Sector10_start;
}
else if((address >= Bzero_Sector11_start) &&
(address < Bzero_Sector12_start) && (erasedAlready[11] == 0))
{
erasedAlready[11] = 1;
return (uint32_t)Bzero_Sector11_start;
}
else if((address >= Bzero_Sector12_start) &&
(address < Bzero_Sector13_start) && (erasedAlready[12] == 0))
{
erasedAlready[12] = 1;
return (uint32_t)Bzero_Sector12_start;
}
else if((address >= Bzero_Sector13_start) &&
(address <= FlashEndAddress) && (erasedAlready[13] == 0))
{
erasedAlready[13] = 1;
return (uint32_t)Bzero_Sector13_start;
}
else
{
return 0xdeadbeef; // a proxy address to signify that it is not
// a flash sector.
}
}
//
// uint32_t findSize(uint32_t address) - This routine finds the size of the sector under use.
//
uint16_t findSize(uint32_t address)
{
if(address == Bzero_Sector0_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector1_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector2_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector3_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector4_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector5_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector6_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector7_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector8_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector9_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector10_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector11_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector12_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector13_start)
{
return Sector16KB_u32length;
}
//
// no other possible case
//
return 0xbeef;
}
//
// uint32_t getLongData(void) - This routine fetches a 32-bit value from the peripheral
// input stream.
//
uint32_t getLongData()
{
uint32_t longData;
//
// Fetch the upper 1/2 of the 32-bit value
//
longData = ( (uint32_t)(*getWordData)() << 16);
//
// Fetch the lower 1/2 of the 32-bit value
//
longData |= (uint32_t)(*getWordData)();
return longData;
}
//
// readReservedFn - This function reads 8 reserved words in the header.
// None of these reserved words are used by the
// this boot loader at this time, they may be used in
// future devices for enhancements. Loaders that use
// these words use their own read function.
//
void readReservedFn()
{
uint16_t i;
//
// Read and discard the 8 reserved words.
//
for(i = 1; i <= 8; i++)
{
getWordData();
}
return;
}
void setFlashAPIError(Fapi_StatusType status)
{
if(status == Fapi_Error_AsyncIncorrectDataBufferLength)
{
statusCode.flashAPIError = INCORRECT_DATA_BUFFER_LENGTH;
}
else if(status == Fapi_Error_AsyncIncorrectEccBufferLength)
{
statusCode.flashAPIError = INCORRECT_ECC_BUFFER_LENGTH;
}
else if(status == Fapi_Error_AsyncDataEccBufferLengthMismatch)
{
statusCode.flashAPIError = DATA_ECC_BUFFER_LENGTH_MISMATCH;
}
else if(status == Fapi_Error_FlashRegsNotWritable)
{
statusCode.flashAPIError = FLASH_REGS_NOT_WRITABLE;
}
else if(status == Fapi_Error_FeatureNotAvailable)
{
statusCode.flashAPIError = FEATURE_NOT_AVAILABLE;
}
else if(status == Fapi_Error_InvalidAddress)
{
statusCode.flashAPIError = INVALID_ADDRESS;
}
else if(status == Fapi_Error_InvalidCPUID)
{
statusCode.flashAPIError = INVALID_CPUID;
}
else if(status == Fapi_Error_Fail)
{
statusCode.flashAPIError = FAILURE;
}
else
{
statusCode.status = NOT_RECOGNIZED;
}
}
//
// End of file
//
@@ -0,0 +1,600 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_boot_cpu2.c
//
// TITLE: Boot Source Code
//! <h1> Boot Source Code </h1>
//! Functions:
//!
//! void copyData(void)
//! uint32_t getLongData(void)
//! void readReservedFn(void)
//
//###########################################################################
//
// 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 "cpu2bootrom.h"
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "f2838x_kernel_commands_cpu2.h"
#include <assert.h>
//
//Defines
//
#define BUFFER_SIZE 0x80 // because of ECC, must be multiple
// of 64 bits, or 4 words,
// BUFFER_SIZE % 4 == 0
//
// Globals
//
uint16fptr getWordData; // GetWordData is a pointer to the function that
// interfaces to the peripheral. Each loader assigns
// this pointer to it's particular GetWordData
// function.
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
unsigned char erasedAlready[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
//
// Function Prototypes
//
extern void sciSendChecksum(void);
uint32_t getLongData(void);
void copyData(void);
void readReservedFn(void);
uint32_t findSector(uint32_t address);
uint16_t findSize(uint32_t address);
void exampleError(Fapi_StatusType status);
void setFlashAPIError(Fapi_StatusType status);
//
// copyData - This routine copies multiple blocks of data from the host
// to the specified RAM locations. There is no error
// checking on any of the destination addresses.
// That is it is assumed all addresses and block size
// values are correct.
//
// Multiple blocks of data are copied until a block
// size of 00 00 is encountered.
//
void copyData()
{
struct HEADER
{
uint16_t BlockSize;
uint32_t DestAddr;
} BlockHeader;
uint16_t Buffer[BUFFER_SIZE];
uint16_t miniBuffer[8]; //useful for 8-word access to flash with
uint16_t i = 0;
uint16_t j = 0;
uint16_t k = 0;
uint32_t sectorAddress;
uint16_t sectorSize;
uint16_t wordData;
uint16_t wordsWritten = 0;
int fail = 0;
assert(BUFFER_SIZE % 8 == 0);
if(statusCode.status != NO_ERROR)
{
fail++;
}
//
// Reset erase status of all flash sectors
//
for(i = 0; i < 14; i++)
{
erasedAlready[i] = 0;
}
//
// Send checksum to satisfy before we begin
//
#if checksum_enable
sciSendChecksum();
#endif
//
// Get the size in words of the first block
//
BlockHeader.BlockSize = (*getWordData)();
//
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
//
EALLOW;
while(BlockHeader.BlockSize != (uint16_t)0x0000)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
BlockHeader.DestAddr = getLongData();
for(i = 0; i < BlockHeader.BlockSize; i += 0)
{
if(BlockHeader.BlockSize < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
//
// BlockHeader.BlockSize >= BUFFER_SIZE
//
else
{
//
// less than one BUFFER_SIZE left
//
if((BlockHeader.BlockSize - i) < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize - i; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
}
//
// increment i outside here so it doesn't affect loop above
//
i += j;
//
// fill the rest with 0xFFFF
//
for(; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
else
{
//
// fill up like normal, up to BUFFER_SIZE
//
for(j = 0; j < BUFFER_SIZE; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
}
}
for(k = 0; k < (BUFFER_SIZE / 8); k++)
{
miniBuffer[0] = Buffer[k * 8 + 0];
miniBuffer[1] = Buffer[k * 8 + 1];
miniBuffer[2] = Buffer[k * 8 + 2];
miniBuffer[3] = Buffer[k * 8 + 3];
miniBuffer[4] = Buffer[k * 8 + 4];
miniBuffer[5] = Buffer[k * 8 + 5];
miniBuffer[6] = Buffer[k * 8 + 6];
miniBuffer[7] = Buffer[k * 8 + 7];
if(wordsWritten < BlockHeader.BlockSize)
{
if(fail == 0)
{
//
//clean out flash banks if needed
//
sectorAddress = findSector(BlockHeader.DestAddr);
if(sectorAddress != 0xdeadbeef)
{
sectorSize = findSize(sectorAddress);
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32_t *)sectorAddress);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
oReturnCheck = Fapi_doBlankCheck((uint32_t *)sectorAddress,
sectorSize,
&oFlashStatusWord);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success || oFlashStatus != 0)
{
//
//first fail
//
if(fail == 0)
{
statusCode.status = BLANK_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
}
if(fail == 0)
{
//
//program 8 words at once, 128-bits
//
oReturnCheck = Fapi_issueProgrammingCommand((uint32_t *)BlockHeader.DestAddr,
miniBuffer,
sizeof(miniBuffer),
0,
0,
Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success || oFlashStatus != 0)
{
//
// first fail
//
if(fail == 0)
{
statusCode.status = PROGRAM_ERROR;
statusCode.address = BlockHeader.DestAddr;
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
for(j = 0; j < 8; j += 2)
{
if(fail == 0)
{
uint32_t toVerify = miniBuffer[j+1];
toVerify = toVerify << 16;
toVerify |= miniBuffer[j];
oReturnCheck = Fapi_doVerify((uint32_t *)(BlockHeader.DestAddr+j),
1,
(uint32_t *)(&toVerify),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
//
// first fail
//
if(fail == 0)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
//
//FMSTAT not checked for Verify
//
statusCode.flashAPIFsmStatus = 0;
}
fail++;
}
}
} //for j; for Fapi_doVerify
}
BlockHeader.DestAddr += 0x8;
wordsWritten += 0x8;
} //for(int k); loads miniBuffer with Buffer elements
#if checksum_enable
sciSendChecksum();
#endif
}
//
//get the size of the next block
//
BlockHeader.BlockSize = (*getWordData)();
wordsWritten = 0;
}
EDIS;
return;
}
//
// uint32_t findSector(uint32_t address) - This routine finds what sector the mentioned address
// is a part of.
//
uint32_t findSector(uint32_t address)
{
if((address >= Bzero_Sector0_start) && (address < Bzero_Sector1_start) &&
(erasedAlready[0] == 0))
{
erasedAlready[0] = 1;
return (uint32_t)Bzero_Sector0_start;
}
else if((address >= Bzero_Sector1_start) &&
(address < Bzero_Sector2_start) && (erasedAlready[1] == 0))
{
erasedAlready[1] = 1;
return (uint32_t)Bzero_Sector1_start;
}
else if((address >= Bzero_Sector2_start) &&
(address < Bzero_Sector3_start) && (erasedAlready[2] == 0))
{
erasedAlready[2] = 1;
return (uint32_t)Bzero_Sector2_start;
}
else if((address >= Bzero_Sector3_start) &&
(address < Bzero_Sector4_start) && (erasedAlready[3] == 0))
{
erasedAlready[3] = 1;
return (uint32_t)Bzero_Sector3_start;
}
else if((address >= Bzero_Sector4_start) &&
(address < Bzero_Sector5_start) && (erasedAlready[4] == 0))
{
erasedAlready[4] = 1;
return (uint32_t)Bzero_Sector4_start;
}
else if((address >= Bzero_Sector5_start) &&
(address < Bzero_Sector6_start) && (erasedAlready[5] == 0))
{
erasedAlready[5] = 1;
return (uint32_t)Bzero_Sector5_start;
}
else if((address >= Bzero_Sector6_start) &&
(address < Bzero_Sector7_start) && (erasedAlready[6] == 0))
{
erasedAlready[6] = 1;
return (uint32_t)Bzero_Sector6_start;
}
else if((address >= Bzero_Sector7_start) &&
(address < Bzero_Sector8_start) && (erasedAlready[7] == 0))
{
erasedAlready[7] = 1;
return (uint32_t)Bzero_Sector7_start;
}
else if((address >= Bzero_Sector8_start) &&
(address < Bzero_Sector9_start) && (erasedAlready[8] == 0))
{
erasedAlready[8] = 1;
return (uint32_t)Bzero_Sector8_start;
}
else if((address >= Bzero_Sector9_start) &&
(address < Bzero_Sector10_start) && (erasedAlready[9] == 0))
{
erasedAlready[9] = 1;
return (uint32_t)Bzero_Sector9_start;
}
else if((address >= Bzero_Sector10_start) &&
(address < Bzero_Sector11_start) && (erasedAlready[10] == 0))
{
erasedAlready[10] = 1;
return (uint32_t)Bzero_Sector10_start;
}
else if((address >= Bzero_Sector11_start) &&
(address < Bzero_Sector12_start) && (erasedAlready[11] == 0))
{
erasedAlready[11] = 1;
return (uint32_t)Bzero_Sector11_start;
}
else if((address >= Bzero_Sector12_start) &&
(address < Bzero_Sector13_start) && (erasedAlready[12] == 0))
{
erasedAlready[12] = 1;
return (uint32_t)Bzero_Sector12_start;
}
else if((address >= Bzero_Sector13_start) &&
(address <= FlashEndAddress) && (erasedAlready[13] == 0))
{
erasedAlready[13] = 1;
return (uint32_t)Bzero_Sector13_start;
}
else
{
return 0xdeadbeef; // a proxy address to signify that it is not
// a flash sector.
}
}
//
// uint32_t findSize(uint32_t address) - This routine finds the size of the sector under use.
//
uint16_t findSize(uint32_t address)
{
if(address == Bzero_Sector0_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector1_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector2_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector3_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector4_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector5_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector6_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector7_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector8_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector9_start)
{
return Sector64KB_u32length;
}
else if(address == Bzero_Sector10_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector11_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector12_start)
{
return Sector16KB_u32length;
}
else if(address == Bzero_Sector13_start)
{
return Sector16KB_u32length;
}
//
// no other possible case
//
return 0xbeef;
}
//
// uint32_t getLongData(void) - This routine fetches a 32-bit value from the peripheral
// input stream.
//
uint32_t getLongData()
{
uint32_t longData;
//
// Fetch the upper 1/2 of the 32-bit value
//
longData = ( (uint32_t)(*getWordData)() << 16);
//
// Fetch the lower 1/2 of the 32-bit value
//
longData |= (uint32_t)(*getWordData)();
return longData;
}
//
//
// void readReservedFn(void) - This function reads 8 reserved words in the header.
// None of these reserved words are used by the
// this boot loader at this time, they may be used in
// future devices for enhancements. Loaders that use
// these words use their own read function.
//
void readReservedFn()
{
uint16_t i;
//
// Read and discard the 8 reserved words.
//
for(i = 1; i <= 8; i++)
{
getWordData();
}
return;
}
void setFlashAPIError(Fapi_StatusType status)
{
if(status == Fapi_Error_AsyncIncorrectDataBufferLength)
{
statusCode.flashAPIError = INCORRECT_DATA_BUFFER_LENGTH;
}
else if(status == Fapi_Error_AsyncIncorrectEccBufferLength)
{
statusCode.flashAPIError = INCORRECT_ECC_BUFFER_LENGTH;
}
else if(status == Fapi_Error_AsyncDataEccBufferLengthMismatch)
{
statusCode.flashAPIError = DATA_ECC_BUFFER_LENGTH_MISMATCH;
}
else if(status == Fapi_Error_FlashRegsNotWritable)
{
statusCode.flashAPIError = FLASH_REGS_NOT_WRITABLE;
}
else if(status == Fapi_Error_FeatureNotAvailable)
{
statusCode.flashAPIError = FEATURE_NOT_AVAILABLE;
}
else if(status == Fapi_Error_InvalidAddress)
{
statusCode.flashAPIError = INVALID_ADDRESS;
}
else if(status == Fapi_Error_InvalidCPUID)
{
statusCode.flashAPIError = INVALID_CPUID;
}
else if(status == Fapi_Error_Fail)
{
statusCode.flashAPIError = FAILURE;
}
else
{
statusCode.status = NOT_RECOGNIZED;
}
}
//
// End of file
//
@@ -0,0 +1,152 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_erase_cpu1.c
//
// TITLE: Erase functions
//! <h1> Erase functions</h1>
//
//###########################################################################
//
// 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 <flash_kernel_c28x_dual_ex1_erase_cpu1.h>
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "Types.h"
#include "f2838x_kernel_commands_cpu1.h"
//
// Globals
//
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
const uint32_t sectAddress[14] = { Bzero_Sector0_start,
Bzero_Sector1_start,
Bzero_Sector2_start,
Bzero_Sector3_start,
Bzero_Sector4_start,
Bzero_Sector5_start,
Bzero_Sector6_start, //FLASH_SIZE 0x6
Bzero_Sector7_start,
Bzero_Sector8_start,
Bzero_Sector9_start,
Bzero_Sector10_start,
Bzero_Sector11_start,
Bzero_Sector12_start,
Bzero_Sector13_start }; //FLASH_SIZE 0x7
const uint16_t sectSize[14] = { Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length, //FLASH_SIZE 0x6
Sector64KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length }; //FLASH_SIZE 0x7
extern void setFlashAPIError(Fapi_StatusType status);
//
// sharedErase - This routine takes the 32-bit sectors variable as
// a parameter. Each bit corresponds to a sector,
// starting with bit 0 and sector A. This routine
// attempts to erase the sectors specified.
//
void sharedErase(uint32_t sectors)
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12345678;
int i = 0;
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
int fail = 0;
EALLOW;
for(i = 0; i < 14; i++)
{
if((sectors & 0x00000001) == 0x00000001 && fail == 0)
{
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32_t *)(sectAddress[i]));
//
// wait until AsyncCommand is done.
//
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady)
{
}
oReturnCheck = Fapi_doBlankCheck((uint32_t *)(sectAddress[i]),
sectSize[i],
&oFlashStatusWord);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success)
{
if(fail == 0) //first fail
{
statusCode.status = BLANK_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
sectors = sectors >> 1;
}
EDIS;
return;
}
//
// End of file
//
@@ -0,0 +1,62 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_erase_cpu1.h
//
// TITLE: Erase functions
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef __FLASH_KERNEL_C28X_DUAL_EX1_ERASE_CPU1_H__
#define __FLASH_KERNEL_C28X_DUAL_EX1_ERASE_CPU1_H__
//
// Included Files
//
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "cpu1bootrom.h"
//
// Function Prototypes
//
void sharedErase(uint32_t sectors);
#endif
//
// End of file
//
@@ -0,0 +1,145 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_erase_cpu2.c
//
// TITLE: Erase functions
//! <h1> Erase functions</h1>
//
//###########################################################################
//
// 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 <flash_kernel_c28x_dual_ex1_erase_cpu2.h>
//
// Globals
//
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
const uint32_t sectAddress[14] = { Bzero_Sector0_start,
Bzero_Sector1_start,
Bzero_Sector2_start,
Bzero_Sector3_start,
Bzero_Sector4_start,
Bzero_Sector5_start,
Bzero_Sector6_start, //FLASH_SIZE 0x6
Bzero_Sector7_start,
Bzero_Sector8_start,
Bzero_Sector9_start,
Bzero_Sector10_start,
Bzero_Sector11_start,
Bzero_Sector12_start,
Bzero_Sector13_start }; //FLASH_SIZE 0x7
const uint16_t sectSize[14] = { Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length, //FLASH_SIZE 0x6
Sector64KB_u32length,
Sector64KB_u32length,
Sector64KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length,
Sector16KB_u32length }; //FLASH_SIZE 0x7
//
// sciErase - This routine takes the 32-bit sectors variable as
// a parameter. Each bit corresponds to a sector,
// starting with bit 0 and sector A. This routine
// attempts to erase the sectors specified.
//
void sciErase(uint32_t sectors)
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12345678;
int i = 0;
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusWordType oFlashStatusWord;
Fapi_FlashStatusType oFlashStatus;
int fail = 0;
EALLOW;
for(i = 0; i < 14; i++)
{
if((sectors & 0x00000001) == 0x00000001 && fail == 0)
{
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32_t *)(sectAddress[i]));
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy)
{
}
oReturnCheck = Fapi_doBlankCheck((uint32_t *)(sectAddress[i]),
sectSize[i],
&oFlashStatusWord);
oFlashStatus = Fapi_getFsmStatus();
if(oReturnCheck != Fapi_Status_Success || oFlashStatus != 0)
{
if(fail == 0) //first fail
{
statusCode.status = BLANK_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
statusCode.flashAPIFsmStatus = (uint32_t)oFlashStatus;
}
fail++;
}
}
sectors = sectors >> 1;
}
EDIS;
return;
}
//
// End of file
//
@@ -0,0 +1,65 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_erase_cpu2.h
//
// TITLE: Erase functions
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef __FLASH_KERNEL_C28X_DUAL_EX1_ERASE_CPU2_H__
#define __FLASH_KERNEL_C28X_DUAL_EX1_ERASE_CPU2_H__
//
// Included Files
//
#include "cpu2bootrom.h"
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "Types.h"
#include "f2838x_kernel_commands_cpu2.h"
//
// Function Prototypes
//
void sciErase(uint32_t sectors);
extern void setFlashAPIError(Fapi_StatusType status);
#endif
//
// End of file
//
@@ -0,0 +1,208 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_sci_boot_cpu1.c
//
// TITLE: SCI Boot mode functions
//! <h1> SCI Boot mode functions </h1>
//
//###########################################################################
//
// 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 "Types.h"
#include "driverlib.h"
#include "cpu1bootrom.h"
#include "f2838x_kernel_commands_cpu1.h"
//
// Globals
//
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
//
// getWordData is a pointer to the function that interfaces to the peripheral.
// Each loader assigns this pointer to it's particular getWordData function.
//
uint16fptr getWordData;
//
// Function Prototypes
//
extern uint16_t sciaGetWordData(void);
extern uint16_t sciaGetWordDataCPU2(void);
extern void copyData(void);
uint32_t getLongData(void);
extern void readReservedFn(void);
extern void exampleError(Fapi_StatusType status);
uint32_t sciLoadApplication(uint32_t BootMode);
void sciLoadCPU2Kernel(void);
void copyDataRAM(void);
//
// sciLoadApplication - This module is the main SCI boot routine.
// It will load code via the SCI-A port.
//
// It will return a entry point address back
// to the InitBoot routine which in turn calls
// the ExitBoot routine.
//
uint32_t sciLoadApplication(uint32_t BootMode)
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12346578;
statusCode.flashAPIError = NO_ERROR;
statusCode.flashAPIFsmStatus = 0;
uint32_t EntryAddr;
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordData;
//
// If the KeyValue was invalid, abort the load
// and return the flash entry point.
//
if (sciaGetWordData() != 0x08AA)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = FLASH_ENTRY_POINT;
}
readReservedFn(); //reads and discards 8 reserved words
EntryAddr = getLongData();
copyData();
uint16_t x = 0;
for(x = 0; x < 32676; x++){}
for(x = 0; x < 32676; x++){}
return EntryAddr;
}
void sciLoadCPU2Kernel(void)
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12346578;
//uint32_t EntryAddr;
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordDataCPU2;
//
// If the KeyValue was invalid, abort the load
// and return the flash entry point.
//
if (sciaGetWordDataCPU2() != 0x08AA)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = FLASH_ENTRY_POINT;
}
readReservedFn(); //reads and discards 8 reserved words
getLongData();
copyDataRAM();
uint16_t x = 0;
for(x = 0; x < 32676; x++){}
for(x = 0; x < 32676; x++){}
}
void copyDataRAM(void)
{
struct HEADER {
uint32_t DestAddr;
uint16_t BlockSize;
} BlockHeader;
uint16_t wordData;
uint16_t i;
//
// Get the size in words of the first block
//
BlockHeader.BlockSize = (*getWordData)();
//
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
//
while(BlockHeader.BlockSize != (uint16_t)0x0000U)
{
BlockHeader.DestAddr = getLongData();
for(i = 1; i <= BlockHeader.BlockSize; i++)
{
wordData = (*getWordData)();
*(uint16_t *)BlockHeader.DestAddr = wordData;
BlockHeader.DestAddr+=1U;
}
//
// Get the size of the next block
//
BlockHeader.BlockSize = (*getWordData)();
}
return;
}
//
// End of file
//
@@ -0,0 +1,108 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_sci_boot_cpu2.c
//
// TITLE: SCI Boot mode functions
//! <h1> SCI Boot mode functions </h1>
//
//###########################################################################
//
// 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 "cpu2bootrom.h"
#include "Types.h"
//
// getWordData is a pointer to the function that interfaces to the peripheral.
// Each loader assigns this pointer to it's particular getWordData function.
//
extern uint16fptr getWordData;
//
// Function Prototypes
//
uint32_t sciLoadApplication(void);
uint16_t sciaGetWordData(void);
uint16_t sciaGetOnlyWordData(void);
extern uint32_t copyData(void);
uint32_t getLongData(void);
extern void readReservedFn(void);
//
// SCI_Boot - This module is the main SCI boot routine.
// It will load code via the SCI-A port.
//
// It will return a entry point address back
// to the InitBoot routine which in turn calls
// the ExitBoot routine.
//
uint32_t sciLoadApplication(void)
{
uint32_t EntryAddr;
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordData;
//
// If the KeyValue was invalid, abort the load
// and return the flash entry point.
//
if (sciaGetWordData() != 0x08AA)
{
return FLASH_ENTRY_POINT;
}
readReservedFn(); //reads and discards 8 reserved words
EntryAddr = getLongData();
copyData();
uint16_t x = 0;
for(x = 0; x < 32676; x++){}
return(EntryAddr);
}
//
// End of file
//
@@ -0,0 +1,159 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu1.c
//
// TITLE: CM kernel main function
// <h1> CM kernel main function </h1>
//
//###########################################################################
//
// 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 <flash_kernel_c28x_dual_ex1_erase_cpu1.h>
#include <string.h>
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "F021_F2838x_C28x.h"
#include "cpu1bootrom.h"
#include "device.h"
//
// Function Prototypes
//
void exampleError(Fapi_StatusType status);
void initFlashSectors(void);
void SeizeFlashPump_kernels(void);
extern uint32_t sciGetFunction(uint32_t BootMode);
extern void sciaFlush(void);
//
// Main
//
uint32_t main(void)
{
//
// flush SCIA TX port by waiting while it is busy, driverlib.
//
sciaFlush();
//
// initialize device and GPIO, driverlib.
//
Device_init();
Device_initGPIO();
//
// init interrupt and vectorTable, drivelib.
//
Interrupt_initModule();
Interrupt_initVectorTable();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// At 200MHz, execution wait-states for external oscillator is 3. Modify the
// wait-states when the system clock frequency is changed.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 3);
Flash_claimPumpSemaphore(FLASH_CPU1_WRAPPER);
//
// initialize flash_sectors, fapi + driverlib
//
initFlashSectors();
uint32_t EntryAddr;
//
// parameter SCI_BOOT for GPIO28 (RX),29 (TX) is default.
//
EntryAddr = sciGetFunction(SCI_BOOT);
return(EntryAddr);
}
//
// Init_Flash_Sectors - Initialize flash API and active flash bank sectors
//
void initFlashSectors(void)
{
EALLOW;
Fapi_StatusType oReturnCheck;
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
if(oReturnCheck != Fapi_Status_Success)
{
exampleError(oReturnCheck);
}
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if(oReturnCheck != Fapi_Status_Success)
{
exampleError(oReturnCheck);
}
EDIS;
}
//
// exampleError - For this example, if an error is found just stop here
//
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#pragma CODE_SECTION(exampleError,".TI.ramfunc");
#else
#pragma CODE_SECTION(exampleError,"ramfuncs");
#endif
#endif
void exampleError(Fapi_StatusType status)
{
//
// Error code will be in the status parameter
//
__asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,168 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu2.c
//
// TITLE: CM kernel main function
// <h1> CM kernel main function </h1>
//
//###########################################################################
//
// 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 <flash_kernel_c28x_dual_ex1_erase_cpu2.h>
#include "ipc.h"
#include "sci.h"
#include "device.h"
#include <string.h>
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "F021_F2838x_C28x.h"
#include "cpu2bootrom.h"
//
// Function Prototypes
//
void exampleError(Fapi_StatusType status);
extern uint32_t sciGetFunction(void);
extern signalCPU1(void);
void initFlashSectors(void);
extern void sciaFlush();
//
// Main
//
uint32_t main(void)
{
//
//SCIA Flush
//
sciaFlush();
EALLOW;
SysCtl_setSemOwner(SYSCTL_CPUSEL_CPU2); //Allows CPU2 to take control
//of clock configuration registers
EDIS;
Device_init();
//
// Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// At 200MHz, execution wait-states for external oscillator is 3. Modify the
// wait-states when the system clock frequency is changed.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 3);
uint16_t x = 0;
for(x = 0; x < 32676; x++){}
for(x = 0; x < 32676; x++){}
EINT; //enable global interrupt INTM
ERTM; //enable global realtime interrupt
//
// Gain pump semaphore
//
Flash_claimPumpSemaphore(FLASH_CPU2_WRAPPER);
initFlashSectors();
uint32_t EntryAddr = sciGetFunction();
//
// Leave control over flash pump
//
signalCPU1();
return(EntryAddr); //load entry address of application into
//RPC: return program counter
}
//
// initFlashSectors - Initialize Flash Sectors
//
void initFlashSectors(void)
{
EALLOW;
Fapi_StatusType oReturnCheck;
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
if(oReturnCheck != Fapi_Status_Success)
{
exampleError(oReturnCheck);
}
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if(oReturnCheck != Fapi_Status_Success)
{
exampleError(oReturnCheck);
}
EDIS;
}
//
// exampleError - For this example, if an error is found just stop here
//
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#pragma CODE_SECTION(exampleError,".TI.ramfunc");
#else
#pragma CODE_SECTION(exampleError,"ramfuncs");
#endif
#endif
void exampleError(Fapi_StatusType status)
{
//
// Error code will be in the status parameter
//
__asm(" ESTOP0");
}
//
// End of file
//
@@ -0,0 +1,651 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_sci_get_function_cpu2.c
//
// TITLE: Kernel commands and corresponding function calls
//! <h1> Kernel commands and corresponding function calls </h1>
//
//###########################################################################
//
// 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 <flash_kernel_c28x_dual_ex1_erase_cpu2.h>
#include <flash_kernel_c28x_dual_ex1_verify_cpu2.h>
#include "cpu2bootrom.h"
#include "device.h"
#include "stdint.h"
#include "sysctl.h"
#include "f2838x_kernel_commands_cpu2.h"
//
// Globals
//
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
StatusCode statusCode;
uint16_t checksum;
//
// Function Prototypes
//
uint16_t sciaGetWordData(void);
uint16_t sciaGetOnlyWordData(void);
void sendACK(void);
void sendNAK(void);
inline uint16_t sciaGetACK(void);
inline void sciaFlush(void);
void sciaInit();
void sciaAutobaudLock(void);
uint32_t sciGetFunction(void);
uint16_t sciGetPacket(uint16_t* length, uint16_t* data);
uint16_t sciSendPacket(uint16_t command, uint16_t status, uint16_t length,
uint16_t* data1, uint16_t flashAPIerror, uint16_t* data2);
void sciSendWord(uint16_t word);
void sciSendChecksum(void);
void signalCPU1(void);
extern uint32_t sciLoadApplication(void);
extern void sciErase(uint32_t sectors);
extern void copyData(void);
extern void verifyData(void);
extern uint32_t getLongData(void);
extern void readReservedFn(void);
//
// getWordData is a pointer to the function that interfaces to the peripheral.
// Each loader assigns this pointer to it's particular getWordData function.
//
extern uint16fptr getWordData;
//
// sciGetFunction - This function first initializes SCIA and performs
// an autobaud lock. It contains a while loop waiting on
// commands from the host. It processes each
// command and sends a response except for Run and
// Reset commands. On Run the kernel exits and branches
// to the Entry Point. On Reset, the kernel exits the
// while loop and does a WatchDog Time-out.
//
uint32_t sciGetFunction(void)
{
uint32_t EntryAddr;
uint16_t command;
uint16_t data[10];
uint16_t length;
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordData;
//
// Initialize the SCI-A port for communications
// with the host.
//
//parameter SCI_BOOT for GPIO84,85; parameter SCI_BOOT_ALTERNATE for
//GPIO28,29
//
sciaInit();
//
// driverlib autobaud lock:
//
SCI_lockAutobaud(SCIA_BASE);
//
// echo back the autoBaud success, driverlib.
//
uint16_t byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
SCI_writeCharBlockingNonFIFO(SCIA_BASE, byteData);
command = sciGetPacket(&length, data);
while(command != RESET_CPU2)
{
//
//Reset the statusCode.
//
statusCode.status = NO_ERROR;
statusCode.address = 0x12345678;
statusCode.flashAPIError = NO_ERROR;
statusCode.flashAPIFsmStatus = 0;
checksum = 0;
if(command == CPU2_UNLOCK_Z1)
{
//
// driverlib struct for csmKey.
//
DCSM_CSMPasswordKey psCMDKey;
psCMDKey.csmKey0 = (uint32_t)data[0] | ((uint32_t)data[1] << 16);
psCMDKey.csmKey1 = (uint32_t)data[2] | ((uint32_t)data[3] << 16);
psCMDKey.csmKey2 = (uint32_t)data[4] | ((uint32_t)data[5] << 16);
psCMDKey.csmKey3 = (uint32_t)data[6] | ((uint32_t)data[7] << 16);
//
// Unlock the zone 1, driverlib.
//
DCSM_unlockZone1CSM(&psCMDKey);
//
// check if it is unlocked.
//
if(DCSM_getZone1CSMSecurityStatus() == DCSM_STATUS_LOCKED)
{
statusCode.status = UNLOCK_ERROR;
}
}
else if(command == CPU2_UNLOCK_Z2)
{
//
// driver lib implementation of csmKeys
//
DCSM_CSMPasswordKey psCMDKey;
psCMDKey.csmKey0 = (uint32_t) data[0] | ((uint32_t) data[1] << 16);
psCMDKey.csmKey1 = (uint32_t) data[2] | ((uint32_t) data[3] << 16);
psCMDKey.csmKey2 = (uint32_t) data[4] | ((uint32_t) data[5] << 16);
psCMDKey.csmKey3 = (uint32_t) data[6] | ((uint32_t) data[7] << 16);
//
// Unlock the zone 2, driverlib.
//
DCSM_unlockZone2CSM(&psCMDKey);
//
// check if zone 2 is unlocked.
//
if (DCSM_getZone2CSMSecurityStatus() == DCSM_STATUS_LOCKED)
{
statusCode.status = UNLOCK_ERROR;
}
}
else if(command == DFU_CPU2)
{
//
// loads application into CPU2 FLASH
//
EntryAddr = sciLoadApplication();
if(statusCode.status == NO_ERROR)
{
statusCode.address = EntryAddr;
}
}
else if(command == ERASE_CPU2)
{
uint32_t sectors = (uint32_t)(((uint32_t)data[1] << 16) |
(uint32_t)data[0]);
sciErase(sectors);
}
else if(command == VERIFY_CPU2)
{
verifyData();
}
else if(command == RUN_CPU2)
{
EntryAddr = (uint32_t)( ((uint32_t)data[1] << 16) | (uint32_t)data[0]);
return(EntryAddr);
}
else
{
statusCode.status = COMMAND_ERROR;
}
//
//send the packet and if NAK send again.
//
while(sciSendPacket(command, statusCode.status, 12,
(uint16_t*)&statusCode.address, statusCode.flashAPIError,
(uint16_t*)&statusCode.flashAPIFsmStatus)){}
//
//get next Packet
//
command = sciGetPacket(&length, data);
}
//
// Leave control over flash pump
//
signalCPU1();
//
// Reset with WatchDog Timeout
//
EALLOW;
//
// driverlib, Watchdog reset enable = WDENINT->0 and WDOVERRIDE->0
//
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
//
// enable the Watchdog, driverlib;
// same as HWREGH(WD_BASE + SYSCTL_O_WDCR) = SYSCTL_WD_CHKBITS;
//
SysCtl_enableWatchdog();
EDIS;
while(1){}
}
//
// sciSendPacket - Sends a Packet to the host which contains
// status in the data and address. It sends the
// statusCode global variable contents. It then waits
// for an ACK or NAK from the host.
//
uint16_t sciSendPacket(uint16_t command, uint16_t status, uint16_t length,
uint16_t* data1, uint16_t flashAPIError, uint16_t* data2)
{
int i;
sciaFlush();
DEVICE_DELAY_US(100000);
sciSendWord(0x1BE4);
sciSendWord(length);
checksum = 0;
sciSendWord(command);
sciSendWord(status);
for(i = 0; i < 2; i++)
{
sciSendWord(*(data1 + i));
}
sciSendWord(flashAPIError);
for(i = 0; i < 2; i++){
sciSendWord(*(data2 + i));
}
sciSendChecksum();
sciSendWord(0xE41B);
//
// Receive an ACK or NAK
//
return sciaGetACK();
}
//
// sciaGetACK - Gets 1-byte ACK from the host.
//
inline uint16_t sciaGetACK()
{
uint16_t wordData;
//
// wait for and read a char blocking nonFIFO, driverlib.
//
wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
if(wordData != ACK)
{
return(1);
}
return(0);
}
//
// sciSendChecksum - Sends the Global checksum value
//
void sciSendChecksum()
{
//
// wait for SCIA_TX to be free and write LSB of checksum to it.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, (checksum & 0xFF));
sciaFlush();
sciaGetACK();
//
// wait for SCIA_TX to be free and write MSB of checksum to it.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, ((checksum >> 8) & 0xFF));
sciaFlush();
sciaGetACK();
}
//
// sciSendWord - Sends a uint16_t word.
//
void sciSendWord(uint16_t word)
{
//
// send LSB of word, driverlib.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, (word & 0xFF));
checksum += word & 0xFF;
sciaFlush();
sciaGetACK();
//
// send MSB of word, driverlib.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, ((word>>8) & 0xFF));
checksum += word>>8 & 0xFF;
sciaFlush();
sciaGetACK();
}
//
// sciaInit - Initialize the SCI-A port for communications with the host.
//
void sciaInit(uint32_t BootMode)
{
//
// Enable the SCI-A clocks
//
EALLOW;
//
// Device_enableAllPeripherals enabled PCLKCR7.SCI_A already.
//
//
// TRM, 0x0007 -> scaler of 14. OSCLOK low speed scaling for SCI.
//
SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_14);
// reset SCI channels.
SCI_resetChannels(SCIA_BASE);
//
// 1 stop bit, No parity, 8-bit character
// No loopback
//
// CLK speed and Baud rate get overwritten in autobaud_lock function later.
//
SCI_setConfig(
SCIA_BASE, DEVICE_LSPCLK_FREQ, DEFAULT_BAUD,
SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE);
//
// Enable TX, RX, Use internal SCICLK
//
SCI_enableModule(SCIA_BASE);
//
// Disable RxErr, Sleep, TX Wake,
// Disable Rx Interrupt, Tx Interrupt
//
SCI_disableInterrupt(
SCIA_BASE,
SCI_INT_RXRDY_BRKDT | SCI_INT_TXRDY | SCI_INT_RXERR | SCI_INT_TXRDY);
//
// Relinquish SCI-A from reset
//
SCI_performSoftwareReset(SCIA_BASE);
EDIS;
return;
}
//
// sciaGetWordData - This routine fetches two bytes from the SCI-A
// port and puts them together to form a single
// 16-bit value. It is assumed that the host is
// sending the data in the order LSB followed by MSB.
//
uint16_t sciaGetWordData(void)
{
uint16_t wordData;
uint16_t byteData;
wordData = 0x0000;
byteData = 0x0000;
//
// Fetch the LSB and verify back to the host
//
wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE); // wait until RX is rdy then read.
#if !checksum_enable
//
// wait until TX is rdy then write.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, wordData);
#endif
//
// Fetch the MSB and verify back to the host
//
byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE); // read
#if !checksum_enable
//
// write
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, wordData);
#endif
//
// form checksum.
//
#if checksum_enable
checksum += wordData + byteData;
#endif
//
// form the wordData from the MSB:LSB
//
wordData |= (byteData << 8);
return wordData;
}
//
// sciaGetOnlyWordData - This routine fetches two bytes from the SCI-A
// port and puts them together to form a single
// 16-bit value. It is assumed that the host is
// sending the data in the order LSB followed by MSB.
//
uint16_t sciaGetOnlyWordData(void)
{
uint16_t wordData;
uint16_t byteData;
wordData = 0x0000;
byteData = 0x0000;
//
// Fetch the LSB and verify back to the host
//
wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
//
// Fetch the MSB and verify back to the host
//
byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
// compute checksum.
checksum += wordData + byteData;
//
// form the wordData from the MSB:LSB
//
wordData |= (byteData << 8);
return wordData;
}
//
// sciGetPacket - This routine receives the packet, returns the
// command and puts the data length in Uin16* length
// and data in uint16_t* data
//
uint16_t sciGetPacket(uint16_t* length, uint16_t* data)
{
if(sciaGetOnlyWordData() != 0x1BE4)
{
sendNAK();
//
// start packet error
//
return(100);
}
*length = sciaGetOnlyWordData();
//
// checksum of command and data
//
checksum = 0;
uint16_t command = sciaGetOnlyWordData();
int i = 0;
for(i = 0; i < (*length)/2; i++)
{
*(data+i) = sciaGetOnlyWordData();
}
uint16_t dataChecksum = checksum;
if(dataChecksum != sciaGetOnlyWordData())
{
sendNAK();
//
// checksum error
//
return(101);
}
if(sciaGetOnlyWordData() != 0xE41B)
{
sendNAK();
//
// end packet error
//
return(102);
}
sendACK();
return(command);
}
//
// sendACK - This routine transmits ACK.
//
void sendACK(void)
{
//
// write ACKowledged.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, ACK);
sciaFlush();
}
//
// sendNAK - This routine transmits NAK.
//
void sendNAK(void)
{
//
// write NotAcKowledged.
//
SCI_writeCharBlockingNonFIFO(SCIA_BASE, NAK);
sciaFlush();
}
//
// sciaFlush - This routine flushes SCIA.
//
void sciaFlush(void)
{
//
// wait while TX is busy.
//
while(SCI_isTransmitterBusy(SCIA_BASE))
{
}
}
//
// signalCPU1 - This routine transmits NAK.
//
void signalCPU1(void)
{
//
// Leave control over flash pump
//
Flash_releasePumpSemaphore();
EALLOW;
//
// Free the semaphore
//
HWREG(CLKCFG_BASE + SYSCTL_O_CLKSEM) = SYSCTL_REG_KEY;
EDIS;
IPC_setFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG5); //signal finished
IPC_waitForAck(IPC_CPU2_L_CPU1_R, IPC_FLAG5); //waitForFlag
asm(" NOP");
asm(" NOP");
}
//
// End of file
//
@@ -0,0 +1,270 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_verify_cpu1.c
//
// TITLE: Verify functions
//! <h1> Verify functions </h1>
//
//###########################################################################
//
// 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 "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "cpu1bootrom.h"
#include "f2838x_kernel_commands_cpu1.h"
#include <assert.h>
#include <flash_kernel_c28x_dual_ex1_verify_cpu1.h>
//
// Defines
//
#define BUFFER_SIZE 0x80 //because of ECC, must be multiple of
//64 bits, or 4 words, BUFFER_SIZE %
//4 == 0
//
// Globals
//
extern uint16fptr getWordData; // getWordData is a pointer to the function
// that interfaces to the peripheral.
// Each loader assigns this pointer to it's
// particular GetWordData function.
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
//
// Function Prototypes
//
extern void sciSendChecksum(void);
extern uint32_t getLongData(void);
extern void readReservedFn(void);
extern uint16_t sciaGetWordData(void);
extern void setFlashAPIError(Fapi_StatusType status);
//
// VerifyData - This routine copies multiple blocks of data from the host
// and verifies that data with the flash in the device.
// An error is returned if the flash is not verified.
//
// Multiple blocks of data are copied until a block
// size of 00 00 is encountered.
//
void verifyData()
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12346578;
statusCode.flashAPIError = NO_ERROR;
statusCode.flashAPIFsmStatus = 0;
struct HEADER {
uint16_t BlockSize;
uint32_t DestAddr;
} BlockHeader;
uint16_t wordData;
uint16_t i,j,k;
uint16_t Buffer[BUFFER_SIZE];
uint16_t miniBuffer[4];
int fail = 0;
uint16_t wordsVerified = 0;
assert(BUFFER_SIZE % 4 == 0);
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordData;
//
// If the KeyValue was invalid, abort the load
// and return the flash entry point.
//
if(sciaGetWordData() != 0x08AA)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = FLASH_ENTRY_POINT;
}
readReservedFn(); //reads and discards 8 reserved words
getLongData();
//
// Send checksum to satisfy before we begin
//
#ifdef checksum_enable
sciSendChecksum();
#endif
//
// Get the size in words of the first block
//
BlockHeader.BlockSize = (*getWordData)();
//
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
//
EALLOW;
while(BlockHeader.BlockSize != (uint16_t)0x0000)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusWordType oFlashStatusWord;
BlockHeader.DestAddr = getLongData();
for(i = 0; i < BlockHeader.BlockSize; i += 0)
{
if(BlockHeader.BlockSize < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
else //BlockHeader.BlockSize >= BUFFER_SIZE
{
if((BlockHeader.BlockSize - i) < BUFFER_SIZE) //less than one
//BUFFER_SIZE left
{
//
// fill Buffer with rest of data
//
for(j = 0; j < BlockHeader.BlockSize - i; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
}
i += j; //increment i outside here so it doesn't
//affect loop above
for(; j < BUFFER_SIZE; j++)//fill the rest with 0xFFFF
{
Buffer[j] = 0xFFFF;
}
}
else
{
//
// fill up like normal, up to BUFFER_SIZE
//
for(j = 0; j < BUFFER_SIZE; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
}
}
for(k = 0; k < (BUFFER_SIZE / 4); k++)
{
miniBuffer[0] = Buffer[k * 4 + 0];
miniBuffer[1] = Buffer[k * 4 + 1];
miniBuffer[2] = Buffer[k * 4 + 2];
miniBuffer[3] = Buffer[k * 4 + 3];
if(wordsVerified < BlockHeader.BlockSize)
{
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
for(j = 0; j < 4; j += 2)
{
if(fail == 0)
{
uint32_t toVerify = miniBuffer[j+1];
toVerify = toVerify << 16;
toVerify |= miniBuffer[j];
oReturnCheck = Fapi_doVerify((uint32_t *)(BlockHeader.DestAddr+j),
1,
(uint32_t *)(&toVerify),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
if(fail == 0) //first fail
{
statusCode.status = VERIFY_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
//
// FMSTAT not checked for Verify
//
statusCode.flashAPIFsmStatus = 0;
}
fail++;
}
}
} //for j; for Fapi_doVerify
}
BlockHeader.DestAddr += 0x4;
wordsVerified += 0x4;
} //for(int k); loads miniBuffer with Buffer elements
#ifdef checksum_enable
sciSendChecksum();
#endif
}
//
//get the size of the next block
//
BlockHeader.BlockSize = (*getWordData)();
wordsVerified = 0;
}
EDIS;
return;
}
//
// End of file
//
@@ -0,0 +1,64 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_verify_cpu1.h
//
// TITLE: Verify functions
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef __FLASH_KERNEL_C28X_DUAL_EX1_VERIFY_H__
#define __FLASH_KERNEL_C28X_DUAL_EX1_VERIFY_H__
//
// Included Files
//
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "cpu1bootrom.h"
//
// Function Prototypes
//
void verifyData(void);
#endif
//
// End of file
//
@@ -0,0 +1,271 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_verify_cpu2.c
//
// TITLE: Verify functions
//! <h1> Verify functions </h1>
//
//###########################################################################
//
// 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 "cpu2bootrom.h"
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
#include "f2838x_kernel_commands_cpu2.h"
#include <assert.h>
#include <flash_kernel_c28x_dual_ex1_verify_cpu2.h>
//
// Defines
//
#define BUFFER_SIZE 0x80 // because of ECC, must be multiple
// of 64 bits, or 4 words,
// BUFFER_SIZE % 4 == 0
//
// Globals
//
//
// GetWordData is a pointer to the function that interfaces to the peripheral.
// Each loader assigns this pointer to it's particular GetWordData function.
//
extern uint16fptr getWordData; //make sure that cpu2bootrom.h has this typedef
typedef struct
{
uint16_t status;
uint32_t address;
uint16_t flashAPIError;
uint32_t flashAPIFsmStatus;
} StatusCode;
extern StatusCode statusCode;
//
// Function Prototypes
//
extern void sciSendChecksum(void);
void verifyData(void);
extern uint32_t getLongData(void);
extern void readReservedFn(void);
extern uint16_t sciaGetWordData(void);
extern void setFlashAPIError(Fapi_StatusType status);
//
// VerifyData - This routine copies multiple blocks of data from the host
// and verifies that data with the flash in the device.
// An error is returned if the flash is not verified.
//
// Multiple blocks of data are copied until a block
// size of 00 00 is encountered.
//
void verifyData()
{
statusCode.status = NO_ERROR;
statusCode.address = 0x12346578;
struct HEADER {
uint16_t BlockSize;
uint32_t DestAddr;
} BlockHeader;
uint16_t wordData;
uint16_t i,j,k;
uint16_t Buffer[BUFFER_SIZE];
uint16_t miniBuffer[4];
int fail = 0;
uint16_t wordsVerified = 0;
assert(BUFFER_SIZE % 4 == 0);
//
// Assign GetWordData to the SCI-A version of the
// function. GetWordData is a pointer to a function.
//
getWordData = sciaGetWordData;
//
// If the KeyValue was invalid, abort the load
// and return the flash entry point.
//
if(sciaGetWordData() != 0x08AA)
{
statusCode.status = VERIFY_ERROR;
statusCode.address = FLASH_ENTRY_POINT;
}
readReservedFn(); //reads and discards 8 reserved words
getLongData();
//
// Send checksum to satisfy before we begin
//
#ifdef checksum_enable
sciSendChecksum();
#endif
//
// Get the size in words of the first block
//
BlockHeader.BlockSize = (*getWordData)();
//
// While the block size is > 0 copy the data
// to the DestAddr. There is no error checking
// as it is assumed the DestAddr is a valid
// memory location
//
EALLOW;
while(BlockHeader.BlockSize != (uint16_t)0x0000)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusWordType oFlashStatusWord;
BlockHeader.DestAddr = getLongData();
for(i = 0; i < BlockHeader.BlockSize; i += 0)
{
if(BlockHeader.BlockSize < BUFFER_SIZE)
{
for(j = 0; j < BlockHeader.BlockSize; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
{
Buffer[j] = 0xFFFF;
}
}
else //BlockHeader.BlockSize >= BUFFER_SIZE
{
if((BlockHeader.BlockSize - i) < BUFFER_SIZE) //less than one
//BUFFER_SIZE left
{
//
// fill Buffer with rest of data
//
for(j = 0; j < BlockHeader.BlockSize - i; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
}
i += j; //increment i outside here so it doesn't
//affect loop above
for(; j < BUFFER_SIZE; j++)//fill the rest with 0xFFFF
{
Buffer[j] = 0xFFFF;
}
}
else
{
//
// fill up like normal, up to BUFFER_SIZE
//
for(j = 0; j < BUFFER_SIZE; j++)
{
wordData = (*getWordData)();
Buffer[j] = wordData;
i++;
}
}
}
for(k = 0; k < (BUFFER_SIZE / 4); k++)
{
miniBuffer[0] = Buffer[k * 4 + 0];
miniBuffer[1] = Buffer[k * 4 + 1];
miniBuffer[2] = Buffer[k * 4 + 2];
miniBuffer[3] = Buffer[k * 4 + 3];
if(wordsVerified < BlockHeader.BlockSize)
{
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
for(j = 0; j < 4; j += 2)
{
if(fail == 0)
{
uint32_t toVerify = miniBuffer[j+1];
toVerify = toVerify << 16;
toVerify |= miniBuffer[j];
oReturnCheck = Fapi_doVerify((uint32_t *)(BlockHeader.DestAddr+j),
1,
(uint32_t *)(&toVerify),
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
if(fail == 0) //first fail
{
statusCode.status = VERIFY_ERROR;
statusCode.address = oFlashStatusWord.au32StatusWord[0];
setFlashAPIError(oReturnCheck);
//
// FMSTAT not checked for Verify
//
statusCode.flashAPIFsmStatus = 0;
}
fail++;
}
}
} //for j; for Fapi_doVerify
}
BlockHeader.DestAddr += 0x4;
wordsVerified += 0x4;
} //for(int k); loads miniBuffer with Buffer elements
#ifdef checksum_enable
sciSendChecksum();
#endif
}
//
//get the size of the next block
//
BlockHeader.BlockSize = (*getWordData)();
wordsVerified = 0;
}
EDIS;
return;
}
//
// End of file
//
@@ -0,0 +1,63 @@
//###########################################################################
//
// FILE: flash_kernel_c28x_dual_ex1_verify.h
//
// TITLE: Verify functions
//
//###########################################################################
//
// 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.
// $
//###########################################################################
#ifndef __FLASH_KERNEL_C28X_DUAL_EX1_VERIFY_CPU2_H__
#define __FLASH_KERNEL_C28X_DUAL_EX1_VERIFY_CPU2_H__
//
// Included Files
//
#include "cpu2bootrom.h"
#include "F021_F2838x_C28x.h"
#include "flash_programming_f2838x_c28x.h" // Flash API example header file
//
// Function Prototypes
//
void verifyData(void);
#endif
//
// End of file
//
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="fsi_ex1_multiRx_tagmatch_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../fsi_ex1_multiRx_tagmatch_cpu1.c" targetDirectory="" />
</project>
<project
name="fsi_ex1_multiRx_tagmatch_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.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 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../fsi_ex1_multiRx_tagmatch_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,707 @@
//#############################################################################
//
// FILE: fsi_ex1_multiRx_tagmatch_cpu1.c
//
// TITLE: CPU controlled data frame transfers to multiple receivers with
// tag-match feature enabled in internal loopback mode.
//
//! \addtogroup driver_dual_example_list
//! <h1>FSI Multi-Rx Tag-Match</h1>
//!
//! Example sets up infinite data frame transfers where trigger happens
//! through \b CPU. Multiple receivers receive data as per the received
//! frame tag.
//!
//! This is a dual core example where FSITxA & FSIRxA instances are owned
//! by CPU1 while FSIRxB, FSIRxC & FSIRxD are owned by CPU2. Internal
//! loopback mode is enabled for FSIRxA, FSIRxB, FSIRxC & FSIRxD which
//! connects data & clock lines of these receivers to FSITxA internally.
//!
//! FSITxA infinitely sends data frames with alternating tag values.
//! Receivers are configured to receive data frame with different tag
//! values with tag-match feature enabled. Tx doesn't send next frame of data
//! until it all receivers receive the data. Synchronization among all the
//! receivers is maintained through IPC flags.
//!
//!
//! User can edit some of configuration parameters as per usecase. These are
//! as below. Default values can be referred in code where these globals
//! are defined:-
//! - \b nWords - Number of words per transfer may be from 1 -16
//! - \b nLanes - Choice to select single or double lane for frame transfers
//! - \b fsiClock - FSI Clock used for transfers
//! - \b txUserData - User data to be sent with Data frame
//! - \b txDataFrameTag - Frame tag used for Data transfers
//!
//! For any errors during transfers i.e. \b error events such as Frame Overrun,
//! Underrun, Watchdog timeout and CRC/EOF/TYPE errors, execution will stop
//! immediately and status variables can be looked into for more details.
//! Execution will also stop for any mismatch between received data and sent
//! ones and also if transfers takes unusually long time(detected through
//! software counters - txTimeOutCntr and rxTimeOutCntr)
//!
//!\b External \b Connections \n
//! For FSI internal loopback, no external connections needed
//!
//! \b Watch \b Variables \n
//! - \b dataFrameCntrA Number of Data frame transfered
//! - \b error Non zero for transmit/receive data mismatch
//!
//
//#############################################################################
//
//
//
// 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"
#define PRESCALER_VAL 2U
//
// Globals, User can modify these parameters as per usecase
//
// Number of words per transfer may be from 1 -16
uint16_t nWords = 6;
// Transfer can be happen over single or double lane
FSI_DataWidth nLanes = FSI_DATA_WIDTH_1_LANE;
// FSI Clock used for transfer
uint32_t fsiClock = 50000000;
// User data to be sent with Data frame
uint16_t txUserData = 0x47;
// Global variable to hold tag value to be sent with Data frame.
FSI_FrameTag txDataFrameTag;
// Boolean flag to enable/disable Rx Frame Watchdog
bool isRxFrameWdEnable = true;
//
// This value can be anything suitable to generate a single interrupt event,
// lower values may lead WD to trigger another event even before handler of 1st
// one is not completed
//
uint32_t rxFrameWdRefCntr = 0x1000000;
//
// Globals, these are not config parameters, user are not required to edit them
//
// Globals to capture Tx/Rx Event status.
uint16_t txEventSts = 0, rxEventSts = 0;
// Global to capture Tx buffer adress.
uint16_t *txBufAddr = 0;
// Tx Data Buffer
uint16_t txBufData[16] = {0};
#pragma DATA_SECTION(txBufData,"SHARERAMGS1");
volatile uint32_t fsiTxAInt1Received = 0,fsiTxAInt2Received = 0;
volatile uint32_t fsiRxAInt1Received = 0,fsiRxAInt2Received = 0;
// Timeout counters for Tx/Rx interrupts & ipc flag
uint32_t txTimeOutCntr = 0x100000, rxTimeOutCntr = 0x100000,
ipcFlagTimeOutCntr = 0x100000;
// data frame & error counter
uint32_t dataFrameCntrA = 0, error = 0;
uint32_t tagIndex = 0;
//
// Function Prototypes
//
void initFSI(void);
void disableAllFSIInterrupts(void);
void prepareTxBufData(void);
static inline void compare16(uint16_t val1, uint16_t val2);
void compareBufData(uint32_t base, uint16_t txBufIndex, uint16_t rxBufIndex,
uint16_t nWords);
void checkReceivedFrameTypeTag(uint32_t base, FSI_FrameType type,
FSI_FrameTag tag);
// ISRs
__interrupt void fsiTxAInt1ISR(void);
__interrupt void fsiTxAInt2ISR(void);
__interrupt void fsiRxAInt1ISR(void);
__interrupt void fsiRxAInt2ISR(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// 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();
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file. Total 4; FSITxA/RxA :: INT1/INT2
//
Interrupt_register(INT_FSITXA1, &fsiTxAInt1ISR);
Interrupt_register(INT_FSITXA2, &fsiTxAInt2ISR);
Interrupt_register(INT_FSIRXA1, &fsiRxAInt1ISR);
Interrupt_register(INT_FSIRXA2, &fsiRxAInt2ISR);
//
// Initialize basic settings for FSI.
//
initFSI();
//
// Enable FSI Tx/Rx interrupts.
//
Interrupt_enable(INT_FSITXA1);
Interrupt_enable(INT_FSITXA2);
Interrupt_enable(INT_FSIRXA1);
Interrupt_enable(INT_FSIRXA2);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM).
//
EINT;
ERTM;
//
// Configure for data transfers.
//
//
// Setting for requested nWords and nLanes with transfers
//
FSI_setTxSoftwareFrameSize(FSITXA_BASE, nWords);
FSI_setRxSoftwareFrameSize(FSIRXA_BASE, nWords);
FSI_setRxSoftwareFrameSize(FSIRXB_BASE, nWords);
FSI_setRxSoftwareFrameSize(FSIRXC_BASE, nWords);
FSI_setRxSoftwareFrameSize(FSIRXD_BASE, nWords);
FSI_setTxDataWidth(FSITXA_BASE, nLanes);
FSI_setRxDataWidth(FSIRXA_BASE, nLanes);
FSI_setRxDataWidth(FSIRXB_BASE, nLanes);
FSI_setRxDataWidth(FSIRXC_BASE, nLanes);
FSI_setRxDataWidth(FSIRXD_BASE, nLanes);
//
// Enable normal data transfer events to be sent over INT1 line for FSITxA
//
FSI_enableTxInterrupt(FSITXA_BASE, FSI_INT1, FSI_TX_EVT_FRAME_DONE);
//
// Enable normal data frame tag match events to be sent over INT1 line
// for FSIRxA, FSIRxB, FSIRxC & FSIRxD.
//
FSI_enableRxInterrupt(FSIRXA_BASE, FSI_INT1,
FSI_RX_EVT_DATA_FRAME_TAG_MATCH);
FSI_enableRxInterrupt(FSIRXB_BASE, FSI_INT1,
FSI_RX_EVT_DATA_FRAME_TAG_MATCH);
FSI_enableRxInterrupt(FSIRXC_BASE, FSI_INT1,
FSI_RX_EVT_DATA_FRAME_TAG_MATCH);
FSI_enableRxInterrupt(FSIRXD_BASE, FSI_INT1,
FSI_RX_EVT_DATA_FRAME_TAG_MATCH);
//
// Enable transmit/receive error events to be sent over INT2 line
// Overrun and Underrun conditions in Rx are not enabled as buffer pointers
// are always overwritten to first location for sending data frames.
//
FSI_enableRxInterrupt(FSIRXA_BASE, FSI_INT2, FSI_RX_EVT_CRC_ERR |
FSI_RX_EVT_EOF_ERR |
FSI_RX_EVT_TYPE_ERR |
FSI_RX_EVT_DATA_FRAME);
FSI_enableRxInterrupt(FSIRXB_BASE, FSI_INT2, FSI_RX_EVT_CRC_ERR |
FSI_RX_EVT_EOF_ERR |
FSI_RX_EVT_TYPE_ERR |
FSI_RX_EVT_DATA_FRAME);
FSI_enableRxInterrupt(FSIRXC_BASE, FSI_INT2, FSI_RX_EVT_CRC_ERR |
FSI_RX_EVT_EOF_ERR |
FSI_RX_EVT_TYPE_ERR |
FSI_RX_EVT_DATA_FRAME);
FSI_enableRxInterrupt(FSIRXD_BASE, FSI_INT2, FSI_RX_EVT_CRC_ERR |
FSI_RX_EVT_EOF_ERR |
FSI_RX_EVT_TYPE_ERR |
FSI_RX_EVT_DATA_FRAME);
FSI_setTxUserDefinedData(FSITXA_BASE, txUserData);
FSI_setTxFrameType(FSITXA_BASE, FSI_FRAME_TYPE_NWORD_DATA);
if(isRxFrameWdEnable)
{
//
// Performing a reset on frame WD before its usage is recommended
//
// For FSIRxA
FSI_resetRxModule(FSIRXA_BASE, FSI_RX_FRAME_WD_CNT_RESET);
DEVICE_DELAY_US(1);
FSI_clearRxModuleReset(FSIRXA_BASE, FSI_RX_FRAME_WD_CNT_RESET);
FSI_enableRxInterrupt(FSIRXA_BASE, FSI_INT2,
FSI_RX_EVT_FRAME_WD_TIMEOUT);
FSI_enableRxFrameWatchdog(FSIRXA_BASE, rxFrameWdRefCntr);
// For FSIRxB
FSI_resetRxModule(FSIRXB_BASE, FSI_RX_FRAME_WD_CNT_RESET);
DEVICE_DELAY_US(1);
FSI_clearRxModuleReset(FSIRXB_BASE, FSI_RX_FRAME_WD_CNT_RESET);
FSI_enableRxInterrupt(FSIRXB_BASE, FSI_INT2,
FSI_RX_EVT_FRAME_WD_TIMEOUT);
FSI_enableRxFrameWatchdog(FSIRXB_BASE, rxFrameWdRefCntr);
// For FSIRxC
FSI_resetRxModule(FSIRXC_BASE, FSI_RX_FRAME_WD_CNT_RESET);
DEVICE_DELAY_US(1);
FSI_clearRxModuleReset(FSIRXC_BASE, FSI_RX_FRAME_WD_CNT_RESET);
FSI_enableRxInterrupt(FSIRXC_BASE, FSI_INT2,
FSI_RX_EVT_FRAME_WD_TIMEOUT);
FSI_enableRxFrameWatchdog(FSIRXC_BASE, rxFrameWdRefCntr);
// For FSIRxD
FSI_resetRxModule(FSIRXD_BASE, FSI_RX_FRAME_WD_CNT_RESET);
DEVICE_DELAY_US(1);
FSI_clearRxModuleReset(FSIRXD_BASE, FSI_RX_FRAME_WD_CNT_RESET);
FSI_enableRxInterrupt(FSIRXD_BASE, FSI_INT2,
FSI_RX_EVT_FRAME_WD_TIMEOUT);
FSI_enableRxFrameWatchdog(FSIRXD_BASE, rxFrameWdRefCntr);
}
//
// Configure Tag Match feature for Receivers
//
FSI_setRxFrameTagRef(FSIRXA_BASE, FSI_FRAME_TAG4);
FSI_setRxFrameTagMask(FSIRXA_BASE, 0x0U);
FSI_enableRxFrameTagCompare(FSIRXA_BASE);
FSI_setRxFrameTagRef(FSIRXB_BASE, FSI_FRAME_TAG5);
FSI_setRxFrameTagMask(FSIRXB_BASE, 0x0U);
FSI_enableRxFrameTagCompare(FSIRXB_BASE);
FSI_setRxFrameTagRef(FSIRXC_BASE, FSI_FRAME_TAG6);
FSI_setRxFrameTagMask(FSIRXB_BASE, 0x0U);
FSI_enableRxFrameTagCompare(FSIRXC_BASE);
FSI_setRxFrameTagRef(FSIRXD_BASE, FSI_FRAME_TAG7);
FSI_setRxFrameTagMask(FSIRXB_BASE, 0x0U);
FSI_enableRxFrameTagCompare(FSIRXD_BASE);
//
// Assign ownership of FSIRxB, FSIRxC, FSIRxD modules to CPU2.
// FSIRxB - instance 18; FSIRxC - instance 19; FSIRxD - instance 20
//
SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL16_FSI, 18, SYSCTL_CPUSEL_CPU2);
SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL16_FSI, 19, SYSCTL_CPUSEL_CPU2);
SysCtl_selectCPUForPeripheral(SYSCTL_CPUSEL16_FSI, 20, SYSCTL_CPUSEL_CPU2);
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
prepareTxBufData();
tagIndex = 0;
txDataFrameTag = FSI_FRAME_TAG4;
FSI_setTxFrameTag(FSITXA_BASE, txDataFrameTag);
tagIndex++;
FSI_writeTxBuffer(FSITXA_BASE, txBufData, nWords, 0U);
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10);
//
// Start Transfer
//
FSI_startTxTransmit(FSITXA_BASE);
//
// Now, start transmitting data frames
//
while(1)
{
//
// Wait till frame done event is received by both Tx/Rx modules
//
while((fsiTxAInt1Received != 1U) && (txTimeOutCntr != 0U))
{
txTimeOutCntr--;
}
while((fsiRxAInt2Received != 1U) && (rxTimeOutCntr != 0U))
{
rxTimeOutCntr--;
}
while(IPC_isFlagBusyLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10) != 0)
{
ipcFlagTimeOutCntr--;
}
if((txTimeOutCntr == 0) || (rxTimeOutCntr == 0))
{
//
// Timeout for one of expected Tx/Rx evetns, so break execution here
//
break;
}
else
{
//
// Re-initialize flags and buffer pointer before next transmission
//
fsiTxAInt1Received = 0U;
// fsiRxAInt1Received = 0U;
fsiRxAInt2Received = 0U;
txTimeOutCntr = 0x100000U;
rxTimeOutCntr = 0x100000U;
ipcFlagTimeOutCntr = 0x100000U;
FSI_setTxBufferPtr(FSITXA_BASE, 0U);
FSI_setRxBufferPtr(FSIRXA_BASE, 0U);
}
//
// Write data into Tx buffer and set other Frame specific fields
//
prepareTxBufData();
if(tagIndex % 4 == 0)
{
txDataFrameTag = FSI_FRAME_TAG4;
}
else if(tagIndex % 4 == 1 )
{
txDataFrameTag = FSI_FRAME_TAG5;
}
else if(tagIndex % 4 == 2 )
{
txDataFrameTag = FSI_FRAME_TAG6;
}
else
{
txDataFrameTag = FSI_FRAME_TAG7;
}
FSI_setTxFrameTag(FSITXA_BASE, txDataFrameTag);
tagIndex++;
FSI_writeTxBuffer(FSITXA_BASE, txBufData, nWords, 0U);
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10);
//
// Start Transfer
//
FSI_startTxTransmit(FSITXA_BASE);
}
//
// Coming out of infinite while loop means timeout occurred for one of Tx
// or Rx transmit/receive events. Debug further to root-cause
//
ESTOP0;
}
void initFSI(void)
{
//
// Initialize Tx/Rx, reset sequence, clear events.
//
// TODO- Add logic to calculate PRESCALER_VAL based on user input FSI CLK.
FSI_performTxInitialization(FSITXA_BASE, PRESCALER_VAL);
FSI_performRxInitialization(FSIRXA_BASE);
FSI_performRxInitialization(FSIRXB_BASE);
FSI_performRxInitialization(FSIRXC_BASE);
FSI_performRxInitialization(FSIRXD_BASE);
//
// Set internalLoopback mode for FSIRxA
//
FSI_enableRxInternalLoopback(FSIRXA_BASE);
//
// Enable Internal loopback for FSIRxB, FSIRxC, FSIRxD.
//
FSI_enableRxInternalLoopback(FSIRXB_BASE);
FSI_enableRxInternalLoopback(FSIRXC_BASE);
FSI_enableRxInternalLoopback(FSIRXD_BASE);
//
// Flush Sequence before and after releasing Rx core reset, ensures
// flushing of Rx data/clock lines and prepares it for reception.
//
FSI_resetRxModule(FSIRXA_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_resetRxModule(FSIRXB_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_resetRxModule(FSIRXC_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_resetRxModule(FSIRXD_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_executeTxFlushSequence(FSITXA_BASE, PRESCALER_VAL);
DEVICE_DELAY_US(1);
FSI_clearRxModuleReset(FSIRXA_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_clearRxModuleReset(FSIRXB_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_clearRxModuleReset(FSIRXC_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_clearRxModuleReset(FSIRXD_BASE, FSI_RX_MASTER_CORE_RESET);
FSI_executeTxFlushSequence(FSITXA_BASE, PRESCALER_VAL);
//
// Assigning base addresses of Tx/Rx data buffer to globals.
//
txBufAddr = (uint16_t *)FSI_getTxBufferAddress(FSITXA_BASE);
}
//
// prepareTxBufData - Update array which is used as source to Tx data buffer
//
void prepareTxBufData(void)
{
uint16_t i;
for(i = 0; i < nWords; i++)
{
txBufData[i] = txBufData[i] + 1;
}
}
//
// fsiTxAInt1ISR - FSI Tx Interrupt on INsT1 line
//
__interrupt void fsiTxAInt1ISR(void)
{
fsiTxAInt1Received = 1U;
txEventSts = FSI_getTxEventStatus(FSITXA_BASE);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearTxEvents(FSITXA_BASE, FSI_TX_EVTMASK);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
}
//
// fsiTxAInt2ISR - FSI Tx Interrupt on INT2 line
//
__interrupt void fsiTxAInt2ISR(void)
{
fsiTxAInt2Received = 1U;
txEventSts = FSI_getTxEventStatus(FSITXA_BASE);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearTxEvents(FSITXA_BASE, FSI_TX_EVTMASK);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
disableAllFSIInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Actual
// Error is captured in txEventSts for debug.
//
ESTOP0;
}
//
// fsiRxAInt1ISR - FSI Rx Interrupt on INT1 line
//
__interrupt void fsiRxAInt1ISR(void)
{
rxEventSts = FSI_getRxEventStatus(FSIRXA_BASE);
// fsiRxAInt1Received = 1U;
dataFrameCntrA++;
//
// Verify Frame attributes and data
//
checkReceivedFrameTypeTag(FSIRXA_BASE, FSI_FRAME_TYPE_NWORD_DATA,
FSI_FRAME_TAG4);
compare16(FSI_getRxUserDefinedData(FSIRXA_BASE), txUserData);
compareBufData(FSIRXA_BASE, 0, 0, nWords);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXA_BASE,rxEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
//
// Stop execution if errors encountered in frame verification
//
if(error != 0)
{
disableAllFSIInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxAInt2ISR - FSI Rx Interrupt on INT2 line
//
__interrupt void fsiRxAInt2ISR(void)
{
rxEventSts = FSI_getRxEventStatus(FSIRXA_BASE);
fsiRxAInt2Received = 1U;
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXA_BASE,rxEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
if(rxEventSts & FSI_RX_EVT_DATA_FRAME == 0x0U)
{
disableAllFSIInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// disableAllFSIInterrupts - Disables all event interrupts in both FSI Tx/Rx,
// also clear them
//
void disableAllFSIInterrupts(void)
{
FSI_disableTxInterrupt(FSITXA_BASE, FSI_INT1, FSI_TX_EVTMASK);
FSI_disableTxInterrupt(FSITXA_BASE, FSI_INT2, FSI_TX_EVTMASK);
FSI_disableRxInterrupt(FSIRXA_BASE, FSI_INT1, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXA_BASE, FSI_INT2, FSI_RX_EVTMASK);
FSI_clearTxEvents(FSITXA_BASE, FSI_TX_EVTMASK);
FSI_clearRxEvents(FSIRXA_BASE, FSI_RX_EVTMASK);
}
//
// compare16 - Compares two 16 bit values and increments global error flag by 1
// for mismatch
//
static inline void compare16(uint16_t val1, uint16_t val2)
{
if(val1 != val2)
{
error++;
}
}
//
// compareBufData - Compares if received data is same as transmitted ones
// It doesn't consider wrap-up cases, but, can be enhanced
//
void compareBufData(uint32_t base, uint16_t txBufIndex, uint16_t rxBufIndex,
uint16_t nWords)
{
uint16_t i;
uint16_t rxDataArray[16];
FSI_readRxBuffer(base, rxDataArray, nWords, rxBufIndex);
for(i = 0; i < nWords; i++)
{
if(rxDataArray[i] != txBufAddr[txBufIndex])
{
error++;
return;
}
txBufIndex++;
}
}
//
// checkReceivedFrameTypeTag - Checks received frame type/tag and updates global
// error flag
//
void checkReceivedFrameTypeTag(uint32_t base, FSI_FrameType type,
FSI_FrameTag tag)
{
compare16((uint16_t)FSI_getRxFrameType(base), (uint16_t)type);
if(type == FSI_FRAME_TYPE_PING)
{
compare16(FSI_getRxPingTag(base), (uint16_t)tag);
}
else
{
compare16(FSI_getRxFrameTag(base), (uint16_t)tag);
}
}
//
// End of File
//
@@ -0,0 +1,531 @@
//#############################################################################
//
// FILE: fsi_ex1_multiRx_tagmatch_cpu2.c
//
// TITLE: CPU controlled data frame transfers to multiple receivers with
// tag-match feature enabled in internal loopback mode.
//
//! \addtogroup driver_dual_example_list
//! <h1>FSI Multi-Rx Tag-Match</h1>
//!
//! Example sets up infinite data frame transfers where trigger happens
//! through \b CPU. Multiple receivers receive data as per the received
//! frame tag.
//!
//! This is a dual core example where FSITxA & FSIRxA instances are owned
//! by CPU1 while FSIRxB, FSIRxC & FSIRxD are owned by CPU2. Internal
//! loopback mode is enabled for FSIRxA, FSIRxB, FSIRxC & FSIRxD which
//! connects data & clock lines of these receivers to FSITxA internally.
//!
//! FSITxA infinitely sends data frames with alternating tag values.
//! Receivers are configured to receive data frame with different tag
//! values with tag-match feature enabled. Tx doesn't send next frame of data
//! until it all receivers receive the data. Synchronization among all the
//! receivers is maintained through IPC flags.
//!
//! User can edit some of configuration parameters as per usecase. These are
//! as below. Default values can be referred in code where these globals
//! are defined:-
//! - \b nWords - Number of words per transfer may be from 1 -16
//! - \b nLanes - Choice to select single or double lane for frame transfers
//! - \b fsiClock - FSI Clock used for transfers
//! - \b txUserData - User data to be sent with Data frame
//! - \b txDataFrameTag - Frame tag used for Data transfers
//!
//! For any errors during transfers i.e. \b error events such as Frame Overrun,
//! Underrun, Watchdog timeout and CRC/EOF/TYPE errors, execution will stop
//! immediately and status variables can be looked into for more details.
//! Execution will also stop for any mismatch between received data and sent
//! ones and also if transfers takes unusually long time(detected through
//! software counters - txTimeOutCntr and rxTimeOutCntr)
//!
//!\b External \b Connections \n
//! For FSI internal loopback, no external connections needed
//!
//! \b Watch \b Variables \n
//! - \b dataFrameCntrB Number of Data frame received by FSIRxB
//! - \b dataFrameCntrC Number of Data frame received by FSIRxC
//! - \b dataFrameCntrD Number of Data frame received by FSIRxD
//! - \b error Non zero for transmit/receive data mismatch
//!
//
//#############################################################################
//
//
//
// 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
//
// Number of words per transfer may be from 1 -16
uint16_t nWords = 6;
//
// Globals, these are not config parameters, user are not required to edit them
//
uint16_t rxBEventSts = 0, rxCEventSts = 0, rxDEventSts = 0;
// Reference user data to check with received Data frame user data
uint16_t txUserData = 0x47;
// Buffer used by Tx to send data. This is used to check whether correct
// data is received at the receiver. This buffer is placed in GSRAM1 and
// hence can be accessed by both CPU1 and CPU2.
uint16_t txBufDataRead[16] = {0};
#pragma DATA_SECTION(txBufDataRead,"SHARERAMGS1");
volatile uint32_t fsiRxBInt1Received = 0,fsiRxBInt2Received = 0;
volatile uint32_t fsiRxCInt1Received = 0,fsiRxCInt2Received = 0;
volatile uint32_t fsiRxDInt1Received = 0,fsiRxDInt2Received = 0;
uint32_t rxTimeOutCntr = 0x100000;
// Globals to capture the number of frames received by FSIRxB, FSIRxC &
// FSIRxD respectively.
uint32_t dataFrameCntrB = 0;
uint32_t dataFrameCntrC = 0;
uint32_t dataFrameCntrD = 0;
uint32_t error = 0;
//
// Function Prototypes
//
static inline void compare16(uint16_t val1, uint16_t val2);
void compareBufData(uint32_t base, uint16_t txBufIndex, uint16_t rxBufIndex,
uint16_t nWords);
void disableAllFSIRxInterrupts(void);
void checkReceivedFrameTypeTag(uint32_t base, FSI_FrameType type,
FSI_FrameTag tag);
void prepareTxBufData(void);
// ISRs
__interrupt void fsiRxBInt1ISR(void);
__interrupt void fsiRxBInt2ISR(void);
__interrupt void fsiRxCInt1ISR(void);
__interrupt void fsiRxCInt2ISR(void);
__interrupt void fsiRxDInt1ISR(void);
__interrupt void fsiRxDInt2ISR(void);
//
// 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();
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file. Total 6; FSIRxB/C/D :: INT1/INT2
//
Interrupt_register(INT_FSIRXB1, &fsiRxBInt1ISR);
Interrupt_register(INT_FSIRXB2, &fsiRxBInt2ISR);
Interrupt_register(INT_FSIRXC1, &fsiRxCInt1ISR);
Interrupt_register(INT_FSIRXC2, &fsiRxCInt2ISR);
Interrupt_register(INT_FSIRXD1, &fsiRxDInt1ISR);
Interrupt_register(INT_FSIRXD2, &fsiRxDInt2ISR);
//
// Enable FSI Tx/Rx interrupts.
//
Interrupt_enable(INT_FSIRXB1);
Interrupt_enable(INT_FSIRXB2);
Interrupt_enable(INT_FSIRXC1);
Interrupt_enable(INT_FSIRXC2);
Interrupt_enable(INT_FSIRXD1);
Interrupt_enable(INT_FSIRXD2);
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG11);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM).
//
EINT;
ERTM;
//
// Now, start transmitting data frames
//
while(1)
{
//
// Wait till frame done event is received by both Tx/Rx modules
//
while((fsiRxBInt2Received != 1U) && (fsiRxCInt2Received != 1U) &&
(fsiRxDInt2Received != 1U) && (rxTimeOutCntr != 0U))
{
rxTimeOutCntr--;
}
if(rxTimeOutCntr == 0)
{
//
// Timeout for one of expected Tx/Rx evetns, so break execution here
//
break;
}
else
{
if(IPC_isFlagBusyRtoL(IPC_CPU1_L_CPU2_R, IPC_FLAG10) == 1)
{
//
// Re-initialize flags and buffer pointer before next transmission
//
fsiRxBInt2Received = 0U;
fsiRxCInt2Received = 0U;
fsiRxDInt2Received = 0U;
rxTimeOutCntr = 0x100000U;
FSI_setRxBufferPtr(FSIRXB_BASE, 0U);
FSI_setRxBufferPtr(FSIRXC_BASE, 0U);
FSI_setRxBufferPtr(FSIRXD_BASE, 0U);
// IPCRtoLFlagAcknowledge(IPC_FLAG10);
IPC_ackFlagRtoL(IPC_CPU1_L_CPU2_R, IPC_FLAG10);
}
}
}
//
// Coming out of infinite while loop means timeout occurred for one of Tx
// or Rx transmit/receive events. Debug further to root-cause
//
ESTOP0;
}
//
// fsiRxBInt1ISR - FSI Rx Interrupt on INT1 line
//
__interrupt void fsiRxBInt1ISR(void)
{
rxBEventSts = FSI_getRxEventStatus(FSIRXB_BASE);
fsiRxBInt1Received = 1U;
dataFrameCntrB++;
//
// Verify Frame attributes and data
//
checkReceivedFrameTypeTag(FSIRXB_BASE, FSI_FRAME_TYPE_NWORD_DATA,
FSI_FRAME_TAG5);
compare16(FSI_getRxUserDefinedData(FSIRXB_BASE), txUserData);
compareBufData(FSIRXB_BASE, 0, 0, nWords);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXB_BASE,rxBEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
//
// Stop execution if errors encountered in frame verification
//
if(error != 0)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxBInt2ISR - FSI Rx Interrupt on INT2 line
//
__interrupt void fsiRxBInt2ISR(void)
{
rxBEventSts = FSI_getRxEventStatus(FSIRXB_BASE);
fsiRxBInt2Received = 1U;
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXB_BASE,rxBEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP4);
if(rxBEventSts & FSI_RX_EVT_DATA_FRAME == 0x0U)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxBInt1ISR - FSI Rx Interrupt on INT1 line
//
__interrupt void fsiRxCInt1ISR(void)
{
rxCEventSts = FSI_getRxEventStatus(FSIRXC_BASE);
fsiRxCInt1Received = 1U;
dataFrameCntrC++;
//
// Verify Frame attributes and data
//
checkReceivedFrameTypeTag(FSIRXC_BASE, FSI_FRAME_TYPE_NWORD_DATA,
FSI_FRAME_TAG6);
compare16(FSI_getRxUserDefinedData(FSIRXC_BASE), txUserData);
compareBufData(FSIRXC_BASE, 0, 0, nWords);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXC_BASE,rxCEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
//
// Stop execution if errors encountered in frame verification
//
if(error != 0)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxBInt2ISR - FSI Rx Interrupt on INT2 line
//
__interrupt void fsiRxCInt2ISR(void)
{
rxCEventSts = FSI_getRxEventStatus(FSIRXC_BASE);
fsiRxCInt2Received = 1U;
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXC_BASE,rxCEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
if(rxCEventSts & FSI_RX_EVT_DATA_FRAME == 0x0U)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxBInt1ISR - FSI Rx Interrupt on INT1 line
//
__interrupt void fsiRxDInt1ISR(void)
{
rxDEventSts = FSI_getRxEventStatus(FSIRXD_BASE);
fsiRxDInt1Received = 1U;
dataFrameCntrD++;
//
// Verify Frame attributes and data
//
checkReceivedFrameTypeTag(FSIRXD_BASE, FSI_FRAME_TYPE_NWORD_DATA,
FSI_FRAME_TAG7);
compare16(FSI_getRxUserDefinedData(FSIRXD_BASE), txUserData);
compareBufData(FSIRXD_BASE, 0, 0, nWords);
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXD_BASE,rxDEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
//
// Stop execution if errors encountered in frame verification
//
if(error != 0)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// fsiRxBInt2ISR - FSI Rx Interrupt on INT2 line
//
__interrupt void fsiRxDInt2ISR(void)
{
rxDEventSts = FSI_getRxEventStatus(FSIRXD_BASE);
fsiRxDInt2Received = 1U;
//
// Clear the interrupt flag and issue ACK
//
FSI_clearRxEvents(FSIRXD_BASE,rxDEventSts);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
if(rxDEventSts & FSI_RX_EVT_DATA_FRAME == 0x0U)
{
disableAllFSIRxInterrupts();
//
// INT2 line is set to fire for error events, stop immediately. Error
// is captured in rxEventSts for debug
//
ESTOP0;
}
}
//
// disableAllFSIInterrupts - Disables all event interrupts in both FSI Tx/Rx,
// also clear them
//
void disableAllFSIRxInterrupts(void)
{
FSI_disableRxInterrupt(FSIRXB_BASE, FSI_INT1, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXB_BASE, FSI_INT2, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXC_BASE, FSI_INT1, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXC_BASE, FSI_INT2, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXD_BASE, FSI_INT1, FSI_RX_EVTMASK);
FSI_disableRxInterrupt(FSIRXD_BASE, FSI_INT2, FSI_RX_EVTMASK);
FSI_clearRxEvents(FSIRXB_BASE, FSI_RX_EVTMASK);
FSI_clearRxEvents(FSIRXC_BASE, FSI_RX_EVTMASK);
FSI_clearRxEvents(FSIRXD_BASE, FSI_RX_EVTMASK);
}
//
// compare16 - Compares two 16 bit values and increments global error flag by 1
// for mismatch
//
static inline void compare16(uint16_t val1, uint16_t val2)
{
if(val1 != val2)
{
error++;
}
}
//
// compareBufData - Compares if received data is same as transmitted ones
// It doesn't consider wrap-up cases, but, can be enhanced
//
void compareBufData(uint32_t base, uint16_t txBufIndex, uint16_t rxBufIndex,
uint16_t nWords)
{
uint16_t i;
uint16_t rxDataArray[16];
FSI_readRxBuffer(base, rxDataArray, nWords, rxBufIndex);
for(i = 0; i < nWords; i++)
{
if(rxDataArray[i] != txBufDataRead[txBufIndex])
{
error++;
return;
}
txBufIndex++;
}
}
//
// checkReceivedFrameTypeTag - Checks received frame type/tag and updates global
// error flag
//
void checkReceivedFrameTypeTag(uint32_t base, FSI_FrameType type,
FSI_FrameTag tag)
{
compare16((uint16_t)FSI_getRxFrameType(base), (uint16_t)type);
if(type == FSI_FRAME_TYPE_PING)
{
compare16(FSI_getRxPingTag(base), (uint16_t)tag);
}
else
{
compare16(FSI_getRxFrameTag(base), (uint16_t)tag);
}
}
//
// End of File
//
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="ipc_ex1_basic_c28x1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -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 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -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 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../ipc_ex1_basic_c28x1.c" targetDirectory="" />
</project>
<project
name="ipc_ex1_basic_c28x2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../ipc_ex1_basic_c28x2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="ipc_ex2_msgqueue_c28x1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define RAM --define=CPU1 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -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 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../ipc_ex2_msgqueue_c28x1.c" targetDirectory="" />
</project>
<project
name="ipc_ex2_msgqueue_c28x2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../ipc_ex2_msgqueue_c28x2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,71 @@
<projectSpec>
<project
name="ipc_ex3_basic_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.1.LTS"
>
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<file path="../system/system_ex3/system.xml" action="copy" openOnCreation="true"/>
<configuration name="FLASH"
></configuration>
<configuration name="RAM"
></configuration>
</project>
<project
name="ipc_ex3_basic_sysconfig_c28x1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../ipc_ex3_basic_sysconfig_c28x1.c" targetDirectory="" />
<file action="copy" path="../ipc_ex3_basic_sysconfig_c28x1.syscfg" targetDirectory="" />
</project>
<project
name="ipc_ex3_basic_sysconfig_c28x2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../ipc_ex3_basic_sysconfig_c28x2.c" targetDirectory="" />
<file action="copy" path="../ipc_ex3_basic_sysconfig_c28x2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,71 @@
<projectSpec>
<project
name="ipc_ex4_msgqueue_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.1.LTS"
>
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<file path="../system/system_ex4/system.xml" action="copy" openOnCreation="true"/>
<configuration name="FLASH"
></configuration>
<configuration name="RAM"
></configuration>
</project>
<project
name="ipc_ex4_msgqueue_sysconfig_c28x1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../ipc_ex4_msgqueue_sysconfig_c28x1.c" targetDirectory="" />
<file action="copy" path="../ipc_ex4_msgqueue_sysconfig_c28x1.syscfg" targetDirectory="" />
</project>
<project
name="ipc_ex4_msgqueue_sysconfig_c28x2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../ipc_ex4_msgqueue_sysconfig_c28x2.c" targetDirectory="" />
<file action="copy" path="../ipc_ex4_msgqueue_sysconfig_c28x2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,168 @@
//#############################################################################
//
// FILE: ipc_ex1_basic_c28x1.c
//
// TITLE: IPC example with interrupt
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC basic message passing example with interrupt </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core without message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - pass
//!
//
//#############################################################################
//
// 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"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
#pragma DATA_SECTION(readData, "MSGRAM_CPU1_TO_CPU2")
uint32_t readData[10];
uint32_t pass;
//
// Main
//
void main(void)
{
int i;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// 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 any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Fill in the data to be sent
//
for(i=0; i<10; i++)
{
readData[i] = i;
}
//
// Send a message without message queue
// Length of the data to be read is passed as data.
//
IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
IPC_CMD_READ_MEM, (uint32_t)readData, 10);
//
// Wait for acknowledgment
//
IPC_waitForAck(IPC_CPU1_L_CPU2_R, IPC_FLAG0);
//
// Read response
//
if(IPC_getResponse(IPC_CPU1_L_CPU2_R) == TEST_PASS)
{
pass = 1;
}
else
{
pass = 0;
}
//
// End of example. Loop forever
//
while(1);
}
//
// End of File
//
@@ -0,0 +1,180 @@
//#############################################################################
//
// FILE: ipc_ex1_basic_c28x2.c
//
// TITLE: IPC example with interrupt
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC basic message passing example with interrupt </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core without message queues
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
// 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"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
//
// Function prototypes
//
__interrupt void IPC_ISR0();
//
// 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 any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG_ALL);
//
// Enable IPC interrupts
//
IPC_registerInterrupt(IPC_CPU2_L_CPU1_R, IPC_INT0, IPC_ISR0);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
//
// Loop forever. Wait for IPC interrupt
//
while(1);
}
//
// IPC ISR for Flag 0.
// C28x core sends data without message queue using Flag 0
//
__interrupt void IPC_ISR0()
{
int i;
uint32_t command, addr, data;
bool status = false;
//
// Read the command
//
IPC_readCommand(IPC_CPU2_L_CPU1_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
&command, &addr, &data);
if(command == IPC_CMD_READ_MEM)
{
status = true;
//
// Read and compare data
//
for(i=0; i<data; i++)
{
if(*((uint32_t *)addr + i) != i)
status = false;
}
}
//
// Send response to C28x core
//
if(status)
{
IPC_sendResponse(IPC_CPU2_L_CPU1_R, TEST_PASS);
}
else
{
IPC_sendResponse(IPC_CPU2_L_CPU1_R, TEST_FAIL);
}
//
// Acknowledge the flag
//
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG0);
//
// Acknowledge the PIE interrupt.
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// End of File
//
@@ -0,0 +1,177 @@
//#############################################################################
//
// FILE: ipc_ex2_msgqueue_c28x1.c
//
// TITLE: IPC example with interrupt and message queue
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC message passing example with interrupt and message queue </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core with message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - pass
//!
//
//#############################################################################
//
// 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"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
#pragma DATA_SECTION(readData, "MSGRAM_CPU1_TO_CPU2")
uint32_t readData[10];
uint32_t pass;
//
// Main
//
void main(void)
{
int i;
IPC_MessageQueue_t messageQueue;
IPC_Message_t TxMsg, RxMsg;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// 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 any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
//
// Initialize message queue
//
IPC_initMessageQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_INT1, IPC_INT1);
//
// Synchronize both the cores
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_FLAG31);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Fill in the data to be sent
//
for(i=0; i<10; i++)
{
readData[i] = i;
}
//
// Update the message
//
TxMsg.command = IPC_CMD_READ_MEM;
TxMsg.address = (uint32_t)readData;
TxMsg.dataw1 = 10; // Using dataw1 as data length
TxMsg.dataw2 = 1; // Message identifier
//
// Send message to the queue
//
IPC_sendMessageToQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE,
&TxMsg, IPC_BLOCKING_CALL);
//
// Read message from the queue
//
IPC_readMessageFromQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE,
&RxMsg, IPC_BLOCKING_CALL);
if((RxMsg.command == IPC_CMD_RESP) && (RxMsg.dataw1 == TEST_PASS) && (RxMsg.dataw2 == 1))
pass = 1;
else
pass = 0;
//
// End of example. Loop forever
//
while(1);
}
//
// End of File
//
@@ -0,0 +1,186 @@
//#############################################################################
//
// FILE: ipc_ex2_msgqueue_c28x2.c
//
// TITLE: IPC example with interrupt and message queue
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC message passing example with interrupt and message queue </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core with message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
// 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"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
IPC_MessageQueue_t messageQueue;
//
// Function prototypes
//
__interrupt void IPC_ISR1();
//
// 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 any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG_ALL);
//
// Enable IPC interrupts
//
IPC_registerInterrupt(IPC_CPU2_L_CPU1_R, IPC_INT1, IPC_ISR1);
//
// Initialize message queue
//
IPC_initMessageQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_INT1, IPC_INT1);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_FLAG31);
//
// Loop forever. Wait for IPC interrupt
//
while(1);
}
//
// IPC ISR for Flag 1
// C28x core sends data with message queue using Flag 0
//
__interrupt void IPC_ISR1()
{
int i;
IPC_Message_t TxMsg, RxMsg;
bool status = false;
//
// Read the message from the message queue
//
IPC_readMessageFromQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE,
&RxMsg, IPC_NONBLOCKING_CALL);
if(RxMsg.command == IPC_CMD_READ_MEM)
{
status = true;
//
// Read and compare data
//
for(i=0; i<RxMsg.dataw1; i++)
{
if(*((uint32_t *)RxMsg.address + i) != i)
status = false;
}
}
//
// Send response message
//
TxMsg.command = IPC_CMD_RESP;
TxMsg.address = 0; // Not used
TxMsg.dataw1 = status ? TEST_PASS : TEST_FAIL;
TxMsg.dataw2 = RxMsg.dataw2; // Use the message identifier from the received message
IPC_sendMessageToQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE,
&TxMsg, IPC_NONBLOCKING_CALL);
//
// Acknowledge the flag
//
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
//
// Acknowledge the PIE interrupt.
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// End of File
//
@@ -0,0 +1,168 @@
//#############################################################################
//
// FILE: ipc_ex3_basic_sysconfig_c28x1.c
//
// TITLE: SysConfig IPC example with interrupt
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC basic message passing example with interrupt </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core without message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - pass
//!
//
//#############################################################################
//
// 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"
#include "board.h"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
#pragma DATA_SECTION(readData, "MSGRAM_CPU1_TO_CPU2")
uint32_t readData[10];
uint32_t pass;
//
// Main
//
void main(void)
{
int i;
//
// 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();
//
// Initialize SysConfig Settings
//
Board_init();
//
// Boot CPU2 core
//
Device_bootCPU2(BOOT_MODE_CPU2);
//
// Clear any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU1_L_CPU2_R, SYNC_FLAG);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Fill in the data to be sent
//
for(i=0; i<10; i++)
{
readData[i] = i;
}
//
// Send a message without message queue
// Length of the data to be read is passed as data.
//
IPC_sendCommand(IPC_CPU1_L_CPU2_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
IPC_CMD_READ_MEM, (uint32_t)readData, 10);
//
// Wait for acknowledgment
//
IPC_waitForAck(IPC_CPU1_L_CPU2_R, IPC_FLAG0);
//
// Read response
//
if(IPC_getResponse(IPC_CPU1_L_CPU2_R) == TEST_PASS)
{
pass = 1;
}
else
{
pass = 0;
}
//
// End of example. Loop forever
//
while(1);
}
//
// End of File
//
@@ -0,0 +1,18 @@
/**
* 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 "F2838x" --package "176pin" --part "F2838x_176pin" --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");
/**
* Write custom configuration values to the imported modules.
*/
ipc.flagHandler31 = "SYNC_FLAG";
ipc.ipcRegisterFlag = ["IPC_FLAG0","IPC_FLAG31"];
ipc.enableInterrupt0 = true;
@@ -0,0 +1,176 @@
//#############################################################################
//
// FILE: ipc_ex3_basic_sysconfig_c28x2.c
//
// TITLE: SysConfig IPC example with interrupt
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC basic message passing example with interrupt </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core without message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
// 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"
#include "board.h"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
//
// 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();
//
// Initialize SysConfig Settings
//
Board_init();
//
// Clear any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG_ALL);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU2_L_CPU1_R, SYNC_FLAG);
//
// Loop forever. Wait for IPC interrupt
//
while(1);
}
//
// IPC ISR for Flag 0.
// C28x core sends data without message queue using Flag 0
//
__interrupt void IPC_ISR0()
{
int i;
uint32_t command, addr, data;
bool status = false;
//
// Read the command
//
IPC_readCommand(IPC_CPU2_L_CPU1_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
&command, &addr, &data);
if(command == IPC_CMD_READ_MEM)
{
status = true;
//
// Read and compare data
//
for(i=0; i<data; i++)
{
if(*((uint32_t *)addr + i) != i)
status = false;
}
}
//
// Send response to C28x core
//
if(status)
{
IPC_sendResponse(IPC_CPU2_L_CPU1_R, TEST_PASS);
}
else
{
IPC_sendResponse(IPC_CPU2_L_CPU1_R, TEST_FAIL);
}
//
// Acknowledge the flag
//
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG0);
//
// Acknowledge the PIE interrupt.
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// 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 "F2838x" --package "176pin" --part "F2838x_176pin" --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");
/**
* Write custom configuration values to the imported modules.
*/
ipc.flagHandler31 = "SYNC_FLAG";
ipc.registerInterrupts = ["0"];
ipc.ipcRegisterFlag = ["IPC_FLAG31"];
ipc.ipcInt0.interruptHandler = "IPC_ISR0";
ipc.ipcInt0.enableInterrupt = true;
@@ -0,0 +1,178 @@
//#############################################################################
//
// FILE: ipc_ex4_msgqueue_sysconfig_c28x1.c
//
// TITLE: SysConfig IPC example with interrupt and message queue
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC message passing example with interrupt and message queue </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core with message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - pass
//!
//
//#############################################################################
//
// 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"
#include "board.h"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
#pragma DATA_SECTION(readData, "MSGRAM_CPU1_TO_CPU2")
uint32_t readData[10];
uint32_t pass;
//
// Main
//
void main(void)
{
int i;
IPC_MessageQueue_t messageQueue;
IPC_Message_t TxMsg, RxMsg;
//
// 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();
//
// Initialize settings from SysConfig
//
Board_init();
//
// Boot CPU2 core
//
Device_bootCPU2(BOOT_MODE_CPU2);
//
// Clear any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG_ALL);
//
// Initialize message queue
//
IPC_initMessageQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_INT1, IPC_INT1);
//
// Synchronize both the cores
//
IPC_sync(IPC_CPU1_L_CPU2_R, SYNC_FLAG);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Fill in the data to be sent
//
for(i=0; i<10; i++)
{
readData[i] = i;
}
//
// Update the message
//
TxMsg.command = IPC_CMD_READ_MEM;
TxMsg.address = (uint32_t)readData;
TxMsg.dataw1 = 10; // Using dataw1 as data length
TxMsg.dataw2 = 1; // Message identifier
//
// Send message to the queue
//
IPC_sendMessageToQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE,
&TxMsg, IPC_BLOCKING_CALL);
//
// Read message from the queue
//
IPC_readMessageFromQueue(IPC_CPU1_L_CPU2_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE,
&RxMsg, IPC_BLOCKING_CALL);
if((RxMsg.command == IPC_CMD_RESP) && (RxMsg.dataw1 == TEST_PASS) && (RxMsg.dataw2 == 1))
pass = 1;
else
pass = 0;
//
// End of example. Loop forever
//
while(1);
}
//
// End of File
//
@@ -0,0 +1,18 @@
/**
* 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 "F2838x" --package "176pin" --part "F2838x_176pin" --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");
/**
* Write custom configuration values to the imported modules.
*/
ipc.flagHandler31 = "SYNC_FLAG";
ipc.ipcRegisterFlag = ["IPC_FLAG1","IPC_FLAG31"];
ipc.enableInterrupt1 = true;
@@ -0,0 +1,184 @@
//#############################################################################
//
// FILE: ipc_ex4_msgqueue_sysconfig_c28x2.c
//
// TITLE: SysConfig IPC example with interrupt and message queue
//
//! \addtogroup driver_dual_example_list
//! <h1> IPC message passing example with interrupt and message queue </h1>
//!
//! This example demonstrates how to configure IPC and pass information from
//! C28x1 to C28x2 core with message queues.
//! It is recommended to run the C28x1 core first, followed by the C28x2 core.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
// 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"
#include "board.h"
//
// Defines
//
#define IPC_CMD_READ_MEM 0x1001
#define IPC_CMD_RESP 0x2001
#define TEST_PASS 0x5555
#define TEST_FAIL 0xAAAA
IPC_MessageQueue_t messageQueue;
//
// Function prototypes
//
//__interrupt void IPC_ISR1();
//
// 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();
Board_init();
//
// Clear any IPC flags if set already
//
IPC_clearFlagLtoR(IPC_CPU2_L_CPU1_R, IPC_FLAG_ALL);
//
// Initialize message queue
//
IPC_initMessageQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_INT1, IPC_INT1);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Synchronize both the cores.
//
IPC_sync(IPC_CPU2_L_CPU1_R, SYNC_FLAG);
//
// Loop forever. Wait for IPC interrupt
//
while(1);
}
//
// IPC ISR for Flag 1
// C28x core sends data with message queue using Flag 0
//
__interrupt void IPC_ISR1()
{
int i;
IPC_Message_t TxMsg, RxMsg;
bool status = false;
//
// Read the message from the message queue
//
IPC_readMessageFromQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE,
&RxMsg, IPC_NONBLOCKING_CALL);
if(RxMsg.command == IPC_CMD_READ_MEM)
{
status = true;
//
// Read and compare data
//
for(i=0; i<RxMsg.dataw1; i++)
{
if(*((uint32_t *)RxMsg.address + i) != i)
status = false;
}
}
//
// Send response message
//
TxMsg.command = IPC_CMD_RESP;
TxMsg.address = 0; // Not used
TxMsg.dataw1 = status ? TEST_PASS : TEST_FAIL;
TxMsg.dataw2 = RxMsg.dataw2; // Use the message identifier from the received message
IPC_sendMessageToQueue(IPC_CPU2_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE,
&TxMsg, IPC_NONBLOCKING_CALL);
//
// Acknowledge the flag
//
IPC_ackFlagRtoL(IPC_CPU2_L_CPU1_R, IPC_FLAG1);
//
// Acknowledge the PIE interrupt.
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// 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 "F2838x" --package "176pin" --part "F2838x_176pin" --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");
/**
* Write custom configuration values to the imported modules.
*/
ipc.ipcRegisterFlag = ["IPC_FLAG31"];
ipc.flagHandler31 = "SYNC_FLAG";
ipc.registerInterrupts = ["1"];
ipc.ipcInt1.enableInterrupt = true;
ipc.ipcInt1.interruptHandler = "IPC_ISR1";
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<system>
<project configuration="@match" id="project_0" name="ipc_ex3_basic_sysconfig_c28x1">
</project>
<core id="C28xx_CPU1" project="project_0"/>
<project configuration="@match" id="project_1" name="ipc_ex3_basic_sysconfig_c28x2">
</project>
<core id="C28xx_CPU2" project="project_1"/>
<preBuildSteps>
</preBuildSteps>
<postBuildSteps>
</postBuildSteps>
</system>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<system>
<project configuration="@match" id="project_0" name="ipc_ex4_msgqueue_sysconfig_c28x1">
</project>
<core id="C28xx_CPU1" project="project_0"/>
<project configuration="@match" id="project_1" name="ipc_ex4_msgqueue_sysconfig_c28x2">
</project>
<core id="C28xx_CPU2" project="project_1"/>
<preBuildSteps>
</preBuildSteps>
<postBuildSteps>
</postBuildSteps>
</system>
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="led_ex1_c28x_dual_blinky_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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="../led_ex1_c28x_dual_blinky_cpu1.c" targetDirectory="" />
</project>
<project
name="led_ex1_c28x_dual_blinky_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU2_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 --define RAM" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=_FLASH --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x100 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_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="../led_ex1_c28x_dual_blinky_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,71 @@
<projectSpec>
<project
name="led_ex2_blinky_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.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="led_ex2_blinky_sysconfig_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../led_ex2_blinky_sysconfig_cpu1.c" targetDirectory="" />
<file action="copy" path="../led_ex2_blinky_sysconfig_cpu1.syscfg" targetDirectory="" />
</project>
<project
name="led_ex2_blinky_sysconfig_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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_FLASH_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu2.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_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="../led_ex2_blinky_sysconfig_cpu2.c" targetDirectory="" />
<file action="copy" path="../led_ex2_blinky_sysconfig_cpu2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,144 @@
//#############################################################################
//
// FILE: led_ex1_c28x_dual_blinky_cpu1.c
//
// TITLE: LED Blinky Example
//
//! \addtogroup driver_dual_example_list
//! <h1> LED Blinky Example</h1>
//!
//! This example demonstrates how to blink a LED using CPU1 and blink another
//! LED using CPU2 (led_ex1_blinky_cpu2.c).
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
//
//
// 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();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
Device_initGPIO();
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
//
// Configure CPU2 to control the LED GPIO
//
GPIO_setControllerCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CPU2);
//
// 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();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED1, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED1, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
//
// End of File
//
@@ -0,0 +1,123 @@
//#############################################################################
//
// FILE: led_ex1_c28x_dual_blinky_cpu2.c
//
// TITLE: LED Blinky Example
//
//! <h1> LED Blinky Example (CPU2) </h1>
//!
//! This example demonstrates how to blink a LED using CPU2.
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//
//
//#############################################################################
//
//
//
// 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();
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
// This is configured by CPU1
//
// 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();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
//
// End of File
//
@@ -0,0 +1,145 @@
//#############################################################################
//
// FILE: led_ex2_blinky_sysconfig_cpu1.c
//
// TITLE: SysConfig LED Blinky Example
//
//! \addtogroup driver_dual_example_list
//! <h1> LED Blinky Example</h1>
//!
//! This example demonstrates how to blink a LED using CPU1 and blink another
//! LED using CPU2 (led_ex1_blinky_cpu2.c).
//!
//! \b External \b Connections \n
//! - None.
//!
//! \b Watch \b Variables \n
//! - None.
//!
//
//#############################################################################
//
//
//
// 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
//
// Make sure to include "board.h" to use SysConfig
//
#include "driverlib.h"
#include "device.h"
#include "board.h"
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
Device_bootCPU2(BOOT_MODE_CPU2);
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
Device_initGPIO();
//
// Initialize settings from SysConfig
//
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();
//
// Sync CPUs so the blinking starts at the same time, though the LEDs toggle at different frequency
//
IPC_sync(IPC_CPU1_L_CPU2_R, IPC_SYNC);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(CPU1_LED, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(CPU1_LED, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
//
// End of File
//
@@ -0,0 +1,29 @@
/**
* 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 "F2838x" --package "337bga" --part "F2838x_337bga" --context "CPU1" --product "C2000WARE@4.02.00.00"
* @versions {"tool":"1.13.0+2553"}
*/
/**
* Import the modules used in this configuration.
*/
const gpio = scripting.addModule("/driverlib/gpio.js", {}, false);
const gpio1 = gpio.addInstance();
const gpio2 = gpio.addInstance();
const ipc = scripting.addModule("/driverlib/ipc.js");
/**
* Write custom configuration values to the imported modules.
*/
gpio1.direction = "GPIO_DIR_MODE_OUT";
gpio1.$name = "CPU1_LED";
gpio1.gpioPin.$assign = "GPIO31";
gpio2.direction = "GPIO_DIR_MODE_OUT";
gpio2.masterCore = "GPIO_CORE_CPU2";
gpio2.$name = "CPU2_LED";
gpio2.gpioPin.$assign = "GPIO34";
ipc.ipcRegisterFlag = ["IPC_FLAG31"];
ipc.flagHandler31 = "IPC_SYNC";
@@ -0,0 +1,131 @@
//#############################################################################
//
// FILE: led_ex2_blinky_sysconfig_cpu2.c
//
// TITLE: SysConfig LED Blinky Example
//
// <h1> LED Blinky Example (CPU2) </h1>
//
// This example demonstrates how to blink a LED using CPU2.
//
// \b External \b Connections \n
// - None.
//
// \b Watch \b Variables \n
// - None.
//
//
//#############################################################################
//
//
//
// 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
//
// Make sure to include "board.h" to use SysConfig
//
#include "driverlib.h"
#include "device.h"
#include "board.h"
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize settings from SysConfig
//
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();
//
// Sync CPUs so the blinking starts at the same time, though the LEDs toggle at different frequency
//
IPC_sync(IPC_CPU2_L_CPU1_R, IPC_SYNC);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(CPU2_LED, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(CPU2_LED, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
//
// 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 "F2838x" --package "337bga" --part "F2838x_337bga" --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");
/**
* Write custom configuration values to the imported modules.
*/
ipc.ipcRegisterFlag = ["IPC_FLAG31"];
ipc.flagHandler31 = "IPC_SYNC";
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<system>
<project configuration="@match" id="project_0" name="led_ex2_blinky_sysconfig_cpu1">
</project>
<core id="C28xx_CPU1" project="project_0"/>
<project configuration="@match" id="project_1" name="led_ex2_blinky_sysconfig_cpu2">
</project>
<core id="C28xx_CPU2" project="project_1"/>
<preBuildSteps>
</preBuildSteps>
<postBuildSteps>
</postBuildSteps>
</system>
@@ -0,0 +1,48 @@
<projectSpec>
<project
name="memcfg_ex1_ram_management_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../memcfg_ex1_ram_management_cpu1.c" targetDirectory="" />
</project>
<project
name="memcfg_ex1_ram_management_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.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 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="CPU2_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" 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_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_RAM" />
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_shared_cpu2.cmd" targetDirectory="" applicableConfigurations="CPU2_FLASH" />
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
<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="../memcfg_ex1_ram_management_cpu2.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,67 @@
<projectSpec>
<project
name="memcfg_ex2_ram_sysconfig_multi"
configurations="
FLASH,
RAM,
"
device="TMS320F28388D"
outputType="system"
cgtVersion="22.6.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="memcfg_ex2_ram_sysconfig_cpu1"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU1"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU1 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU1 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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/source/f2838x_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="../memcfg_ex2_ram_sysconfig_cpu1.c" targetDirectory="" />
<file action="copy" path="../memcfg_ex2_ram_sysconfig_cpu1.syscfg" targetDirectory="" />
</project>
<project
name="memcfg_ex2_ram_sysconfig_cpu2"
device="TMS320F28388D"
cgtVersion="22.6.1.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --context CPU2"
>
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --define=CPU2 --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=CPU2 --define RAM -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --fp_mode=relaxed --define=DEBUG --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200" />
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib" 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/source/f2838x_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="../memcfg_ex2_ram_sysconfig_cpu2.c" targetDirectory="" />
<file action="copy" path="../memcfg_ex2_ram_sysconfig_cpu2.syscfg" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,353 @@
//#############################################################################
//
// FILE: memcfg_ex1_ram_management_cpu1.c
//
// TITLE: RAM Management Example
//
//! \addtogroup driver_dual_example_list
//! <h1> Shared RAM Management (CPU1)</h1>
//!
//! This example shows how to assign shared RAM for use by both the CPU2 and
//! CPU1 core. Shared RAM regions are defined in both the CPU2 and CPU1
//! linker files. In this example GS0 and GS14 are assigned to/owned by CPU2.
//! The remaining shared RAM regions are owned by CPU1.
//!
//! In this example, a pattern is written to cpu1RWArray and then an IPC flag
//! is sent to notify CPU2 that data is ready to be read. CPU2 then reads the
//! data from cpu2RArray and writes a modified pattern to cpu2RWArray. Once
//! CPU2 acknowledges the IPC flag, CPU1 reads the data from cpu1RArray and
//! compares with expected result.
//!
//! A timer ISR is also serviced in both CPUs. The ISRs are copied into the
//! shared RAM region owned by the respective CPUs. Each ISR toggles a GPIO.
//! Watch the GPIOs on an oscilloscope, or if using the controlCARD, watch
//! LED1 and LED2 blink at different rates.
//!
//! Following are the memory allocation details of CPU Timer interrupt ISRs &
//! read(R)/read write(RW) arrays in CPU1 & CPU2 as configured in the example.
//! - cpu1RWArray[] is mapped to shared RAM GS1
//! - cpu1RArray[] is mapped to shared RAM GS0
//! - cpu2RArray[] is mapped to shared RAM GS1
//! - cpu2RWArray[] is mapped to shared RAM GS0
//! - cpuTimer0ISR in CPU2 is copied to shared RAM GS14, toggles LED1
//! - cpuTimer0ISR in CPU1 is copied to shared RAM GS15, toggles LED2
//!
//! \b Watch \b Variables
//! - \e error Indicates that the data written is not correctly received by
//! the other CPU.
//!
//
//#############################################################################
//
//
//
// 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
//
uint16_t cpu1RArray[256]; // Mapped to GS0 of shared RAM owned by CPU2
uint16_t cpu1RWArray[256]; // Mapped to GS1 of shared RAM owned by CPU1
#pragma DATA_SECTION(cpu1RArray,"SHARERAMGS0");
#pragma DATA_SECTION(cpu1RWArray,"SHARERAMGS1");
uint16_t error;
uint16_t multiplier;
extern uint16_t isrfuncLoadStart;
extern uint16_t isrfuncLoadEnd;
extern uint16_t isrfuncRunStart;
extern uint16_t isrfuncLoadSize;
//
// Function Prototypes
//
void initCPUTimer(uint32_t);
void configCPUTimer(uint32_t, float, float);
__interrupt void cpuTimer0ISR(void);
#pragma CODE_SECTION(cpuTimer0ISR, "isrfunc")
void readDataCPU1(void);
void writeDataCPU1(void);
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Boot CPU2 core
//
#ifdef _FLASH
Device_bootCPU2(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
#else
Device_bootCPU2(BOOTMODE_BOOT_TO_M0RAM);
#endif
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
Device_initGPIO();
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
//
// Configure CPU ownership of the GPIOs
//
GPIO_setControllerCore(DEVICE_GPIO_PIN_LED1, GPIO_CORE_CPU2);
GPIO_setControllerCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CPU1);
//
// 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();
//
// Give memory access to GS0 and GS14 RAM to CPU2
//
MemCfg_setGSRAMControllerSel((MEMCFG_SECT_GS0 | MEMCFG_SECT_GS14),
MEMCFG_GSRAMCONTROLLER_CPU2);
//
// Give memory access to GS1 and GS15 RAM to CPU1
//
MemCfg_setGSRAMControllerSel((MEMCFG_SECT_GS1 | MEMCFG_SECT_GS15),
MEMCFG_GSRAMCONTROLLER_CPU1);
//
// Copy the ISR to a specified RAM location
//
memcpy(&isrfuncRunStart, &isrfuncLoadStart, (uint32_t)&isrfuncLoadSize);
//
// Interrupts that are used in this example are re-mapped to ISR functions
// found within this file.
//
Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
//
// Configure CPU Timer 0 to a 2 second period
//
initCPUTimer(CPUTIMER0_BASE);
configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, 2000000);
//
// Start CPU Timer 0
//
CPUTimer_startTimer(CPUTIMER0_BASE);
//
// Enable CPU Timer 0 interrupt
//
Interrupt_enable(INT_TIMER0);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
error = 0;
multiplier = 0;
writeDataCPU1();
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10);
//
// Loop indefinitely
//
for(;;)
{
//
// If there is no pending flag
//
if(IPC_isFlagBusyLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10) == 0)
{
readDataCPU1();
if(multiplier++ > 255)
{
multiplier = 0;
}
//
// Write an array to a memory location owned by CPU01
//
writeDataCPU1();
//
// Set a flag to notify CPU02 that data is available
//
IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG10);
}
}
}
//
// initCPUTimer - This function initializes a CPU Timer to a known state.
//
void initCPUTimer(uint32_t cpuTimer)
{
//
// Initialize timer period to maximum
//
CPUTimer_setPeriod(cpuTimer, 0xFFFFFFFF);
//
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Make sure timer is stopped
//
CPUTimer_stopTimer(cpuTimer);
//
// Reload all counter registers with period value
//
CPUTimer_reloadTimerCounter(cpuTimer);
}
//
// configCPUTimer - This function initializes the selected timer to the
// period specified by the "freq" and "period" parameters. The "freq" is
// entered as Hz and the period in microseconds. The timer is held in the
// stopped state after configuration.
//
void configCPUTimer(uint32_t cpuTimer, float freq, float period)
{
uint32_t temp;
//
// Initialize timer period:
//
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(cpuTimer, temp - 1);
//
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Initializes timer control register. The timer is stopped, reloaded,
// free run disabled, and interrupt enabled.
//
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
}
//
// cpuTimer0ISR - CPU Timer0 ISR
//
__interrupt void cpuTimer0ISR(void)
{
GPIO_togglePin(DEVICE_GPIO_PIN_LED2);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
//
// writeDataCPU1 - Write a pattern to an array in shared RAM
//
void writeDataCPU1(void)
{
uint16_t index;
//
// Use first location to write a multiplier.
//
cpu1RWArray[0] = multiplier;
for(index = 1; index < 256; index++)
{
cpu1RWArray[index] = index;
//
// The following code will attempt to write to a shared RAM assigned
// to CPU2 and as a result will cause an access violation.
//
// cpu1RArray[index] = 1000 + index;
}
}
//
// readDataCPU1 - Read and compare an array from shared RAM
//
void readDataCPU1(void)
{
uint16_t index;
if(cpu1RArray[0] == multiplier)
{
for(index = 1; index < 256; index++)
{
if(cpu1RArray[index] != multiplier * cpu1RWArray[index])
{
error = 1;
}
}
}
else
{
error = 1;
}
}
//
// End of File
//
Loaded 100 of 14950 files, more files were not shown because too many files have changed in this diff. Show more