This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1352R: Problem with adding On-Chip OAD function to simple peripheral application

Part Number: CC1352R


SDK:  simplelink_cc13x2_26x2_sdk_4_20_00_35

CCS: Code Composer Studio 10.0.0

Although I have known there exists simple_peripheral_oad_onchip_app, I still try to add On-Chip OAD to simple peripheral application by myself. I do the steps as the Simplelink Academy: Task 3 – Add OAD to Multi Role and refer to simple_peripheral_oad_onchip_app example project. If I modify the simple_peripheral_app.cfg according to simple_peripheral_oad_onchip_app.cfg, the modifications are as follows:

var OAD_IMG_TYPE;
var USE_SECURE_FW_IMG = false;

if(Program.build.cfgArgs != null)
{
  if(typeof Program.build.cfgArgs.OAD_IMG_A != 'undefined' &&
      Program.build.cfgArgs.OAD_IMG_A == 1)
  {
    OAD_IMG_TYPE = "A";
  }
  else if (typeof Program.build.cfgArgs.OAD_IMG_B != 'undefined' &&
      Program.build.cfgArgs.OAD_IMG_B == 1)
  {
    OAD_IMG_TYPE = "B";
  }

}

/* Put reset vector after OAD metadata */
var compilerOpts = prog.build.target.ccOpts.prefix; // Get the target compiler options
var regex = /(?:\-\-define\=)(\w*)(?:\=*\w*\s)/g; 
var compilerDefs = [];
while ((tmp = regex.exec(compilerOpts)) !== null) compilerDefs.push(tmp[1]); // Parse compiler symbols

if (Program.build.cfgArgs.OAD_IMG_A == 1)
{
  m3Hwi.resetVectorAddress  = 0x00055fc0;
  ROM.constStructAddr = 0x37000;
  ROM.externFuncStructAddr = 0x373C0;
}
else if (Program.build.cfgArgs.OAD_IMG_B == 1) //(OAD_IMG_TYPE == "B")
{
  if (compilerDefs.indexOf('SECURITY') > -1)
  {
    // Check for SECURITY compiler symbol
    m3Hwi.resetVectorAddress = 0x90; // Image B Reset Vector Address
  }
  else
  {
    m3Hwi.resetVectorAddress = 0x50; // Image B Reset Vector Address
  }
  ROM.constStructAddr = 0x01000;
  ROM.externFuncStructAddr = 0x013c0;
}
else
{
  /* Put reset vector at start of Flash */
  m3Hwi.resetVectorAddress  = 0x0;
}

I have come across the following error when I build the simple peripheral application after modifications:

workspace_v10/simple_peripheral_CC13X2R1_LAUNCHXL_tirtos_ccs/simple_peripheral_app.cfg", line 262: TypeError: Cannot read property "OAD_IMG_A" from null (E:/TIC1352R/workspace_v10/simple_peripheral_CC13X2R1_LAUNCHXL_tirtos_ccs/simple_peripheral_app.cfg#262)
"./package/cfg/simple_peripheral_app_pem4f.cfg", line 192
gmake.exe: *** [package.mak:202: package/cfg/simple_peripheral_app_pem4f.xdl] Error 1
js: "C:/ti/ccs1000/xdctools_3_61_00_16_core/packages/xdc/tools/Cmdr.xs", line 52: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted.
gmake[1]: *** [build-634555279-inproc] Error 1
gmake: *** No rule to make target 'build-634555279', needed by 'configPkg/compiler.opt'.
gmake: *** No rule to make target 'build-634555279', needed by 'configPkg/linker.cmd'.
gmake: *** No rule to make target 'build-634555279', needed by 'configPkg/compiler.opt'.
gmake: *** No rule to make target 'build-634555279', needed by 'configPkg/compiler.opt'.
gmake: *** No rule to make target 'build-634555279', needed by 'configPkg/compiler.opt'.

But when I use the simplified version according to simple Simplelink Academy: Task 3 – Add OAD to Multi Role(Add Off-Chip OAD), the modifications are as follows:

/* Put reset vector after OAD metadata */
var compilerOpts = prog.build.target.ccOpts.prefix; // Get the target compiler options
var regex = /(?:\-\-define\=)(\w*)(?:\=*\w*\s)/g; 
var compilerDefs = []; 
while ((tmp = regex.exec(compilerOpts)) !== null) compilerDefs.push(tmp[1]); // Parse compiler symbols

if (compilerDefs.indexOf('SECURITY') > -1) { // Check for SECURITY compiler symbol 
  m3Hwi.resetVectorAddress = 0x90; // Image B Reset Vector Address
}
else { 
  m3Hwi.resetVectorAddress = 0x50; // Image A Reset Vector Address
}

Everything is Ok. And I can build and link successfully and generate OAD bin image. I don't know why when I use modifications according to the simple_peripheral_oad_onchip_app.cfg, but I can't build successfully. Any suggestions? 

Thank you.

BRs.