Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
+47
@@ -0,0 +1,47 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="dcsm_ex1_cpu_cm_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_cpu_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_cm_memory_access"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --float_support=none --define=_FLASH -mv7M4 -me --diag_warning=225 " linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../dcsm_ex1_cm_memory_access.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,243 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: dcsm_ex1_cm_memory_access.c
|
||||
//
|
||||
// TITLE: DCSM CM Secure Memory Access
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> DCSM Memory Access by CM </h1>
|
||||
//!
|
||||
//! This example demonstrates how the access of the memory is affected
|
||||
//! when the memories are secured by CPU1.
|
||||
//! CPU1 allocate CM's C0RAM to zone 1 & CM's C1RAM to zone 2 using
|
||||
//! the 1st Zone Select Block.
|
||||
//!
|
||||
//! Zone1 | Zone2
|
||||
//! |
|
||||
//! CM's C0RAM | CM's C1RAM
|
||||
//! |
|
||||
//!
|
||||
//! 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 CM 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 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 CM'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_cm.h"
|
||||
#include "cm.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define PASS 0
|
||||
#define FAIL 1
|
||||
|
||||
uint16_t Zone1_Locked_Array[256]; // Mapped to C0RAM
|
||||
uint16_t Unsecure_mem_Array[256]; // Mapped to C1RAM
|
||||
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 CM cores - CPU1 has finished device init
|
||||
// and CM boot
|
||||
//
|
||||
IPC_sync(IPC_CM_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 CM cores - CM has finished device zone unlock
|
||||
//
|
||||
IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG11);
|
||||
|
||||
//
|
||||
// Initialize device and peripherals
|
||||
//
|
||||
CM_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 CM cores - CPU1 has finished checking
|
||||
// status of Zones
|
||||
//
|
||||
IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG11);
|
||||
|
||||
//
|
||||
// Locking the zone1
|
||||
//
|
||||
DCSM_secureZone1();
|
||||
|
||||
//
|
||||
// Synchronize CPU1 and CM cores - CPU1 has finished
|
||||
// checking status of Zones
|
||||
//
|
||||
IPC_sync(IPC_CM_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 CM cores - CPU1 has dummy read
|
||||
// the Zone1 CSM Password
|
||||
//
|
||||
IPC_sync(IPC_CM_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 CM'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,209 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: dcsm_ex1_cpu_access_control.c
|
||||
//
|
||||
// TITLE: DCSM master CPU Access control Example
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> DCSM Memory Access control by master CPU1</h1>
|
||||
//!
|
||||
//! This example demonstrates how to configure the 1st Zone Select Block
|
||||
//! in the OTP to allocate CM's C0RAM to zone 1 & CM's C1RAM to zone 2,
|
||||
//! later accessed by CM.
|
||||
//!
|
||||
//! Zone1 | Zone2
|
||||
//! |
|
||||
//! CM's C0RAM | CM's C1RAM
|
||||
//! |
|
||||
//!
|
||||
//! 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 CM.
|
||||
//! This would even do a dummy read of the password needed by CM to
|
||||
//! unsecure the memory. The communication between the 2 CPUs are done
|
||||
//! 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 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 CM's C0RAM to zone 1 , C1RAM to zone 2
|
||||
//! ZSBx_Z1_GRABRAM2R 0x0AAAAA09
|
||||
//! ZSBx_Z2_GRABRAM2R 0x0AAAAA06
|
||||
//! - 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 CM's Ram module allocated to zone
|
||||
//
|
||||
DCSM_MemoryStatus mem_status;
|
||||
|
||||
//
|
||||
//Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
//Boot CM core
|
||||
//
|
||||
#ifdef _FLASH
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
|
||||
#else
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
|
||||
#endif
|
||||
|
||||
//
|
||||
//Synchronize CPU1 and CM cores - CPU1 device init & CM boot complete
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG12);
|
||||
|
||||
//
|
||||
//Synchronize CPU1 and CM cores - CM has finished unlocking all
|
||||
//zones at start
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_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 CM's C0RAM & C1RAM
|
||||
//memories, only the status of these RAMs are checked.
|
||||
//
|
||||
//Getting the default status of the CM's C0RAM allocation
|
||||
//
|
||||
mem_status = DCSM_getRAMZone(DCSM_RAM_CM_C0,DCSM_CPUSEL_CM);
|
||||
if(mem_status!=DCSM_MEMORY_ZONE1) set_error++;
|
||||
|
||||
//
|
||||
//Getting the default status of the CM's C1RAM allocation
|
||||
//
|
||||
mem_status = DCSM_getRAMZone(DCSM_RAM_CM_C1,DCSM_CPUSEL_CM);
|
||||
if(mem_status!=DCSM_MEMORY_ZONE2) set_error++;
|
||||
|
||||
//
|
||||
//Synchronize CPU1 and CM cores - CM has finished writing to the memories
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG11);
|
||||
|
||||
//
|
||||
//Synchronize CPU1 and CM cores - CM's memories are secure
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_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 CM writes to the CSM key to unlock the memories
|
||||
//
|
||||
DCSM_readZone1CSMPwd();
|
||||
|
||||
//
|
||||
//Synchronize CPU1 and CM cores - CPU1 dummy read of the Zone 1
|
||||
//CSM password before the CM writes to the CSM key complete
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_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,154 @@
|
||||
;;#############################################################################
|
||||
;;
|
||||
;; FILE: dcsm_ex1_f2838x_dcsm_z1otp.asm
|
||||
;;
|
||||
;; TITLE: Dual Code Security Module Zone 1 OTP for CM'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 CM's C0RAM 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 0x0AAAAA09 ;Z1OTP_GRABRAM2
|
||||
;; .long 0x000AAAAA ;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 CM'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 CM's C1RAM 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 0x0AAAAA06 ;Z2OTP_GRABRAM2
|
||||
;; .long 0x000AAAAA ;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
|
||||
;;#############################################################################
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="empty_c28x_cm_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 --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=0x100 --heap_size=0x200" />
|
||||
<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="../../../../../../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="../empty_c28x_cm_driverlib_main_cpu1.c" targetDirectory="" />
|
||||
</project>
|
||||
<project
|
||||
name="empty_c28x_cm_driverlib_project_cm"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --float_support=none -mv7M4 -me --diag_warning=225 " linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a --define RAM" />
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --float_support=none --define=_FLASH -mv7M4 -me --diag_warning=225 " linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" applicableConfigurations="CM_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="CM_FLASH" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../empty_c28x_cm_driverlib_main_cm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: empty_c28x_cm_driverlib_main_cm.c
|
||||
//
|
||||
// TITLE: Empty Project
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CM Empty Project Example </h1>
|
||||
//!
|
||||
//! This example is an empty project setup for Driverlib development for CM.
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// 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_cm.h"
|
||||
#include "cm.h"
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: empty_c28x_cm_driverlib_main_cpu1.c
|
||||
//
|
||||
// TITLE: Empty Project
|
||||
//
|
||||
//! \addtogroup driver_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
|
||||
//
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="ethernet_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="../ethernet_ipc_ex1_basic_c28x1.c" targetDirectory="" />
|
||||
</project>
|
||||
<project
|
||||
name="ethernet_ipc_ex1_basic_cm"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" applicableConfigurations="CM_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="CM_FLASH" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../ethernet_ipc_ex1_basic_cm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,234 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ethernet_ipc_ex1_basic_c28x1.c
|
||||
//
|
||||
// TITLE: Ethernet IPC example with interrupt
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> Ethernet + IPC basic message passing example with interrupt </h1>
|
||||
//!
|
||||
//! This example demonstrates how to configure IPC and pass information from
|
||||
//! C28x to CM core without message queues. This configures the Pinmux for Ethernet
|
||||
//! Prepares the Ethernet frame that is sent to the CM core
|
||||
//! over IPC Message RAM. Uses the IPC command interface to signal
|
||||
//! the IPC Command, Packet address, Packet Length which is used by CM
|
||||
//! side code to send it on the Ethernet Line, which is acknowledged by
|
||||
//! the CM core side code over IPC on succesfully receiving a packet
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM core.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - Connections for Ethernet in MII mode
|
||||
//!
|
||||
//! \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
|
||||
|
||||
#define PACKET_LENGTH 132
|
||||
#pragma DATA_SECTION(packetData, "MSGRAM_CPU_TO_CM")
|
||||
uint8_t packetData[PACKET_LENGTH];
|
||||
|
||||
uint32_t pass;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Boot CM core
|
||||
//
|
||||
#ifdef _FLASH
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
|
||||
#else
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
|
||||
#endif
|
||||
|
||||
//
|
||||
//Set up EnetCLK to use SYSPLL as the clock source and set the
|
||||
//clock divider to 2.
|
||||
//
|
||||
//This way we ensure that the PTP clock is 100 MHz. Note that this value
|
||||
//is not automatically/dynamically known to the CM core and hence it needs
|
||||
//to be made available to the CM side code beforehand.
|
||||
//
|
||||
SysCtl_setEnetClk(SYSCTL_ENETCLKOUT_DIV_2, SYSCTL_SOURCE_SYSPLL);
|
||||
|
||||
//
|
||||
// Configure the GPIOs for ETHERNET.
|
||||
//
|
||||
|
||||
//
|
||||
// MDIO Signals
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_105_ENET_MDIO_CLK);
|
||||
GPIO_setPinConfig(GPIO_106_ENET_MDIO_DATA);
|
||||
|
||||
//
|
||||
// Use this only for RMII Mode
|
||||
//GPIO_setPinConfig(GPIO_73_ENET_RMII_CLK);
|
||||
//
|
||||
|
||||
//
|
||||
//MII Signals
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_109_ENET_MII_CRS);
|
||||
GPIO_setPinConfig(GPIO_110_ENET_MII_COL);
|
||||
|
||||
GPIO_setPinConfig(GPIO_75_ENET_MII_TX_DATA0);
|
||||
GPIO_setPinConfig(GPIO_122_ENET_MII_TX_DATA1);
|
||||
GPIO_setPinConfig(GPIO_123_ENET_MII_TX_DATA2);
|
||||
GPIO_setPinConfig(GPIO_124_ENET_MII_TX_DATA3);
|
||||
|
||||
//
|
||||
//Use this only if the TX Error pin has to be connected
|
||||
//GPIO_setPinConfig(GPIO_46_ENET_MII_TX_ERR);
|
||||
//
|
||||
|
||||
GPIO_setPinConfig(GPIO_118_ENET_MII_TX_EN);
|
||||
|
||||
GPIO_setPinConfig(GPIO_114_ENET_MII_RX_DATA0);
|
||||
GPIO_setPinConfig(GPIO_115_ENET_MII_RX_DATA1);
|
||||
GPIO_setPinConfig(GPIO_116_ENET_MII_RX_DATA2);
|
||||
GPIO_setPinConfig(GPIO_117_ENET_MII_RX_DATA3);
|
||||
GPIO_setPinConfig(GPIO_113_ENET_MII_RX_ERR);
|
||||
GPIO_setPinConfig(GPIO_112_ENET_MII_RX_DV);
|
||||
|
||||
GPIO_setPinConfig(GPIO_44_ENET_MII_TX_CLK);
|
||||
GPIO_setPinConfig(GPIO_111_ENET_MII_RX_CLK);
|
||||
|
||||
//
|
||||
//Power down pin to bring the external PHY out of Power down
|
||||
//
|
||||
GPIO_setDirectionMode(108, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(108, GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_writePin(108,1);
|
||||
|
||||
//
|
||||
//PHY Reset Pin to be driven High to bring external PHY out of Reset
|
||||
//
|
||||
|
||||
GPIO_setDirectionMode(119, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(119, GPIO_PIN_TYPE_PULLUP);
|
||||
GPIO_writePin(119,1);
|
||||
|
||||
//
|
||||
//Form the unicast Ethernet Packet in Memory
|
||||
//
|
||||
for(i=0;i<PACKET_LENGTH/4;i++)
|
||||
{
|
||||
//
|
||||
//First 6 bytes of the packet are the MAC Destination Address
|
||||
//Bytes, the Destination and CRC shall be inserted by the hardware
|
||||
//
|
||||
if(i == 0)
|
||||
*((uint32_t *)packetData + i) = 0x01020304;
|
||||
else if(i == 1)
|
||||
*((uint32_t *)packetData + i) = 0xFFFF0506;
|
||||
else
|
||||
HWREG((uint32_t *)packetData +i) = i;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear any IPC flags if set already
|
||||
//
|
||||
IPC_clearFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Synchronize both the cores.
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG31);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Send a message without message queue
|
||||
// Since C28x and CM does not share the same address space for shared RAM,
|
||||
// ADDRESS_CORRECTION is enabled
|
||||
// Length of the data to be read is passed as data.
|
||||
//
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
|
||||
IPC_CMD_READ_MEM, (uint32_t)packetData, PACKET_LENGTH);
|
||||
|
||||
//
|
||||
// Wait for acknowledgment
|
||||
//
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG0);
|
||||
|
||||
//
|
||||
// Read response
|
||||
//
|
||||
if(IPC_getResponse(IPC_CPU1_L_CM_R) == TEST_PASS)
|
||||
{
|
||||
pass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pass = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// End of example. Loop forever
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,279 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ethernet_ipc_ex1_basic_cm.c
|
||||
//
|
||||
// TITLE: Ethernet + IPC example with interrupt
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> Ethernet + IPC basic message passing example with interrupt </h1>
|
||||
//!
|
||||
//! This example demonstrates how to receive the message passed from C28x side
|
||||
//! containing the Ethernet Packet over IPC,sends the packet on Ethernet
|
||||
//! acknowledge the packet received over IPC to C28x core.
|
||||
//! This extends the IPC Example. Uses IPC C28x to CM core
|
||||
//! without message queues. It can be used as a reference for flow using Ethernet
|
||||
//! and IPC together. If the Packet data received over Ethernet is to be passed
|
||||
//! to C28x for control applications, it can send IPC message to C28x.
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM core.
|
||||
//! The example actually uses the internal loopback mode of MAC hence the MII
|
||||
//! Tx and Rx signals are not used, but needs the MII Tx and Rx Clock signals
|
||||
//! which comes from the External PHY.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - MII connections on Control card
|
||||
//!
|
||||
//! \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_cm.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define IPC_CMD_READ_MEM 0x1001
|
||||
#define IPC_CMD_RESP 0x2001
|
||||
|
||||
#define TEST_PASS 0x5555
|
||||
#define TEST_FAIL 0xAAAA
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define PACKET_LENGTH 132
|
||||
|
||||
|
||||
#define ETHERNET_NO_OF_RX_PACKETS 1U
|
||||
//
|
||||
//Change this define for changing Packet buffer length
|
||||
//
|
||||
#define ETHERNET_MAX_PACKET_LENGTH 1538U
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint8_t pData[PACKET_LENGTH];
|
||||
uint8_t Ethernet_rxBuffer[ETHERNET_NO_OF_RX_PACKETS *
|
||||
ETHERNET_MAX_PACKET_LENGTH];
|
||||
Ethernet_Handle emac_handle;
|
||||
Ethernet_Pkt_Desc pktDesc;
|
||||
extern uint32_t Ethernet_rxInterruptCount;
|
||||
bool status = false;
|
||||
|
||||
//
|
||||
// IPC ISR for Flag 0.
|
||||
// C28x core sends data without message queue using Flag 0
|
||||
//
|
||||
void IPC_ISR0()
|
||||
{
|
||||
uint32_t command, addr, data;
|
||||
|
||||
|
||||
//
|
||||
// Read the command
|
||||
//
|
||||
IPC_readCommand(IPC_CM_L_CPU1_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
|
||||
&command, &addr, &data);
|
||||
|
||||
if(command == IPC_CMD_READ_MEM)
|
||||
{
|
||||
status = true;
|
||||
//
|
||||
//Read the buffer address and Length
|
||||
//from the IPC message
|
||||
//
|
||||
pktDesc.dataBuffer = (uint8_t *)addr;
|
||||
pktDesc.bufferLength = data;
|
||||
pktDesc.pktLength = data;
|
||||
pktDesc.validLength = data;
|
||||
//
|
||||
//Send the packet on receiving Message from C28x side
|
||||
//
|
||||
Ethernet_sendPacket(emac_handle,&pktDesc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Ethernet_InitInterfaceConfig initInterfaceConfig;
|
||||
Ethernet_InitConfig *pInitCfg;
|
||||
|
||||
//
|
||||
//Select the MII interface of the module
|
||||
//
|
||||
initInterfaceConfig.ssbase = EMAC_SS_BASE;
|
||||
initInterfaceConfig.enet_base = EMAC_BASE;
|
||||
initInterfaceConfig.phyMode = ETHERNET_SS_PHY_INTF_SEL_MII;
|
||||
//
|
||||
//Assign SoC specific functions for Enabling,Disabling interrupts
|
||||
//and for enabling the Peripheral at system level
|
||||
//
|
||||
initInterfaceConfig.ptrPlatformInterruptDisable = &Platform_disableInterrupt;
|
||||
initInterfaceConfig.ptrPlatformInterruptEnable = &Platform_enableInterrupt;
|
||||
initInterfaceConfig.ptrPlatformPeripheralEnable = &Platform_enablePeripheral;
|
||||
initInterfaceConfig.ptrPlatformPeripheralReset = &Platform_resetPeripheral;
|
||||
//
|
||||
//Assign the peripheral number at the SoC
|
||||
//
|
||||
initInterfaceConfig.peripheralNum = SYSCTL_PERIPH_CLK_ENET;
|
||||
//
|
||||
//Assign the default SoC specific interrupt numbers of Ethernet interrupts
|
||||
//
|
||||
initInterfaceConfig.interruptNum[0] = INT_EMAC;
|
||||
initInterfaceConfig.interruptNum[1] = INT_EMAC_TX0;
|
||||
initInterfaceConfig.interruptNum[2] = INT_EMAC_TX1;
|
||||
initInterfaceConfig.interruptNum[3] = INT_EMAC_RX0;
|
||||
initInterfaceConfig.interruptNum[4] = INT_EMAC_RX1;
|
||||
|
||||
pInitCfg = Ethernet_initInterface(initInterfaceConfig);
|
||||
|
||||
//
|
||||
// Get an initial configuration of known good parameters
|
||||
//
|
||||
Ethernet_getInitConfig(pInitCfg);
|
||||
|
||||
//
|
||||
//Configure the Loopback mode
|
||||
//
|
||||
pInitCfg->loopbackMode = ETHERNET_MAC_CONFIGURATION_LM_LOOPBACK_ENABLED;
|
||||
|
||||
//
|
||||
//Assign the callbacks for Getting packet buffer when needed
|
||||
//Releasing the TxPacketBuffer on Transmit interrupt callbacks
|
||||
//Receive packet callback on Receive packet completion interrupt
|
||||
//
|
||||
pInitCfg->pfcbGetPacket = &Ethernet_getPacketBuffer;
|
||||
pInitCfg->pfcbFreePacket = &Ethernet_releaseTxPacketBuffer;
|
||||
pInitCfg->pfcbRxPacket = &Ethernet_receivePacketCallback;
|
||||
//
|
||||
//Assign the Buffer to be used by the Low level driver for receiving
|
||||
//Packets. This should be accessible by the Ethernet DMA
|
||||
//
|
||||
pInitCfg->rxBuffer = Ethernet_rxBuffer;
|
||||
|
||||
//
|
||||
//The Application handle is not used by this application
|
||||
//Hence using a dummy value of 1
|
||||
//
|
||||
Ethernet_getHandle((Ethernet_Handle)1,pInitCfg , &emac_handle);
|
||||
//
|
||||
//Do global Interrupt Enable
|
||||
//
|
||||
(void)Interrupt_enableInProcessor();
|
||||
//
|
||||
//Assign default ISRs
|
||||
//
|
||||
Interrupt_registerHandler(INT_EMAC_TX0, Ethernet_transmitISR);
|
||||
Interrupt_registerHandler(INT_EMAC_RX0, Ethernet_receiveISR);
|
||||
//
|
||||
//Enable the default interrupt handlers
|
||||
//
|
||||
Interrupt_enable(INT_EMAC_TX0);
|
||||
Interrupt_enable(INT_EMAC_RX0);
|
||||
|
||||
//
|
||||
//Prepare a Packet Descriptor structure to send a packet
|
||||
//This contains a single buffer packet
|
||||
//The Source address shall be inserted by the MAC
|
||||
//Packet CRC is auto computed by the module and appended in the packet
|
||||
//
|
||||
|
||||
pktDesc.dataOffset = 0;
|
||||
pktDesc.nextPacketDesc = 0;
|
||||
pktDesc.flags = ETHERNET_PKT_FLAG_SOP |ETHERNET_PKT_FLAG_EOP|ETHERNET_PKT_FLAG_SA_INS;
|
||||
pktDesc.pktChannel = ETHERNET_DMA_CHANNEL_NUM_0;
|
||||
|
||||
pktDesc.numPktFrags = 1;
|
||||
|
||||
//
|
||||
// Clear any IPC flags if set already
|
||||
//
|
||||
IPC_clearFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Enable IPC interrupts
|
||||
//
|
||||
IPC_registerInterrupt(IPC_CM_L_CPU1_R, IPC_INT0, IPC_ISR0);
|
||||
|
||||
//
|
||||
// Synchronize both the cores.
|
||||
//
|
||||
IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG31);
|
||||
|
||||
//
|
||||
//At this point the C28x core shall send IPC command
|
||||
//which triggers the IPC ISR where the packet is sent
|
||||
//With internal loopback the packet is looped back
|
||||
//Wait for the packet to be received
|
||||
//
|
||||
|
||||
while(0 == Ethernet_rxInterruptCount);
|
||||
|
||||
//
|
||||
//The control data to C28x side can be picked up from Ethernet buffer and
|
||||
//Passed to Ethernet
|
||||
//
|
||||
// Send response to C28x core
|
||||
//
|
||||
if(status)
|
||||
{
|
||||
IPC_sendResponse(IPC_CM_L_CPU1_R, TEST_PASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPC_sendResponse(IPC_CM_L_CPU1_R, TEST_FAIL);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the flag
|
||||
//
|
||||
IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG0);
|
||||
|
||||
__asm(" bkpt #0");
|
||||
|
||||
}
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="flash_kernel_c28x_cm_ex1_c28x1"
|
||||
device = "TMS320F28388D"
|
||||
cgtVersion= "20.2.1.LTS"
|
||||
enableHexTool="True"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
postBuildStep=""${CG_TOOL_HEX}" "${BuildArtifactFileName}" -boot -sci8 -a -o "${BuildArtifactFileBaseName}.txt""
|
||||
>
|
||||
<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/ccs/Debug/driverlib.lib" />
|
||||
<file action="link" path="../../../../driverlib/interrupt.c" />
|
||||
<file action="link" path="../../../../driverlib/gpio.c" />
|
||||
<file action="copy" path = "../../../../../../device_support/f2838x/common/cmd/flash_programming_cpu1tocm_RAM_2838.cmd"/>
|
||||
<file action="copy" path = "../f2838x_codestartbranch_cpu1.asm"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_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_cm_ex1_sci_boot_cpu1.c"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_ex1_sci_get_function_cpu1.c"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_ex1_boot_cpu1.c"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_ex1_erase_cpu1.c"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_ex1_erase_cpu1.h"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_ex1_verify_cpu1.c"/>
|
||||
<file action="copy" path = "../flash_kernel_c28x_cm_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"/>
|
||||
</project>
|
||||
<project
|
||||
name="flash_kernel_c28x_cm_ex1_cm"
|
||||
device = "Cortex M.TMS320F28388D"
|
||||
cgtVersion= "20.2.1.LTS"
|
||||
enableHexTool="True"
|
||||
endianness="little"
|
||||
linkerCommandFile=""
|
||||
postBuildStep=""${CG_TOOL_HEX}" "${BuildArtifactFileName}" -boot -gpio8 -a -o "${BuildArtifactFileBaseName}.txt""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="
|
||||
--opt_level=off
|
||||
-I${C2000WARE_CM_DLIB_ROOT}
|
||||
-I${Flash_CM_EXAMPLE_ROOT}
|
||||
-I${BootROM_CM_INC_PATH}
|
||||
-I${FlashAPI_CM_INCLUDE_ROOT}
|
||||
-I${PROJECT_ROOT}/device
|
||||
-mv7M4
|
||||
--define=CM
|
||||
--diag_warning=225
|
||||
--diag_suppress=10063
|
||||
--display_error_number"
|
||||
linkerBuildOptions="--stack_size=1024 --heap_size=1024 --library=libc.a"
|
||||
hexBuildOptions="--boot --gpio8 --ascii --outfile=${BuildArtifactFileBaseName}.txt" />
|
||||
<pathVariable name="C2000WARE_CM_DLIB_ROOT" path="../../../../../f2838x/driverlib_cm" scope="project"/>
|
||||
<pathVariable name="Flash_CM_EXAMPLE_ROOT" path="../../../../../f2838x/examples/cm/flash" scope="project"/>
|
||||
<pathVariable name="BootROM_CM_INC_PATH" path="../../../../../../libraries/boot_rom/f2838x/revA/rom_sources/cm/F2838x_ROM/driverlib_cm/inc_cm" scope="project"/>
|
||||
<pathVariable name="FlashAPI_CM_INCLUDE_ROOT" path="../../../../../../libraries/flash_api/f2838x/cm/include/FlashAPI" scope="project"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_sci_flash_kernel_cm.c"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_erase_cm.h"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_erase_cm.c"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_sci_boot_cm.c"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_boot_cm.c"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_verify_cm.h"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_verify_cm.c"/>
|
||||
<file action="copy" path="../flash_kernel_c28x_cm_ex1_sci_get_function_cm.c"/>
|
||||
<file action="copy" path="../f2838x_kernel_commands_cm.h"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/F2838x_RAM_sci_flash_kernel_cm.cmd"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.c" targetDirectory = "device"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory = "device"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory = "device"/>
|
||||
<file action="link" path="../../../../driverlib_cm/ccs/Debug/driverlib_cm.lib" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/sysctl.c"/>
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/inc/hw_sysctl.h"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs"/>
|
||||
<file action="link" path="../../../../../../libraries/flash_api/f2838x/cm/lib/F2838x_CM_FlashAPI.lib"/>
|
||||
<file action="copy" path="../../../../../../libraries/boot_rom/f2838x/revA/rom_sources/cm/F2838x_ROM/bootROM/include/cmbootrom.h"/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
+905
@@ -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(0x00039400,0, 0x400, "R|W|AS2",0); /* CPU1TOCMSGRAM1 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 ***/
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
;//###########################################################################
|
||||
;//
|
||||
;// 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,98 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: f2838x_kernel_commands_cm.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_CM_H_
|
||||
#define F2838X_KERNEL_COMMANDS_CM_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 RUN_CPU1_LOAD_CM 0x0030
|
||||
#define RESET_CPU1_LOAD_CM 0x0040
|
||||
#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 checksum_enable 1
|
||||
|
||||
#endif /* F2838X_KERNEL_COMMANDS_CM_H_ */
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: f2838x_kernel_commands_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 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 RUN_CPU1_LOAD_CM 0x0030
|
||||
#define RESET_CPU1_LOAD_CM 0x0040
|
||||
#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_ */
|
||||
+595
@@ -0,0 +1,595 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_boot.c
|
||||
//
|
||||
// TITLE: CM application load functions
|
||||
//! <h1> CM application load 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_programming_f2838x_cm.h" // Flash API example header file
|
||||
#include "cmbootrom.h"
|
||||
#include "F021_F2838x_CM.h"
|
||||
#include "f2838x_kernel_commands_cm.h"
|
||||
#include <assert.h>
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
#define BUFFER_SIZE 0x100 // Must be a multiple
|
||||
// of 128 bits, or 8 words,
|
||||
// BUFFER_SIZE % 8 == 0
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
|
||||
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 uint16_t sciaGetWordData(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);
|
||||
extern void callSCIFunctionFromCPU1(uint16_t command, uint16_t parameter1, uint16_t parameter2,
|
||||
uint16_t parameter3, uint16_t parameter4, uint16_t parameter5,
|
||||
uint16_t parameter6, uint16_t parameter7, uint16_t parameter8);
|
||||
extern uint16_t dataFromCPU1[11];
|
||||
|
||||
//
|
||||
// copyData - This routine copies multiple blocks of data from the host
|
||||
// to the specified Flash locations. The data is first copied from
|
||||
// the host to a buffer in RAM, and from there written into Flash in
|
||||
// 128 bit increments.
|
||||
// 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;
|
||||
|
||||
uint8_t Buffer[BUFFER_SIZE];
|
||||
uint8_t miniBuffer[16]; //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 fail = 0;
|
||||
uint16_t bytesWritten = 0;
|
||||
|
||||
assert(BUFFER_SIZE % 16 == 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
|
||||
callSCIFunctionFromCPU1(2, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Get the size in words of the first block
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
BlockHeader.BlockSize = dataFromCPU1[0];
|
||||
|
||||
//
|
||||
// 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)0x0000)
|
||||
{
|
||||
Fapi_StatusType oReturnCheck;
|
||||
Fapi_FlashStatusWordType oFlashStatusWord;
|
||||
Fapi_FlashStatusType oFlashStatus;
|
||||
|
||||
BlockHeader.DestAddr = getLongData();
|
||||
|
||||
for(i = 0; i < BlockHeader.BlockSize; i += 0)
|
||||
{
|
||||
//the entire block can fit into the buffer, so all the data in
|
||||
//the block will be copied over into the buffer in RAM
|
||||
if(BlockHeader.BlockSize < BUFFER_SIZE)
|
||||
{
|
||||
for(j = 0; j < BlockHeader.BlockSize; j++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
i++;
|
||||
}
|
||||
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
|
||||
{
|
||||
Buffer[j] = 0xFF;
|
||||
}
|
||||
}
|
||||
//BlockHeader.BlockSize >= BUFFER_SIZE
|
||||
//The entire block cannot fit into the buffer in RAM, so the buffer
|
||||
//will be filled up and written into Flash in increments until the
|
||||
//entire block is filled up
|
||||
else
|
||||
{
|
||||
if((BlockHeader.BlockSize - i) < BUFFER_SIZE)
|
||||
{
|
||||
for(j = 0; j < BlockHeader.BlockSize - i; j++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
}
|
||||
i += j; // increment i outside here so it doesn't affect
|
||||
// loop above
|
||||
for(; j < BUFFER_SIZE; j++) //fill the rest with 0xFF
|
||||
{
|
||||
Buffer[j] = 0xFF;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j = 0; j < BUFFER_SIZE; j++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(k = 0; k < (BUFFER_SIZE / 16); k++)
|
||||
{
|
||||
miniBuffer[0] = Buffer[k * 16 + 0];
|
||||
miniBuffer[1] = Buffer[k * 16 + 1];
|
||||
miniBuffer[2] = Buffer[k * 16 + 2];
|
||||
miniBuffer[3] = Buffer[k * 16 + 3];
|
||||
miniBuffer[4] = Buffer[k * 16 + 4];
|
||||
miniBuffer[5] = Buffer[k * 16 + 5];
|
||||
miniBuffer[6] = Buffer[k * 16 + 6];
|
||||
miniBuffer[7] = Buffer[k * 16 + 7];
|
||||
miniBuffer[8] = Buffer[k * 16 + 8];
|
||||
miniBuffer[9] = Buffer[k * 16 + 9];
|
||||
miniBuffer[10] = Buffer[k * 16 + 10];
|
||||
miniBuffer[11] = Buffer[k * 16 + 11];
|
||||
miniBuffer[12] = Buffer[k * 16 + 12];
|
||||
miniBuffer[13] = Buffer[k * 16 + 13];
|
||||
miniBuffer[14] = Buffer[k * 16 + 14];
|
||||
miniBuffer[15] = Buffer[k * 16 + 15];
|
||||
//
|
||||
// check if there are bytes left to be written
|
||||
//
|
||||
if(bytesWritten < 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)
|
||||
{
|
||||
if(fail == 0) //first fail
|
||||
{
|
||||
statusCode.status = BLANK_ERROR;
|
||||
statusCode.address = oFlashStatusWord.au32StatusWord[0];
|
||||
setFlashAPIError(oReturnCheck);
|
||||
statusCode.flashAPIFsmStatus = oFlashStatus;
|
||||
}
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fail == 0)
|
||||
{
|
||||
//
|
||||
//program 16 bytes 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)
|
||||
{
|
||||
if(fail == 0) //first fail
|
||||
{
|
||||
statusCode.status = PROGRAM_ERROR;
|
||||
statusCode.address = BlockHeader.DestAddr;
|
||||
setFlashAPIError(oReturnCheck);
|
||||
statusCode.flashAPIFsmStatus = oFlashStatus;
|
||||
}
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
for(j = 0; j < 16; j += 4)
|
||||
{
|
||||
uint32_t toVerify = miniBuffer[j+3];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j+2];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j+1];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j];
|
||||
if(fail == 0)
|
||||
{
|
||||
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 += 0x10;
|
||||
bytesWritten += 0x10;
|
||||
} //for(int k); loads miniBuffer with Buffer elements
|
||||
#if checksum_enable
|
||||
callSCIFunctionFromCPU1(2, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
//
|
||||
//get the size of the next block
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
BlockHeader.BlockSize = dataFromCPU1[0];
|
||||
bytesWritten = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// findSector - 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.
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// findSector - 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;
|
||||
}
|
||||
|
||||
//
|
||||
// getLongData - 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
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
uint16_t wordData = dataFromCPU1[0];
|
||||
longData = ((uint32_t)wordData << 16);
|
||||
|
||||
//
|
||||
// Fetch the lower 1/2 of the 32-bit value
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
wordData = dataFromCPU1[0];
|
||||
longData |= wordData;
|
||||
|
||||
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++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
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
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+618
@@ -0,0 +1,618 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_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
|
||||
//
|
||||
|
||||
//
|
||||
// Must be a multiple
|
||||
// of 128 bits, or 8 words,
|
||||
// BUFFER_SIZE % 8 == 0
|
||||
//
|
||||
#define BUFFER_SIZE 0x80
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
// 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;
|
||||
|
||||
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);
|
||||
extern uint16_t sciaGetWordData(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];
|
||||
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);
|
||||
//
|
||||
// oFlashStatus not checked for Verify
|
||||
//
|
||||
statusCode.flashAPIFsmStatus = 0;
|
||||
}
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BlockHeader.DestAddr += 0x8;
|
||||
wordsWritten += 0x8;
|
||||
}
|
||||
#if checksum_enable
|
||||
sciSendChecksum();
|
||||
#endif
|
||||
}
|
||||
//
|
||||
//get the size of the next block
|
||||
//
|
||||
BlockHeader.BlockSize = (*getWordData)();
|
||||
wordsWritten = 0;
|
||||
}
|
||||
EDIS;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// findSector - 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
|
||||
{
|
||||
//
|
||||
// a proxy address to signify that it is not
|
||||
// a flash sector.
|
||||
//
|
||||
return(0xdeadbeef);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// findSize - 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);
|
||||
}
|
||||
|
||||
//
|
||||
// getLongData - 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
|
||||
//
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_erase.c
|
||||
//
|
||||
// TITLE: CM erase functions
|
||||
//! <h1> CM 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_cm_ex1_erase_cm.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,
|
||||
Bzero_Sector7_start,
|
||||
Bzero_Sector8_start,
|
||||
Bzero_Sector9_start,
|
||||
Bzero_Sector10_start,
|
||||
Bzero_Sector11_start,
|
||||
Bzero_Sector12_start,
|
||||
Bzero_Sector13_start };
|
||||
|
||||
const uint16_t sectSize[14] = { Sector16KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector64KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector16KB_u32length,
|
||||
Sector16KB_u32length };
|
||||
extern void setFlashAPIError(Fapi_StatusType status);
|
||||
//
|
||||
// cmErase - This routine takes the 32-bit sectors variable as
|
||||
// a parameter. Each bit corresponds to a sector,
|
||||
// starting with bit 0 and sector 0. This routine
|
||||
// attempts to erase the sectors specified.
|
||||
//
|
||||
void cmErase(uint32_t sectors)
|
||||
{
|
||||
statusCode.status = NO_ERROR;
|
||||
statusCode.address = 0x12345678;
|
||||
statusCode.flashAPIError = NO_ERROR;
|
||||
statusCode.flashAPIFsmStatus = 0;
|
||||
|
||||
int i = 0;
|
||||
Fapi_StatusType oReturnCheck;
|
||||
Fapi_FlashStatusType oFlashStatus;
|
||||
Fapi_FlashStatusWordType oFlashStatusWord;
|
||||
|
||||
int fail = 0;
|
||||
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 || oFlashStatus != 0)
|
||||
{
|
||||
if(fail == 0) //first fail
|
||||
{
|
||||
statusCode.status = BLANK_ERROR;
|
||||
statusCode.address = oFlashStatusWord.au32StatusWord[0];
|
||||
setFlashAPIError(oReturnCheck);
|
||||
statusCode.flashAPIFsmStatus = oFlashStatus;
|
||||
|
||||
}
|
||||
fail++;
|
||||
}
|
||||
|
||||
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy)
|
||||
{
|
||||
}
|
||||
}
|
||||
sectors = sectors >> 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_erase.h
|
||||
//
|
||||
// TITLE: CM 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_CM_EX1_ERASE_H__
|
||||
#define __FLASH_KERNEL_C28X_CM_EX1_ERASE_H__
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "F021_F2838x_CM.h"
|
||||
#include "flash_programming_f2838x_cm.h" // Flash API example header file
|
||||
|
||||
#include "Types.h"
|
||||
#include "cmbootrom.h"
|
||||
#include "f2838x_kernel_commands_cm.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void cmErase(uint32_t sectors);
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_erase_cpu1.c
|
||||
//
|
||||
// TITLE: Erase Source Code
|
||||
//! <h1> Erase Source Code </h1>
|
||||
//! Functions:
|
||||
//!
|
||||
//! void sciErase(uint32_t sectors)
|
||||
//
|
||||
//
|
||||
//###########################################################################
|
||||
//
|
||||
// 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_cm_ex1_erase_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
|
||||
|
||||
void setFlashAPIError(Fapi_StatusType status);
|
||||
|
||||
//
|
||||
// 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_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
|
||||
//
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_erase_cpu1.h
|
||||
//
|
||||
// TITLE: Erase Function Protoypes
|
||||
//
|
||||
// Functions:
|
||||
//
|
||||
// void sciErase(uint32_t sectors)
|
||||
//
|
||||
//
|
||||
//###########################################################################
|
||||
//
|
||||
// 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_CM_EX1_ERASE_H__
|
||||
#define __FLASH_KERNEL_C28X_CM_EX1_ERASE_H__
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "F021_F2838x_C28x.h"
|
||||
#include "flash_programming_f2838x_c28x.h"
|
||||
#include "Types.h"
|
||||
#include "cpu1bootrom.h"
|
||||
#include "f2838x_kernel_commands_cpu1.h"
|
||||
#include <assert.h>
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void sciErase(uint32_t sectors);
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_sci_boot.c
|
||||
//
|
||||
// TITLE: SCI Boot Functions
|
||||
//! <h1> SCI Boot 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 "cmbootrom.h"
|
||||
#include "f2838x_kernel_commands_cm.h"
|
||||
#include "ipc.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t status;
|
||||
uint32_t address;
|
||||
uint16_t flashAPIError;
|
||||
uint32_t flashAPIFsmStatus;
|
||||
} StatusCode;
|
||||
extern StatusCode statusCode;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
extern uint16_t SCIA_GetWordData(void);
|
||||
extern uint16_t SCIA_GetWordData_CM(void);
|
||||
extern void copyData(void);
|
||||
extern uint32_t getLongData(void);
|
||||
extern void readReservedFn(void);
|
||||
extern void exampleError(Fapi_StatusType status);
|
||||
uint32_t ipcBootApplication(void);
|
||||
extern uint16_t dataFromCPU1[10];
|
||||
extern void callSCIFunctionFromCPU1(uint16_t command, uint16_t parameter1, uint16_t parameter2,
|
||||
uint16_t parameter3, uint16_t parameter4, uint16_t parameter5,
|
||||
uint16_t parameter6, uint16_t parameter7, uint16_t parameter8);
|
||||
|
||||
|
||||
//
|
||||
// ipcBootApplication - This module is the application boot routine.
|
||||
// It reads in the application by calling SCI
|
||||
// functions via CPU1 and reading the output of
|
||||
// the functions from IPC Message RAM.
|
||||
//
|
||||
// It will return a entry point address back
|
||||
// to the InitBoot routine which in turn calls
|
||||
// the ExitBoot routine.
|
||||
//
|
||||
uint32_t ipcBootApplication(void)
|
||||
{
|
||||
statusCode.status = NO_ERROR;
|
||||
statusCode.address = 0x12346578;
|
||||
|
||||
uint32_t EntryAddr;
|
||||
|
||||
//
|
||||
// If the KeyValue was invalid, abort the load
|
||||
// and return the flash entry point.
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (dataFromCPU1[0] != 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;
|
||||
}
|
||||
|
||||
|
||||
+557
@@ -0,0 +1,557 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_sci_boot_cpu1.h
|
||||
//
|
||||
// TITLE: SCI Boot Functions
|
||||
//! <h1> SCI Boot 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 "cpu1bootrom.h"
|
||||
#include "f2838x_kernel_commands_cpu1.h"
|
||||
#include "ipc.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t status;
|
||||
uint32_t address;
|
||||
} StatusCode;
|
||||
extern StatusCode statusCode;
|
||||
|
||||
#define KERNEL_BUFFER_SIZE 250
|
||||
|
||||
uint32_t EntryAddrCMKernel;
|
||||
|
||||
|
||||
#pragma DATA_SECTION(kernelBuffer, "MSGRAM_CPU_TO_CM")
|
||||
uint16_t kernelBuffer[KERNEL_BUFFER_SIZE];
|
||||
|
||||
#pragma DATA_SECTION(CopyDataToCMRAM, "MSGRAM_CPU_TO_CM_COPY_TO_S0_RAM")
|
||||
#pragma RETAIN(CopyDataToCMRAM)
|
||||
const uint16_t CopyDataToCMRAM[138] ={
|
||||
0xB500, 0xF1AD, 0x0D1C, 0x4935, 0x6808, 0xF040, 0x0002, 0x6008, 0x4833,
|
||||
0x6800, 0xF000, 0x0002, 0x0840, 0xD0F9, 0x4931, 0x6808, 0xF040, 0x0002,
|
||||
0x6008, 0x4830, 0x6800, 0xF000, 0x0002, 0x0840, 0xD1F9, 0x482E, 0x9005,
|
||||
0x482A, 0x6800, 0xF000, 0x0004, 0x0880, 0xD0F9, 0xA803, 0xA904, 0xF000,
|
||||
0xF853, 0xF8BD, 0x0010, 0xF8AD, 0x0004, 0xE02B, 0x9803, 0x9000, 0x2000,
|
||||
0x9002, 0xE00D, 0x9802, 0x9905, 0xF851, 0x0020, 0x9006, 0x9900, 0x9806,
|
||||
0x6008, 0x9800, 0x1D00, 0x9000, 0x9802, 0x1C40, 0x9002, 0xF8BD, 0x0004,
|
||||
0x9902, 0xEBB0, 0x0F81, 0xD8EB, 0x4917, 0x6808, 0xF040, 0x0004, 0x6008,
|
||||
0x4813, 0x6800, 0xF000, 0x0004, 0x0880, 0xD0F9, 0xA803, 0xA904, 0xF000,
|
||||
0xF826, 0xF8BD, 0x0010, 0xF8AD, 0x0004, 0xF8BD, 0x0004, 0x2800, 0xD1CF,
|
||||
0x490B, 0x6808, 0xF040, 0x0004, 0x6008, 0x4808, 0x6800, 0xF000, 0x0008,
|
||||
0x08C0, 0xD0F9, 0x4906, 0x6808, 0xF040, 0x0008, 0x6008, 0x9803, 0x4780,
|
||||
0xB007, 0xBD00, 0xD008, 0x400F, 0xD004, 0x400F, 0xD000, 0x400F, 0xD010,
|
||||
0x400F, 0x0000, 0x2008, 0xF1AD, 0x0D08, 0x9101, 0x9000, 0x4804, 0x9900,
|
||||
0x6800, 0x6008, 0x4803, 0x9901, 0x6800, 0x6008, 0xB002, 0x4770, 0xD020,
|
||||
0x400F, 0xD028, 0x400F};
|
||||
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
extern uint16_t sciaGetWordData(void);
|
||||
extern uint16_t sciaGetWordDataCM(void);
|
||||
extern uint8_t sciaGetByteDataCM(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 sciIpcLoadCM(void);
|
||||
void copyDataToCPU1ToCMMSGRAM(void);
|
||||
void clearKernelBuffer(void);
|
||||
|
||||
extern uint16fptr getWordData;
|
||||
|
||||
//
|
||||
// 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;
|
||||
|
||||
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 sciIpcLoadCM(void)
|
||||
{
|
||||
statusCode.status = NO_ERROR;
|
||||
statusCode.address = 0x12346578;
|
||||
|
||||
//
|
||||
// Assign GetWordData to the SCI-A version of the
|
||||
// function. GetWordData is a pointer to a function.
|
||||
//
|
||||
getWordData = sciaGetWordDataCM;
|
||||
|
||||
//
|
||||
// If the KeyValue was invalid, abort the load
|
||||
// and return the flash entry point.
|
||||
//
|
||||
if(sciaGetWordDataCM() != 0x08AA)
|
||||
{
|
||||
statusCode.status = VERIFY_ERROR;
|
||||
statusCode.address = FLASH_ENTRY_POINT;
|
||||
}
|
||||
|
||||
readReservedFn(); //reads and discards 8 reserved words
|
||||
|
||||
EntryAddrCMKernel = getLongData();
|
||||
uint32_t byte4 = EntryAddrCMKernel & 0xFF000000;
|
||||
uint32_t byte3 = EntryAddrCMKernel & 0x00FF0000;
|
||||
uint32_t byte2 = EntryAddrCMKernel & 0x0000FF00;
|
||||
uint32_t byte1 = EntryAddrCMKernel & 0x000000FF;
|
||||
byte4 = byte4 >> 8;
|
||||
byte3 = byte3 << 8;
|
||||
byte2 = byte2 >> 8;
|
||||
byte1 = byte1 << 8;
|
||||
EntryAddrCMKernel = byte3 | byte4 | byte1 | byte2;
|
||||
|
||||
copyDataToCPU1ToCMMSGRAM();
|
||||
|
||||
uint16_t x = 0;
|
||||
for(x = 0; x < 32676; x++){}
|
||||
for(x = 0; x < 32676; x++){}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// CopyDataToCPU1ToCMMSGRAM
|
||||
// This function takes the CM kernel being streamed through SCI and places it
|
||||
// in a buffer in CPU1TOCMMSGRAM where it can be accessed by CM to then copy
|
||||
// into CM RAM. CPU1 and CM first synchronize with each other and then CPU1
|
||||
// starts sending the kernel to CM. Once it hasfilled up the buffer, it signals
|
||||
// CM. It then waits on CM to signal that it has finished copying the contents
|
||||
// of the buffer before filling it up again with the next section of the
|
||||
// kernel. CPU1 continues this operation until a blocksize of 00 00 is
|
||||
// encountered, at which point it lets CM know that it has finished
|
||||
// transmitting the kernel and waits for an acknowledgement from CM before
|
||||
// exiting the function.
|
||||
//
|
||||
void copyDataToCPU1ToCMMSGRAM(void)
|
||||
{
|
||||
IPC_sync(IPC_CPU1_L_CM_R, IPC_FLAG1);
|
||||
|
||||
struct HEADER {
|
||||
uint32_t DestAddr;
|
||||
uint16_t BlockSize;
|
||||
} BlockHeader;
|
||||
|
||||
uint16_t i;
|
||||
uint16_t j;
|
||||
uint32_t byte4;
|
||||
uint32_t byte3;
|
||||
uint32_t byte2;
|
||||
uint32_t byte1;
|
||||
uint16_t bufferIndex = 0;
|
||||
uint16_t wordData = 0;
|
||||
|
||||
//
|
||||
// Get the size in words of the first block
|
||||
//
|
||||
BlockHeader.BlockSize = (*getWordData)();
|
||||
byte2 = BlockHeader.BlockSize & 0x0000FF00;
|
||||
byte1 = BlockHeader.BlockSize & 0x000000FF;
|
||||
byte2 = byte2 >> 8;
|
||||
byte1 = byte1 << 8;
|
||||
BlockHeader.BlockSize = byte1 | byte2;
|
||||
|
||||
//
|
||||
// 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();
|
||||
byte4 = BlockHeader.DestAddr & 0xFF000000;
|
||||
byte3 = BlockHeader.DestAddr & 0x00FF0000;
|
||||
byte2 = BlockHeader.DestAddr & 0x0000FF00;
|
||||
byte1 = BlockHeader.DestAddr & 0x000000FF;
|
||||
byte4 = byte4 >> 8;
|
||||
byte3 = byte3 << 8;
|
||||
byte2 = byte2 >> 8;
|
||||
byte1 = byte1 << 8;
|
||||
BlockHeader.DestAddr = byte3 | byte4 | byte1 | byte2;
|
||||
for(i = 0; i < BlockHeader.BlockSize; i += 0)
|
||||
{
|
||||
//
|
||||
// The size of the block is less than the buffer size, so the entire
|
||||
// block is written to the buffer and sent to CM
|
||||
// For example. block size is 4 and buffer size is 5, so all 4 bytes
|
||||
// are sent to CM via the buffer
|
||||
//
|
||||
|
||||
//
|
||||
// BlockSize is in bytes, KERNEL_BUFFER_SIZE is in words
|
||||
//
|
||||
if(BlockHeader.BlockSize < (KERNEL_BUFFER_SIZE << 1))
|
||||
{
|
||||
//
|
||||
// fill up the buffer with the SCI data stream
|
||||
//
|
||||
for(j = 0; j < BlockHeader.BlockSize; j += 0)
|
||||
{
|
||||
byte1 = sciaGetByteDataCM();
|
||||
j++;
|
||||
|
||||
//
|
||||
//when there are an odd number of bytes, we don't want to
|
||||
//get an extra byte from the data stream, so pad with 0xFF
|
||||
//
|
||||
if(j == BlockHeader.BlockSize)
|
||||
{
|
||||
byte2 = 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte2 = sciaGetByteDataCM();
|
||||
j++;
|
||||
}
|
||||
|
||||
wordData = (byte2 << 8) | byte1;
|
||||
kernelBuffer[bufferIndex] = wordData;
|
||||
bufferIndex++;
|
||||
}
|
||||
i += j;
|
||||
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG2,
|
||||
IPC_ADDR_CORRECTION_ENABLE,
|
||||
BlockHeader.DestAddr,
|
||||
(uint32_t)kernelBuffer, j);
|
||||
//
|
||||
//set flag l to r
|
||||
//
|
||||
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
|
||||
bufferIndex = 0;
|
||||
|
||||
//
|
||||
//wait for ack
|
||||
//
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
clearKernelBuffer();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// The size of the block is greater than the buffer, so it will be
|
||||
// split up and sent in chunks until the entire block is sent
|
||||
// For example, block size is 7 and buffer size is 5, so first 5
|
||||
// bytes will be sent over and then the remaining 2 bytes will be
|
||||
// sent over
|
||||
//
|
||||
else //BlockHeader.BlockSize >= BUFFER_SIZE
|
||||
{
|
||||
//
|
||||
// keep sending until we have sent over the entire block
|
||||
//
|
||||
while(i < BlockHeader.BlockSize){
|
||||
if((BlockHeader.BlockSize - i) < (KERNEL_BUFFER_SIZE << 1))
|
||||
{
|
||||
for(j = 0; j < BlockHeader.BlockSize - i; j += 0)
|
||||
{
|
||||
byte1 = sciaGetByteDataCM();
|
||||
j++;
|
||||
|
||||
//
|
||||
//when there are an odd number of bytes, we don't
|
||||
//want to get an extra byte from the data stream,
|
||||
//so pad with 0xFF
|
||||
//
|
||||
if(j == BlockHeader.BlockSize)
|
||||
{
|
||||
byte2 = 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte2 = sciaGetByteDataCM();
|
||||
j++;
|
||||
}
|
||||
wordData = (byte2 << 8) | byte1;
|
||||
kernelBuffer[bufferIndex] = wordData;
|
||||
bufferIndex++;
|
||||
}
|
||||
//
|
||||
// increment i outside here so it doesn't affect loop
|
||||
// above
|
||||
//
|
||||
i += j;
|
||||
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG2,
|
||||
IPC_ADDR_CORRECTION_ENABLE,
|
||||
BlockHeader.DestAddr,
|
||||
(uint32_t)kernelBuffer, j);
|
||||
//
|
||||
//set flag l to r
|
||||
//
|
||||
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
|
||||
bufferIndex = 0;
|
||||
|
||||
//
|
||||
//wait for ack
|
||||
//
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
clearKernelBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j = 0; j < (KERNEL_BUFFER_SIZE << 1); j += 2)
|
||||
{
|
||||
wordData = getWordData();
|
||||
kernelBuffer[bufferIndex] = wordData;
|
||||
bufferIndex++;
|
||||
}
|
||||
i += j;
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG2,
|
||||
IPC_ADDR_CORRECTION_ENABLE,
|
||||
BlockHeader.DestAddr,
|
||||
(uint32_t)kernelBuffer, j);
|
||||
//
|
||||
//to account for byte addressing in CM
|
||||
//
|
||||
BlockHeader.DestAddr += j;
|
||||
|
||||
//
|
||||
//set flag l to r
|
||||
//
|
||||
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
|
||||
bufferIndex = 0;
|
||||
|
||||
//
|
||||
//wait for ack
|
||||
//
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG2);
|
||||
clearKernelBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Get the size of the next block
|
||||
//
|
||||
BlockHeader.BlockSize = (*getWordData)();
|
||||
byte2 = BlockHeader.BlockSize & 0x0000FF00;
|
||||
byte1 = BlockHeader.BlockSize & 0x000000FF;
|
||||
byte2 = byte2 >> 8;
|
||||
byte1 = byte1 << 8;
|
||||
BlockHeader.BlockSize = byte1 | byte2;
|
||||
}
|
||||
//BlockSize is 0, CM will exit out of the loop
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG2, IPC_ADDR_CORRECTION_ENABLE,
|
||||
EntryAddrCMKernel, (uint32_t)kernelBuffer, 0);
|
||||
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG3);
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG3);
|
||||
return;
|
||||
}
|
||||
|
||||
void clearKernelBuffer(void){
|
||||
uint16_t index = 0;
|
||||
for (index = 0; index < KERNEL_BUFFER_SIZE; index++){
|
||||
kernelBuffer[index] = 0x0000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// CopyDataToCMRAM
|
||||
// This function has been compiled with an ARM compiler and is being stored as a const
|
||||
// array at the top of the file. It is stored in CPU1TOCMMSGRAM and is copied over to
|
||||
// S0RAM in CM when the RUN_CPU1_LOAD_CM or RESET_CPU1_LOAD_CM command is called and the
|
||||
// boot mode for CM is set. Once the CM Boot ROM flow is complete, CM jumps to this function
|
||||
// and facilitates the transfer of the CM kernel into CM RAM. It synchronizes with CPU1 and then
|
||||
// waits for a signal from CPU1 that the buffer in Message RAM is ready to be read. The buffer
|
||||
// is then copied over into CM RAM. CM then signals CPU1 that it is ready for the next block to
|
||||
// copy over. When CPU1 is done transmitting the kernel, it singals CM which acknowledges the signal
|
||||
// and then jumps to the entry point of the CM kernel.
|
||||
//
|
||||
|
||||
// void CopyDataToCMRAM(void)
|
||||
//{
|
||||
//// //adapted from IPC_sync
|
||||
//// //set flag l to r -> cm to cpu1
|
||||
// *(volatile unsigned long *)0x400FD008U |= 0x02;
|
||||
//// //wait for flag -> cpu1 to cm
|
||||
// while((*(volatile unsigned long *)0x400FD004U & 0x02)>>1 == 0){}
|
||||
//// //ack flag r to l -> cm acks cpu1 flag
|
||||
// *(volatile unsigned long *)0x400FD000U |= 0x02;
|
||||
//// //wait for ack -> cpu1 acks cm flag
|
||||
// while((*(volatile unsigned long *)0x400FD010U & 0x02)>>1 != 0){}
|
||||
// //IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG4);
|
||||
//
|
||||
// struct HEADER {
|
||||
// uint32_t DestAddr;
|
||||
// uint16_t BlockSize;
|
||||
// } BlockHeader;
|
||||
//
|
||||
// uint32_t i;
|
||||
// uint32_t addr, data;
|
||||
// uint32_t kernelBufferEntryAddress = 0x20080000;
|
||||
//
|
||||
// // Check for CPU1 signal that the buffer is ready to be read
|
||||
// // while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flags) != 0U)
|
||||
// while((*(volatile unsigned long *)0x400FD004U & 0x4)>>2 == 0U){}
|
||||
|
||||
// F2838x_kernelcopy_readCommand(&addr, &data);
|
||||
//
|
||||
//
|
||||
// //
|
||||
// // Get the size in words of the first block
|
||||
// //
|
||||
// BlockHeader.BlockSize = (uint16_t)data;
|
||||
//
|
||||
//
|
||||
// //
|
||||
// // 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 = addr;
|
||||
//
|
||||
// for(i = 0 ; i*4 < BlockHeader.BlockSize; i++)
|
||||
// {
|
||||
// uint32_t longData = *((uint32_t *)kernelBufferEntryAddress + i);
|
||||
// *(uint32_t *)BlockHeader.DestAddr = longData;
|
||||
// BlockHeader.DestAddr+=4U;
|
||||
// }
|
||||
//
|
||||
// //
|
||||
// // Let CPU1 know that CM is ready for the next block
|
||||
// //
|
||||
// //acknowledge the flag
|
||||
// //IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG4);
|
||||
// //
|
||||
// *(volatile unsigned long *)0x400FD000U |= 0x4;
|
||||
//
|
||||
//
|
||||
// //
|
||||
// // Read the buffer
|
||||
// //
|
||||
//
|
||||
//
|
||||
// //adapted from IPC_readCommand, cannot call the CM functions here
|
||||
// //so read/writes directly to the registers
|
||||
// // Check for CPU1 signal that the buffer is ready to be read
|
||||
// // while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flags) != 0U)
|
||||
// //
|
||||
// while((*(volatile unsigned long *)0x400FD004U & 0x4)>>2 == 0U){}
|
||||
// F2838x_kernelcopy_readCommand(&addr, &data);
|
||||
//
|
||||
// //
|
||||
// // Get the size in words of the next block
|
||||
// //
|
||||
// BlockHeader.BlockSize = (uint16_t)data;
|
||||
// }
|
||||
//
|
||||
// //
|
||||
// // Check to see whether we are done writing in the kernel
|
||||
// // CPU1 sends the kernel entry address over message ram and sets flag 3 when it is done
|
||||
// //
|
||||
// *(volatile unsigned long *)0x400FD000U |= 0x4; //ack the message ram flag
|
||||
// while((*(volatile unsigned long *)0x400FD004U & 0x8)>>3 == 0U){}
|
||||
// *(volatile unsigned long *)0x400FD000U |= 0x8; //ack the end of kernel transmission flag
|
||||
//
|
||||
// //
|
||||
// // Jumps to kernel entry address
|
||||
// //
|
||||
// ((void (*)(void))addr)();
|
||||
//}
|
||||
//
|
||||
//void F2838x_kernelcopy_readCommand(uint32_t *addr, uint32_t *data)
|
||||
//{
|
||||
// // uint32_t addrReg;
|
||||
//
|
||||
// //read the command registers
|
||||
// *addr = *(volatile unsigned long *)0x400FD020U; //*command = IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_RECVCOM;
|
||||
// *data = *(volatile unsigned long *)0x400FD028U; //*data = IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_RECVDATA;
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_sci_flash_kernel.c
|
||||
//
|
||||
// TITLE: CM kernel main function
|
||||
//! <h1> CM kernek 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 "driverlib_cm.h"
|
||||
#include "cm.h"
|
||||
|
||||
//
|
||||
// Include Flash API include file
|
||||
//
|
||||
#include "F021_F2838x_CM.h"
|
||||
|
||||
//
|
||||
// Include Flash API example header file
|
||||
//
|
||||
#include "flash_programming_f2838x_cm.h"
|
||||
|
||||
void initFlashSectors(void);
|
||||
extern uint32_t ipcGetFunction(void);
|
||||
void exampleError(Fapi_StatusType status);
|
||||
void exit(uint32_t address);
|
||||
extern void signalCPU1();
|
||||
|
||||
void main(void)
|
||||
{
|
||||
CM_init();
|
||||
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 2);
|
||||
Flash_claimPumpSemaphore(FLASH_CM_WRAPPER);
|
||||
initFlashSectors();
|
||||
|
||||
uint32_t EntryAddr;
|
||||
|
||||
EntryAddr = ipcGetFunction();
|
||||
|
||||
signalCPU1();
|
||||
exit(EntryAddr);
|
||||
}
|
||||
|
||||
void exit(uint32_t address){
|
||||
//
|
||||
// Jump to entry address
|
||||
//
|
||||
__asm(" bx r0");
|
||||
}
|
||||
|
||||
void initFlashSectors(void){
|
||||
Fapi_StatusType oReturnCheck;
|
||||
|
||||
//
|
||||
// Initialize the Flash API by providing the Flash register base address
|
||||
// and operating frequency(in MHz).
|
||||
// This function is required to initialize the Flash API based on CM
|
||||
// operating frequency before any other Flash API operation can be performed.
|
||||
// This function must also be called whenever System frequency or RWAIT is
|
||||
// changed.
|
||||
//
|
||||
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS,
|
||||
CM_CLK_FREQ/1000000U);
|
||||
|
||||
if(oReturnCheck != Fapi_Status_Success)
|
||||
{
|
||||
//
|
||||
// Check Flash API documentation for possible errors
|
||||
//
|
||||
exampleError(oReturnCheck);
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize the Flash banks and FMC for erase and program operations.
|
||||
// Fapi_setActiveFlashBank() function sets the Flash banks and FMC for
|
||||
// further Flash operations to be performed on the banks.
|
||||
//
|
||||
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
|
||||
|
||||
if(oReturnCheck != Fapi_Status_Success)
|
||||
{
|
||||
//
|
||||
// Check Flash API documentation for possible errors
|
||||
//
|
||||
exampleError(oReturnCheck);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// For this example, just stop here if an API error is found
|
||||
//******************************************************************************
|
||||
void exampleError(Fapi_StatusType status)
|
||||
{
|
||||
//
|
||||
// Error code will be in the status parameter
|
||||
//
|
||||
__asm(" bkpt #0");
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_sci_flash_kernel_cpu1.c
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> Flash Programming Solution using SCI. </h1>
|
||||
//!
|
||||
//! In this example, we set up a UART connection with a host using SCI, receive
|
||||
//! commands for CPU1 to perform which then sends ACK, NAK, and status packets
|
||||
//! back to the host after receiving and completing the tasks. This kernel has
|
||||
//! the ability to program, verify, unlock, reset, and run an application.
|
||||
//! Each command either expects no data from the command packet
|
||||
//! or specific data relative to the command.
|
||||
//!
|
||||
//! In this example, we set up a UART connection with a host using SCI, receive
|
||||
//! an application for CPU01 in -sci8 ascii format to run on the device and
|
||||
//! program it into Flash.
|
||||
//
|
||||
//###########################################################################
|
||||
//
|
||||
// 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_cm_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);
|
||||
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 = 0;
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Example_Error - 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
|
||||
//
|
||||
|
||||
+332
@@ -0,0 +1,332 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_sci_get_function.c
|
||||
//
|
||||
// TITLE: SCI Boot Functions
|
||||
// <h1> SCI Boot 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "f2838x_kernel_commands_cm.h"
|
||||
#include "ipc.h"
|
||||
#include "sysctl.h"
|
||||
#include "flash.h"
|
||||
#include "dcsm.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t status;
|
||||
uint32_t address;
|
||||
uint16_t flashAPIError;
|
||||
uint32_t flashAPIFsmStatus;
|
||||
} StatusCode;
|
||||
StatusCode statusCode;
|
||||
|
||||
uint16_t checksum;
|
||||
|
||||
#pragma DATA_SECTION(commandsForCPU1, "MSGRAM_CM_TO_CPU1")
|
||||
uint16_t commandsForCPU1[8];
|
||||
|
||||
uint16_t dataFromCPU1[10];
|
||||
uint16_t kernelCommand;
|
||||
|
||||
extern void cmErase(uint32_t sectors);
|
||||
extern void cmVerify(void);
|
||||
extern uint32_t ipcBootApplication(void);
|
||||
void callSCIFunctionFromCPU1(uint16_t command, uint16_t parameter1, uint16_t parameter2,
|
||||
uint16_t parameter3, uint16_t parameter4, uint16_t parameter5,
|
||||
uint16_t parameter6, uint16_t parameter7, uint16_t parameter8);
|
||||
|
||||
uint32_t ipcGetFunction(void){
|
||||
|
||||
uint32_t EntryAddr;
|
||||
uint16_t command;
|
||||
|
||||
//receive command via IPC from CPU1
|
||||
|
||||
callSCIFunctionFromCPU1(1, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
command = kernelCommand;
|
||||
|
||||
//
|
||||
//decode
|
||||
//
|
||||
while(command != RESET_CM)
|
||||
{
|
||||
//
|
||||
// Reset the statusCode.
|
||||
//
|
||||
statusCode.status = NO_ERROR;
|
||||
statusCode.address = 0x12345678;
|
||||
statusCode.flashAPIError = NO_ERROR;
|
||||
statusCode.flashAPIFsmStatus = 0;
|
||||
checksum = 0;
|
||||
|
||||
//
|
||||
//UNLOCK ZONE 1 CM
|
||||
//
|
||||
if(command == CM_UNLOCK_Z1)
|
||||
{
|
||||
//
|
||||
// driverlib struct for csmKey.
|
||||
//
|
||||
DCSM_CSMPasswordKey psCMDKey;
|
||||
|
||||
psCMDKey.csmKey0 = (uint32_t)dataFromCPU1[0] | ((uint32_t)dataFromCPU1[1] << 16);
|
||||
psCMDKey.csmKey1 = (uint32_t)dataFromCPU1[2] | ((uint32_t)dataFromCPU1[3] << 16);
|
||||
psCMDKey.csmKey2 = (uint32_t)dataFromCPU1[4] | ((uint32_t)dataFromCPU1[5] << 16);
|
||||
psCMDKey.csmKey3 = (uint32_t)dataFromCPU1[6] | ((uint32_t)dataFromCPU1[7] << 16);
|
||||
|
||||
//
|
||||
// Unlock the zone 1, driverlib.
|
||||
//
|
||||
DCSM_writeZone1CSM(&psCMDKey);
|
||||
|
||||
//
|
||||
// check if it is unlocked.
|
||||
//
|
||||
if(DCSM_getZone1CSMSecurityStatus() == DCSM_STATUS_LOCKED) {
|
||||
statusCode.status = UNLOCK_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//UNLOCK ZONE 2 CM
|
||||
//
|
||||
else if(command == CM_UNLOCK_Z2)
|
||||
{
|
||||
//
|
||||
// driverlib struct for csmKey.
|
||||
//
|
||||
DCSM_CSMPasswordKey psCMDKey;
|
||||
|
||||
psCMDKey.csmKey0 = (uint32_t)dataFromCPU1[0] | ((uint32_t)dataFromCPU1[1] << 16);
|
||||
psCMDKey.csmKey1 = (uint32_t)dataFromCPU1[2] | ((uint32_t)dataFromCPU1[3] << 16);
|
||||
psCMDKey.csmKey2 = (uint32_t)dataFromCPU1[4] | ((uint32_t)dataFromCPU1[5] << 16);
|
||||
psCMDKey.csmKey3 = (uint32_t)dataFromCPU1[6] | ((uint32_t)dataFromCPU1[7] << 16);
|
||||
|
||||
//
|
||||
// Unlock the zone 2, driverlib.
|
||||
//
|
||||
DCSM_writeZone2CSM(&psCMDKey);
|
||||
|
||||
//
|
||||
// check if it is unlocked.
|
||||
//
|
||||
if(DCSM_getZone2CSMSecurityStatus() == DCSM_STATUS_LOCKED) {
|
||||
statusCode.status = UNLOCK_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//DFU CM
|
||||
//
|
||||
else if(command == DFU_CM)
|
||||
{
|
||||
EntryAddr = ipcBootApplication();
|
||||
if(statusCode.status == NO_ERROR)
|
||||
{
|
||||
statusCode.address = EntryAddr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//ERASE CM
|
||||
//
|
||||
else if(command == ERASE_CM)
|
||||
{
|
||||
uint32_t sectors = (uint32_t)dataFromCPU1[0] | ((uint32_t)dataFromCPU1[1] << 16);
|
||||
cmErase(sectors);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//VERIFY CM
|
||||
//
|
||||
else if(command == VERIFY_CM)
|
||||
{
|
||||
cmVerify();
|
||||
}
|
||||
|
||||
//
|
||||
//RUN CM
|
||||
//
|
||||
else if(command == RUN_CM){
|
||||
EntryAddr = (uint32_t)((uint32_t)dataFromCPU1[1] << 16) |
|
||||
(uint32_t)dataFromCPU1[0];
|
||||
return EntryAddr;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// COMMAND_ERROR
|
||||
//
|
||||
else
|
||||
{
|
||||
statusCode.status = COMMAND_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// send the packet.
|
||||
//
|
||||
callSCIFunctionFromCPU1(4, command, statusCode.status, 12, statusCode.address & 0xFFFF,
|
||||
((statusCode.address & 0xFFFF0000) >> 16), statusCode.flashAPIError,
|
||||
statusCode.flashAPIFsmStatus & 0xFFFF,
|
||||
((statusCode.flashAPIFsmStatus & 0xFFFF0000) >> 16));
|
||||
callSCIFunctionFromCPU1(1, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
command = kernelCommand; //get next command
|
||||
}
|
||||
//
|
||||
//RESET CM
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
//
|
||||
// callSCIFunctionFromCPU1
|
||||
// This function sends a command via IPC to CPU1 to call an SCI function
|
||||
// After CPU1 has called the function and copied the result of the function
|
||||
// call into IPC Message RAM, it signals CM to read the result from Message RAM.
|
||||
// CM will then take this data and use it as needed.
|
||||
//
|
||||
// command numbers
|
||||
// 1 - SCI_GetPacket - CPU1 gets the packet from the host and parses it for the
|
||||
// command the user entered as well as any information CM
|
||||
// needs to execute a kernel command
|
||||
//
|
||||
// 2 - SCI_SendChecksum - CPU1 is keeping track of the checksum from streaming
|
||||
// the application, CM can tell CPU1 to send it to the
|
||||
// host
|
||||
//
|
||||
// 3 - SCI_GetWordData - CPU1 reads a word from the SCI data stream and copies
|
||||
// it to Message RAM for CM to read
|
||||
//
|
||||
// 4 - SCI_SendPacket - CM tells CPU1 to send a packet to the host software
|
||||
// and sends the information that it wants CPU1 to transmit
|
||||
// to the host side software
|
||||
//
|
||||
// 5 - SCI_GetByteData - CPU1 reads a byte from the SCI data stream and copies
|
||||
// it to Message RAM for CM to read
|
||||
//
|
||||
void callSCIFunctionFromCPU1(uint16_t command, uint16_t parameter1, uint16_t parameter2,
|
||||
uint16_t parameter3, uint16_t parameter4, uint16_t parameter5,
|
||||
uint16_t parameter6, uint16_t parameter7, uint16_t parameter8)
|
||||
{
|
||||
|
||||
uint32_t ipcCommand, addr, data;
|
||||
int i = 0;
|
||||
|
||||
//write any params needed for the function into msgram
|
||||
if (command == 4){
|
||||
commandsForCPU1[0] = parameter1; //command
|
||||
commandsForCPU1[1] = parameter2; //statusCode.status
|
||||
commandsForCPU1[2] = parameter3; //length
|
||||
commandsForCPU1[3] = parameter4; //LSW of statusCode.address
|
||||
commandsForCPU1[4] = parameter5; //MSW of statusCode.address
|
||||
commandsForCPU1[5] = parameter6; //Flash API Error
|
||||
commandsForCPU1[6] = parameter7; //LSW of statusCode.flashAPIFsmStatus
|
||||
commandsForCPU1[7] = parameter8; //MSW of statusCode.flashAPIFsmStatus
|
||||
}
|
||||
|
||||
//
|
||||
// Send a message without message queue
|
||||
// Length of the data to be read is passed as data.
|
||||
//
|
||||
IPC_sendCommand(IPC_CM_L_CPU1_R, IPC_FLAG1, IPC_ADDR_CORRECTION_ENABLE,
|
||||
command, (uint32_t)commandsForCPU1, 10);
|
||||
|
||||
//
|
||||
// Wait for acknowledgment
|
||||
//
|
||||
IPC_waitForAck(IPC_CM_L_CPU1_R, IPC_FLAG1);
|
||||
|
||||
//
|
||||
// clear buffer used to send CPU1 information
|
||||
//
|
||||
for(i = 0; i < 5; i++){
|
||||
commandsForCPU1[i] = 0x0000;
|
||||
}
|
||||
|
||||
IPC_waitForFlag(IPC_CM_L_CPU1_R, IPC_FLAG7);
|
||||
|
||||
//
|
||||
// Read command and buffer for information needed to execute a command
|
||||
//
|
||||
IPC_readCommand(IPC_CM_L_CPU1_R, IPC_FLAG7, IPC_ADDR_CORRECTION_ENABLE,
|
||||
&ipcCommand, &addr, &data);
|
||||
|
||||
//
|
||||
// Copy data from CPU1 into an array accessible by CM
|
||||
//
|
||||
for(i = 0; i < 10; i++){
|
||||
dataFromCPU1[i] = *((uint16_t *)addr + i);
|
||||
}
|
||||
|
||||
kernelCommand = ipcCommand;
|
||||
|
||||
//
|
||||
// Ack the flag
|
||||
//
|
||||
IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG7);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// SignalCPU1 - This routine lets CPU1 know that CM is done with the kernel
|
||||
//
|
||||
void signalCPU1(void)
|
||||
{
|
||||
//
|
||||
// Leave control over flash pump
|
||||
//
|
||||
Flash_releasePumpSemaphore();
|
||||
|
||||
//
|
||||
// Signal CPU1 that CM has completed flash kernel command exeuction
|
||||
//
|
||||
IPC_setFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG5);
|
||||
IPC_waitForAck(IPC_CM_L_CPU1_R, IPC_FLAG5);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1118
File diff suppressed because it is too large.
Load diff
+274
@@ -0,0 +1,274 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_verify.h
|
||||
//
|
||||
// TITLE: CM verify functions
|
||||
//! <h1> CM 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 <flash_kernel_c28x_cm_ex1_verify_cm.h>
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define BUFFER_SIZE 0x100 //because of ECC, must be multiple of
|
||||
//64 bits, or 4 words, BUFFER_SIZE %
|
||||
//4 == 0
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t status;
|
||||
uint32_t address;
|
||||
uint16_t flashAPIError;
|
||||
uint32_t flashAPIFsmStatus;
|
||||
} StatusCode;
|
||||
extern StatusCode statusCode;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
extern uint32_t getLongData(void);
|
||||
extern void readReservedFn(void);
|
||||
extern void callSCIFunctionFromCPU1(uint16_t command, uint16_t parameter1, uint16_t parameter2,
|
||||
uint16_t parameter3,uint16_t parameter4, uint16_t parameter5,
|
||||
uint16_t parameter6, uint16_t parameter7, uint16_t parameter8);
|
||||
extern uint16_t dataFromCPU1[11];
|
||||
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 cmVerify(void)
|
||||
{
|
||||
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;
|
||||
uint8_t Buffer[BUFFER_SIZE];
|
||||
uint8_t miniBuffer[8];
|
||||
int fail = 0;
|
||||
uint16_t bytesVerified = 0;
|
||||
|
||||
assert(BUFFER_SIZE % 8 == 0);
|
||||
|
||||
//
|
||||
// If the KeyValue was invalid, abort the load
|
||||
// and return the flash entry point.
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
wordData = dataFromCPU1[0];
|
||||
if(wordData != 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
|
||||
//
|
||||
#if checksum_enable
|
||||
callSCIFunctionFromCPU1(2, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Get the size in words of the first block
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
BlockHeader.BlockSize = dataFromCPU1[0];
|
||||
|
||||
//
|
||||
// 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)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++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
// Buffer[j] = (wordData & 0xFF00) >> 8;
|
||||
// Buffer[j + 1] = wordData & 0xFF;
|
||||
i++;
|
||||
}
|
||||
for(j = BlockHeader.BlockSize; j < BUFFER_SIZE; j++)
|
||||
{
|
||||
Buffer[j] = 0xFF;
|
||||
}
|
||||
}
|
||||
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++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
// Buffer[j] = (wordData & 0xFF00) >> 8;
|
||||
// Buffer[j + 1] = wordData & 0xFF;
|
||||
}
|
||||
|
||||
i += j; //increment i outside here so it doesn't
|
||||
//affect loop above
|
||||
for(; j < BUFFER_SIZE; j++)//fill the rest with 0xFF
|
||||
{
|
||||
Buffer[j] = 0xFF;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// fill up like normal, up to BUFFER_SIZE
|
||||
//
|
||||
for(j = 0; j < BUFFER_SIZE; j++)
|
||||
{
|
||||
callSCIFunctionFromCPU1(5, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
Buffer[j] = dataFromCPU1[0];
|
||||
// Buffer[j] = (wordData & 0xFF00) >> 8;
|
||||
// Buffer[j + 1] = wordData & 0xFF;
|
||||
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(bytesVerified < BlockHeader.BlockSize)
|
||||
{
|
||||
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
|
||||
|
||||
for(j = 0; j < 8; j += 4)
|
||||
{
|
||||
uint32_t toVerify = miniBuffer[j+3];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j+2];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j+1];
|
||||
toVerify = toVerify << 8;
|
||||
toVerify |= miniBuffer[j];
|
||||
if(fail == 0)
|
||||
{
|
||||
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 += 0x8;
|
||||
bytesVerified += 0x8;
|
||||
} //for(int k); loads miniBuffer with Buffer elements
|
||||
#if checksum_enable
|
||||
callSCIFunctionFromCPU1(2, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
//
|
||||
//get the size of the next block
|
||||
//
|
||||
callSCIFunctionFromCPU1(3, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
BlockHeader.BlockSize = dataFromCPU1[0];
|
||||
bytesVerified = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_ex1_verify.h
|
||||
//
|
||||
// TITLE: CM 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_CM_EX1_VERIFY_H__
|
||||
#define __FLASH_KERNEL_C28X_CM_EX1_VERIFY_H__
|
||||
|
||||
|
||||
#include "F021_F2838x_CM.h"
|
||||
#include "flash_programming_f2838x_cm.h" // Flash API example header file
|
||||
#include "cmbootrom.h"
|
||||
#include "f2838x_kernel_commands_cm.h"
|
||||
#include <assert.h>
|
||||
|
||||
void cmVerify(void);
|
||||
|
||||
#endif /* _CM_VERIFY_H_ */
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: flash_kernel_c28x_cm_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 "flash_kernel_c28x_cm_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);
|
||||
void verifyData(void);
|
||||
extern uint32_t getLongData(void);
|
||||
extern void readReservedFn(void);
|
||||
extern uint16_t sciaGetWordData(void);
|
||||
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
|
||||
//
|
||||
#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_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
|
||||
#if checksum_enable
|
||||
sciSendChecksum();
|
||||
#endif
|
||||
}
|
||||
//
|
||||
//get the size of the next block
|
||||
//
|
||||
BlockHeader.BlockSize = (*getWordData)();
|
||||
wordsVerified = 0;
|
||||
}
|
||||
EDIS;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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_CPU1_H__
|
||||
#define __FLASH_KERNEL_C28X_DUAL_EX1_VERIFY_CPU1_H__
|
||||
|
||||
//
|
||||
// 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>
|
||||
|
||||
//
|
||||
// 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="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_cm"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" applicableConfigurations="CM_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="CM_FLASH" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../ipc_ex1_basic_cm.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_cm"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -mv7M4 --define=DEBUG --float_support=none --diag_warning=225" linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" applicableConfigurations="CM_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="CM_FLASH" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../ipc_ex2_msgqueue_cm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,169 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ipc_ex1_basic_c28x1.c
|
||||
//
|
||||
// TITLE: IPC example with interrupt
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> IPC basic message passing example with interrupt </h1>
|
||||
//!
|
||||
//! This example demonstrates how to configure IPC and pass information from
|
||||
//! C28x to CM core without message queues.
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM 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_CPU_TO_CM")
|
||||
uint32_t readData[10];
|
||||
|
||||
uint32_t pass;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Boot CM core
|
||||
//
|
||||
#ifdef _FLASH
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
|
||||
#else
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
|
||||
#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_CM_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Synchronize both the cores.
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_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
|
||||
// Since C28x and CM does not share the same address space for shared RAM,
|
||||
// ADDRESS_CORRECTION is enabled
|
||||
// Length of the data to be read is passed as data.
|
||||
//
|
||||
IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
|
||||
IPC_CMD_READ_MEM, (uint32_t)readData, 10);
|
||||
|
||||
//
|
||||
// Wait for acknowledgment
|
||||
//
|
||||
IPC_waitForAck(IPC_CPU1_L_CM_R, IPC_FLAG0);
|
||||
|
||||
//
|
||||
// Read response
|
||||
//
|
||||
if(IPC_getResponse(IPC_CPU1_L_CM_R) == TEST_PASS)
|
||||
{
|
||||
pass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pass = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// End of example. Loop forever
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,156 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ipc_ex1_basic_cm.c
|
||||
//
|
||||
// TITLE: IPC example with interrupt
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> IPC basic message passing example with interrupt </h1>
|
||||
//!
|
||||
//! This example demonstrates how to configure IPC and pass information from
|
||||
//! C28x to CM core without message queues
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM 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 "cm.h"
|
||||
#include "ipc.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define IPC_CMD_READ_MEM 0x1001
|
||||
#define IPC_CMD_RESP 0x2001
|
||||
|
||||
#define TEST_PASS 0x5555
|
||||
#define TEST_FAIL 0xAAAA
|
||||
|
||||
|
||||
//
|
||||
// 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_CM_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_CM_L_CPU1_R, TEST_PASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPC_sendResponse(IPC_CM_L_CPU1_R, TEST_FAIL);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the flag
|
||||
//
|
||||
IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG0);
|
||||
}
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
CM_init();
|
||||
|
||||
//
|
||||
// Clear any IPC flags if set already
|
||||
//
|
||||
IPC_clearFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Enable IPC interrupts
|
||||
//
|
||||
IPC_registerInterrupt(IPC_CM_L_CPU1_R, IPC_INT0, IPC_ISR0);
|
||||
|
||||
//
|
||||
// Synchronize both the cores.
|
||||
//
|
||||
IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG31);
|
||||
|
||||
//
|
||||
// Loop forever. Wait for IPC interrupt
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,180 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ipc_ex2_msgqueue_c28x1.c
|
||||
//
|
||||
// TITLE: IPC example with interrupt and message queue
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_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
|
||||
//! C28x to CM core with message queues.
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM 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_CPU_TO_CM")
|
||||
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 CM core
|
||||
//
|
||||
#ifdef _FLASH
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
|
||||
#else
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
|
||||
#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_CM_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Initialize message queue
|
||||
//
|
||||
IPC_initMessageQueue(IPC_CPU1_L_CM_R, &messageQueue, IPC_INT1, IPC_INT1);
|
||||
|
||||
//
|
||||
// Synchronize both the cores
|
||||
//
|
||||
IPC_sync(IPC_CPU1_L_CM_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
|
||||
// Since C28x and CM does not share the same address space for shared RAM,
|
||||
// ADDRESS_CORRECTION is enabled
|
||||
//
|
||||
IPC_sendMessageToQueue(IPC_CPU1_L_CM_R, &messageQueue, IPC_ADDR_CORRECTION_ENABLE,
|
||||
&TxMsg, IPC_BLOCKING_CALL);
|
||||
|
||||
//
|
||||
// Read message from the queue
|
||||
// Return message from CM does not use the address field, hence
|
||||
// ADDRESS_COREECTION feature is not used
|
||||
//
|
||||
IPC_readMessageFromQueue(IPC_CPU1_L_CM_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,161 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: ipc_ex2_msgqueue_cm.c
|
||||
//
|
||||
// TITLE: IPC example with interrupt and message queue
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_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
|
||||
//! C28x to CM core with message queues.
|
||||
//! It is recommended to run the C28x1 core first, followed by the CM 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 "cm.h"
|
||||
#include "ipc.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;
|
||||
|
||||
|
||||
//
|
||||
// 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_CM_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_CM_L_CPU1_R, &messageQueue, IPC_ADDR_CORRECTION_DISABLE,
|
||||
&TxMsg, IPC_NONBLOCKING_CALL);
|
||||
|
||||
//
|
||||
// Acknowledge the flag
|
||||
//
|
||||
IPC_ackFlagRtoL(IPC_CM_L_CPU1_R, IPC_FLAG1);
|
||||
}
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
CM_init();
|
||||
|
||||
//
|
||||
// Clear any IPC flags if set already
|
||||
//
|
||||
IPC_clearFlagLtoR(IPC_CM_L_CPU1_R, IPC_FLAG_ALL);
|
||||
|
||||
//
|
||||
// Enable IPC interrupts
|
||||
//
|
||||
IPC_registerInterrupt(IPC_CM_L_CPU1_R, IPC_INT1, IPC_ISR1);
|
||||
|
||||
//
|
||||
// Initialize message queue
|
||||
//
|
||||
IPC_initMessageQueue(IPC_CM_L_CPU1_R, &messageQueue, IPC_INT1, IPC_INT1);
|
||||
|
||||
//
|
||||
// Synchronize both the cores.
|
||||
//
|
||||
IPC_sync(IPC_CM_L_CPU1_R, IPC_FLAG31);
|
||||
|
||||
//
|
||||
// Loop forever. Wait for IPC interrupt
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="led_ex1_c28x_cm_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 --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=0x100 --heap_size=0x200" />
|
||||
<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="../../../../../../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="../led_ex1_c28x_cm_blinky_cpu1.c" targetDirectory="" />
|
||||
</project>
|
||||
<project
|
||||
name="led_ex1_c28x_cm_blinky_cm"
|
||||
device="Cortex M.TMS320F28388D"
|
||||
cgtVersion="20.2.7.LTS"
|
||||
products="C2000WARE"
|
||||
endianness="little"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
<configuration name="CM_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --float_support=none -mv7M4 -me --diag_warning=225 " linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a --define RAM" />
|
||||
<configuration name="CM_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG --float_support=none --define=_FLASH -mv7M4 -me --diag_warning=225 " linkerBuildOptions="--stack_size=512 --heap_size=1024 --library=libc.a " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib_cm/" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib_cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/cm.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/cm.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_cm.cmd" targetDirectory="" applicableConfigurations="CM_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="CM_FLASH" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/startup_cm.c" targetDirectory="" />
|
||||
<file action="copy" path="../led_ex1_c28x_cm_blinky_cm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,106 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: led_ex1_c28x_cm_blinky_cm.c
|
||||
//
|
||||
// TITLE: LED Blinky Example
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> LED Blinky Example (CM) </h1>
|
||||
//!
|
||||
//! This example demonstrates how to blink a LED using CM.
|
||||
//!
|
||||
//! \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_cm.h"
|
||||
#include "cm.h"
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
CM_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure the GPIO pin as a push-pull output
|
||||
//
|
||||
// This is configured by CPU1
|
||||
|
||||
//
|
||||
// Loop Forever
|
||||
//
|
||||
for(;;)
|
||||
{
|
||||
//
|
||||
// Turn on LED
|
||||
//
|
||||
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 0);
|
||||
|
||||
//
|
||||
// Delay for 500000uS.
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
|
||||
//
|
||||
// Turn off LED
|
||||
//
|
||||
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 1);
|
||||
|
||||
//
|
||||
// Delay for 500000uS.
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,143 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: led_ex1_c28x_cm_blinky_cpu1.c
|
||||
//
|
||||
// TITLE: LED Blinky Example
|
||||
//
|
||||
//! \addtogroup driver_cm_c28x_dual_example_list
|
||||
//! <h1> LED Blinky Example</h1>
|
||||
//!
|
||||
//! This example demonstrates how to blink a LED using CPU1 and blink another
|
||||
//! LED using CM (led_ex1_blinky_cm.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 CM core
|
||||
//
|
||||
#ifdef _FLASH
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_FLASH_SECTOR0);
|
||||
#else
|
||||
Device_bootCM(BOOTMODE_BOOT_TO_S0RAM);
|
||||
#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_setMasterCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CM);
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
Reference in new issue
Block a user