📄 applytablebinitcmdfile.tci
字号:
/** * ======== applyTableBinitCmdFile.tci ======== * * The function modifies a generated DSP/BIOS *cfg.cmd file
* to append the new table() operator for bootloading a BIOS application * * The function works around a limitation in DSP/BIOS 5.1 or lower,
* in that the configuration (gconf/tconf) does have table()
* capabilities -- it only supports LOAD, RUN addresses in the *cfg.cmd file. * * The fxn takes an input *cfg.cmd file and creates * a new/existing command file with table(binit) appended to sections
* that have different load/run addresses. * * The user specifies the string to append. This flexibility allows for
* potential future changes in syntax with new CG tools. * * Call the function as follows: * * ti_tcapps_utils.applyTableBinitCmdFile ("myappcfg.cmd", "newcfg.cmd", * ", table(BINIT)" ); * * This is a snippet of the DSP/BIOS generated linker command file, * * Before the function call * .bios: {} load > FLASHREST, run > IRAM * * After the function call * .bios: {} load > FLASHREST, run > IRAM, table(BINIT) * * Constraints: 1. The function assumes the following pattern " } > " to * indicate the end of memory section delimiter.
* 2. You need at least Codegen 5.0 on C6000 to leverage this
* function since it uses the new linker table() operator. * * * @params inFile - DSP/BIOS generated linker command file * * @params outFile - New generated DSP/BIOS linker command file * * @params tableBinitString - String to append to Load/Run sections * * @return outFile - New generated DSP/BIOS linker command file or null if * no new file is generated * */ti_tcapps_utils.applyTableBinitCmdFile = function (inFile, outFile, tableBinitString){ var startPattern = new RegExp("load" // look for string 'load'
+ "\\s*" // look for zero or more spaces
+ ">" // look for memory assignment operator
, "i"); // case-insensitive var endPattern = new RegExp("run" // look for string 'run'
+ "\\s*" // look for zero or more spaces
+ ">" // look for memory assignment operator
, "i"); // case-insensitive var outputline = ""; var flag = 0; var nextline; if ( (inFile == null) || (outFile == null) || (tableBinitString == null) ) { print ("Please enter correct params for applyTableBinitCmdFile fxn"); return(null); } /* Open input file */ var srcFile = new java.io.BufferedReader(new java.io.FileReader(inFile)); /* Read input file line until EOF */ while ((nextline = srcFile.readLine()) != null) { /* * Convert the Java object to a JavaScript string to call the * JavaScript String.match and String.replace functions */ nextline = String(nextline); /* Check to see if memory section has been found */ if (nextline.match(startPattern) != null) { /* Section found set flag */ flag = 1;
/* Read and write until end of memory section found */ while (nextline.match(endPattern) == null) { outputline += nextline + "\n"; nextline = String(srcFile.readLine()); } /* Found both patterns : append the user's string for table() */ nextline = nextline + tableBinitString; } outputline += nextline + "\n"; } /* Close source file */ srcFile.close(); /* Check if both load & run patterns were found */ if (flag == 0) { print("Load/run sections don't exist in this linker command file"); return(null); } /* Open output file */ var dstFile = new java.io.FileWriter(outFile); /* Write outputline to file and close file */ dstFile.write(outputline); dstFile.close(); return (outFile);}/*! Revision History *! ================ *! 18-Jun-2004 alancam Created *!*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -