Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_dcsm_ffi"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="../f2838x_dcsm_ffi_flash_lnk_cpu1.cmd" targetDirectory="" />
|
||||
<file action="copy" path="../f2838x_dcsm.cmd" targetDirectory="" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../sdl_ex_dcsm_ffi.c" targetDirectory="" />
|
||||
<file action="copy" path="../f2838x_dcsm.asm" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,112 @@
|
||||
;;//###########################################################################
|
||||
;;//
|
||||
;;// FILE: f2838x_dcsm.asm
|
||||
;;//
|
||||
;;//###########################################################################
|
||||
;;//
|
||||
;;// This file was originally generated by the DCSM Tool and then edited to
|
||||
;;// remove sections not used by the sdl_ex_dcsm_ffi example. We strongly
|
||||
;;// recommend using this tool to generate the code for your DCSM configuration.
|
||||
;;// Refer to the following guide for more information:
|
||||
;;// http://www.ti.com/lit/pdf/spracp8
|
||||
;;//
|
||||
;;//###########################################################################
|
||||
;;// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
;;// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
;;// $Copyright:
|
||||
;// 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.
|
||||
;// $
|
||||
;;//###########################################################################
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Zone 1
|
||||
;----------------------------------------------------------------------
|
||||
.sect "dcsm_otp_z1_linkpointer"
|
||||
.retain
|
||||
; .long 0x00003FFF
|
||||
; .long 0x00003FFF
|
||||
; .long 0x00003FFF
|
||||
|
||||
.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 0x0AAAA6AA ;Z1OTP_GRABSECT1
|
||||
; .long 0x0AAAAAAA ;Z1OTP_GRABSECT2
|
||||
; .long 0x0AAAAAAA ;Z1OTP_GRABSECT3
|
||||
; .long 0x000AAA9A ;Z1OTP_GRABRAM1
|
||||
; .long 0xAAAAAA0A ;Z1OTP_GRABRAM2
|
||||
; .long 0x000AAAAA ;Z1OTP_GRABRAM3
|
||||
|
||||
; .long 0x3FFF3FFF ;Z1OTP_EXEONLYSECT1
|
||||
; .long 0x00003FFF ;Z1OTP_EXEONLYSECT2
|
||||
; .long 0xFFC303FF ;Z1OTP_EXEONLYRAM1
|
||||
; .long 0xFFFFFFFF ;Reserved
|
||||
; .long 0xFFFFFFFF ;Z1OTP_JTAGPSWDL0
|
||||
; .long 0x2BFFFFFF ;Z1OTP_JTAGPSWDL1
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Zone 2
|
||||
;----------------------------------------------------------------------
|
||||
.sect "dcsm_otp_z2_linkpointer"
|
||||
.retain
|
||||
; .long 0x00003FFF
|
||||
; .long 0x00003FFF
|
||||
; .long 0x00003FFF
|
||||
|
||||
.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 0x0AAA9AAA ;Z2OTP_GRABSECT1
|
||||
; .long 0x0AAAAAAA ;Z2OTP_GRABSECT2
|
||||
; .long 0x0AAAAAAA ;Z2OTP_GRABSECT3
|
||||
; .long 0x000AA9AA ;Z2OTP_GRABRAM1
|
||||
; .long 0xAAAAAA0A ;Z2OTP_GRABRAM2
|
||||
; .long 0x000AAAAA ;Z2OTP_GRABRAM3
|
||||
|
||||
; .long 0x3FFF3FFF ;Z2OTP_EXEONLYSECT1
|
||||
; .long 0x00003FFF ;Z2OTP_EXEONLYSECT2
|
||||
; .long 0xFFC303FF ;Z2OTP_EXEONLYRAM1
|
||||
; .long 0xFFFFFFFF ;Reserved
|
||||
; .long 0xFFFFFFFF ;Reserved
|
||||
; .long 0xFFFFFFFF ;Reserved
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; End of file
|
||||
;----------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This linker command file is to be included if user wants to use the DCSM
|
||||
* (Dual Zone Code Security Module) feature on the device. This linker command
|
||||
* file works as an addendum to the main Flash/RAM linker command file.
|
||||
* The sections in the dcsm.asm source file in this project are linked as per
|
||||
* the commands given in the file.
|
||||
*
|
||||
* This file was originally generated by the DCSM Tool and then edited to
|
||||
* remove sections not used by the sdl_ex_dcsm_ffi example. We strongly
|
||||
* recommend using this tool to generate the code for your DCSM configuration.
|
||||
* Refer to the following guide for more information:
|
||||
* http://www.ti.com/lit/pdf/spracp8
|
||||
*
|
||||
* Once users are confident that they want to program the passwords in OTP,
|
||||
* the DSECT section type can be removed.
|
||||
*
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 : /* Program Memory */
|
||||
|
||||
/* Z1 OTP. LinkPointers */
|
||||
DCSM_OTP_Z1_LINKPOINTER : origin = 0x78000, length = 0x00006
|
||||
|
||||
/* DCSM Z1 Zone Select Contents (!!Movable!!) */
|
||||
/* Z1 OTP. Z1 password locations / Flash and RAM partitioning */
|
||||
DCSM_ZSEL_Z1_P0 : origin = 0x78020, length = 0x000020
|
||||
|
||||
/* Z2 OTP. LinkPointers */
|
||||
DCSM_OTP_Z2_LINKPOINTER : origin = 0x78200, length = 0x00006
|
||||
|
||||
/* DCSM Z2 Zone Select Contents (!!Movable!!) */
|
||||
/* Z2 OTP. Z2 password locations / Flash and RAM partitioning */
|
||||
DCSM_ZSEL_Z2_P0 : origin = 0x78220, length = 0x000020
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Remove the DSECT when you're ready to permanantly write to these
|
||||
sections. Make sure you've also uncommented the .asm file! */
|
||||
dcsm_otp_z1_linkpointer : > DCSM_OTP_Z1_LINKPOINTER, PAGE = 0, type = DSECT
|
||||
dcsm_zsel_z1 : > DCSM_ZSEL_Z1_P0, PAGE = 0, type = DSECT
|
||||
|
||||
dcsm_otp_z2_linkpointer : > DCSM_OTP_Z2_LINKPOINTER, PAGE = 0, type = DSECT
|
||||
dcsm_zsel_z2 : > DCSM_ZSEL_Z2_P0, PAGE = 0, type = DSECT
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */
|
||||
// FLASH13_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(8)
|
||||
.cinit : > FLASH4, ALIGN(8)
|
||||
.switch : > FLASH1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
.stack : > RAMM1
|
||||
|
||||
.init_array : > FLASH1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH7, ALIGN(8)
|
||||
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
|
||||
ZONE1_RAM : > RAMLS2
|
||||
ZONE2_RAM : > RAMLS4
|
||||
ZONE1_CODE : > FLASH5
|
||||
ZONE2_CODE : > FLASH6
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,353 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_dcsm_ffi.c
|
||||
//
|
||||
// TITLE: DCSM Freedom From Interference example
|
||||
//
|
||||
//! \defgroup sdl_ex_dcsm_ffi Using DCSM for Freedom From Interference (FFI)
|
||||
//! <h1>sdl_ex_dcsm_ffi</h1>
|
||||
//!
|
||||
//! This example demonstrates how to configure and use DCSM and how the DCSM
|
||||
//! blocks writes from one secured zone to another, simulating the its use to
|
||||
//! create firewalls between code of different safety requirement criticality.
|
||||
//!
|
||||
//! It uses the default passwords to allocate one LSRAM block and one flash
|
||||
//! sector to zone 1 and another to zone 2. In this example, zoning of memories
|
||||
//! is done by programming the DCSM OTP. The values that are programmed can be
|
||||
//! found in in dcsm.asm. Secured RAM blocks are partitioned to contain data
|
||||
//! arrays used in the example, and secured Flash sectors contain the program
|
||||
//! code. Once secure, both zone1LockedArray and zone2LockedArray are immutable
|
||||
//! outside of the safety functions residing in the same zone.
|
||||
//!
|
||||
//! !!IMPORTANT!! By default, assignments in dcsm.asm are commented out and
|
||||
//! the sections mapped to OTP in dcsm.cmd are given the "type = DSECT"
|
||||
//! attribute to prevent programming of the OTP. In this state, this example is
|
||||
//! expected to fail (result = FAIL) because the memories won't actually be
|
||||
//! secured. If you are sure you want to permanently update the zones' link
|
||||
//! pointers and zone select blocks, uncomment the code in dcsm.asm and remove
|
||||
//! "type = DSECT" from dcsm.cmd.
|
||||
//!
|
||||
//! Parts of this example where generated with assistance from the DCSM Tool.
|
||||
//! We strongly recommend using this tool to generate the code for your DCSM
|
||||
//! configuration. Refer to the following guide for more information:
|
||||
//! http://www.ti.com/lit/pdf/spracp8
|
||||
//!
|
||||
//! \note This example assumes you have not written to the DCSM OTP before and
|
||||
//! that the first zone select block is available for use. If this is not the
|
||||
//! case, you will need to update the link pointer, zone select block address,
|
||||
//! and passwords to use the next available zone select block.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b result - Status indicating success of blocking writes to
|
||||
//! secured zones.
|
||||
//! - \b errorZone1NotChanged, errorZone2NotChanged, errorZone1Changed,
|
||||
//! errorZone2Changed - Count of errors found during execution.
|
||||
//! - \b zone1LockedArray - Array located in zone 1 secured memory.
|
||||
//! - \b zone2LockedArray - Array located in zone 2 secured memory.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 0U
|
||||
#define FAIL 1U
|
||||
|
||||
#define ARRAY_SIZE 256U
|
||||
#define INIT_ARRAY1 0U
|
||||
#define INIT_ARRAY2 1U
|
||||
#define Z1_CHANGE_Z1 2U
|
||||
#define Z1_CHANGE_Z2 3U
|
||||
#define Z2_CHANGE_Z1 4U
|
||||
#define Z2_CHANGE_Z2 5U
|
||||
#define UNSEC_CHANGE_Z1 6U
|
||||
#define UNSEC_CHANGE_Z2 7U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t result = FAIL;
|
||||
|
||||
uint16_t zone1LockedArray[ARRAY_SIZE]; // Located in zone 1
|
||||
uint16_t zone2LockedArray[ARRAY_SIZE]; // Located in zone 2
|
||||
|
||||
#pragma DATA_SECTION(zone1LockedArray, "ZONE1_RAM");
|
||||
#pragma DATA_SECTION(zone2LockedArray, "ZONE2_RAM");
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initArray1(void); // Initializes array to value, located in Z1
|
||||
void initArray2(void); // Initializes array to value, located in Z2
|
||||
void secureFunction1(void); // Located in zone 1
|
||||
void secureFunction2(void); // Located in zone 2
|
||||
void unsecureFunction(void); // Located in unsecured memory
|
||||
uint16_t checkArray1(uint16_t); // Checks Z1 data against value, located in Z1
|
||||
uint16_t checkArray2(uint16_t); // Checks Z2 data against value, located in Z2
|
||||
|
||||
#pragma CODE_SECTION(initArray1, "ZONE1_CODE");
|
||||
#pragma CODE_SECTION(initArray2, "ZONE2_CODE");
|
||||
#pragma CODE_SECTION(secureFunction1, "ZONE1_CODE");
|
||||
#pragma CODE_SECTION(secureFunction2, "ZONE2_CODE");
|
||||
#pragma CODE_SECTION(checkArray1, "ZONE1_CODE");
|
||||
#pragma CODE_SECTION(checkArray2, "ZONE2_CODE");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errorZone1NotChanged = 0U, errorZone1Changed = 0U;
|
||||
uint16_t errorZone2NotChanged = 0U, errorZone2Changed = 0U;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Initialize arrays.
|
||||
//
|
||||
initArray1();
|
||||
initArray2();
|
||||
|
||||
//
|
||||
// Make sure both zone 1 and zone 2 are locked
|
||||
//
|
||||
DCSM_secureZone1();
|
||||
DCSM_secureZone2();
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// Calling secure function 1 - Zone 1 array will be updated. Will attempt
|
||||
// to update zone 2 but should be blocked.
|
||||
//
|
||||
//*************************************************************************
|
||||
secureFunction1();
|
||||
|
||||
//
|
||||
// Checking array contents from secure code.
|
||||
//
|
||||
errorZone1NotChanged = checkArray1(Z1_CHANGE_Z1);
|
||||
errorZone2Changed = checkArray2(INIT_ARRAY2);
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// Calling secure function 2 - Zone 2 array will be updated. Will attempt
|
||||
// to update zone 1 but should be blocked.
|
||||
//
|
||||
//*************************************************************************
|
||||
secureFunction2();
|
||||
|
||||
//
|
||||
// Checking array contents from secure code.
|
||||
//
|
||||
errorZone1Changed = checkArray1(Z1_CHANGE_Z1);
|
||||
errorZone2NotChanged = checkArray2(Z2_CHANGE_Z2);
|
||||
|
||||
//*************************************************************************
|
||||
//
|
||||
// Calling unsecure function - Will attempt to write to both arrays but
|
||||
// should be blocked in both zones.
|
||||
//
|
||||
//*************************************************************************
|
||||
unsecureFunction();
|
||||
|
||||
//
|
||||
// Checking array contents from secure code.
|
||||
//
|
||||
errorZone1Changed += checkArray1(Z1_CHANGE_Z1);
|
||||
errorZone2Changed += checkArray2(Z2_CHANGE_Z2);
|
||||
|
||||
//
|
||||
// Report whether any data was incorrectly updated.
|
||||
//
|
||||
if((errorZone1Changed != 0U) || (errorZone1NotChanged != 0U) ||
|
||||
(errorZone2Changed != 0U) || (errorZone2NotChanged != 0U))
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// initArray1 - Fill the zone 1 array with a known value to start.
|
||||
//
|
||||
void initArray1(void)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
zone1LockedArray[i] = INIT_ARRAY1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// initArray2 - Fill the zone 2 array with a known value to start.
|
||||
//
|
||||
void initArray2(void)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
zone2LockedArray[i] = INIT_ARRAY2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// secureFunction1 - This function resides secure memory grabbed by DCSM
|
||||
// zone 1. zone1LockedArray is modified whereas writes to zone2LockedArray are
|
||||
// blocked because it resides zone 2 memory.
|
||||
//
|
||||
void secureFunction1(void)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
zone1LockedArray[i] = Z1_CHANGE_Z1;
|
||||
zone2LockedArray[i] = Z1_CHANGE_Z2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// secureFunction2 - This function resides secure memory grabbed by DCSM
|
||||
// zone 2. zone2LockedArray is modified whereas writes to zone1LockedArray are
|
||||
// blocked because it resides zone 2 memory.
|
||||
//
|
||||
void secureFunction2(void)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
zone1LockedArray[i] = Z2_CHANGE_Z1;
|
||||
zone2LockedArray[i] = Z2_CHANGE_Z2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// unsecureFunction - This function resides in unsecure memory and is blocked
|
||||
// from writing to either array.
|
||||
//
|
||||
void unsecureFunction(void)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
zone1LockedArray[i] = UNSEC_CHANGE_Z1;
|
||||
zone2LockedArray[i] = UNSEC_CHANGE_Z2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// checkArray1 - This function resides in secure memory grabbed by DCSM
|
||||
// zone 1. It compares zone1LockedArray against a parameter value and returns
|
||||
// the count of unexpected values.
|
||||
//
|
||||
uint16_t checkArray1(uint16_t value)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
uint16_t count = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
if(zone1LockedArray[i] != value)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
//
|
||||
// checkArray2 - This function resides in secure memory grabbed by DCSM
|
||||
// zone 2. It compares zone2LockedArray against a parameter value and returns
|
||||
// the count of unexpected values.
|
||||
//
|
||||
uint16_t checkArray2(uint16_t value)
|
||||
{
|
||||
uint16_t i = 0U;
|
||||
uint16_t count = 0U;
|
||||
|
||||
for(i = 0U; i < ARRAY_SIZE; i++)
|
||||
{
|
||||
if(zone2LockedArray[i] != value)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_flash_ecc_test"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../sdl_ex_flash_ecc_test.c" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+664
@@ -0,0 +1,664 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_flash_ecc_test.c
|
||||
//
|
||||
// TITLE: Test of ECC logic in Flash
|
||||
//
|
||||
//! \defgroup sdl_ex_flash_ecc_test Test of ECC logic in Flash
|
||||
//! <h1>sdl_ex_flash_ecc_test</h1>
|
||||
//!
|
||||
//! This example demonstrates how to test the Flash ECC logic functionality.
|
||||
//!
|
||||
//! A software test of the Flash ECC logic can be performed with the help of
|
||||
//! ECC test registers. Using the test registers, you can generate both single
|
||||
//! bit errors and uncorrectable errors. For additional details on the
|
||||
//! implementation of this diagnostic, see the "SECDED Logic Correctness Check"
|
||||
//! section in the device technical reference manual.
|
||||
//!
|
||||
//! \note When using the flash test mode, you should not execute code from
|
||||
//! Flash. Note the #pragma CODE_SECTION lines below.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b nmiISRFlag - Indicates that the NMI was triggered and called the ISR.
|
||||
//! - \b nmiStatus - NMI status flags read in the ISR.
|
||||
//! - \b errorISRFlag - Indicates that the correctable ECC error interrupt was
|
||||
//! triggered and called the ISR.
|
||||
//! - \b errorStatus - Error status flags read in the ISR, indicating whether
|
||||
//! an error was single-bit or uncorrectable.
|
||||
//! - \b errorCount - Number of correctable errors detected read in the ISR.
|
||||
//! - \b errorType - For a single-bit error, indicates whether it was in the
|
||||
//! data or ECC bits.
|
||||
//! - \b dataOut - For a single-bit error, displays the corrected data.
|
||||
//! - \b result - Status of a successful detection and handling of ECC errors.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 0U
|
||||
#define FAIL 1U
|
||||
|
||||
#define ISR_LOOP_TIMEOUT 0x3U
|
||||
#define MASK_ALL_BUT_FLASH_ERR \
|
||||
(0x0000FFFFUL & ~(uint32_t)SYSCTL_STATUS_FLASH_CORRECTABLE_ERR)
|
||||
|
||||
//
|
||||
// Flash ECC Logic test values
|
||||
//
|
||||
#define TEST_FLASH_DATA64 0xFEDCBA0987654321ULL
|
||||
#define TEST_FLASH_DATAL ((uint32_t)(TEST_FLASH_DATA64))
|
||||
#define TEST_FLASH_DATAH ((uint32_t)(TEST_FLASH_DATA64 >> 32))
|
||||
#define TEST_FLASH_ADDR 0x00090000UL
|
||||
|
||||
//
|
||||
// Typedefs
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
TEST_ECC_BLOCK_LOW = 0x00, //!< Low 64-bit block
|
||||
TEST_ECC_BLOCK_HIGH = 0x02 //!< High 64-bit block
|
||||
} ECCBlock;
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t calcECC;
|
||||
uint32_t result = FAIL;
|
||||
volatile bool nmiISRFlag;
|
||||
uint16_t nmiStatus;
|
||||
volatile bool errorISRFlag;
|
||||
uint16_t errorStatus;
|
||||
uint16_t errorCount;
|
||||
uint32_t errorType;
|
||||
uint32_t dataOutLow;
|
||||
uint32_t dataOutHigh;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
// All the code we're using while test mode is enabled should be executed
|
||||
// from Flash.
|
||||
//
|
||||
__interrupt void nmiISR(void);
|
||||
__interrupt void corrErrorISR(void);
|
||||
#pragma CODE_SECTION(nmiISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(corrErrorISR, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_getECCTestStatus, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_clearUncorrectableInterruptFlag, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_getECCTestSingleBitErrorType, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_getTestDataOutHigh, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_getTestDataOutLow, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_getErrorCount, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_clearSingleErrorInterruptFlag, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_getNMIFlagStatus, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_clearAllNMIFlags, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_getInterruptStatus, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(SysCtl_clearInterruptStatus, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Interrupt_clearACKGroup, ".TI.ramfunc");
|
||||
|
||||
uint16_t runCorrectableDataErrorTest(void);
|
||||
uint16_t runCorrectableECCErrorTest(void);
|
||||
uint16_t runUncorrectableErrorTest(void);
|
||||
void testECCBlock(uint64_t data, uint32_t address, ECCBlock eccBlock,
|
||||
uint16_t ecc);
|
||||
|
||||
uint16_t calculateECC(uint32_t address, uint64_t data);
|
||||
#pragma CODE_SECTION(testECCBlock, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_enableECCTestMode, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_performECCCalculation, ".TI.ramfunc");
|
||||
#pragma CODE_SECTION(Flash_disableECCTestMode, ".TI.ramfunc");
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t failCount;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Clear all the NMI and Flash error status flags.
|
||||
//
|
||||
EALLOW;
|
||||
HWREG(FLASH0ECC_BASE + FLASH_O_ERR_STATUS_CLR) = 0xFFFFFFFFU;
|
||||
HWREG(FLASH0ECC_BASE + FLASH_O_ERR_INTCLR) = 0xFFFFFFFFU;
|
||||
EDIS;
|
||||
|
||||
SysCtl_clearAllNMIFlags();
|
||||
SysCtl_clearInterruptStatus(0xFFFFFFFFU);
|
||||
|
||||
//
|
||||
// Plug the NMI and Flash correctable error ISRs.
|
||||
//
|
||||
Interrupt_register(INT_NMI, &nmiISR);
|
||||
Interrupt_register(INT_SYS_ERR, corrErrorISR);
|
||||
Interrupt_enable(INT_SYS_ERR);
|
||||
|
||||
SysCtl_setInterruptStatusMask(MASK_ALL_BUT_FLASH_ERR);
|
||||
|
||||
//
|
||||
// Enabling the NMI global interrupt (typically already enabled by boot ROM
|
||||
// or GEL file).
|
||||
//
|
||||
SysCtl_enableNMIGlobalInterrupt();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM).
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Calculate ECC on test data.
|
||||
//
|
||||
calcECC = calculateECC(TEST_FLASH_ADDR, TEST_FLASH_DATA64);
|
||||
|
||||
//
|
||||
// Enable ECC.
|
||||
//
|
||||
Flash_enableECC(FLASH0ECC_BASE);
|
||||
|
||||
//
|
||||
// Test detection of correctable ECC errors in Flash data bits.
|
||||
//
|
||||
failCount = runCorrectableDataErrorTest();
|
||||
|
||||
//
|
||||
// Test detection of correctable ECC errors in Flash ECC bits.
|
||||
//
|
||||
failCount += runCorrectableECCErrorTest();
|
||||
|
||||
//
|
||||
// Test detection of uncorrectable ECC errors in Flash.
|
||||
//
|
||||
failCount += runUncorrectableErrorTest();
|
||||
|
||||
//
|
||||
// Status of a successful handling of the ECC errors.
|
||||
//
|
||||
if(failCount != 0U)
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// nmiISR - The interrupt service routine called when the NMI is generated
|
||||
// on an uncorrectable Flash ECC error.
|
||||
//
|
||||
__interrupt void nmiISR(void)
|
||||
{
|
||||
//
|
||||
// Set a flag indicating the NMI ISR occurred and get the NMI status.
|
||||
//
|
||||
nmiISRFlag = true;
|
||||
nmiStatus = SysCtl_getNMIFlagStatus();
|
||||
|
||||
//
|
||||
// Record the error test status.
|
||||
//
|
||||
errorStatus = Flash_getECCTestStatus(FLASH0ECC_BASE);
|
||||
|
||||
//
|
||||
// Clear all the flags.
|
||||
//
|
||||
EALLOW;
|
||||
HWREG(FLASH0ECC_BASE + FLASH_O_ERR_STATUS_CLR) = 0xFFFFFFFFU;
|
||||
EDIS;
|
||||
|
||||
Flash_clearUncorrectableInterruptFlag(FLASH0ECC_BASE);
|
||||
SysCtl_clearAllNMIFlags();
|
||||
}
|
||||
|
||||
//
|
||||
// corrErrorISR - The interrupt service routine called when the correctable
|
||||
// error count hits the configured interrupt threshold.
|
||||
//
|
||||
__interrupt void corrErrorISR(void)
|
||||
{
|
||||
//
|
||||
// Set a flag indicating the RAM error ISR occurred.
|
||||
//
|
||||
errorISRFlag = true;
|
||||
|
||||
//
|
||||
// Record the type of error injected, the status flags, the corrected data,
|
||||
// and the number of single-bit ECC errors detected.
|
||||
//
|
||||
errorType = Flash_getECCTestSingleBitErrorType(FLASH0ECC_BASE);
|
||||
errorStatus = Flash_getECCTestStatus(FLASH0ECC_BASE);
|
||||
dataOutLow = Flash_getTestDataOutLow(FLASH0ECC_BASE);
|
||||
dataOutHigh = Flash_getTestDataOutHigh(FLASH0ECC_BASE);
|
||||
errorCount = Flash_getErrorCount(FLASH0ECC_BASE);
|
||||
|
||||
//
|
||||
// Clear all the flags.
|
||||
//
|
||||
EALLOW;
|
||||
HWREG(FLASH0ECC_BASE + FLASH_O_ERR_STATUS_CLR) = 0xFFFFFFFFU;
|
||||
EDIS;
|
||||
|
||||
Flash_clearSingleErrorInterruptFlag(FLASH0ECC_BASE);
|
||||
|
||||
uint32_t sysIntStatus = SysCtl_getInterruptStatus();
|
||||
SysCtl_clearInterruptStatus(sysIntStatus);
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// runCorrectableDataErrorTest - Runs a test of the correctable data error
|
||||
// detection and correction as well as the error interrupt threshold.
|
||||
//
|
||||
uint16_t runCorrectableDataErrorTest(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout= ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Clear error status variables.
|
||||
//
|
||||
errorISRFlag = false;
|
||||
errorStatus = 0U;
|
||||
errorType = 0U;
|
||||
errorCount = 0U;
|
||||
dataOutLow = 0U;
|
||||
dataOutHigh = 0U;
|
||||
|
||||
//
|
||||
// Configure the correctable error interrupt threshold to >1 errors.
|
||||
//
|
||||
Flash_setErrorThreshold(FLASH0ECC_BASE, 1U);
|
||||
|
||||
//
|
||||
// Flip a single bit in the data to inject a correctable error for the
|
||||
// test to detect.
|
||||
//
|
||||
testECCBlock(TEST_FLASH_DATA64 ^ 0x80U, TEST_FLASH_ADDR,
|
||||
TEST_ECC_BLOCK_LOW, calcECC);
|
||||
|
||||
//
|
||||
// Generate another single bit error to increase the count above the
|
||||
// threshold.
|
||||
//
|
||||
testECCBlock(TEST_FLASH_DATA64 ^ ((uint64_t)0x1U << 37), TEST_FLASH_ADDR,
|
||||
TEST_ECC_BLOCK_LOW, calcECC);
|
||||
|
||||
//
|
||||
// Wait until the error interrupt is fired.
|
||||
//
|
||||
while((errorISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the appropriate correctable Flash error flag was set.
|
||||
//
|
||||
if((errorStatus & FLASH_SINGLE_ERROR) != FLASH_SINGLE_ERROR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the error count is 2.
|
||||
//
|
||||
if(errorCount != 2U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the error was a data error.
|
||||
//
|
||||
if(errorType != FLASH_DATA_ERR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check that the data value was corrected properly.
|
||||
//
|
||||
if(dataOutLow != TEST_FLASH_DATAL)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
if(dataOutHigh != TEST_FLASH_DATAH)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// runCorrectableECCErrorTest - Runs a test of the correctable error detection.
|
||||
//
|
||||
uint16_t runCorrectableECCErrorTest(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout= ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Clear error status variables.
|
||||
//
|
||||
errorISRFlag = false;
|
||||
errorStatus = 0U;
|
||||
errorType = 0U;
|
||||
|
||||
//
|
||||
// Configure the correctable error interrupt threshold to >0 errors.
|
||||
//
|
||||
Flash_setErrorThreshold(FLASH0ECC_BASE, 0U);
|
||||
|
||||
//
|
||||
// Flip a single bit in the data to inject a correctable error for the
|
||||
// test to detect.
|
||||
//
|
||||
testECCBlock(TEST_FLASH_DATA64, TEST_FLASH_ADDR,
|
||||
TEST_ECC_BLOCK_LOW, calcECC ^ 0x2U);
|
||||
|
||||
//
|
||||
// Wait until the error interrupt is fired.
|
||||
//
|
||||
while((errorISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the appropriate correctable Flash error flag was set.
|
||||
//
|
||||
if((errorStatus & FLASH_SINGLE_ERROR) != FLASH_SINGLE_ERROR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the error was an ECC error.
|
||||
//
|
||||
if(errorType != FLASH_ECC_ERR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// runUncorrectableErrorTest - Runs a test of the uncorrectable data error
|
||||
// detection and associated NMI generation.
|
||||
//
|
||||
uint16_t runUncorrectableErrorTest(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout= ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Clear error status variables.
|
||||
//
|
||||
nmiISRFlag = false;
|
||||
nmiStatus = 0U;
|
||||
errorStatus = 0U;
|
||||
|
||||
//
|
||||
// Flip multiple bits in the data to inject an uncorrectable error for the
|
||||
// test to detect.
|
||||
//
|
||||
testECCBlock(TEST_FLASH_DATA64 ^ 0x30U, TEST_FLASH_ADDR,
|
||||
TEST_ECC_BLOCK_LOW, calcECC);
|
||||
|
||||
//
|
||||
// Wait until the NMI is fired.
|
||||
//
|
||||
while((nmiISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the NMI triggered was due to an uncorrectable Flash error.
|
||||
//
|
||||
if((nmiStatus & SYSCTL_NMI_FLUNCERR) != SYSCTL_NMI_FLUNCERR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the appropriate uncorrectable Flash error flag was set.
|
||||
//
|
||||
if((errorStatus & FLASH_UNC_ERROR) != FLASH_UNC_ERROR)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// testECCBlock - Sets up the ECC test registers and performs the ECC
|
||||
// calculation to detect and error if one is injected.
|
||||
//
|
||||
void testECCBlock(uint64_t data, uint32_t address, ECCBlock eccBlock,
|
||||
uint16_t ecc)
|
||||
{
|
||||
//
|
||||
// Write 128-bit flash address in FADDR_TEST
|
||||
//
|
||||
Flash_setECCTestAddress(FLASH0ECC_BASE, address);
|
||||
|
||||
//
|
||||
// Write lower 32 bits of data in FDATAL_TEST
|
||||
//
|
||||
Flash_setDataLowECCTest(FLASH0ECC_BASE, (uint32_t)data);
|
||||
|
||||
//
|
||||
// Write upper 32 bits of data in FDATAH_TEST
|
||||
//
|
||||
Flash_setDataHighECCTest(FLASH0ECC_BASE, (uint32_t)(data >> 32));
|
||||
|
||||
//
|
||||
// Write corresponding ECC in the FECC_TEST
|
||||
// Insert double bit error in flash ecc
|
||||
//
|
||||
Flash_setECCTestECCBits(FLASH0ECC_BASE, ecc);
|
||||
|
||||
//
|
||||
// Select the ECC block to be tested. Only one of the SECDED modules (out
|
||||
// of the two SECDED modules that work on lower 64 bits and upper 64 bits
|
||||
// of a read 128-bit data) at a time can be tested.
|
||||
//
|
||||
if(eccBlock == TEST_ECC_BLOCK_LOW)
|
||||
{
|
||||
Flash_selectLowECCBlock(FLASH0ECC_BASE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Flash_selectHighECCBlock(FLASH0ECC_BASE);
|
||||
}
|
||||
|
||||
//
|
||||
// Enable the ECC Test Mode
|
||||
//
|
||||
Flash_enableECCTestMode(FLASH0ECC_BASE);
|
||||
|
||||
//
|
||||
// Perform ECC calculation
|
||||
//
|
||||
Flash_performECCCalculation(FLASH0ECC_BASE);
|
||||
|
||||
//
|
||||
// Disable the ECC Test Mode
|
||||
//
|
||||
Flash_disableECCTestMode(FLASH0ECC_BASE);
|
||||
}
|
||||
|
||||
//
|
||||
// calcECC - Calculate the ECC for an address/data pair. This code comes from
|
||||
// the ECC Calculation Algorithm appendix of the Flash API reference
|
||||
// guide (SPNU628). If you are using the Flash API in your code, you
|
||||
// could use Fapi_calculateEcc() instead.
|
||||
//
|
||||
uint16_t calculateECC(uint32_t address, uint64_t data)
|
||||
{
|
||||
const uint32_t addrSyndrome[8] = {0x554EAU, 0x0BAD1U, 0x2A9B5U, 0x6A78DU,
|
||||
0x19F83U, 0x07F80U, 0x7FF80U, 0x0007FU};
|
||||
const uint64_t dataSyndrome[8] = {0xB4D1B4D14B2E4B2EU, 0x1557155715571557U,
|
||||
0xA699A699A699A699U, 0x38E338E338E338E3U,
|
||||
0xC0FCC0FCC0FCC0FCU, 0xFF00FF00FF00FF00U,
|
||||
0xFF0000FFFF0000FFU, 0x00FFFF00FF0000FFU};
|
||||
const uint16_t parity = 0xFCU;
|
||||
uint64_t xorData;
|
||||
uint32_t xorAddr;
|
||||
uint16_t bit, eccBit, eccVal;
|
||||
|
||||
//
|
||||
// Extract bits "20:2" of the address
|
||||
//
|
||||
address = (address >> 2) & 0x7FFFFU;
|
||||
|
||||
//
|
||||
// Compute the ECC one bit at a time.
|
||||
//
|
||||
eccVal = 0U;
|
||||
|
||||
for (bit = 0U; bit < 8U; bit++)
|
||||
{
|
||||
//
|
||||
// Apply the encoding masks to the address and data
|
||||
//
|
||||
xorAddr = address & addrSyndrome[bit];
|
||||
xorData = data & dataSyndrome[bit];
|
||||
|
||||
//
|
||||
// Fold the masked address into a single bit for parity calculation.
|
||||
// The result will be in the LSB.
|
||||
//
|
||||
xorAddr = xorAddr ^ (xorAddr >> 16);
|
||||
xorAddr = xorAddr ^ (xorAddr >> 8);
|
||||
xorAddr = xorAddr ^ (xorAddr >> 4);
|
||||
xorAddr = xorAddr ^ (xorAddr >> 2);
|
||||
xorAddr = xorAddr ^ (xorAddr >> 1);
|
||||
|
||||
//
|
||||
// Fold the masked data into a single bit for parity calculation.
|
||||
// The result will be in the LSB.
|
||||
//
|
||||
xorData = xorData ^ (xorData >> 32);
|
||||
xorData = xorData ^ (xorData >> 16);
|
||||
xorData = xorData ^ (xorData >> 8);
|
||||
xorData = xorData ^ (xorData >> 4);
|
||||
xorData = xorData ^ (xorData >> 2);
|
||||
xorData = xorData ^ (xorData >> 1);
|
||||
|
||||
//
|
||||
// Merge the address and data, extract the ECC bit, and add it in
|
||||
//
|
||||
eccBit = ((uint16_t)xorData ^ (uint16_t)xorAddr) & 0x0001U;
|
||||
eccVal |= eccBit << bit;
|
||||
}
|
||||
|
||||
//
|
||||
// Handle the bit parity. For odd parity, XOR the bit with 1
|
||||
//
|
||||
eccVal ^= parity;
|
||||
return eccVal;
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_flash_prefetch_test"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=0 -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../sdl_ex_flash_prefetch_test.c" targetDirectory="" />
|
||||
<file action="copy" path="../sdl_ex_flash_prefetch_test_func.asm" targetDirectory="" />
|
||||
<file action="copy" path="../../test_application/sta_util.c" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+310
@@ -0,0 +1,310 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_flash_prefetch_test.c
|
||||
//
|
||||
// TITLE: Software Test of Flash Prefetch, Data Cache and Wait-States
|
||||
//
|
||||
//! \defgroup sdl_ex_flash_prefetch_test Test of Flash Prefetch, Data Cache and Wait-States
|
||||
//! <h1>sdl_ex_flash_prefetch_test</h1>
|
||||
//!
|
||||
//! This example demonstrates how to test the behavior of the flash prefetch,
|
||||
//! data cache, and wait-states. Each of these configurations are altered one
|
||||
//! by one and the impact they have on a test function's execution time is
|
||||
//! measured. It is expected that an increase in the execution time will be
|
||||
//! observed in each case.
|
||||
//!
|
||||
//! Note that as mentioned in the safety manual description of this diagnostic,
|
||||
//! a golden value may be used to check the execution time. This wasn't used
|
||||
//! for this example because of possible compiler differences between users'
|
||||
//! environments, but can be used in your actual application.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b baseCycles - Execution time of runPrefetchTestCode();
|
||||
//! - \b failCount - Number of tests that returned failures.
|
||||
//! - \b result - Status of flash configuration logic test.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
#include "sta_util.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define PASS 0U
|
||||
#define FAIL 1U
|
||||
#define PIPELINE_FLUSH __asm(" RPT #7 || NOP")
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t result = FAIL;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
uint32_t testBaseline(void);
|
||||
uint16_t testPrefetch(uint32_t baseCycles);
|
||||
uint16_t testDataCache(uint32_t baseCycles);
|
||||
uint16_t testWaitStates(uint32_t baseCycles);
|
||||
|
||||
//
|
||||
// Place functions in RAM since they will be modifying flash configurations.
|
||||
//
|
||||
#pragma CODE_SECTION(testBaseline, ".TI.ramfunc")
|
||||
#pragma CODE_SECTION(testPrefetch, ".TI.ramfunc")
|
||||
#pragma CODE_SECTION(testDataCache, ".TI.ramfunc")
|
||||
#pragma CODE_SECTION(testWaitStates, ".TI.ramfunc")
|
||||
#pragma FUNC_CANNOT_INLINE(testBaseline);
|
||||
#pragma FUNC_CANNOT_INLINE(testPrefetch);
|
||||
#pragma FUNC_CANNOT_INLINE(testDataCache);
|
||||
#pragma FUNC_CANNOT_INLINE(testWaitStates);
|
||||
|
||||
//
|
||||
// This is the function that will be profiled under different flash conditions.
|
||||
// Its implementation can be found in sdl_ex_flash_prefetch_test_func.asm.
|
||||
//
|
||||
extern void runPrefetchTestCode(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t failCount = 0U;
|
||||
uint32_t baseCycles;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM).
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Borrowing the STA profiling function for this test. Set up CPU Timer 1.
|
||||
//
|
||||
STA_Util_configProfiler(CPUTIMER1_BASE);
|
||||
|
||||
//
|
||||
// Get the original execution time.
|
||||
//
|
||||
baseCycles = testBaseline();
|
||||
|
||||
//
|
||||
// Alter the flash configurations and check that the execution time
|
||||
// increases as a result.
|
||||
//
|
||||
failCount += testPrefetch(baseCycles);
|
||||
failCount += testDataCache(baseCycles);
|
||||
failCount += testWaitStates(baseCycles);
|
||||
|
||||
//
|
||||
// Status of flash configuration logic test.
|
||||
//
|
||||
if(failCount != 0U)
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// testBaseline - Call the test function with the typical flash configurations:
|
||||
// prefetch and data cache enabled with the recommended number of wait-states
|
||||
// for the system clock speed.
|
||||
//
|
||||
uint32_t testBaseline(void)
|
||||
{
|
||||
uint32_t cycles;
|
||||
|
||||
//
|
||||
// Call the test function and capture the execution time.
|
||||
//
|
||||
STA_Util_startProfiler(CPUTIMER1_BASE);
|
||||
runPrefetchTestCode();
|
||||
cycles = STA_Util_stopProfiler(CPUTIMER1_BASE);
|
||||
|
||||
return(cycles);
|
||||
}
|
||||
|
||||
//
|
||||
// testPrefetch - Disable prefetch and confirm that the execution time
|
||||
// of the test function increases.
|
||||
//
|
||||
uint16_t testPrefetch(uint32_t baseCycles)
|
||||
{
|
||||
uint16_t fail = 1U;
|
||||
uint32_t cycles;
|
||||
|
||||
Flash_disablePrefetch(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Call the test function and capture the execution time.
|
||||
//
|
||||
STA_Util_startProfiler(CPUTIMER1_BASE);
|
||||
runPrefetchTestCode();
|
||||
cycles = STA_Util_stopProfiler(CPUTIMER1_BASE);
|
||||
|
||||
Flash_enablePrefetch(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Confirm that execution time increased.
|
||||
//
|
||||
if(cycles > baseCycles)
|
||||
{
|
||||
fail = 0U;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// testDataCache - Disable data cache and confirm that the execution time
|
||||
// of the test function increases.
|
||||
//
|
||||
uint16_t testDataCache(uint32_t baseCycles)
|
||||
{
|
||||
uint16_t fail = 1U;
|
||||
uint32_t cycles;
|
||||
|
||||
Flash_disableCache(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Call the test function and capture the execution time.
|
||||
//
|
||||
STA_Util_startProfiler(CPUTIMER1_BASE);
|
||||
runPrefetchTestCode();
|
||||
cycles = STA_Util_stopProfiler(CPUTIMER1_BASE);
|
||||
|
||||
Flash_enableCache(FLASH0CTRL_BASE);
|
||||
|
||||
//
|
||||
// Confirm that execution time increased.
|
||||
//
|
||||
if(cycles > baseCycles)
|
||||
{
|
||||
fail = 0U;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// testWaitStates - Increase the number of wait-states and confirm that the
|
||||
// execution time of the test function increases.
|
||||
//
|
||||
uint16_t testWaitStates(uint32_t baseCycles)
|
||||
{
|
||||
uint16_t fail = 1U;
|
||||
uint32_t cycles;
|
||||
|
||||
//
|
||||
// Need to disable prefetch and cache before altering wait-states.
|
||||
//
|
||||
Flash_disablePrefetch(FLASH0CTRL_BASE);
|
||||
Flash_disableCache(FLASH0CTRL_BASE);
|
||||
Flash_setWaitstates(FLASH0CTRL_BASE, DEVICE_FLASH_WAITSTATES * 2);
|
||||
Flash_enablePrefetch(FLASH0CTRL_BASE);
|
||||
Flash_enableCache(FLASH0CTRL_BASE);
|
||||
|
||||
PIPELINE_FLUSH;
|
||||
|
||||
//
|
||||
// Call the test function and capture the execution time.
|
||||
//
|
||||
STA_Util_startProfiler(CPUTIMER1_BASE);
|
||||
runPrefetchTestCode();
|
||||
cycles = STA_Util_stopProfiler(CPUTIMER1_BASE);
|
||||
|
||||
//
|
||||
// Set wait-states back to original number.
|
||||
//
|
||||
Flash_disablePrefetch(FLASH0CTRL_BASE);
|
||||
Flash_disableCache(FLASH0CTRL_BASE);
|
||||
Flash_setWaitstates(FLASH0CTRL_BASE, DEVICE_FLASH_WAITSTATES);
|
||||
Flash_enablePrefetch(FLASH0CTRL_BASE);
|
||||
Flash_enableCache(FLASH0CTRL_BASE);
|
||||
|
||||
PIPELINE_FLUSH;
|
||||
|
||||
//
|
||||
// Confirm that execution time increased.
|
||||
//
|
||||
if(cycles > baseCycles)
|
||||
{
|
||||
fail = 0U;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
;;//###########################################################################
|
||||
;;//
|
||||
;;// FILE: sdl_ex_flash_prefetch_test_func.asm
|
||||
;;//
|
||||
;;// TITLE: Function for testing testing flash logic configurations.
|
||||
;;//
|
||||
;;//###########################################################################
|
||||
;;// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
;;// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
;;// $Copyright:
|
||||
;// 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.
|
||||
;// $
|
||||
;;//###########################################################################
|
||||
|
||||
;;
|
||||
;; Function needs to operate on some data in flash to allow us to observe the
|
||||
;; impact of the data cache disable/enable.
|
||||
;;
|
||||
.sect ".const:prefetchTestTable"
|
||||
.def prefetchTestTable
|
||||
.align 8
|
||||
|
||||
prefetchTestTable:
|
||||
.long 0x00001111
|
||||
.long 0x22223333
|
||||
.long 0x44445555
|
||||
.long 0x66667777
|
||||
.long 0x88889999
|
||||
.long 0xAAAABBBB
|
||||
.long 0xCCCCDDDD
|
||||
|
||||
;;
|
||||
;; This is nonsense code for the sake of testing. It has some branches and some
|
||||
;; accesses to const data which will allow us to observe differences in the
|
||||
;; execution time as we disable prefetch and cache and increase wait-states.
|
||||
;;
|
||||
;; Written in assembly to keep cycle counts consistent across compiler versions
|
||||
;; and optimization levels.
|
||||
;;
|
||||
.sect ".text:runPrefetchTestCode"
|
||||
.global runPrefetchTestCode
|
||||
.align 8
|
||||
|
||||
runPrefetchTestCode:
|
||||
ADDB SP, #8
|
||||
|
||||
MOVB ACC, #61
|
||||
MOVL *-SP[6], ACC
|
||||
|
||||
MOVB ACC, #0
|
||||
MOVL *-SP[8], ACC
|
||||
|
||||
CLRC SXM
|
||||
MOVL ACC, *-SP[6]
|
||||
SFR ACC, 5
|
||||
LSL ACC, 5
|
||||
LSL ACC, 1
|
||||
ADD ACC, #0x1f << 10
|
||||
MOVL *-SP[2], ACC
|
||||
|
||||
MOVB ACC, #1
|
||||
MOVL @XAR6, ACC
|
||||
MOV AL, *-SP[6]
|
||||
ANDB AL, #0x1f
|
||||
MOV T, @AL
|
||||
MOVL ACC, @XAR6
|
||||
LSLL ACC, T
|
||||
MOVL *-SP[4], ACC
|
||||
|
||||
TBIT *-SP[8], #0x2
|
||||
SB testLabel1, NTC
|
||||
|
||||
OR *-SP[2], AL
|
||||
OR *-SP[1], AH
|
||||
SB testLabel2, UNC
|
||||
|
||||
testLabel1:
|
||||
NOT ACC
|
||||
AND *-SP[2], AL
|
||||
AND *-SP[1], AH
|
||||
|
||||
testLabel2:
|
||||
TBIT *-SP[8], #0x0
|
||||
SB testLabel3, NTC
|
||||
NOP
|
||||
NOP ; NOPs added to make sure branch above is a prefetch miss
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
NOP
|
||||
MOVL ACC, *-SP[4]
|
||||
NOT ACC
|
||||
AND *-SP[2], AL
|
||||
AND *-SP[1], AH
|
||||
SB testLabel4, UNC
|
||||
|
||||
testLabel3:
|
||||
MOVL ACC, *-SP[4]
|
||||
OR *-SP[2], AL
|
||||
OR *-SP[1], AH
|
||||
|
||||
testLabel4:
|
||||
TBIT *-SP[8], #0x1
|
||||
SB testLabel5, NTC
|
||||
|
||||
MOVL ACC, *-SP[4]
|
||||
OR *-SP[2], AL
|
||||
OR *-SP[1], AH
|
||||
SB testLabel6, UNC
|
||||
|
||||
testLabel5:
|
||||
MOVL ACC, *-SP[4]
|
||||
NOT ACC
|
||||
AND *-SP[2], AL
|
||||
AND *-SP[1], AH
|
||||
|
||||
testLabel6:
|
||||
MOVL XAR6, #prefetchTestTable
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6++
|
||||
MOVL ACC, *XAR6
|
||||
|
||||
SUBB SP, #8
|
||||
LRETR
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_mcd_test"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x100 --heap_size=0x200" />
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../sdl_ex_mcd_test.c" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,256 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_mcd_test.c
|
||||
//
|
||||
// TITLE: Missing clock detection
|
||||
//
|
||||
//! \defgroup sdl_ex_mcd_test Missing clock detection
|
||||
//! <h1>sdl_ex_mcd_test</h1>
|
||||
//!
|
||||
//! This example demonstrates how to check the missing clock detection
|
||||
//! functionality.
|
||||
//!
|
||||
//! Once the MCD is simulated by disconnecting the clock to the MCD module
|
||||
//! an NMI is generated. This NMI determines that an MCD error was generated
|
||||
//! due to a clock failure which is handled in the ISR.
|
||||
//!
|
||||
//! Before the MCD the clock frequency will be as per device initialization.
|
||||
//! Post MCD error, the clock will be running at the speed of INTOSC1 with the
|
||||
//! PLL disabled (10 MHz).
|
||||
//!
|
||||
//! The example also shows how to lock the PLL after missing clock detection,
|
||||
//! by first explicitly switching the clock source to INTOSC1, resetting the
|
||||
//! missing clock detect circuit and then re-locking the PLL. After that the
|
||||
//! clock frequency will be restored to the original configuration.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b fail - Indicates that a missing clock was either not detected or was
|
||||
//! not handled correctly.
|
||||
//! - \b nmiISRFlag - Indicates that the missing clock failure caused an
|
||||
//! NMI to be triggered and called the ISR to handle it.
|
||||
//! - \b mcdDetect - Indicates that a missing clock was detected.
|
||||
//! - \b result - Status of a successful handling of missing clock detection.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 0U
|
||||
#define FAIL 1U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
bool mcdDetect = false;
|
||||
volatile bool nmiISRFlag = false;
|
||||
uint16_t nmiStatus = 0U;
|
||||
uint32_t result = FAIL;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void nmiISR(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint32_t fail = 0U;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Re-map NMI signal to call the ISR function in this example.
|
||||
//
|
||||
SysCtl_clearAllNMIFlags();
|
||||
Interrupt_register(INT_NMI, &nmiISR);
|
||||
|
||||
//
|
||||
// Enabling the NMI global interrupt (typically already enabled by boot ROM
|
||||
// or GEL file).
|
||||
//
|
||||
SysCtl_enableNMIGlobalInterrupt();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM).
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Check the PLL System clock before the Missing clock detection
|
||||
// is simulated. It should be same as that set by Device_init().
|
||||
//
|
||||
if(SysCtl_getClock(DEVICE_OSCSRC_FREQ) != DEVICE_SYSCLK_FREQ)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable the missing clock detection (MCD) Logic as a precaution.
|
||||
// The is continuously active unless the MCD was disabled previously.
|
||||
//
|
||||
SysCtl_enableMCD();
|
||||
|
||||
//
|
||||
// Simulate a missing clock.
|
||||
//
|
||||
SysCtl_disconnectMCDClockSource();
|
||||
|
||||
//
|
||||
// Wait till the NMI is fired on clock failure.
|
||||
//
|
||||
while(nmiISRFlag != true);
|
||||
|
||||
//
|
||||
// A missing clock was detected.
|
||||
//
|
||||
if(mcdDetect != true)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the NMI triggered was due to a clock failure.
|
||||
//
|
||||
if((nmiStatus & SYSCTL_NMI_CLOCKFAIL) != SYSCTL_NMI_CLOCKFAIL)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check the PLL System clock after the Missing clock detection
|
||||
// is simulated. It should be equal to INTOSC1(10Mhz).
|
||||
//
|
||||
if(SysCtl_getClock(DEVICE_OSCSRC_FREQ) != SYSCTL_DEFAULT_OSC_FREQ)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// To lock the PLL after missing clock detection, we first explicitly
|
||||
// switch the clock source to INTOSC1, reset the missing clock detect
|
||||
// circuit, and then re-lock the PLL.
|
||||
//
|
||||
// Configure oscillator source to INTOSC1.
|
||||
//
|
||||
SysCtl_selectOscSource(SYSCTL_OSCSRC_OSC1);
|
||||
|
||||
//
|
||||
// Re-connect missing clock detection to clock source to stop simulating
|
||||
// clock failure.
|
||||
//
|
||||
SysCtl_connectMCDClockSource();
|
||||
|
||||
//
|
||||
// Reset the missing clock detection logic after clock failure.
|
||||
//
|
||||
SysCtl_resetMCD();
|
||||
|
||||
//
|
||||
// Set up PLL control and clock dividers using the original clock source.
|
||||
//
|
||||
SysCtl_setClock(DEVICE_SETCLOCK_CFG);
|
||||
|
||||
//
|
||||
// Check the system clock after the missing clock detection is cleared
|
||||
// and handled using INTOSC1 as clock source.
|
||||
//
|
||||
if(SysCtl_getClock(DEVICE_OSCSRC_FREQ) != DEVICE_SYSCLK_FREQ)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Status of a successful handling of missing clock detection.
|
||||
//
|
||||
if(fail != 0U)
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// nmiISR - The interrupt service routine called when the NMI
|
||||
// is generated on clock failure detection.
|
||||
//
|
||||
__interrupt void nmiISR(void)
|
||||
{
|
||||
nmiISRFlag = true;
|
||||
mcdDetect = SysCtl_isMCDClockFailureDetected();
|
||||
nmiStatus = SysCtl_getNMIFlagStatus();
|
||||
SysCtl_clearAllNMIFlags();
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_ram_access_protect"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=770 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x100 --heap_size=0x200" />
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=770 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../f2838x_ram_access_protect_ram_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../f2838x_ram_access_protect_flash_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../sdl_ex_ram_access_protect.c" targetDirectory="" />
|
||||
<file action="copy" path="../f2838x_sdl_ex_ram_access_cla_read.cla" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */
|
||||
// FLASH13_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(8)
|
||||
.cinit : > FLASH4, ALIGN(8)
|
||||
.switch : > FLASH1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
.stack : > RAMM1
|
||||
|
||||
.init_array : > FLASH1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH5, ALIGN(8)
|
||||
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
|
||||
Cla1Prog : LOAD = FLASH3,
|
||||
RUN = RAMLS1,
|
||||
LOAD_START(cla1ProgLoadStart),
|
||||
LOAD_SIZE(cla1ProgLoadSize),
|
||||
RUN_START(cla1ProgRunStart),
|
||||
ALIGN(4)
|
||||
|
||||
.scratchpad : > RAMLS0
|
||||
|
||||
ramls6 : > RAMLS6
|
||||
ramgs0 : > RAMGS0
|
||||
|
||||
ramls1 : LOAD = FLASH3,
|
||||
RUN = RAMLS1,
|
||||
LOAD_START(ramls1LoadStart),
|
||||
LOAD_SIZE(ramls1LoadSize),
|
||||
RUN_START(ramls1RunStart),
|
||||
ALIGN(4)
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.text : >> RAMD0 | RAMD1 | RAMLS0 | RAMLS2 | RAMLS3
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS4
|
||||
|
||||
Cla1Prog : > RAMLS1
|
||||
.scratchpad : > RAMLS0
|
||||
|
||||
ramls1 : > RAMLS1
|
||||
ramls6 : > RAMLS6
|
||||
ramgs0 : > RAMGS0
|
||||
|
||||
.TI.ramfunc : > RAMM0
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_ram_access_cla_read.cla
|
||||
//
|
||||
// TITLE: RAM access protection violation detection CLA read task
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 <stdint.h>
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern volatile uint32_t ls6Data;
|
||||
|
||||
//
|
||||
// Cla1Task1 - Task code to do a read of a variable to which it shouldn't
|
||||
// have access.
|
||||
//
|
||||
__attribute__((interrupt)) void Cla1Task1(void)
|
||||
{
|
||||
uint32_t test;
|
||||
test = ls6Data;
|
||||
test++;
|
||||
}
|
||||
+926
@@ -0,0 +1,926 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_ram_access_protect.c
|
||||
//
|
||||
// TITLE: RAM access protection violation detection
|
||||
//
|
||||
//! \defgroup sdl_ex_ram_access_protect RAM access protection violation detection
|
||||
//! <h1>sdl_ex_ram_access_protect</h1>
|
||||
//!
|
||||
//! This example demonstrates a functional test of the RAM access protection
|
||||
//! violation detection and handling for several different types accesses. The
|
||||
//! example generates a number of controller or non-controller fetch, write,
|
||||
//! or read violations from the CPU, CLA, and DMA as applicable to the device.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b violationISRFlag - Indicates that the access violation interrupt was
|
||||
//! triggered and called the ISR.
|
||||
//! - \b illegalISRFlag - Indicates that a CPU fetch violation interrupt was
|
||||
//! generated and the ITRAP ISR ran.
|
||||
//! - \b violationStatus - Access protection violation status flags read in
|
||||
//! the ISR.
|
||||
//! - \b violationAddr - Address at which the access violation occurred.
|
||||
//! - \b result - Status of a successful detection and handling of RAM access
|
||||
//! protection violations.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 0U
|
||||
#define FAIL 1U
|
||||
|
||||
#define LS6_ORIG_VALUE 0xCBA98765U
|
||||
#define GS0_ORIG_VALUE1 0xF0F0F0F0U
|
||||
#define GS0_ORIG_VALUE2 0x5A5A5A5AU
|
||||
|
||||
#define ISR_LOOP_TIMEOUT 0x3U
|
||||
#define MASK_ALL_BUT_RAM_ACC_VIOL \
|
||||
(0x0000FFFFUL & ~(uint32_t)SYSCTL_STATUS_RAM_ACC_VIOL)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t result = FAIL;
|
||||
volatile bool violationISRFlag;
|
||||
volatile bool illegalISRFlag;
|
||||
uint32_t violationStatus;
|
||||
uint32_t violationAddr;
|
||||
|
||||
//
|
||||
// Reserving memory locations for testing.
|
||||
//
|
||||
#pragma DATA_SECTION(ls6Data, "ramls6");
|
||||
volatile uint32_t ls6Data = LS6_ORIG_VALUE;
|
||||
#pragma DATA_SECTION(gs0Data1, "ramgs0");
|
||||
volatile uint32_t gs0Data1 = GS0_ORIG_VALUE1;
|
||||
#pragma DATA_SECTION(gs0Data2, "ramgs0");
|
||||
volatile uint32_t gs0Data2 = GS0_ORIG_VALUE1;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void accessViolationISR(void);
|
||||
__interrupt void illegalISR(void);
|
||||
uint32_t generateNonControllerCPURdViolation(void);
|
||||
uint32_t generateNonControllerCPUWrViolation(void);
|
||||
uint32_t generateNonControllerCPUFetchViolation(void);
|
||||
uint32_t generateControllerCPUWrViolation(void);
|
||||
uint32_t generateControllerCPUFetchViolation(void);
|
||||
uint32_t generateControllerDMAWrViolation(void);
|
||||
uint32_t generateNonControllerCLAReadViolation(void);
|
||||
uint32_t generateNonControllerCLAFetchViolation(void);
|
||||
|
||||
extern void Cla1Task1(void);
|
||||
|
||||
#pragma CODE_SECTION(testCPUFetchFunc, "ramls1");
|
||||
void testCPUFetchFunc(void);
|
||||
|
||||
#ifdef _FLASH
|
||||
extern uint16_t cla1ProgLoadStart;
|
||||
extern uint16_t cla1ProgLoadSize;
|
||||
extern uint16_t cla1ProgRunStart;
|
||||
extern uint16_t ramls1LoadStart;
|
||||
extern uint16_t ramls1LoadSize;
|
||||
extern uint16_t ramls1RunStart;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t failCount;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
#ifdef _FLASH
|
||||
//
|
||||
// Need to copy testCPUFetchFunc() from Flash to RAM for the _FLASH build.
|
||||
//
|
||||
memcpy(&ramls1RunStart, &ramls1LoadStart, (size_t)&ramls1LoadSize);
|
||||
memcpy(&cla1ProgRunStart, &cla1ProgLoadStart, (size_t)&cla1ProgLoadSize);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Clear access violation interrupt status.
|
||||
//
|
||||
MemCfg_clearViolationInterruptStatus(0xFFFFFFFFU);
|
||||
SysCtl_clearInterruptStatus(0xFFFFFFFFU);
|
||||
|
||||
//
|
||||
// Enable access violation interrupt & register ISR.
|
||||
//
|
||||
Interrupt_register(INT_ILLEGAL, illegalISR);
|
||||
Interrupt_register(INT_SYS_ERR, accessViolationISR);
|
||||
Interrupt_enable(INT_SYS_ERR);
|
||||
|
||||
SysCtl_setInterruptStatusMask(MASK_ALL_BUT_RAM_ACC_VIOL);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and Real Time interrupt (DBGM).
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Non-controller CPU read violation generation & handling.
|
||||
//
|
||||
failCount = generateNonControllerCPURdViolation();
|
||||
|
||||
//
|
||||
// Non-controller CPU write violation generation & handling.
|
||||
//
|
||||
failCount += generateNonControllerCPUWrViolation();
|
||||
|
||||
//
|
||||
// Non-controller CPU fetch violation generation & handling.
|
||||
//
|
||||
failCount += generateNonControllerCPUFetchViolation();
|
||||
|
||||
//
|
||||
// Controller CPU write violation generation & handling.
|
||||
//
|
||||
failCount += generateControllerCPUWrViolation();
|
||||
|
||||
//
|
||||
// Controller CPU fetch violation generation & handling.
|
||||
//
|
||||
failCount += generateControllerCPUFetchViolation();
|
||||
|
||||
//
|
||||
// Controller DMA write violation generation & handling.
|
||||
//
|
||||
failCount += generateControllerDMAWrViolation();
|
||||
|
||||
//
|
||||
// Non-controller CLA read violation generation & handling.
|
||||
//
|
||||
failCount += generateNonControllerCLAReadViolation();
|
||||
|
||||
//
|
||||
// Non-controller CLA fetch violation generation & handling.
|
||||
//
|
||||
failCount += generateNonControllerCLAFetchViolation();
|
||||
|
||||
//
|
||||
// Status of a successful generation, detection, and handling of RAM access
|
||||
// protection violations.
|
||||
//
|
||||
if(failCount != 0U)
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// illegalISR - ISR called when an ITRAP occurs, such as one generated by a
|
||||
// CPU fetch to a fetch-protected memory.
|
||||
//
|
||||
__interrupt void illegalISR(void)
|
||||
{
|
||||
illegalISRFlag = true;
|
||||
|
||||
//
|
||||
// Need to remove the protection on LS1RAM to allow us to return.
|
||||
//
|
||||
MemCfg_setProtection(MEMCFG_SECT_LS1, MEMCFG_PROT_ALLOWCPUFETCH);
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_DATA);
|
||||
}
|
||||
|
||||
//
|
||||
// accessViolationISR - RAM access protection violation ISR.
|
||||
//
|
||||
__interrupt void accessViolationISR(void)
|
||||
{
|
||||
violationISRFlag = true;
|
||||
|
||||
//
|
||||
// Capture the violation type and the address at which violation occurred.
|
||||
//
|
||||
violationStatus = MemCfg_getViolationInterruptStatus();
|
||||
violationAddr = MemCfg_getViolationAddress(violationStatus);
|
||||
|
||||
//
|
||||
// Clear interrupt flags.
|
||||
//
|
||||
MemCfg_clearViolationInterruptStatus(violationStatus);
|
||||
|
||||
//
|
||||
// Clear System Error flags
|
||||
//
|
||||
uint32_t sysIntStatus = SysCtl_getInterruptStatus();
|
||||
SysCtl_clearInterruptStatus(sysIntStatus);
|
||||
|
||||
//
|
||||
// Clear the interrupt at PIE level.
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// generateNonControllerCPURdViolation - Generate non-controller CPU read violation.
|
||||
//
|
||||
uint32_t generateNonControllerCPURdViolation()
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
volatile uint16_t readMemData;
|
||||
|
||||
//
|
||||
// Enable violation interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_NMVIOL_CPUREAD);
|
||||
|
||||
//
|
||||
// Memory is shared between CLA & CPU.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS6, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
|
||||
|
||||
//
|
||||
// Set memory as program memory for CLA. Now the read access from CPU
|
||||
// will result in non-controller CPU read violation.
|
||||
//
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS6, MEMCFG_CLA_MEM_PROGRAM);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Initiate CPU read from memory.
|
||||
//
|
||||
readMemData = ls6Data;
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_NMVIOL_CPUREAD);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was ls6Data.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&ls6Data)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_NMVIOL_CPUREAD) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateNonControllerCPUWrViolation - Generate non-controller CPU write violation.
|
||||
//
|
||||
uint32_t generateNonControllerCPUWrViolation()
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable violation interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_NMVIOL_CPUWRITE);
|
||||
|
||||
//
|
||||
// Memory is shared between CLA & CPU.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS6, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
|
||||
|
||||
//
|
||||
// Set memory as program memory for CLA. Now the write access from CPU
|
||||
// will result in non-controller CPU write violation.
|
||||
//
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS6, MEMCFG_CLA_MEM_PROGRAM);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Write to memory will generate non-controller CPU write violation as
|
||||
// LS6 RAM is configured as CLA program memory.
|
||||
//
|
||||
ls6Data = 0xEFFFFFFFU;
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_NMVIOL_CPUWRITE);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was ls6Data.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&ls6Data)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_NMVIOL_CPUWRITE) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Make LS6 readable to the CPU again and confirm that the write didn't
|
||||
// affect the data.
|
||||
//
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS6, MEMCFG_CLA_MEM_DATA);
|
||||
if(ls6Data != LS6_ORIG_VALUE)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateNonControllerCPUFetchViolation - Generate non-controller CPU fetch violation.
|
||||
//
|
||||
uint32_t generateNonControllerCPUFetchViolation()
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable violation interrupt
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_NMVIOL_CPUFETCH);
|
||||
|
||||
//
|
||||
// Memory is shared between CLA & CPU.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
|
||||
|
||||
//
|
||||
// Set memory as program memory for CLA. Now the fetch from CPU
|
||||
// will result in a non-controller CPU fetch violation.
|
||||
//
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_PROGRAM);
|
||||
|
||||
//
|
||||
// Clear access violation status variables
|
||||
//
|
||||
illegalISRFlag = false;
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Calling this function (which has been placed in LS1) will cause a CPU
|
||||
// fetch access violation.
|
||||
//
|
||||
testCPUFetchFunc();
|
||||
|
||||
//
|
||||
// The violation will generate both an ITRAP interrupt and the RAM access
|
||||
// violation interrupt.
|
||||
//
|
||||
while(((illegalISRFlag != true) || (violationISRFlag != true)) &&
|
||||
(timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_NMVIOL_CPUFETCH);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was testCPUFetchFunc().
|
||||
//
|
||||
if(violationAddr != (uint32_t)&testCPUFetchFunc)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_NMVIOL_CPUFETCH) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateControllerCPUWrViolation - Generate controller CPU write violation.
|
||||
//
|
||||
uint32_t generateControllerCPUWrViolation()
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable violation interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_MVIOL_CPUWRITE);
|
||||
|
||||
//
|
||||
// Set write protection which generates controller CPU write violation in
|
||||
// case of CPU writes.
|
||||
//
|
||||
MemCfg_setProtection(MEMCFG_SECT_GS0, MEMCFG_PROT_BLOCKCPUWRITE);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Write to memory will generate controller CPU write violation as
|
||||
// CPU writes are blocked.
|
||||
//
|
||||
gs0Data1 = 0xEFFFFFFFU;
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_MVIOL_CPUWRITE);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was expected address.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&gs0Data1)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_MVIOL_CPUWRITE) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm that the write didn't affect the data.
|
||||
//
|
||||
if(gs0Data1 != GS0_ORIG_VALUE1)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateControllerCPUFetchViolation - Generate controller CPU fetch violation.
|
||||
//
|
||||
uint32_t generateControllerCPUFetchViolation()
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable violation interrupt
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_MVIOL_CPUFETCH);
|
||||
|
||||
//
|
||||
// Set fetch protection which generates controller CPU fetch violation in
|
||||
// case of CPU fetch.
|
||||
//
|
||||
MemCfg_setProtection(MEMCFG_SECT_LS1, MEMCFG_PROT_BLOCKCPUFETCH);
|
||||
|
||||
//
|
||||
// Clear access violation status variables
|
||||
//
|
||||
illegalISRFlag = false;
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Calling this function (which has been placed in a section configured to
|
||||
// block fetches) will cause a CPU fetch access violation.
|
||||
//
|
||||
testCPUFetchFunc();
|
||||
|
||||
//
|
||||
// The violation will generate both an ITRAP interrupt and the RAM access
|
||||
// violation interrupt.
|
||||
//
|
||||
while(((illegalISRFlag != true) || (violationISRFlag != true)) &&
|
||||
(timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_MVIOL_CPUFETCH);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was testCPUFetchFunc().
|
||||
//
|
||||
if(violationAddr != (uint32_t)&testCPUFetchFunc)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_MVIOL_CPUFETCH) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateControllerDMAWrViolation - Generate controller DMA read access violation.
|
||||
//
|
||||
uint32_t generateControllerDMAWrViolation(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_MVIOL_DMAWRITE);
|
||||
|
||||
//
|
||||
// Set write protection which generates an access violation in case of
|
||||
// DMA writes.
|
||||
//
|
||||
MemCfg_setProtection(MEMCFG_SECT_GS0, MEMCFG_PROT_BLOCKDMAWRITE);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Force controller DMA write violation by configuration a DMA channel to
|
||||
// transfer data to the protected area.
|
||||
//
|
||||
DMA_initController();
|
||||
DMA_configAddresses(DMA_CH5_BASE, (void *)&gs0Data1,
|
||||
(void *)&gs0Data2);
|
||||
DMA_configBurst(DMA_CH5_BASE, 1U, 0U, 0U);
|
||||
DMA_configTransfer(DMA_CH5_BASE, 1U, 0U, 0U);
|
||||
DMA_configMode(DMA_CH5_BASE, DMA_TRIGGER_SOFTWARE, DMA_CFG_ONESHOT_DISABLE |
|
||||
DMA_CFG_CONTINUOUS_DISABLE | DMA_CFG_SIZE_32BIT);
|
||||
DMA_startChannel(DMA_CH5_BASE);
|
||||
DMA_enableTrigger(DMA_CH5_BASE);
|
||||
DMA_forceTrigger(DMA_CH5_BASE);
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt and DMA channel.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_MVIOL_DMAWRITE);
|
||||
DMA_disableTrigger(DMA_CH5_BASE);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was gs0Data1.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&gs0Data1)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_MVIOL_DMAWRITE) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm that the write didn't affect the data.
|
||||
//
|
||||
if(gs0Data1 != GS0_ORIG_VALUE1)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateNonControllerCLAReadViolation - Generate non-controller CLA read violation.
|
||||
//
|
||||
uint32_t generateNonControllerCLAReadViolation(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_NMVIOL_CLA1READ);
|
||||
|
||||
//
|
||||
// Make sure Cla1Task1 and .scratchpad is in memory accessible to the CLA.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS0, MEMCFG_CLA_MEM_DATA);
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
|
||||
MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_PROGRAM);
|
||||
|
||||
//
|
||||
// Memory is CPU only, so CLA reads should fail.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS6, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Force non-controller CLA read violation.
|
||||
//
|
||||
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (uint16_t)&Cla1Task1);
|
||||
CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_SOFTWARE);
|
||||
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_1);
|
||||
CLA_enableIACK(CLA1_BASE);
|
||||
CLA_forceTasks(CLA1_BASE, CLA_TASKFLAG_1);
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_NMVIOL_CLA1READ);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was ls6Data.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&ls6Data)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_NMVIOL_CLA1READ) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// generateNonControllerCLAFetchViolation - Generate non-controller CLA fetch violation.
|
||||
//
|
||||
uint32_t generateNonControllerCLAFetchViolation(void)
|
||||
{
|
||||
uint16_t fail = 0U;
|
||||
uint16_t timeout = ISR_LOOP_TIMEOUT;
|
||||
|
||||
//
|
||||
// Enable interrupt.
|
||||
//
|
||||
MemCfg_enableViolationInterrupt(MEMCFG_NMVIOL_CLA1FETCH);
|
||||
|
||||
//
|
||||
// Memory controller is the CPU only, so CLA accesses will cause a violation.
|
||||
//
|
||||
MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS6, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
|
||||
|
||||
//
|
||||
// Clear access violation status variables.
|
||||
//
|
||||
violationISRFlag = false;
|
||||
violationAddr = 0U;
|
||||
violationStatus = 0U;
|
||||
|
||||
//
|
||||
// Force non-controller CLA fetch violation.
|
||||
//
|
||||
CLA_mapTaskVector(CLA1_BASE, CLA_MVECT_1, (uint16_t)&ls6Data);
|
||||
CLA_setTriggerSource(CLA_TASK_1, CLA_TRIGGER_SOFTWARE);
|
||||
CLA_enableTasks(CLA1_BASE, CLA_TASKFLAG_1);
|
||||
CLA_enableIACK(CLA1_BASE);
|
||||
CLA_forceTasks(CLA1_BASE, CLA_TASKFLAG_1);
|
||||
|
||||
while((violationISRFlag != true) && (timeout != 0U))
|
||||
{
|
||||
timeout--;
|
||||
}
|
||||
|
||||
//
|
||||
// Disable interrupt.
|
||||
//
|
||||
MemCfg_disableViolationInterrupt(MEMCFG_NMVIOL_CLA1FETCH);
|
||||
|
||||
//
|
||||
// Check if interrupt occurred as expected or if the loop timed out.
|
||||
//
|
||||
if(timeout == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the violation address was ls6Data.
|
||||
//
|
||||
if(violationAddr != (uint32_t)&ls6Data)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
//
|
||||
// Confirm the expected violation type was detected.
|
||||
//
|
||||
if((violationStatus & MEMCFG_NMVIOL_CLA1FETCH) == 0U)
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
|
||||
return(fail);
|
||||
}
|
||||
|
||||
//
|
||||
// testCPUFetchFunc - Function to be called to generate a CPU fetch violation.
|
||||
//
|
||||
void testCPUFetchFunc(void)
|
||||
{
|
||||
NOP;
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_ram_ecc_parity_test"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x100 --heap_size=0x200" />
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --define=_FLASH --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../f2838x_ram_ecc_parity_test_ram_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="../f2838x_ram_ecc_parity_test_flash_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../sdl_ex_ram_ecc_parity_test.c" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */
|
||||
// FLASH13_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(8)
|
||||
.cinit : > FLASH4, ALIGN(8)
|
||||
.switch : > FLASH1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
.stack : > RAMM1
|
||||
|
||||
.init_array : > FLASH1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH5, ALIGN(8)
|
||||
|
||||
ramm0 : > RAMM0
|
||||
ramgs0 : > RAMGS0
|
||||
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.text : >> RAMD0 | RAMD1 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5 | RAMLS6
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS4
|
||||
|
||||
ramm0 : > RAMM0
|
||||
ramgs0 : > RAMGS0
|
||||
|
||||
.TI.ramfunc : > RAMM0
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+1057
File diff suppressed because it is too large.
Load diff
+35
@@ -0,0 +1,35 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sdl_ex_watchdog"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT}"
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x100 --heap_size=0x200" />
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${DIAG_LIBRARY_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x100 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
|
||||
<file action="copy" path="C2000WARE_COMMON/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib" targetDirectory="device" excludeFromBuild="True" />
|
||||
|
||||
<file action="copy" path="../sdl_ex_watchdog.c" targetDirectory="" />
|
||||
|
||||
<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/source/f2838x_codestartbranch.asm" targetDirectory="" applicableConfigurations="FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,234 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sdl_ex_watchdog.c
|
||||
//
|
||||
// TITLE: Software test of watchdog operation
|
||||
//
|
||||
//! \defgroup sdl_ex_watchdog Software test of watchdog operation
|
||||
//! <h1>sdl_ex_watchdog</h1>
|
||||
//!
|
||||
//! This example shows how to use the wakeup interrupt to test the operation of
|
||||
//! the watchdog. The example generates two watchdog interrupts. The first is
|
||||
//! caused by delaying the reset of the watchdog too long, causing it to
|
||||
//! overflow. The second uses the windowing functionality to reset the counter
|
||||
//! before the minimum threshold can be reached.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b wakeISRFlag - Indicates the watchdog ISR was executed.
|
||||
//! - \b result - Status of successful generation of expected watchdog pulse.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 0U
|
||||
#define FAIL 1U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t result = FAIL;
|
||||
bool wakeISRFlag;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void wakeupISR(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t failCount;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Re-map watchdog wake interrupt signal to call the ISR function in this
|
||||
// example.
|
||||
//
|
||||
Interrupt_register(INT_WAKE, &wakeupISR);
|
||||
|
||||
//
|
||||
// Clear the test status.
|
||||
//
|
||||
wakeISRFlag = false;
|
||||
failCount = 0U;
|
||||
|
||||
//
|
||||
// Set the watchdog to generate an interrupt signal instead of a
|
||||
// reset signal.
|
||||
//
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_INTERRUPT);
|
||||
|
||||
//
|
||||
// Enable the watchdog wake interrupt signal.
|
||||
//
|
||||
Interrupt_enable(INT_WAKE);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM).
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Enable the watchdog counter to be reset and then reset it. Note that
|
||||
// during run time, it is good practice to write these keys in separate
|
||||
// parts of the code but for a start up test this is sufficient.
|
||||
//
|
||||
EALLOW;
|
||||
SysCtl_enableWatchdogReset();
|
||||
SysCtl_resetWatchdog();
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Set lower boundary of the watchdog window.
|
||||
//
|
||||
SysCtl_setWatchdogWindowValue(0x20U);
|
||||
|
||||
//
|
||||
// Enable the watchdog.
|
||||
//
|
||||
SysCtl_enableWatchdog();
|
||||
|
||||
//
|
||||
// Fail to reset the watchdog in time by delaying until it overflows. The
|
||||
// minimum delay was determined by considering the watchdog is an 8-bit
|
||||
// timer running off of INTOSC1 (10MHz) with a default pre-divider of /512.
|
||||
//
|
||||
DEVICE_DELAY_US(13800U);
|
||||
|
||||
//
|
||||
// If watchdog interrupt has not occurred by now, increment the fail count.
|
||||
//
|
||||
if(wakeISRFlag != true)
|
||||
{
|
||||
failCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Test the windowing feature by resetting the watchdog before it has a
|
||||
// chance to reach the window threshold.
|
||||
//
|
||||
wakeISRFlag = false;
|
||||
|
||||
EALLOW;
|
||||
SysCtl_enableWatchdogReset();
|
||||
SysCtl_resetWatchdog();
|
||||
EDIS;
|
||||
|
||||
EALLOW;
|
||||
SysCtl_enableWatchdogReset();
|
||||
SysCtl_resetWatchdog();
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Short delay to allow the interrupt to occur.
|
||||
//
|
||||
DEVICE_DELAY_US(1U);
|
||||
|
||||
//
|
||||
// If watchdog interrupt has not occurred by now, increment the fail count.
|
||||
//
|
||||
if(wakeISRFlag != true)
|
||||
{
|
||||
failCount++;
|
||||
}
|
||||
|
||||
//
|
||||
// Status of successful generation of expected watchdog pulse.
|
||||
//
|
||||
if(failCount != 0U)
|
||||
{
|
||||
result = FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PASS;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop here and check results in the CCS Expressions view.
|
||||
//
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// wakeupISR - The interrupt service routine called when the watchdog
|
||||
// triggers the wake interrupt signal.
|
||||
//
|
||||
__interrupt void
|
||||
wakeupISR(void)
|
||||
{
|
||||
wakeISRFlag = true;
|
||||
|
||||
//
|
||||
// Acknowledge this interrupt located in group 1.
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="f2838x_test_application"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
sourceLookupPath="${C2000WARE_DLIB_ROOT},${DIAG_LIBRARY_ROOT}/source"
|
||||
>
|
||||
<configuration name="RAM" compilerBuildOptions="--opt_level=off -I${DIAG_LIBRARY_ROOT}/include -I${PROJECT_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -I${DIAG_LIBRARY_ROOT}/../../calibration/hrpwm/f2838x/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x300 --heap_size=0x200" />
|
||||
<configuration name="RAM_RELEASE" compilerBuildOptions="--opt_level=4 -I${DIAG_LIBRARY_ROOT}/include -I${PROJECT_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -I${DIAG_LIBRARY_ROOT}/../../calibration/hrpwm/f2838x/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--stack_size=0x300 --heap_size=0x200" />
|
||||
<configuration name="FLASH" compilerBuildOptions="--opt_level=off -I${DIAG_LIBRARY_ROOT}/include -I${PROJECT_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -I${DIAG_LIBRARY_ROOT}/../../calibration/hrpwm/f2838x/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x300 --heap_size=0x200 " />
|
||||
<configuration name="FLASH_RELEASE" compilerBuildOptions="--opt_level=4 -I${DIAG_LIBRARY_ROOT}/include -I${PROJECT_ROOT}/include -I${DIAG_LIBRARY_ROOT}/examples/test_application/include -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_COMMON}/include -I${DIAG_LIBRARY_ROOT}/../../calibration/hrpwm/f2838x/include -v28 -ml -mt --float_support=fpu64 --tmu_support=tmu0 --vcu_support=vcrc --define=_FLASH --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point=code_start --stack_size=0x300 --heap_size=0x200 " />
|
||||
|
||||
<pathVariable name="DIAG_LIBRARY_ROOT" path="../../.." scope="project" />
|
||||
<pathVariable name="C2000WARE_COMMON" path="../../../../../../device_support/f2838x/common" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
|
||||
<file action="copy" path="../cmd/f2838x_sta_ram_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM,RAM_RELEASE" />
|
||||
<file action="copy" path="../cmd/f2838x_sta_flash_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH,FLASH_RELEASE" />
|
||||
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Release/driverlib.lib" targetDirectory="" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_debug.lib" targetDirectory="" applicableConfigurations="RAM,FLASH" />
|
||||
<file action="link" path="../../../lib/f2838x_diagnostic_stl_release.lib" targetDirectory="" applicableConfigurations="RAM_RELEASE,FLASH_RELEASE" />
|
||||
<file action="link" path="../../../../../calibration/hrpwm/f2838x/lib/SFO_v8_fpu_lib_build_c28_driverlib_eabi.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../include" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../sta_main.c" targetDirectory="" />
|
||||
<file action="copy" path="../sta_comm.c" targetDirectory="" />
|
||||
<file action="copy" path="../sta_tests.c" targetDirectory="" />
|
||||
<file action="copy" path="../sta_timer.c" targetDirectory="" />
|
||||
<file action="copy" path="../sta_user.c" targetDirectory="" />
|
||||
<file action="copy" path="../sta_util.c" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="include" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" applicableConfigurations="FLASH,FLASH_RELEASE" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
HWBIST : origin = 0x000000, length = 0x000020
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
// BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */
|
||||
// FLASH13_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH1 | FLASH2 | FLASH3 | FLASH4, ALIGN(8)
|
||||
.cinit : > FLASH4, ALIGN(8)
|
||||
.switch : > FLASH1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
/* HWBIST reset context restore code must be placed at 0x0000 */
|
||||
hwbist : LOAD = FLASH3,
|
||||
RUN = HWBIST,
|
||||
LOAD_START(HwbistLoadStart),
|
||||
LOAD_SIZE(HwbistLoadSize),
|
||||
RUN_START(HwbistRunStart),
|
||||
PAGE = 0, ALIGN(4)
|
||||
|
||||
/* Must be placed lower than a 16-bit memory address */
|
||||
hwbiststack : > RAMM0
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
.init_array : > FLASH1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH5, ALIGN(8)
|
||||
|
||||
ramgs0 : > RAMGS0, type=NOINIT
|
||||
ramgs1 : > RAMGS1, type=NOINIT
|
||||
ramm0 : > RAMM0, type=NOINIT
|
||||
|
||||
MSGRAM_CPU1_TO_CPU2 : > CPU1TOCPU2RAM, type=NOINIT
|
||||
MSGRAM_CPU2_TO_CPU1 : > CPU2TOCPU1RAM, type=NOINIT
|
||||
MSGRAM_CPU_TO_CM : > CPUTOCMRAM, type=NOINIT
|
||||
MSGRAM_CM_TO_CPU : > CMTOCPURAM, type=NOINIT
|
||||
|
||||
.TI.ramfunc : {} LOAD = FLASH3,
|
||||
RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
MEMORY
|
||||
{
|
||||
HWBIST : origin = 0x000000, length = 0x000020
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6_7 : origin = 0x00B000, length = 0x001000
|
||||
// RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
// RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text : >> RAMD0 | RAMD1 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
/* HWBIST reset context restore code must be placed at 0x0000 */
|
||||
hwbist : > HWBIST
|
||||
|
||||
/* Must be placed lower than a 16-bit memory address */
|
||||
hwbiststack : > RAMM0
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS6_7
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS4
|
||||
|
||||
ramgs0 : > RAMGS0, type=NOINIT
|
||||
ramgs1 : > RAMGS1, type=NOINIT
|
||||
ramm0 : > RAMM0, type=NOINIT
|
||||
|
||||
MSGRAM_CPU1_TO_CPU2 > CPU1TOCPU2RAM, type=NOINIT
|
||||
MSGRAM_CPU2_TO_CPU1 > CPU2TOCPU1RAM, type=NOINIT
|
||||
MSGRAM_CPU_TO_CM > CPUTOCMRAM, type=NOINIT
|
||||
MSGRAM_CM_TO_CPU > CMTOCPURAM, type=NOINIT
|
||||
|
||||
.TI.ramfunc : {} > RAMM0
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,134 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_comm.h
|
||||
//
|
||||
// TITLE: Self Test Application Communication header
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 STA_COMM_H
|
||||
#define STA_COMM_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup sta_comm STA_Comm API Functions
|
||||
//!
|
||||
//! This module handles the configuration of the SCIA module for communication
|
||||
//! over the board USB-to-UART adapter. This path will allow the application to
|
||||
//! send test pass/fail status to a terminal program.
|
||||
//!
|
||||
//! The code for this module is contained in <tt>sta_comm.c</tt>, with
|
||||
//! <tt>sta_comm.h</tt> containing the API declarations.
|
||||
//!
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define STA_COMM_BAUD_RATE 9600 // Currently selected baud rate for UART
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Configures SCIA for serial communication.
|
||||
//!
|
||||
//! This function configures SCIA for communication to a serial communication
|
||||
//! terminal for 9600 baud rate, 8-N-1.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Comm_configSCIA(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Transmits data via SCIA.
|
||||
//!
|
||||
//! \param msg is a \0 terminated array of characters
|
||||
//!
|
||||
//! This function transmits the \b msg via SCIA to a serial communication
|
||||
//! terminal.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Comm_transmitData(unsigned char *msg);
|
||||
|
||||
#endif // STA_COMM_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_tests.h
|
||||
//
|
||||
// TITLE: Self Test Application Tests header
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 STA_TESTS_H
|
||||
#define STA_TESTS_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Included files for tests.
|
||||
//
|
||||
#include "sta_util.h"
|
||||
#include "stl_cpu_reg.h"
|
||||
#include "stl_crc.h"
|
||||
#include "stl_hwbist.h"
|
||||
#include "stl_march.h"
|
||||
#include "stl_osc_ct.h"
|
||||
#include "stl_osc_hr.h"
|
||||
#include "stl_pie_ram.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup sta_tests STA_Tests API Functions
|
||||
//!
|
||||
//! This module contains the core test execution function for this application.
|
||||
//! It defines the list of test cases to be executed and their implementations.
|
||||
//!
|
||||
//! The code for this module is contained in <tt>sta_tests.c</tt>, with
|
||||
//! <tt>sta_tests.h</tt> containing the API declarations.
|
||||
//!
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define STA_TESTS_PASS 0U
|
||||
#define STA_TESTS_FAIL 1U
|
||||
|
||||
//
|
||||
// Typedefs
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
STA_TEST_START,
|
||||
STA_HWBIST_MICRO,
|
||||
STA_HWBIST_FULL,
|
||||
STA_TEST_PIE_RAM,
|
||||
STA_TEST_PIE_HANDLER,
|
||||
STA_CPU_REG,
|
||||
STA_FPU_REG,
|
||||
STA_VCRC_REG,
|
||||
STA_MARCH,
|
||||
STA_MARCH_COPY,
|
||||
STA_MARCH_CAN,
|
||||
STA_MARCH_CAN_COPY,
|
||||
STA_MARCH_MCAN,
|
||||
STA_MARCH_MCAN_COPY,
|
||||
STA_CAN_RAM_PARITY,
|
||||
STA_MCAN_RAM_ECC,
|
||||
STA_FLASH_CRC,
|
||||
STA_OSC_CT,
|
||||
STA_OSC_HR,
|
||||
STA_TEST_END,
|
||||
STA_TESTS_NUMBERS
|
||||
} STA_TestsTypes;
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
extern const STA_TestsTypes STA_Tests_testArray[STA_TESTS_NUMBERS];
|
||||
#if STA_UTIL_PROFILE
|
||||
extern uint32_t STA_Tests_cycleCounts[STA_TESTS_NUMBERS];
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Executes the safety library tests as an example.
|
||||
//!
|
||||
//! \param testItem is the enumerated type STA_test_types test to perform.
|
||||
//!
|
||||
//! This function configures the device for each specific test. If injected
|
||||
//! errors are enabled, then this function will inject an error for the test
|
||||
//! being performed. It will then execute each STL test and return a message
|
||||
//! of characters to be printed to the terminal via SCI.
|
||||
//!
|
||||
//! \return Returns a pointer to a message string indicating a pass or fail
|
||||
//! status and the test name. This string will be printed out of SCIA to the
|
||||
//! user.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern unsigned char * STA_Tests_testDevice(STA_TestsTypes testItem);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Enables errors to be injected into the tests.
|
||||
//!
|
||||
//! This function sets the global variable \b STA_Tests_injectError to true.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Tests_injectErrorEnable(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Disables errors to be injected into the tests.
|
||||
//!
|
||||
//! This function sets the global variable \b STA_Tests_injectError to false.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Tests_injectErrorDisable(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#endif // STA_TESTS_H
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,146 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_timer.h
|
||||
//
|
||||
// TITLE: Self Test Application Timer header
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 STA_TIMER_H
|
||||
#define STA_TIMER_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Includes
|
||||
//
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup sta_timer STA_Timer API Functions
|
||||
//!
|
||||
//! This module handles the initialization and handling of the CPU timer
|
||||
//! system used to time the execution of the tests run by this application.
|
||||
//!
|
||||
//! The code for this module is contained in <tt>sta_timer.c</tt>, with
|
||||
//! <tt>sta_timer.h</tt> containing the API declarations.
|
||||
//!
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Timer 0 ISR.
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __interrupt void STA_Timer_timer0Isr(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Configures Timer 0 to tick so that the STA will continue to make
|
||||
//! progress.
|
||||
//!
|
||||
//! \param msTimeOut is the number of milliseconds between each execution
|
||||
//! of a test found in sta_tests.c. Another test will execute every time
|
||||
//! this STA timer runs out.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Timer_config(uint16_t msTimeOut);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Checks if Timer 0 has timed-out.
|
||||
//!
|
||||
//! \return Returns true if the timer has timed-out and false if it has not.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern bool STA_Timer_isTimedOut(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Clears Timer 0 time-out flag.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Timer_clearTimeOut(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Restarts Timer 0.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Timer_restart(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#endif // STA_TIMER_H
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,320 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_user.h
|
||||
//
|
||||
// TITLE: Self Test Application User header
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 STA_USER_H
|
||||
#define STA_USER_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Included files for tests.
|
||||
//
|
||||
#include "stl_can_ram.h"
|
||||
#include "stl_march.h"
|
||||
#include "stl_mcan_ram.h"
|
||||
#include "stl_osc_ct.h"
|
||||
#include "stl_osc_hr.h"
|
||||
#include "stl_pie_ram.h"
|
||||
#include "stl_util.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup sta_user STA_User API Functions
|
||||
//!
|
||||
//! This module contains the declaration and initialization of the various
|
||||
//! objects and handles required by SDL modules tested in this application.
|
||||
//!
|
||||
//! The code for this module is contained in <tt>sta_user.c</tt>, with
|
||||
//! <tt>sta_user.h</tt> containing the API declarations.
|
||||
//!
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
//
|
||||
// March example data buffer length
|
||||
//
|
||||
#define STA_USER_MARCH_DATA_SIZE 16U
|
||||
|
||||
//
|
||||
// March copy buffer length. We'll use the same one for SRAMs and CAN message
|
||||
// RAMs, so make it big enough for the biggest of them.
|
||||
//
|
||||
#define STA_USER_MARCH_COPY_SIZE 320U
|
||||
|
||||
//
|
||||
// CAN message RAM March test copy buffer length
|
||||
//
|
||||
#define STA_USER_MARCH_CAN_SIZE 320U
|
||||
|
||||
//
|
||||
// Addresses of CAN A message RAM objects for use as an example. Note that the
|
||||
// message RAM objects are placed at offsets of 0x20, although in RDA mode only
|
||||
// up through 0x10 is used.
|
||||
//
|
||||
#define STA_USER_MARCH_CANA_OBJ32_START_ADDR \
|
||||
(CANA_BASE + STL_CAN_RAM_ADDR_OFFSET)
|
||||
#define STA_USER_MARCH_CANA_OBJ4_END_ADDR \
|
||||
(CANA_BASE + STL_CAN_RAM_ADDR_OFFSET + (0x20U * 4U) + 0x10U)
|
||||
|
||||
#define STA_USER_MARCH_CANA_OBJ6_START_ADDR \
|
||||
(CANA_BASE + STL_CAN_RAM_ADDR_OFFSET + (0x20U * 6U))
|
||||
#define STA_USER_MARCH_CANA_OBJ15_END_ADDR \
|
||||
(CANA_BASE + STL_CAN_RAM_ADDR_OFFSET + (0x20U * 15U) + 0x10U)
|
||||
|
||||
//
|
||||
// MCAN message RAM March test MCAN config parameters
|
||||
//
|
||||
#define STA_USER_MCAN_STD_ID_FILT_START_ADDR 0x0U
|
||||
#define STA_USER_MCAN_STD_ID_FILTER_NUM 1U
|
||||
#define STA_USER_MCAN_EXT_ID_FILT_START_ADDR 0x14U
|
||||
#define STA_USER_MCAN_EXT_ID_FILTER_NUM 1U
|
||||
#define STA_USER_MCAN_TX_BUFF_START_ADDR 0x80U
|
||||
#define STA_USER_MCAN_TX_BUFF_SIZE 10U
|
||||
#define STA_USER_MCAN_FIFO_1_START_ADDR 0xc0U
|
||||
#define STA_USER_MCAN_FIFO_1_NUM 10U
|
||||
#define STA_USER_MCAN_TX_EVENT_START_ADDR 0x100U
|
||||
#define STA_USER_MCAN_TX_EVENT_SIZE 10U
|
||||
#define STA_USER_MCAN_EXT_ID_AND_MASK 0x1FFFFFFFUL
|
||||
#define STA_USER_MCAN_RX_BUFF_START_ADDR 948U
|
||||
#define STA_USER_MCAN_FIFO_0_START_ADDR 548U
|
||||
#define STA_USER_MCAN_FIFO_0_NUM 5U
|
||||
#define STA_USER_MCAN_MSG_INT 0x81200UL
|
||||
|
||||
//
|
||||
// Addresses of MCAN A message RAM
|
||||
//
|
||||
#define STA_USER_MARCH_MCAN_START_ADDR MCANA_DRIVER_BASE
|
||||
#define STA_USER_MARCH_MCAN_END_ADDR (MCANA_DRIVER_BASE + \
|
||||
STL_MCAN_RAM_MAX_ADDR_OFFSET)
|
||||
|
||||
//
|
||||
// PIE RAM example entry
|
||||
//
|
||||
#define STA_USER_PIE_RAM_ENTRY ((INT_ADCC3 >> STL_PIE_RAM_VECT_ID_S)*2)
|
||||
|
||||
//
|
||||
// PIE RAM handler test interrupt and corresponding interrupt group mask
|
||||
//
|
||||
#define STA_USER_PIE_TEST_INT INT_EPWM7
|
||||
#define STA_USER_PIE_TEST_INT_GROUP_M \
|
||||
(1U << (((uint16_t)(STA_USER_PIE_TEST_INT & STL_PIE_RAM_TABLE_COL_M) >> \
|
||||
STL_PIE_RAM_TABLE_COL_S) - 1U))
|
||||
|
||||
//
|
||||
// CRC test golden CRC
|
||||
//
|
||||
#define STA_USER_GOLDEN_CRC 0xE4990204UL
|
||||
#define STA_USER_CRC_DATA_SIZE 16U
|
||||
|
||||
//
|
||||
// Oscillator CPU Timer test values
|
||||
//
|
||||
// 13,107,000 cycles at DEVICE_SYSCLK_FREQ
|
||||
//
|
||||
#define STA_USER_OSC_DELAY_US (13107000UL / (DEVICE_SYSCLK_FREQ / 1000000UL))
|
||||
#define STA_USER_OSC_MIN_COUNT 13100000UL
|
||||
#define STA_USER_OSC_MAX_COUNT 13115000UL
|
||||
|
||||
//
|
||||
// Oscillator HRPWM test values
|
||||
//
|
||||
// Note that 6666666666L comes from the 150ps MEP step size.
|
||||
//
|
||||
#define STA_USER_OSC_HR_MEP (6666666666L / (DEVICE_SYSCLK_FREQ / 2))
|
||||
#define STA_USER_OSC_HR_MEP_MIN (STA_USER_OSC_HR_MEP - 10U)
|
||||
#define STA_USER_OSC_HR_MEP_MAX (STA_USER_OSC_HR_MEP + 10U)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
// March inject error test object and buffers
|
||||
//
|
||||
extern STL_March_InjectErrorObj STA_User_marchErrorObj;
|
||||
extern STL_March_InjectErrorHandle STA_User_marchErrorHandle;
|
||||
extern uint16_t STA_User_marchTestData[STA_USER_MARCH_DATA_SIZE];
|
||||
extern uint16_t STA_User_marchTestDataCopy[STA_USER_MARCH_COPY_SIZE];
|
||||
|
||||
//
|
||||
// CAN parity logic test variables
|
||||
//
|
||||
extern bool STA_User_canInterruptFlag;
|
||||
extern uint16_t STA_User_parityErrorCode;
|
||||
extern uint16_t STA_User_canErrorReturnVal;
|
||||
|
||||
|
||||
//
|
||||
// MCAN ECC logic test variables
|
||||
//
|
||||
extern uint16_t STA_User_mcanSECReturnVal;
|
||||
extern uint16_t STA_User_mcanDEDReturnVal;
|
||||
|
||||
//
|
||||
// Flash CRC test array
|
||||
//
|
||||
extern const float32_t STA_User_crcData[STA_USER_CRC_DATA_SIZE];
|
||||
|
||||
//
|
||||
// OSC Timer2 test object
|
||||
//
|
||||
extern STL_OSC_CT_Obj STA_User_oscTimer2Obj;
|
||||
extern STL_OSC_CT_Handle STA_User_oscTimer2Handle;
|
||||
|
||||
//
|
||||
// Oscillator HRPWM test object
|
||||
//
|
||||
extern STL_OSC_HR_Obj STA_User_oscHRObj;
|
||||
extern STL_OSC_HR_Handle STA_User_oscHRHandle;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! This function initializes the inject error object for March13N test.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_User_initMarch(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! This function initializes the Oscillator Timer2 test objects.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_User_initOSCTimer2Test(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! This function initializes the object for the Oscillator HRPWM test.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_User_initOSCHRTest(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! This function initializes the object for the MCAN RAM March test.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_User_initMCANRAMTest(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Default handler for PIE Vector Table errors like a parity error or double
|
||||
//! RAM mismatch depending on your device's features.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_User_pieVectError(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! CAN ISR to execute upon parity error detection in CAN message RAM.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __interrupt void STA_User_canParityErrorISR(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! MMCAN ISR to execute upon ECC error correction in MCAN message RAM.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __interrupt void STA_User_mcanECCErrorISR(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! NMI ISR for the CAN ECC logic test for uncorrectable errors.
|
||||
//!
|
||||
//! \return None
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern __interrupt void STA_User_nmiISR(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#endif // STA_USER_H
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,202 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_util.h
|
||||
//
|
||||
// TITLE: Self Test Application Utility header
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 STA_UTIL_H
|
||||
#define STA_UTIL_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "stl_hwbist.h"
|
||||
#include "stl_util.h"
|
||||
#include "cputimer.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup sta_util STA_Util API Functions
|
||||
//!
|
||||
//! This module contains utility functions for this test application. This
|
||||
//! primarily includes the functions used to profile the cycle counts of the
|
||||
//! SDL functions.
|
||||
//!
|
||||
//! The code for this module is contained in <tt>sta_util.c</tt>, with
|
||||
//! <tt>sta_util.h</tt> containing the API declarations.
|
||||
//!
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
//
|
||||
// Enable HWBIST test
|
||||
//
|
||||
// Due to RAM size constraints and the need to locate the HWBIST reset handler at
|
||||
// the RAM boot entry point, only the Flash build is supported for HWBIST.
|
||||
//
|
||||
#ifdef _FLASH
|
||||
//! Used to enable or disable HWBIST micro-run test.
|
||||
//! A value of 0 will disable the HWBIST micro-run test.
|
||||
//! A value of not 0 will enable the HWBIST micro-run test.
|
||||
#define STA_UTIL_HWBIST_MICRO 0
|
||||
//! Used to enable or disable a complete HWBIST test.
|
||||
//! A value of 0 will disable the complete HWBIST test.
|
||||
//! A value of not 0 will enable the complete HWBIST test.
|
||||
#define STA_UTIL_HWBIST_FULL 0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
STL_HWBIST_Error errorInjected;
|
||||
bool isISRRestored;
|
||||
uint16_t returnVal;
|
||||
uint32_t globalFlag;
|
||||
} STA_Util_HWBISTMemDump;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable profiling
|
||||
//
|
||||
//! Used to enable or disable CPUTimer cycle profiling of STA tests.
|
||||
//! A value of 0 will disable cycle profiling.
|
||||
//! A value of not 0 will enable cycle profiling.
|
||||
#define STA_UTIL_PROFILE 1
|
||||
|
||||
#if STA_UTIL_PROFILE
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Configures the CPUTimer specified by the parameter \b base for
|
||||
//! profiling cycle counts.
|
||||
//!
|
||||
//! \param base is the base address of a valid CPUTimer.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void STA_Util_configProfiler(uint32_t base);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Starts the CPUTimer used for profiling cycles.
|
||||
//!
|
||||
//! \param base is the base address of a valid CPUTimer.
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline void STA_Util_startProfiler(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Set TSS bit of register TCR
|
||||
//
|
||||
HWREGH(base + CPUTIMER_O_TCR) |= CPUTIMER_TCR_TSS;
|
||||
|
||||
//
|
||||
// Reload the timer counter.
|
||||
//
|
||||
HWREGH(base + CPUTIMER_O_TCR) |= CPUTIMER_TCR_TRB;
|
||||
|
||||
//
|
||||
// Clear TSS bit of register TCR
|
||||
//
|
||||
HWREGH(base + CPUTIMER_O_TCR) &= ~CPUTIMER_TCR_TSS;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \brief Stops the CPUTimer used for profiling cycles.
|
||||
//!
|
||||
//! \param base is the base address of a valid CPUTimer.
|
||||
//!
|
||||
//! \return Returns the number of cycles elapsed since STA_Util_startProfiler()
|
||||
//! was called.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static inline uint32_t STA_Util_stopProfiler(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Set TSS bit of register TCR
|
||||
//
|
||||
HWREGH(base + CPUTIMER_O_TCR) |= CPUTIMER_TCR_TSS;
|
||||
|
||||
//
|
||||
// Return the cycle count
|
||||
//
|
||||
return(0xFFFFFFFFU - HWREG(base + CPUTIMER_O_TIM));
|
||||
}
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#endif // STA_UTIL_H
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,108 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_comm.c
|
||||
//
|
||||
// TITLE: Self Test Application Communication source
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "sta_comm.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Comm_configSCIA(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Comm_configSCIA(void)
|
||||
{
|
||||
//
|
||||
// Configure the SCI Rx pin.
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
|
||||
|
||||
//
|
||||
// Configure the SCI Tx pin.
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
|
||||
GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
|
||||
|
||||
//
|
||||
// Initialize SCIA and its FIFO.
|
||||
//
|
||||
SCI_performSoftwareReset(SCIA_BASE);
|
||||
|
||||
SCI_setConfig(SCIA_BASE, SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ),
|
||||
STA_COMM_BAUD_RATE, (SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE |
|
||||
SCI_CONFIG_PAR_NONE));
|
||||
SCI_resetChannels(SCIA_BASE);
|
||||
SCI_resetTxFIFO(SCIA_BASE);
|
||||
SCI_clearInterruptStatus(SCIA_BASE, SCI_INT_TXFF | SCI_INT_RXFF);
|
||||
SCI_enableFIFO(SCIA_BASE);
|
||||
SCI_enableModule(SCIA_BASE);
|
||||
SCI_performSoftwareReset(SCIA_BASE);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Comm_transmitData(unsigned char *msg)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Comm_transmitData(unsigned char *msg)
|
||||
{
|
||||
int16_t i;
|
||||
|
||||
i = 0;
|
||||
|
||||
while(msg[i] != '\0')
|
||||
{
|
||||
SCI_writeCharBlockingFIFO(SCIA_BASE,(uint16_t)msg[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,218 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_main.c
|
||||
//
|
||||
// TITLE: Self Test Application Main source
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 for device configuration
|
||||
//
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Included files for test-infrastructure.
|
||||
//
|
||||
#include "sta_comm.h"
|
||||
#include "sta_tests.h"
|
||||
#include "sta_timer.h"
|
||||
#include "sta_user.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define STA_MAIN_TIMEOUT 4000U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
int16_t enableErrorInject;
|
||||
int16_t enableReset;
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
void STA_Main_configXCLKOut(void);
|
||||
|
||||
#ifdef _FLASH
|
||||
extern uint16_t HwbistLoadStart;
|
||||
extern uint16_t HwbistLoadSize;
|
||||
extern uint16_t HwbistRunStart;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
#ifdef _FLASH
|
||||
memcpy(&HwbistRunStart, &HwbistLoadStart, (size_t)&HwbistLoadSize);
|
||||
#endif
|
||||
|
||||
unsigned char *msg;
|
||||
uint16_t testIndex = 0;
|
||||
|
||||
enableErrorInject = 0;
|
||||
|
||||
//
|
||||
// Configure PLL, disable WD, enable peripheral clocks.
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pull-ups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Put watchdog in interrupt mode.
|
||||
//
|
||||
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_INTERRUPT);
|
||||
|
||||
//
|
||||
// Disable global interrupts.
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Initialize interrupt controller and vector table.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable NMI. Typically this is already enabled by either the GEL file when
|
||||
// debugging or by the boot ROM when running standalone.
|
||||
//
|
||||
EALLOW;
|
||||
HWREGH(NMI_BASE + NMI_O_FLGCLR) = 0xFFFF;
|
||||
HWREGH(NMI_BASE + NMI_O_CFG) |= NMI_CFG_NMIE;
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Plug an NMI handler used to handle several expected NMIs caused by tests.
|
||||
//
|
||||
Interrupt_register(INT_NMI, &STA_User_nmiISR);
|
||||
|
||||
//
|
||||
// Plug a default PIE vector table error handler.
|
||||
//
|
||||
STL_PIE_RAM_configHandler(&STA_User_pieVectError);
|
||||
|
||||
//
|
||||
// Debug
|
||||
//
|
||||
STA_Main_configXCLKOut();
|
||||
|
||||
//
|
||||
// Configure SCI A as the main communication port
|
||||
//
|
||||
STA_Comm_configSCIA();
|
||||
|
||||
//
|
||||
// Configure Timer 0 as the main time-out timer
|
||||
//
|
||||
STA_Timer_config(STA_MAIN_TIMEOUT);
|
||||
|
||||
#if STA_UTIL_PROFILE
|
||||
STA_Util_configProfiler(CPUTIMER1_BASE);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and real time interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Send starting message.
|
||||
//
|
||||
msg = "\r\n\n\nBegin Test\0";
|
||||
STA_Comm_transmitData(msg);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(STA_Timer_isTimedOut())
|
||||
{
|
||||
if(enableErrorInject)
|
||||
{
|
||||
STA_Tests_injectErrorEnable();
|
||||
}
|
||||
else
|
||||
{
|
||||
STA_Tests_injectErrorDisable();
|
||||
}
|
||||
|
||||
STA_Comm_transmitData(
|
||||
STA_Tests_testDevice(STA_Tests_testArray[testIndex++]));
|
||||
|
||||
if(testIndex >= STA_TESTS_NUMBERS)
|
||||
{
|
||||
testIndex = 0U;
|
||||
}
|
||||
STA_Timer_restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// STA_Main_configXCLKOut(void)
|
||||
//
|
||||
void STA_Main_configXCLKOut(void)
|
||||
{
|
||||
// Configure GPIO as SYSCLK out
|
||||
GPIO_setPadConfig(73, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_73_XCLKOUT);
|
||||
|
||||
|
||||
// Clock source is SYSCLK
|
||||
SysCtl_selectClockOutSource(SYSCTL_CLOCKOUT_SYSCLK);
|
||||
|
||||
EALLOW;
|
||||
// XCLOCK out = clock source /8
|
||||
HWREG(CLKCFG_BASE + SYSCTL_O_XCLKOUTDIVSEL) = 3U;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,142 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_timer.c
|
||||
//
|
||||
// TITLE: Self Test Application Timer source
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "sta_timer.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define STA_TIMER_TIMEOUT_PRD_MS 100U
|
||||
#define STA_TIMER_PRD_100_MS (DEVICE_SYSCLK_FREQ/STA_TIMER_TIMEOUT_PRD_MS)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
bool timeOutFlag;
|
||||
uint16_t timeOutCount;
|
||||
uint16_t isrTimeout;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Timer_timer0Isr(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
#pragma CODE_SECTION(STA_Timer_timer0Isr,".TI.ramfunc")
|
||||
__interrupt void STA_Timer_timer0Isr(void)
|
||||
{
|
||||
|
||||
if(isrTimeout++ > timeOutCount)
|
||||
{
|
||||
timeOutFlag = true;
|
||||
CPUTimer_stopTimer(CPUTIMER0_BASE);
|
||||
}
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Timer_config(uint16_t msTimeOut)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Timer_config(uint16_t msTimeOut)
|
||||
{
|
||||
|
||||
Interrupt_register(INT_TIMER0, &STA_Timer_timer0Isr);
|
||||
|
||||
timeOutCount = msTimeOut/100U;
|
||||
timeOutFlag = false;
|
||||
isrTimeout = 0;
|
||||
|
||||
// Set period for a 100mS interrupt
|
||||
CPUTimer_setPeriod(CPUTIMER0_BASE, (STA_TIMER_PRD_100_MS - 1));
|
||||
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
|
||||
CPUTimer_stopTimer(CPUTIMER0_BASE);
|
||||
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
|
||||
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
|
||||
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
|
||||
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
|
||||
CPUTimer_startTimer(CPUTIMER0_BASE);
|
||||
|
||||
Interrupt_enable(INT_TIMER0);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Timer_isTimedOut(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool STA_Timer_isTimedOut(void)
|
||||
{
|
||||
return(timeOutFlag);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Timer_clearTimeOut(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Timer_clearTimeOut(void)
|
||||
{
|
||||
timeOutFlag = false;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_Timer_restart(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Timer_restart(void)
|
||||
{
|
||||
isrTimeout = 0;
|
||||
timeOutFlag = false;
|
||||
CPUTimer_startTimer(CPUTIMER0_BASE);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,453 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_user.c
|
||||
//
|
||||
// TITLE: Self Test Application User source
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "sta_user.h"
|
||||
#include "sta_comm.h"
|
||||
#include "sta_util.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
// March inject error test object and buffers
|
||||
//
|
||||
STL_March_InjectErrorObj STA_User_marchErrorObj;
|
||||
STL_March_InjectErrorHandle STA_User_marchErrorHandle;
|
||||
|
||||
#pragma DATA_SECTION(STA_User_marchTestData, "ramm0");
|
||||
#pragma DATA_ALIGN(STA_User_marchTestData, 2)
|
||||
uint16_t STA_User_marchTestData[STA_USER_MARCH_DATA_SIZE];
|
||||
|
||||
#pragma DATA_ALIGN(STA_User_marchTestDataCopy, 2)
|
||||
uint16_t STA_User_marchTestDataCopy[STA_USER_MARCH_COPY_SIZE];
|
||||
|
||||
//
|
||||
// CAN parity logic test variables
|
||||
//
|
||||
bool STA_User_canInterruptFlag;
|
||||
uint16_t STA_User_parityErrorCode;
|
||||
uint16_t STA_User_canErrorReturnVal;
|
||||
|
||||
//
|
||||
// MCAN ECC logic test variables
|
||||
//
|
||||
uint16_t STA_User_mcanSECReturnVal;
|
||||
MCAN_ECCErrStatus errInfoSEC;
|
||||
uint16_t STA_User_mcanDEDReturnVal;
|
||||
MCAN_ECCErrStatus errInfoDED;
|
||||
|
||||
//
|
||||
// Flash CRC test array
|
||||
//
|
||||
const float32_t STA_User_crcData[STA_USER_CRC_DATA_SIZE] =
|
||||
{0.00006104, 0.00164795, 0.00762939, 0.02093506,
|
||||
0.04449463, 0.08123779, 0.13409424, 0.20599365,
|
||||
0.29962158, 0.41204834, 0.53472900, 0.65887451,
|
||||
0.77569580, 0.87640381, 0.95220947, 0.99432373};
|
||||
|
||||
//
|
||||
// OSC Timer2 test object
|
||||
//
|
||||
STL_OSC_CT_Obj STA_User_oscTimer2Obj;
|
||||
STL_OSC_CT_Handle STA_User_oscTimer2Handle;
|
||||
|
||||
//
|
||||
// Oscillator HRPWM test object, including ePWM and MEP_ScaleFactor required by
|
||||
// SFO library.
|
||||
//
|
||||
STL_OSC_HR_Obj STA_User_oscHRObj;
|
||||
STL_OSC_HR_Handle STA_User_oscHRHandle;
|
||||
int32_t MEP_ScaleFactor;
|
||||
volatile uint32_t ePWM[PWM_CH_MAX + 1U] = {0,
|
||||
EPWM1_BASE,
|
||||
EPWM2_BASE,
|
||||
EPWM3_BASE,
|
||||
EPWM4_BASE,
|
||||
EPWM5_BASE,
|
||||
EPWM6_BASE,
|
||||
EPWM7_BASE,
|
||||
EPWM8_BASE};
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_initMarch(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_User_initMarch(void)
|
||||
{
|
||||
STA_User_marchErrorObj.address = (uint32_t)STA_User_marchTestData;
|
||||
STA_User_marchErrorObj.ramSection = MEMCFG_SECT_M0;
|
||||
STA_User_marchErrorObj.xorMask = 0x00000000U;
|
||||
STA_User_marchErrorObj.testMode = MEMCFG_TEST_FUNCTIONAL;
|
||||
|
||||
STA_User_marchErrorHandle = &STA_User_marchErrorObj;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_initOSCTimer2Test(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_User_initOSCTimer2Test(void)
|
||||
{
|
||||
STA_User_oscTimer2Obj.minCount = STA_USER_OSC_MIN_COUNT;
|
||||
STA_User_oscTimer2Obj.maxCount = STA_USER_OSC_MAX_COUNT;
|
||||
STA_User_oscTimer2Obj.clockSource = CPUTIMER_CLOCK_SOURCE_SYS;
|
||||
STA_User_oscTimer2Obj.prescaler = CPUTIMER_CLOCK_PRESCALER_1;
|
||||
|
||||
STA_User_oscTimer2Handle = &STA_User_oscTimer2Obj;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_initOSCHRTest(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_User_initOSCHRTest(void)
|
||||
{
|
||||
STA_User_oscHRObj.ePWMBase = EPWM1_BASE;
|
||||
STA_User_oscHRObj.channel = HRPWM_CHANNEL_A;
|
||||
STA_User_oscHRObj.mepEdgeMode = HRPWM_MEP_CTRL_RISING_EDGE;
|
||||
STA_User_oscHRObj.mepMax = (int16_t)STA_USER_OSC_HR_MEP_MAX;
|
||||
STA_User_oscHRObj.mepMin = (int16_t)STA_USER_OSC_HR_MEP_MIN;
|
||||
STA_User_oscHRObj.sfoDelay = 4000;
|
||||
|
||||
STA_User_oscHRHandle = &STA_User_oscHRObj;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_initMCANRAMTest(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_User_initMCANRAMTest(void)
|
||||
{
|
||||
//
|
||||
// Allocated MCAN shared peripheral to C28x
|
||||
//
|
||||
SysCtl_allocateSharedPeripheral(SYSCTL_PALLOCATE_MCAN_A, 0x0U);
|
||||
|
||||
MCAN_RevisionId revId;
|
||||
MCAN_InitParams initParams;
|
||||
MCAN_ConfigParams configParams;
|
||||
MCAN_MsgRAMConfigParams msgRAMConfigParams;
|
||||
MCAN_StdMsgIDFilterElement stdFiltelem;
|
||||
MCAN_BitTimingParams bitTimes;
|
||||
MCAN_ECCConfigParams eccConfig;
|
||||
|
||||
//
|
||||
// Initialize MCAN Init parameters.
|
||||
//
|
||||
initParams.fdMode = 0x1U; // FD operation enabled.
|
||||
initParams.brsEnable = 0x1U; // Bit rate switching for
|
||||
// transmissions enabled.
|
||||
initParams.txpEnable = 0x0U; // Transmit pause disabled.
|
||||
initParams.efbi = 0x0U; // Edge filtering disabled.
|
||||
initParams.pxhddisable = 0x0U; // Protocol exception handling enabled.
|
||||
initParams.darEnable = 0x0U; // Automatic retransmission of messages
|
||||
// not transmitted successfully enabled.
|
||||
initParams.wkupReqEnable = 0x1U; // Wakeup request is enabled.
|
||||
initParams.autoWkupEnable = 0x1U; // Auto-Wakeup is enabled.
|
||||
initParams.emulationEnable = 0x1U; // Emulation/Debug Suspend is enabled.
|
||||
initParams.tdcEnable = 0x1U; // Transmitter Delay Compensation is
|
||||
// enabled.
|
||||
initParams.wdcPreload = 0xFFU; // Start value of the Message RAM
|
||||
// Watchdog Counter preload.
|
||||
|
||||
//
|
||||
// Transmitter Delay Compensation parameters.
|
||||
//
|
||||
initParams.tdcConfig.tdcf = 0xAU;
|
||||
initParams.tdcConfig.tdco = 0x6U;
|
||||
|
||||
//
|
||||
// Initialize MCAN Config parameters.
|
||||
//
|
||||
configParams.monEnable = 0x0U; // Bus Monitoring Mode is disabled.
|
||||
configParams.asmEnable = 0x0U; // Normal CAN operation.
|
||||
configParams.tsPrescalar = 0xFU; // Prescaler Value.
|
||||
configParams.tsSelect = 0x0U; // Timestamp counter value.
|
||||
configParams.timeoutSelect = MCAN_TIMEOUT_SELECT_CONT;
|
||||
// Time-out counter source select.
|
||||
configParams.timeoutPreload = 0xFFFFU; // Start value of the Timeout
|
||||
// Counter.
|
||||
configParams.timeoutCntEnable = 0x0U; // Time-out Counter is disabled.
|
||||
configParams.filterConfig.rrfs = 0x1U; // Reject all remote frames with
|
||||
// 29-bit extended IDs.
|
||||
configParams.filterConfig.rrfe = 0x1U; // Reject all remote frames with
|
||||
// 11-bit standard IDs.
|
||||
configParams.filterConfig.anfe = 0x1U; // Accept in Rx FIFO 1.
|
||||
configParams.filterConfig.anfs = 0x1U; // Accept in Rx FIFO 1.
|
||||
|
||||
//
|
||||
// Initialize Message RAM Sections Configuration Parameters.
|
||||
//
|
||||
msgRAMConfigParams.flssa = STA_USER_MCAN_STD_ID_FILT_START_ADDR;
|
||||
// Standard ID Filter List Start Address.
|
||||
msgRAMConfigParams.lss = STA_USER_MCAN_STD_ID_FILTER_NUM;
|
||||
// List Size: Standard ID.
|
||||
msgRAMConfigParams.flesa = STA_USER_MCAN_EXT_ID_FILT_START_ADDR;
|
||||
// Extended ID Filter List Start Address.
|
||||
msgRAMConfigParams.lse = STA_USER_MCAN_EXT_ID_FILTER_NUM;
|
||||
// List Size: Extended ID.
|
||||
msgRAMConfigParams.txStartAddr = STA_USER_MCAN_TX_BUFF_START_ADDR;
|
||||
// Tx Buffers Start Address.
|
||||
msgRAMConfigParams.txBufNum = STA_USER_MCAN_TX_BUFF_SIZE;
|
||||
// Number of Dedicated Transmit Buffers.
|
||||
msgRAMConfigParams.txFIFOSize = 0U; // No Tx FIFO/Queue.
|
||||
msgRAMConfigParams.txBufMode = 0U; //Tx FIFO operation
|
||||
msgRAMConfigParams.txBufElemSize = MCAN_ELEM_SIZE_64BYTES;
|
||||
// Tx Buffer Element Size.
|
||||
msgRAMConfigParams.txEventFIFOStartAddr = STA_USER_MCAN_TX_EVENT_START_ADDR;
|
||||
// Tx Event FIFO Start Address.
|
||||
msgRAMConfigParams.txEventFIFOSize = STA_USER_MCAN_TX_BUFF_SIZE;
|
||||
// Event FIFO Size.
|
||||
msgRAMConfigParams.txEventFIFOWaterMark = 3U;
|
||||
// Level for Tx Event FIFO watermark interrupt.
|
||||
msgRAMConfigParams.rxFIFO0startAddr = STA_USER_MCAN_FIFO_0_START_ADDR;
|
||||
// Rx FIFO0 Start Address.
|
||||
msgRAMConfigParams.rxFIFO0size = STA_USER_MCAN_FIFO_0_NUM;
|
||||
// Number of Rx FIFO elements.
|
||||
msgRAMConfigParams.rxFIFO0waterMark = 3U; // Rx FIFO0 Watermark.
|
||||
msgRAMConfigParams.rxFIFO0OpMode = 0U; // FIFO blocking mode.
|
||||
msgRAMConfigParams.rxFIFO1startAddr = STA_USER_MCAN_FIFO_1_START_ADDR;
|
||||
// Rx FIFO1 Start Address.
|
||||
msgRAMConfigParams.rxFIFO1size = STA_USER_MCAN_FIFO_1_NUM;
|
||||
// Number of Rx FIFO elements.
|
||||
msgRAMConfigParams.rxFIFO1waterMark = 3U; // Level for Rx FIFO 1
|
||||
// watermark interrupt.
|
||||
msgRAMConfigParams.rxFIFO1OpMode = 0U; // FIFO blocking mode.
|
||||
msgRAMConfigParams.rxBufStartAddr = STA_USER_MCAN_RX_BUFF_START_ADDR;
|
||||
// Rx Buffer Start Address.
|
||||
msgRAMConfigParams.rxBufElemSize = MCAN_ELEM_SIZE_64BYTES;
|
||||
// Rx Buffer Element Size.
|
||||
msgRAMConfigParams.rxFIFO0ElemSize = MCAN_ELEM_SIZE_64BYTES;
|
||||
// Rx FIFO0 Element Size.
|
||||
msgRAMConfigParams.rxFIFO1ElemSize = MCAN_ELEM_SIZE_64BYTES;
|
||||
// Rx FIFO1 Element Size.
|
||||
|
||||
//
|
||||
// Initialize Tx Buffer Configuration parameters.
|
||||
//
|
||||
stdFiltelem.sfid2 = 0x0U; // Standard Filter ID 2.
|
||||
stdFiltelem.sfid1 = 0x4U; // Standard Filter ID 1.
|
||||
stdFiltelem.sfec = 0x7U; // Store into Rx Buffer or as
|
||||
// debug message, configuration of SFT[1:0] ignored.
|
||||
stdFiltelem.sft = 0x0U; // Range filter from SFID1 to SFID2.
|
||||
|
||||
//
|
||||
// Initialize bit timings.
|
||||
//
|
||||
bitTimes.nomRatePrescalar = 0x1FU; // Nominal Baud Rate Pre-scaler.
|
||||
bitTimes.nomTimeSeg1 = 0x1U; // Nominal Time segment before sample point.
|
||||
bitTimes.nomTimeSeg2 = 0x1U; // Nominal Time segment after sample point.
|
||||
bitTimes.nomSynchJumpWidth = 0x0U; // Nominal (Re)Synchronization Jump Width Range.
|
||||
bitTimes.dataRatePrescalar = 0x3U; // Data Baud Rate Pre-scaler.
|
||||
bitTimes.dataTimeSeg1 = 0x1U; // Data Time segment before sample point.
|
||||
bitTimes.dataTimeSeg2 = 0x1U; // Data Time segment after sample point.
|
||||
bitTimes.dataSynchJumpWidth = 0x0U; // Data (Re)Synchronization Jump Width.
|
||||
|
||||
eccConfig.enable = 1U; // Turn ECC on.
|
||||
eccConfig.enableChk = 1U;
|
||||
eccConfig.enableRdModWr = 0U;
|
||||
|
||||
//
|
||||
// Get MCANSS Revision ID.
|
||||
//
|
||||
MCAN_getRevisionId(MCANA_DRIVER_BASE, &revId);
|
||||
|
||||
//
|
||||
// Wait for Memory initialization to be completed.
|
||||
//
|
||||
while(false == MCAN_isMemInitDone(MCANA_DRIVER_BASE));
|
||||
|
||||
//
|
||||
// Put MCAN in SW initialization mode.
|
||||
//
|
||||
MCAN_setOpMode(MCANA_DRIVER_BASE, MCAN_OPERATION_MODE_SW_INIT);
|
||||
|
||||
//
|
||||
// Wait till MCAN is not initialized.
|
||||
//
|
||||
while (MCAN_OPERATION_MODE_SW_INIT != MCAN_getOpMode(MCANA_DRIVER_BASE));
|
||||
|
||||
//
|
||||
// Initialize MCAN module.
|
||||
//
|
||||
MCAN_init(MCANA_DRIVER_BASE, &initParams);
|
||||
|
||||
//
|
||||
// Configure MCAN module.
|
||||
//
|
||||
MCAN_config(MCANA_DRIVER_BASE, &configParams);
|
||||
|
||||
//
|
||||
// Configure Bit timings.
|
||||
//
|
||||
MCAN_setBitTime(MCANA_DRIVER_BASE, &bitTimes);
|
||||
|
||||
//
|
||||
// Set Extended ID Mask.
|
||||
//
|
||||
MCAN_setExtIDAndMask(MCANA_DRIVER_BASE, STA_USER_MCAN_EXT_ID_AND_MASK);
|
||||
|
||||
//
|
||||
// Configure Message RAM Sections
|
||||
//
|
||||
MCAN_msgRAMConfig(MCANA_DRIVER_BASE, &msgRAMConfigParams);
|
||||
|
||||
//
|
||||
// Configure Standard ID filter element
|
||||
//
|
||||
MCAN_addStdMsgIDFilter(MCANA_DRIVER_BASE, 0U, &stdFiltelem);
|
||||
|
||||
//
|
||||
// Enable internal loopback mode
|
||||
//
|
||||
MCAN_lpbkModeEnable(MCANA_DRIVER_BASE, MCAN_LPBK_MODE_EXTERNAL, true);
|
||||
|
||||
//
|
||||
// Take MCAN out of the SW initialization mode
|
||||
//
|
||||
MCAN_setOpMode(MCANA_DRIVER_BASE, MCAN_OPERATION_MODE_NORMAL);
|
||||
|
||||
while (MCAN_OPERATION_MODE_NORMAL != MCAN_getOpMode(MCANA_DRIVER_BASE));
|
||||
|
||||
MCAN_eccConfig(MCANA_DRIVER_BASE, &eccConfig);
|
||||
|
||||
MCAN_eccClearErrorStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_SEC);
|
||||
MCAN_eccClearIntrStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_SEC);
|
||||
|
||||
MCAN_eccClearErrorStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_DED);
|
||||
MCAN_eccClearIntrStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_DED);
|
||||
|
||||
uint32_t intrStatus;
|
||||
intrStatus = MCAN_getIntrStatus(MCANA_DRIVER_BASE);
|
||||
MCAN_clearIntrStatus(MCANA_DRIVER_BASE, intrStatus);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_pieVectError(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_User_pieVectError(void)
|
||||
{
|
||||
//
|
||||
// This is unexpected. STA_TEST_PIE_HANDLER generates a PIE vector error
|
||||
// but it should have plugged its own handler.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_canParityErrorISR(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
__interrupt void STA_User_canParityErrorISR(void)
|
||||
{
|
||||
STA_User_canErrorReturnVal = STL_CAN_RAM_checkErrorStatus(CANA_BASE);
|
||||
STA_User_canInterruptFlag = true;
|
||||
STA_User_parityErrorCode = HWREGH(CANA_BASE + CAN_O_PERR);
|
||||
|
||||
CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
|
||||
}
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_mcanECCErrorISR(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
__interrupt void STA_User_mcanECCErrorISR(void)
|
||||
{
|
||||
STA_User_mcanSECReturnVal = STL_MCAN_RAM_checkErrorStatus(MCANA_DRIVER_BASE,
|
||||
&errInfoSEC);
|
||||
|
||||
MCAN_eccClearErrorStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_SEC);
|
||||
MCAN_eccClearIntrStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_SEC);
|
||||
MCAN_eccWriteEOI(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_SEC);
|
||||
MCAN_clearIntrStatus(MCANA_DRIVER_BASE, MCAN_IR_BEC_MASK);
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// STA_User_nmiISR(void)
|
||||
//
|
||||
//*****************************************************************************
|
||||
__interrupt void STA_User_nmiISR(void)
|
||||
{
|
||||
uint32_t nmiFlags = SysCtl_getNMIFlagStatus();
|
||||
|
||||
if((nmiFlags & SYSCTL_NMI_MCAN_ERR) != 0U)
|
||||
{
|
||||
SysCtl_clearAllNMIFlags();
|
||||
|
||||
STA_User_mcanDEDReturnVal = STL_MCAN_RAM_checkErrorStatus(MCANA_DRIVER_BASE,
|
||||
&errInfoDED);
|
||||
|
||||
MCAN_eccClearErrorStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_DED);
|
||||
MCAN_eccClearIntrStatus(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_DED);
|
||||
MCAN_eccWriteEOI(MCANA_DRIVER_BASE, MCAN_ECC_ERR_TYPE_DED);
|
||||
MCAN_clearIntrStatus(MCANA_DRIVER_BASE, MCAN_IR_BEU_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Unexpected NMI
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,90 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sta_util.c
|
||||
//
|
||||
// TITLE: Self Test Application Utility source
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: C2000 Diagnostic Library v5.00.01 $
|
||||
// $Release Date: Tue Oct 29 00:57:20 IST 2024 $
|
||||
// $Copyright:
|
||||
// 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 <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "driverlib.h"
|
||||
#include "sta_util.h"
|
||||
#include "sysctl.h"
|
||||
#include "interrupt.h"
|
||||
|
||||
#if STA_UTIL_PROFILE
|
||||
//*****************************************************************************
|
||||
//
|
||||
// void STA_Util_configProfiler
|
||||
//
|
||||
//*****************************************************************************
|
||||
void STA_Util_configProfiler(uint32_t base)
|
||||
{
|
||||
//
|
||||
// Clear overflow flag.
|
||||
//
|
||||
CPUTimer_clearOverflowFlag(base);
|
||||
|
||||
//
|
||||
// Initialize timer period.
|
||||
//
|
||||
CPUTimer_setPeriod(base, 0xFFFFFFFFU);
|
||||
|
||||
//
|
||||
// Initialize pre-scaler.
|
||||
//
|
||||
CPUTimer_setPreScaler(base, 0U);
|
||||
|
||||
//
|
||||
// Reload timer counter.
|
||||
//
|
||||
CPUTimer_reloadTimerCounter(base);
|
||||
|
||||
//
|
||||
// Set the timer to stop after next decrement on emulation halt.
|
||||
//
|
||||
CPUTimer_setEmulationMode(base, CPUTIMER_EMULATIONMODE_RUNFREE);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
Reference in new issue
Block a user