SPRU513Z August 2001 – October 2023 SM320F28335-EP
#include <stdio.h>
#include <cpy_tbl.h>
#include <crc_tbl.h>
extern COPY_TABLE task1_ctbl;
extern COPY_TABLE task2_ctbl;
extern COPY_TABLE task3_ctbl;
extern CRC_TABLE task1_crctbl;
extern CRC_TABLE union_crctbl;
/****************************************************************************/
/* copy_in - provided by the RTS library to copy code from its load */
/* address to its run address. */
/* my_check_CRC - verify that the CRC values stored in the given table */
/* match the computed value at run time, using load address. */
/* taskX - perform a simple task. These routines share the same run */
/* address. */
/****************************************************************************/
extern void copy_in(COPY_TABLE *tp);
extern unsigned int my_check_CRC(CRC_TABLE *tp);
extern void task1(void);
extern void task2(void);
extern void task3(void);
int x = 0;
main()
{
unsigned int ret_val = 0;
unsigned int CRC_ok = 1;
printf("Start task copy test with CRC checking.\n");
printf("Check CRC of task1 section.\n");
ret_val = my_check_CRC(&task1_crctbl);
if (ret_val == 1)
printf("\nPASSED: CRCs for task1_crc_tbl match.\n");
else
{
CRC_ok = 0;
printf("\nFAILED: CRCs for task1_crc_tbl do NOT match.\n");
}
/*************************************************************************/
/* Copy task1 into the run area and execute it. */
/*************************************************************************/
copy_in(&task1_ctbl);
task1();
printf("Check CRC of UNION.\n");
if ((ret_val = my_check_CRC(&union_crctbl)) == 1)
printf("\nPASSED: CRCs for union_crc_tbl match.\n");
else
{
CRC_ok = 0;
printf("\nFAILED: CRCs for union_crc_tbl do NOT match.\n");
}
copy_in(&task2_ctbl);
task2();
copy_in(&task3_ctbl);
task3();
printf("Copy table and CRC tasks %s!!\n",
((CRC_ok == 1 && x == 6)) ? "PASSED" : "FAILED");
}