| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- //-------------------------------------------------------------------------------
- #include "parseConfig.h"
- #include "loadBasicPacket.h"
- //-------------------------------------------------------------------------------
- const char* ACTION_NAME[ACTION_MAX] = { "FileName", "Protected", "MaxSize", "NVMData", "PathName", "Output", "BasicPacket", "END" };
- enum {
- ACTION_FILENAME = 0,
- ACTION_PROTECTED,
- ACTION_MAXSIZE,
- ACTION_NVMDATA,
- ACTION_PATHNAME,
- ACTION_OUTPUT,
- ACTION_BASICPACKET,
- ACTION_ENDFILE
- };
- int parseAction;
- //u32 flashModuleInfoNum;
- NorFlashModuleInfo flashModuleInfo[MODULE_MAX];
- NorFlashModulePathInfo flashModulePathInfo[PATHINFO_MAX];
- char DEFAULT_FILE_NAME[] = "S2.code.bin";
- char BIN_FILENAME[128];
- NVMData gNVMData[MODULE_MAX];
- u32 gNVMData_count = 0;
- #ifndef CONFIG_BIN_FILENAME
- #define CONFIG_BIN_FILENAME DEFAULT_FILE_NAME
- #endif
- //---------------------------------------------------------------------------
- static inline int check_keyword( const char *keyword, const char* tempString )
- { //return (!strncmp(keyword, tempString, strlen(keyword))) ;gaia fixed
- char tmp[FILENAME_SIZE];
- char *ptr = NULL;
- memset(tmp ,'\0', FILENAME_SIZE);
- strcpy(tmp ,tempString);
- ptr = strstr(tmp, "=" );
- if (ptr != NULL)
- {
- *ptr = '\0';
- }
- if(!strncmp(keyword, "CONFIG_", (int)7)) //parse string CONFIG_
- return false;
- return (strlen(keyword)==0)?false:(!strncmp(keyword, tmp, strlen(tmp))) ;
- }
- //---------------------------------------------------------------------------
- static bool copy_settingString( char* dstString, const char* tempString )
- {
- char* tmp = strstr( tempString, "=" );
- if (tmp == NULL)
- return false;
- tempString = tmp + 1;
- strcpy( dstString, tempString );
- return true;
- }
- //---------------------------------------------------------------------------
- static bool copy_settingYesNo( bool* dstValue, const char* tempString )
- {
- char* tmp = strstr( tempString, "=" );
- if (tmp == NULL)
- return false;
- tempString = tmp + 1;
- switch( tempString[0] )
- {
- case 'y': case 'Y': *dstValue = true; break;
- case 'n': case 'N': *dstValue = false; break;
- default: return false;
- }
-
- return true;
- }
- //---------------------------------------------------------------------------
- char* fgetLine( char *s, int size, FILE *fpIn )
- {
- int i = 0;
- while( i == 0 )
- {
- if( fgets( s, size, fpIn ) == NULL ) return NULL;
- i = strlen( s );
- if( s[i-1] == '\n' )
- {
- i--;
- if( (i != 0) && s[i-1] == '\r' ) i--;
- s[i] = '\0';
- }
- }
-
- return s;
- }
- //---------------------------------------------------------------------------
- // Search ModuleInfo & ActionIndex
- //---------------------------------------------------------------------------
- NorFlashModuleInfo* searchModuleInfo( const char *moduleName )
- {
- int i = 0;
- for( i = 0; i < MODULE_MAX; i++ )
- {
- if( check_keyword( flashModuleInfo[i].moduleName, moduleName ) ) {
- //printFlashModuleInfo( &flashModuleInfo[i] );
- return &flashModuleInfo[i];
- }
- }
- //showMsg( "warning! searchModuleInfo failed (%s)\n", moduleName );
- return NULL;
- }
- NorFlashModulePathInfo* searchModulePathInfo( const char *moduleName )
- {
- int i = 0;
- for( i = 0; i < PATHINFO_MAX; i++ )
- {
- if( check_keyword( flashModulePathInfo[i].moduleName, moduleName ) )
- return &flashModulePathInfo[i];
- }
- errMsg( "searchModulePathInfo failed (%s)\n", moduleName );
- return NULL;
- }
- static inline int searchActionIndex( const char *actionName )
- {
- int i = 0;
- for( i = 0; i <ACTION_MAX; i++ )
- {
- if( check_keyword( ACTION_NAME[i], actionName ) ) return i;
- }
- return -1;
- }
- #if 0//ndef RELEASE_VER
- static inline void bootrom_append_dbg_string(NorFlashModuleInfo *moduleInfo)
- {
- static char* bootrom_str = "BootROM";
- static char* dbg_str = "_dbg.bin";
- if(!strncmp(moduleInfo->moduleName , bootrom_str, strlen(bootrom_str))){
- //hard coding.....carefully
- int tmp_str_len = strlen(moduleInfo->fileName);
- showMsg( "bootrom_append_dbg_string: %s ->", moduleInfo->fileName);
- memcpy(&moduleInfo->fileName[tmp_str_len-4], dbg_str, strlen(dbg_str)+1);
- //moduleInfo->fileName[tmp_str_len+4]='\0';
- showMsg( " %s \n", moduleInfo->fileName);
- }
- }
- #endif
- void initFlashModuleInfo(int moduleIndex, const char *moduleName, u32 flashAddr1, u32 flashSize1)
- {
- //initSingleNorFlashModuleInfoCrossFlash( moduleName, flashAddr1, flashSize1, 0, 0 );
-
- NorFlashModuleInfo *info;
- info = &flashModuleInfo[moduleIndex];
- //flashModuleInfoNum++
- info->isValid = false;
- info->isProtected = false;
- info->isInitModuleNameByUser = false;
- info->isInitProtectedByUser = false;
- info->flashAddr1 = flashAddr1;
- info->flashSize1 = flashSize1;
- info->max_module_size = 0;
- // info->flashAddr2 = 0;
- // info->flashSize2 = 0;
- info->fileName[0] = '\0';
- strcpy( info->moduleName, moduleName );
- printf("info->moduleName %s\n", info->moduleName);
- }
- //---------------------------------------------------------------------------
- // Parse mergeImage.cfg
- //---------------------------------------------------------------------------
- static inline bool parseMIC_FileName( const char* tempString )
- {
- bool ret = false;
- #ifdef CONFIG_APPEND_NAME_TO_CIKEY_HDCPKEY
- char *token;
- char tokenfileName[FILENAME_SIZE];
- char tname[FILENAME_SIZE];
- #endif
- NorFlashModuleInfo *moduleInfo = searchModuleInfo( tempString );
- if( moduleInfo == NULL ) return false;
- if( moduleInfo->isInitModuleNameByUser )
- {
- errMsg( "[%s] re-assign fileName\n", moduleInfo->moduleName );
- return false;
- }
- if( copy_settingString( moduleInfo->fileName, tempString ) )
- {
- moduleInfo->isInitModuleNameByUser = true;
- if( moduleInfo->fileName[0] != '\0' ) moduleInfo->isValid = true;
- ret = true;
- }
- #ifdef CONFIG_APPEND_NAME_TO_CIKEY_HDCPKEY
- memset(tname, 0, FILENAME_SIZE);
- strcpy(tokenfileName, moduleInfo->fileName );
- token = strtok(tokenfileName,"/"); /*There are two delimiters here*/
- while (token != NULL){
- strcpy(tname, token);
- token = strtok(NULL," /");
- }
- strcpy(moduleInfo->eachfileName, tname);
- #endif
- #if 0//ndef RELEASE_VER
- /*special take care bootrom debug/release version */
- bootrom_append_dbg_string(moduleInfo);
- #endif
- return ret;
- }
- static inline bool parseMIC_Protected( const char* tempString )
- {
- NorFlashModuleInfo *moduleInfo = searchModuleInfo( tempString );
- if( moduleInfo == NULL ) return false;
- if( moduleInfo->isInitProtectedByUser )
- {
- errMsg( "[%s] re-assign protect\n", moduleInfo->moduleName );
- return false;
- }
- if( copy_settingYesNo( &moduleInfo->isProtected, tempString ) )
- {
- moduleInfo->isInitProtectedByUser = true;
- return true;
- }
- return false;
- }
- static inline bool parseMIC_MaxSize( const char* tempString )
- {
- char max_size[12];
- NorFlashModuleInfo *moduleInfo = searchModuleInfo( tempString );
- memset(max_size, '\0', 12);
- if( moduleInfo == NULL ) return false;
- if(copy_settingString(max_size, tempString ) )
- {
- moduleInfo->max_module_size = atoi(max_size);
- return true;
- }
- return false;
- }
- static inline bool parseMIC_NVMdata( const char* tempString )
- {
- char tmp[FILENAME_SIZE];
- char *ptr;
- memset(tmp, 0, FILENAME_SIZE);
- strcpy(tmp, tempString);
- ptr = strstr(tmp, "=" );
- if (ptr == NULL)
- return false;
- *ptr = '\0';
- gNVMData[gNVMData_count].id = atoi(tmp);
- strcpy(gNVMData[gNVMData_count].pathName, ptr+1);
- gNVMData_count++;
- return true;
- }
- #if 0
- static inline bool parseMIC_PathName( const char* tempString )
- {
- NorFlashModulePathInfo *modulePathInfo = searchModulePathInfo( tempString );
- if( modulePathInfo == NULL ) return false;
- return copy_settingString( modulePathInfo->pathName, tempString );
- }
- #endif
- static inline bool parseMIC_Output( const char* tempString )
- {
- if( check_keyword( "Folder", tempString ) )
- return copy_settingString( miOutputPathName, tempString );
- else if( check_keyword( "judgeDebugVersion", tempString ) )
- return copy_settingYesNo( &miJudgeDebugVersionFlag, tempString );
- return false;
- }
- static inline bool parseMIC_BasicPacket( const char* tempString )
- {
- if( check_keyword( "BasicPacket", tempString ) )
- {
- if( !copy_settingString( miBaseImageName, tempString ) ) return false;
- return loadBasicPacket();
- }
-
- return false;
- }
- //---------------------------------------------------------------------------
- static inline bool parseMIC_Action( const char* tempString )
- {
- int index = searchActionIndex( tempString );
- if( index < 0 ) return false;
- parseAction = index;
- return true;
- }
- static inline bool parseMIC_Setting( const char* tempString )
- {
- switch( parseAction )
- {
- case ACTION_FILENAME: return parseMIC_FileName( tempString );
- case ACTION_PROTECTED: return parseMIC_Protected( tempString );
- case ACTION_MAXSIZE: return parseMIC_MaxSize( tempString );
- case ACTION_NVMDATA: return parseMIC_NVMdata( tempString );
- // case ACTION_PATHNAME: return parseMIC_PathName( tempString );
- case ACTION_OUTPUT: return parseMIC_Output( tempString );
- case ACTION_BASICPACKET: return parseMIC_BasicPacket( tempString );
- case ACTION_ENDFILE: return true;
- default:
- errMsg( "parseAction (%d) not define\n", parseAction ); return false;
- }
- }
- static inline bool parseMergeImageConfigString( const char* tempString )
- {
- switch( tempString[0] )
- {
- case '@': return parseMIC_Action( tempString+1 );
- case '#': return true;
- default: return parseMIC_Setting( tempString );
- }
- }
- // ivan
- char *parseQuota(char *str)
- {
- int i, n=strlen(str);
- char *p=str;
- for(i=0;i<n;)
- {
- if(*p!='"')
- str[i++] = *p;
- p++;
- }
- return str;
- }
- bool parseMergeImageConfigFile( const char *filename)
- {
- int parseLine; bool ret = true;
- char tempString[TMP_BUFFER_SIZE];
- FILE *fpIn = fopen( filename, "rt" );
- if( fpIn == NULL )
- {
- errMsg( "MergeImageConfig (%s) not found!\n", filename );
- return false;
- }
- for( parseLine = 1; !feof(fpIn); parseLine++ )
- {
- if( fgetLine( tempString, TMP_BUFFER_SIZE, fpIn ) != NULL )
- {
- #if DBG_SHOW_CONFIG_LINE
- dbgMsg( "line%d: %s\n",parseLine, tempString );
- #endif
- // ivan
- strcpy(tempString, parseQuota( tempString ));
- ret = parseMergeImageConfigString( tempString );
- }
- if( !ret )
- {
- showMsg( "\nwarning!Parse config failed , line:%d , string: \n\"%s\"\n\n", parseLine, tempString );
- ret = true;//gaia
- //break;
- }
- if( parseAction == ACTION_ENDFILE ) break;
- }
-
- fclose( fpIn );
- return ret;
- }
- //---------------------------------------------------------------------------
- // Parse BasicSaveInfo
- //---------------------------------------------------------------------------
- static inline bool parseBasicSaveInfoString( const char* tempString )
- {
- u32 searchSize;
- const char *endString;
- char searchName[32];
- NorFlashModuleInfo* info;
-
- if( tempString[0] != '[' ) return true;
- tempString += 1;
-
- if( check_keyword( "CODE", tempString ) ) return true;
- else if( check_keyword( "DATA", tempString ) ) return true;
- else if( check_keyword( "MODEL", tempString ) ) return true;
- endString = strstr( tempString, "]" );
- if( endString == NULL ) return false;
- searchSize = endString - tempString;
- strncpy( searchName, tempString, searchSize );
- searchName[searchSize] = '\0';
- info = searchModuleInfo( searchName );
- if( info == NULL ) return true;
- if( info->isInitModuleNameByUser ) return true;
- if( info->isInitProtectedByUser ) return true;
- info->isProtected = true;
- dbgMsg( "BasicSaveInfo: set %s protected\n", info->moduleName );
- return true;
- }
- static inline bool parseBasicSaveInfo( const char *filename)
- {
- int parseLine; bool ret = true;
- char tempString[TMP_BUFFER_SIZE];
- FILE *fpIn = fopen( filename, "rt" );
- if( fpIn == NULL )
- {
- errMsg( "BasicSaveInfo (%s) not found!\n", filename );
- return false;
- }
- dbgMsg( "\nparseBasicSaveInfo =>\n" );
- for( parseLine = 1; !feof(fpIn); parseLine++ )
- {
- if( fgetLine( tempString, TMP_BUFFER_SIZE, fpIn ) != NULL )
- {
- #if DBG_SHOW_CONFIG_LINE
- dbgMsg( "line%d: %s\n",parseLine, tempString );
- #endif
- if( check_keyword( "#END", tempString ) ) break;
- ret = parseBasicSaveInfoString( tempString );
- }
- if( !ret )
- {
- errMsg( "Parse config failed\n, line:%d , string: %s\n", parseLine, tempString );
- break;
- }
- }
-
- fclose( fpIn );
- return ret;
- }
- //---------------------------------------------------------------------------
- // init & load moduleInfo
- //---------------------------------------------------------------------------
- #if 0
- void initSingleNorFlashModuleInfoCrossFlash(
- const char *moduleName, u32 flashAddr1, u32 flashSize1, u32 flashAddr2, u32 flashSize2 )
- {
- NorFlashModuleInfo *info;
- info = &flashModuleInfo[flashModuleInfoNum++];
- info->isValid = false;
- info->isProtected = false;
- info->isInitModuleNameByUser = false;
- info->isInitProtectedByUser = false;
- info->flashAddr1 = flashAddr1;
- info->flashSize1 = flashSize1;
- info->flashAddr2 = flashAddr2;
- info->flashSize2 = flashSize2;
- info->fileName[0] = '\0';
- strcpy( info->moduleName, moduleName );
- }
- #endif
- inline void printFlashModuleInfo( NorFlashModuleInfo *info )
- {
- #if DBG_SHOW_PARSE_RESULT
- showMsg( "[Module] %s\n", info->moduleName );
- showMsg( "isValid=%s\n", info->isValid ? "true" : "false" );
- showMsg( "isProtected=%s\n", info->isProtected ? "true" : "false" );
- showMsg( "isInitModuleNameByUser=%s\n", info->isInitModuleNameByUser ? "true" : "false" );
- showMsg( "isInitProtectedByUser=%s\n", info->isInitProtectedByUser ? "true" : "false" );
- showMsg( "flashAddr1=0x%08x\n", info->flashAddr1 );
- showMsg( "flashSize1=0x%08x\n", info->flashSize1 );
- showMsg( "flashAddr2=0x%08x\n", info->flashAddr2 );
- showMsg( "flashSize2=0x%08x\n", info->flashSize2 );
- showMsg( "fileName=%s\n", info->fileName );
- #endif
- }
- static inline void reviewFlashModuleInfoFlag(int index)
- {
- //NorFlashModuleInfo *info
- if( isLoadBasicPacket() ) return;
- #if MI_PROTECT_INVALID_MODULE
- if( (flashModuleInfo[index].isInitModuleNameByUser) && (!flashModuleInfo[index].isValid) )
- {
-
- #if defined(OP_IRCommandType)
- if( MODULE_OPTION == index) return;
- #endif
- flashModuleInfo[index].isProtected= true;
- showMsg( "[%s] Auto force set protect=y\n", flashModuleInfo[index].moduleName );
- }
- #endif
- }
- /* remove space after filename */
- static inline void reviewFlashModuleFileName( NorFlashModuleInfo *info )
- {
- int max = strlen(info->fileName);
- for( ; max > 0 ; max-- )
- {
- if( info->fileName[max-1] != ' ' ) break;
- }
- info->fileName[max] = '\0';
- }
- static inline void reviewFolderString( const char *folderName, char *folderString, const char *defaultFolder )
- {
- u32 strLen = strlen(folderString);
- while( strLen && (folderString[strLen-1] == '/' ) ) folderString[--strLen] = '\0';
- if( strLen == 0 ) strcpy( folderString, defaultFolder );
- dbgMsg( "%s : %s\n", folderName, folderString );
- }
- #include "init_flash_module.h"
- //---------------------------------------------------------------------------
- static inline void initSingleNorFlashModulePathInfo(
- NorFlashModulePathInfo *info, const char *moduleName, const char *pathName )
- {
- strcpy( info->moduleName, moduleName );
- strcpy( info->pathName, pathName );
- }
- #if 0
- static inline void initNorFlashModulePathInfo()
- {
- initSingleNorFlashModulePathInfo( &flashModulePathInfo[0], "BootROM", PATHNAME_BOOTROM );
- initSingleNorFlashModulePathInfo( &flashModulePathInfo[1], "AudioROM", PATHNAME_AUDIOROM );
- }
- #endif
- //---------------------------------------------------------------------------
- bool loadNorFlashModuleInfo()
- {
- int index;
- //initNorFlashModulePathInfo();
- initNorFlashModuleInfo();
- parseAction = -1;
- flashModuleInfo[MODULE_OPTION].isValid = true; //force Option = valid
- flashModuleInfo[MODULE_END].isValid = true; //force END = valid
- #ifdef CONFIG_SUPPORT_NVM_PRELOAD
- flashModuleInfo[MODULE_NVM].isValid = true; //force END = valid
- #endif
- if( !parseMergeImageConfigFile(miConfigFile) ) return false;
- for( index = 0; index < MODULE_MAX; index++ )
- {
- reviewFlashModuleInfoFlag(index);
- reviewFlashModuleFileName( &flashModuleInfo[index] );
- printFlashModuleInfo( &flashModuleInfo[index] );
- }
- reviewFolderString( "OutputFolder", miOutputPathName, PATHNAME_OUTPUT );
- //reviewFolderString( "BootROMFolder", searchModulePathInfo( MODULENAME_BOOTROM )->pathName, PATHNAME_BOOTROM );
- //reviewFolderString( "AudioROMFolder", searchModulePathInfo( MODULENAME_AUDIOROM )->pathName, PATHNAME_AUDIOROM );
- //if( isLoadBasicPacket() ) parseBasicSaveInfo( BASEIMAGE_SAVE );
- return true;
- }
- //---------------------------------------------------------------------------
- // parse Program Argument ...
- //---------------------------------------------------------------------------
- static inline void showProgramUsageHint()
- {
- showMsg( "\nUsage: mergeImage targetDir targetName <option(s)>\n\n" );
- showMsg( "=> targetDir: The directory of source files.\n");
- showMsg( "=> targetName: Final production file-name. Don't need to include the file extension. (*.packet *.bin)\n\n");
- showMsg( "The options are:\n" );
- showMsg( "=> -Config=<configFile>: Re-specified the mergeImage configuration file.\n" );
- showMsg( "=> -deleteTempFile=<Y/N>: Re-specified delete intermediate files or not.\n" );
- showMsg( "=> -generatePacket=<Y/N>: Re-specified generate packet or not.\n" );
- showMsg( "=> -generateOriginalBin=<Y/N>: Re-specified generate original-bin or not.\n" );
- showMsg( "\n" );
- }
- static inline void showFlashMapItemInfo( const char* s, u32 addr, u32 size )
- {
- showMsg( "%8s: 0x%08x, %d KB\n", s, addr, ROUND_KB( size ) );
- }
- #if 0
- static inline void showDynamicItemOfFlashMap() /* debug for sisspi_flashalloc.h*/
- {
- showMsg( "\nDynamicItemOfFlashMap=>\n" );
- showFlashMapItemInfo( "RRTTable", SPI_RRTTABLE_FLASHADDR, SPI_RRTTABLE_FLASHSIZE );
- // showFlashMapItemInfo( "RRTTable2", SPI_RRTTABLE2_FLASHADDR, SPI_RRTTABLE2_FLASHSIZE );
- showFlashMapItemInfo( "Logo", SPI_LOGO_FLASHADDR, SPI_LOGO_FLASHSIZE );
- // showFlashMapItemInfo( "Logo2", SPI_LOGO2_FLASHADDR, SPI_LOGO2_FLASHSIZE );
- showFlashMapItemInfo( "Backup64K", SPI_MEMALLOCBACKUP_FLASHADDR, 64*1024 );
- showFlashMapItemInfo( "MultiTable", SPI_MULTITABLE_FLASHADDR, SPI_MULTITABLE_FLASHSIZE );
- showFlashMapItemInfo( "AudioROM", SPI_AUDIOROM_FLASHADDR, SPI_AUDIOROM_FLASHSIZE );
- showFlashMapItemInfo( "Kernel", SPI_KERNEL_FLASHADDR, SPI_KERNEL_FLASHSIZE );
- showMsg( "\n" );
- }
- #endif
- static inline bool parseProgArg_Option( const char *optionArgument )
- {
- if( check_keyword( "-Config=", optionArgument ) )
- {
- if( copy_settingString( miConfigFile, optionArgument ) ) return true;
- }
- else if( check_keyword( "-deleteTempFile=", optionArgument ) )
- {
- if( copy_settingYesNo( &miDeleteTempFileFlag, optionArgument ) ) return true;
- }
- else if( check_keyword( "-generatePacket=", optionArgument ) )
- {
- if( copy_settingYesNo( &miGeneratePacketFlag, optionArgument ) ) return true;
- }
- else if( check_keyword( "-generateOriginalBib=", optionArgument ) )
- {
- if( copy_settingYesNo( &miGenerateOriginalBinFlag, optionArgument ) ) return true;
- }
- return false;
- }
- static inline bool parseProgArg_Necessary( const char *targetDir, const char *targetName )
- {
- if( chdir( targetDir ) != 0 )
- {
- errMsg( "Cannot find the specified folder: %s\n", targetDir );
- return false;
- }
- strcpy( miPacketName, targetName );
- strcat( miPacketName, ".packet" );
- #if 0
- strcpy( miCodeBinName, targetName );
- strcat( miCodeBinName, ".code.bin" );
- strcpy( miDataBinName, targetName );
- strcat( miDataBinName, ".data.bin" );
- #endif
- strcpy( miBinWithInfo, targetName );
- //strcat( miBinWithInfo, ".code.bin" );
-
- strcpy( miSaveInfoName, targetName );
- strcat( miSaveInfoName, ".save" );
- #ifdef MERGEFEATURE
- strcpy( miConfigFile , MERGEFEATURE );
- #else
- showMsg( "[Waring] No define MERGEFEATURE in Project.h\n" );
- strcpy( miConfigFile , FILENAME_MICONFIG );
- #endif
- miBaseImageName[0] = '\0';
- strcpy( miOutputPathName, PATHNAME_OUTPUT );
-
- showMsg( "TargetDirectory: %s\n", targetDir );
- showMsg( "TargetName: %s\n", targetName );
- return true;
- }
- bool parseProgArg( int argc, char *argv[] )
- {
- int i;
- if( argc < 2 )
- {
- showProgramUsageHint();
- return false;
- }
- #if 0
- if( argc == 2 )
- {
- if( check_keyword( "-printmap", argv[1] ) ) showDynamicItemOfFlashMap( );
- return false;
- }
- #endif
- strcpy( BIN_FILENAME , CONFIG_BIN_FILENAME );
- if( !parseProgArg_Necessary( argv[1], BIN_FILENAME ) ) return false;
- for( i = 3; i < argc; i++ )
- {
- if( !parseProgArg_Option( argv[i] ) )
- {
- errMsg( "parse Argument Option failed : %s\n", argv[i] );
- return false;
- }
- }
- showMsg( "miConfigFile: %s\n", miConfigFile );
- showMsg( "miDeleteTempFileFlag: %d\n", miDeleteTempFileFlag );
- showMsg( "miGeneratePacketFlag: %d\n", miGeneratePacketFlag );
- showMsg( "miGenerateOriginalBinFlag: %d\n", miGenerateOriginalBinFlag );
- return true;
- }
|