Part Number: LAUNCHXL-F280039C
Hi Experts,
Posting on behalf of customer.
The issue I am facing is the following: I am unable to authenticate flash memory beyond 16 kB using CMAC. I am following the Application Report: Secure Boot on C2000 Devices, which describes the LED behavior indicating whether Secure Boot has passed. In my case, the LED remains solid, but it does not start blinking, which means that the full-flash CMAC authentication fails.
Below is the modified code based on the example:
#include "driverlib.h"
#include "device.h"
//
// Defines
//
#define CMAC_AUTH_PASS 0UL
#define CMAC_AUTH_START_ADDRESS 0x00080000UL
#define CMAC_AUTH_END_ADDRESS 0x000B0000UL
#define CMAC_AUTH_TAG_ADDRESS 0x00084002UL
//
// Globals
//
bool cpu1_SuccessfullyBooted = false;
//
// Structure required for CMAC symbol reserving in memory.
// Required for performing CMAC on non-entry sector of flash.
//
// Read more in the Assembly Language Tools User's Guide
//
struct CMAC_TAG
{
char tag[8];
uint32_t start;
uint32_t end;
};
//
// Create CMAC symbol for flash entry point 1 (0x80000).
//
// Reserves memory for storing the golden CMAC tag that gets
// generated by the HEX Utility.
//
#pragma RETAIN(cmac_sb_1)
#pragma LOCATION(cmac_sb_1, 0x080002)
const char cmac_sb_1[8] = { 0 };
//
// Create CMAC symbol for full length flash authentication.
// The start and end CMAC_TAG struct members are zero, therefore
// the CMAC algorithm runs over entire memory region specified in
// the HEX directive.
//
// Note that the location 0x082002 can be set to anywhere as long
// as it is within the specified CMAC authentication memory.
//
// Reserves memory for storing the golden CMAC tag that gets
// generated by the HEX Utility.
//
#pragma RETAIN(cmac_all)
#pragma LOCATION(cmac_all, 0x084002)
const struct CMAC_TAG cmac_all = { {0}, 0x0 , 0x0};
//
// Function Prototypes
//
uint32_t CPU1BROM_calculateCMAC(uint32_t startAddress,
uint32_t endAddress,
uint32_t tagAddress);
//
// Main
//
void main(void)
{
uint32_t applicationCMACStatus = CMAC_AUTH_PASS;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize GPIO and configure the GPIO pins as a push-pull output
//
Device_initGPIO();
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
//
// Turn on LED1 to indicate CPU1 has entered application
//
GPIO_writePin(DEVICE_GPIO_PIN_LED1, 0);
//
// Call CMAC Authentication API to verify contents of all of
// device flash.
//
// Upon failure, enter infinite loop.
//
applicationCMACStatus = CPU1BROM_calculateCMAC(CMAC_AUTH_START_ADDRESS,
CMAC_AUTH_END_ADDRESS,
CMAC_AUTH_TAG_ADDRESS);
if(CMAC_AUTH_PASS != applicationCMACStatus)
{
//
// Application will get stuck here upon failure
//
while(1);
}
else
{
cpu1_SuccessfullyBooted = true;
}
Here for the hex.cmd
/* CPU1 Flash sectors */
/* HEX directive required by HEX utility to generate the golden CMAC tag */
/* with one entry that represents all the allocated flash memory */
ROMS
{
FLASH_BANK0_2: o=0x00080000 l=0x00030000, fill = 0xFFFF /* If fill not specified, then default is all 0s */
}
Regards,
Marvin
