-
大小: 26KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-05-12
- 語(yǔ)言: 其他
- 標(biāo)簽: FileIOShell??hex??bin??
資源簡(jiǎn)介
dsp hex文件轉(zhuǎn)bin文件
可以把f28335等dsp的hex文件轉(zhuǎn)換成bin文件

代碼片段和文件信息
//?FileIOShell.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“FileIOShell.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
//?Global?Structure?for?storing?command?line?arguments
typedef?struct?tCommandLineArgs
{
??CString?sInFileName??;
??CString?sOutFileName?;
??CString?sInCMDFileName?;
??int?????nMaxFileSize?;
??char????cData[MAXFILESIZE]?;
??long ??nBlockAddr[MAXBLOCKNUM];
??int nBlockCount;
}?sCommandLineArgs?;
void?InitializeCommandLineArgs(sCommandLineArgs?*sContext)?;
BOOL?ParseCommandLine(int?argc?TCHAR*?argv[]?sCommandLineArgs?*sContext)?;
//?The?one?and?only?application?object
CWinApp?theApp;
using?namespace?std;
int?_tmain(int?argc?TCHAR*?argv[]?TCHAR*?envp[])
{
int?nRetCode?=?0;
sCommandLineArgs?sContext?;
//?initialize?MFC?and?print?and?error?on?failure
if?(!AfxWinInit(::GetModuleHandle(NULL)?NULL?::GetCommandLine()?0))
{
//?TODO:?change?error?code?to?suit?your?needs
_tprintf(_T(“Fatal?Error:?MFC?initialization?failed\n“));
nRetCode?=?1;
}
else
{
//?TODO:?code?your?application‘s?behavior?here.
//?Initialize?Command?Line?Argument?structure
InitializeCommandLineArgs(&sContext)?;
//?Parse?the?command?line?arguments
if?(ParseCommandLine(argc?argv?&sContext)?==?FALSE)
??????????return?nRetCode?;
//?Read?an?ASCII?text?file?into?an?array?to?be?manipulated
bReadFileToArray2(sContext.sInFileName?&sContext.nMaxFileSize?&sContext.cData[0])?;
// bReadFileToArray(sContext.sInCMDFileName?&sContext.nMaxFileSize?&sContext.cData[0])?;
HEXtoBinary(&sContext.nMaxFileSize?&sContext.cData[0]);
// SwapEndian(&sContext.nMaxFileSize?&sContext.cData[0]);
// MotHEXtoBinary(&sContext.nMaxFileSize?&sContext.cData[0]);
// IntelHEXtoBinary(&sContext.nMaxFileSize?&sContext.cData[0]);
// BuildBlockAddrArray(&sContext.nMaxFileSize?&sContext.cData[0]?&sContext.nBlockAddr[0]?&sContext.nBlockCount);
// SortBlockAddrArray(&sContext.nBlockAddr[0]?&sContext.nBlockCount);
// SortBlockDataRecords(&sContext.nMaxFileSize?&sContext.cData[0]?&sContext.nBlockAddr[0]?&sContext.nBlockCount);
// RemoveExtraInfo(&sContext.nMaxFileSize?&sContext.cData[0]?&sContext.nBlockAddr[0]?&sContext.nBlockCount);
bWriteArrayToFile(sContext.sOutFileName?&sContext.nMaxFileSize?&sContext.cData[0])?;
}
return?nRetCode;
}
/*?**********************************************************************
//?Subroutines?used?for?supporting?the?main?function.??These?routines?are
//?used?to?initialize?the?structure?that?holds?the?Command?Line?Arguments.
//?There?is?additional?support?for?Parsing?the?Command?Line?Arguments.
//?**********************************************************************
*/
void?InitializeCommandLineArgs(sCommandLineArgs?*sContext)
{
??int?i?;
//??(*sContext).sInFileName???=?“C:\\Projects\\FileIOShell\\Debug\\IPM.hex“?;
//??(*sContext).sOutFileName??=?“C:\\Projects\\FileIO
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????17708??2007-04-19?00:53??FileIOShell\FileIOShell.aps
?????文件???????5351??2007-07-13?22:00??FileIOShell\FileIOShell.cpp
?????文件?????????63??2007-01-20?20:23??FileIOShell\FileIOShell.h
?????文件???????1371??2007-01-20?18:28??FileIOShell\FileIOShell.rc
?????文件????????911??2007-03-13?09:24??FileIOShell\FileIOShell.sln
????..A..H.?????14848??2007-07-12?13:13??FileIOShell\FileIOShell.suo
????..A..H.?????14848??2007-07-12?13:13??FileIOShell\FileIOShell.v11.suo
?????文件???????4202??2007-01-20?20:24??FileIOShell\FileIOShell.vcproj
?????文件??????20111??2007-07-13?21:53??FileIOShell\FileLibrary.cpp
?????文件???????2432??2007-07-13?21:53??FileIOShell\FileLibrary.h
?????文件???????1863??2007-01-20?18:28??FileIOShell\ReadMe.txt
?????文件??????24576??2007-07-13?22:00??FileIOShell\Release\FileIOShell.exe
?????文件????????410??2007-01-20?18:28??FileIOShell\Resource.h
?????文件????????298??2007-01-20?18:28??FileIOShell\stdafx.cpp
?????文件????????833??2007-01-20?18:28??FileIOShell\stdafx.h
?????目錄??????????0??2007-07-25?01:01??FileIOShell\Release
?????目錄??????????0??2015-08-19?14:07??FileIOShell
-----------?---------??----------?-----??----
???????????????109825????????????????????17
評(píng)論
共有 條評(píng)論