6 Hardware and Software Requirements

The following sections cover hardware and software prerequisites used for this application, and they also cover the overview of the application.

Prerequisites

Hardware:

Software:

Note: The application discussed in this document uses the above-mentioned MPLAB Harmony v3 repositories. These repositories can be downloaded from GitHub or use MCC Content Manager to download the above mentioned repositories. These steps can also be used for the PIC32CZ CA70/MC70 family of microcontrollers.

Application Overview

This example illustrates the use of TCM in the PIC32CZ CA and SAM E70/S70/V70/V71 family of devices. It compares the time taken to execute the code from Flash memory, SRAM, and TCM with or without the I-cache and D-cache.

Figure 6-1. Flowchart

Application Code

To illustrate code execution from memory locations, a simple data transfer function is created on Flash memory, SRAM, and TCM. Then, the time taken is compared for each data transfer with the help of the core cycle counter. Using the MPLAB XC32 compiler attributes, the functions and data buffers are placed in different memory locations.

  • __attribute__((tcm)): Places the function or buffer in TCM
  • __attribute__ ((ramfunc, long_call)): Places the function or buffer in SRAM

In the main.c file,

  • Two buffers, TCM_SrcBuff and TCM_DestBuff, are defined and placed in DTCM
  • Two buffers, SrcBuff and DestBuff, are defined and placed in SRAM
  • A function, TCM_memcpy(), is in ITCM
  • A function, SRAM_memcpy(), is in SRAM
  • A function, flash_memcpy(), is in Flash