完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,
我一直试图通过ST-LINK连接我的应用程序 http://www.st.com/content/ccc/resource/technical/document/user_manual/90/cb/42/ef/2e/53/46/75/CD00060186.pdf/files/CD00060186.pdf/jcr:内容/翻译/ en.CD00060186.pdf ,但是当我调用时 ESelectHard('ST-LINK','SWIM',FALSE) 它返回0,并且 CGetLastError 提供以下消息: File TOOLS.CNF:没有这样的文件或目录 文件TOOLS.CNF显然与我成功管理加载的.dll文件存在于同一目录中(eprcore60.dll,dbca60.dll,lef60.dll和file60.dll)。 s的政策是什么? 以上来自于谷歌翻译 以下为原文 Hi, I've been trying to connect my application through ST-LINK according to the http://www.st.com/content/ccc/resource/technical/document/user_manual/90/cb/42/ef/2e/53/46/75/CD00060186.pdf/files/CD00060186.pdf/jcr:content/translations/en.CD00060186.pdf , but when I invoke ESelectHard('ST-LINK', 'SWIM', FALSE) it returns 0, and CGetLastError provides the following message: File TOOLS.CNF : No such file or directory The file TOOLS.CNF is clearly present in the same directory as the .dll files that I successfully manage to load (eprcore60.dll, dbca60.dll, lef60.dll and file60.dll). What is the policy of s |
|
相关推荐
2个回答
|
|
我不小心发了不完整的问题,找不到编辑方法。
我想问一下,在file60.dll中搜索.cnf文件的策略是什么 - 是硬编码的路径,还是它们相对于dll文件,还是可以以某种方式设置它们的路径? 我附上以下尝试的完整源代码: #include'stdafx.h' #include< windows.h> #include< conio.h> #ifndef MAX_PATH #define MAX_PATH 260 #endif // MAX_PATH 使用命名空间std; #define WARN(msg,...)fprintf(stderr,msg' n',## __ VA_ARGS__) #define WWARN(wmsg,...)fwprintf(stderr,wmsg L' n',## __ VA_ARGS__) typedef int(* EAllAccess_t)(DWORD dwAreaId); typedef int(* EAreaAccess_t)(DWORD dwAreaId,long FirstAddr,long LastAddr); int(* ESelectDevice)(const char * szDevice); int(* ESelectHard)(const char * szCard,const char * szProtocol,BOOL bDemo); int(* ESelectPort)(const char * szPort); int(* ESetPreferences)(int iPreference,BOOL bState); int(* ESetProtection)(const char * szProtectMode,BOOL bState); int(* ECheckSum)(DWORD dwAreaId,long * FileCheckSum,long * MemoryCheckSum); int(* EGetId)(const char * szName,DWORD * pdwId); char *(* EGetImagePtr)(DWORD dwAreaId,long * MemSize); INT(* ECloseComm)(); char *(* CGetLastError)()= NULL; char * LastErrorMessage() { if(CGetLastError) { return CGetLastError(); } 返回'未知错误'; } #define TRY(action)if(!(action)){WARN(#action'failed:%s',LastErrorMessage());返回; } EAllAccess_t EBlankAll; EAreaAccess_t EBlankArea; EAllAccess_t EEraseAll; EAreaAccess_t EEraseArea; EAllAccess_t EProgAll; EAreaAccess_t EProgArea; // EAllAccess_t EReadAll; EAreaAccess_t EReadArea; EAllAccess_t EVerifyAll; EAreaAccess_t EVerifyArea; void LoadLibraries() { HINSTANCE eprcore,dbca,lef,file; TRY(eprcore = LoadLibrary(L'eprcore60.dll')); TRY(dbca = LoadLibrary(L'dbca60.dll')); TRY(lef = LoadLibrary(L'lef60.dll')); TRY(file = LoadLibrary(L'file60.dll')); TRY(CGetLastError =(char *(*)())GetProcAddress(dbca,'CGetLastError')); TRY(ESelectPort =(int(*)(const char *))GetProcAddress(eprcore,'ESelectPort')); // TRY(EReadAll =(EAllAccess_t)GetProcAddress(eprcore,'EReadAll')); TRY(ESelectHard =(int(*)(const char *,const char *,BOOL))GetProcAddress(eprcore,'ESelectHard')); TRY(EReadArea =(EAreaAccess_t)GetProcAddress(eprcore,'EReadArea')); TRY(EVerifyAll =(EAllAccess_t)GetProcAddress(eprcore,'EVerifyAll')); TRY(EVerifyArea =(EAreaAccess_t)GetProcAddress(eprcore,'EVerifyArea')); TRY(EProgAll =(EAllAccess_t)GetProcAddress(eprcore,'EProgAll')); TRY(EProgArea =(EAreaAccess_t)GetProcAddress(eprcore,'EProgArea')); TRY(EEraseAll =(EAllAccess_t)GetProcAddress(eprcore,'EEraseAll')); TRY(EEraseArea =(EAreaAccess_t)GetProcAddress(eprcore,'EEraseArea')); TRY(EBlankAll =(EAllAccess_t)GetProcAddress(eprcore,'EBlankAll')); TRY(EBlankArea =(EAreaAccess_t)GetProcAddress(eprcore,'EBlankArea')); } void ReadMemory() { DWORD PROGRAM_MEMORY,DATA_MEMORY; 尝试(ESelectHard('ST-LINK','游泳',假)); TRY(ESelectDevice( 'STM8L15xC6')); TRY(ESelectPort( 'USB')); TRY(EGetId('PROGRAM MEMORY',& PROGRAM_MEMORY)); TRY(EGetId('DATA MEMORY',& DATA_MEMORY)); WARN('程序存储器=%d,数据存储器=%d',PROGRAM_MEMORY,DATA_MEMORY); } int main() { TCHAR pwd [MAX_PATH]; _wgetcwd(pwd,MAX_PATH); WWARN(当前工作目录:%s n',pwd); SetDllDirectory会(L'C:\ st_toolset \ STVP'); LoadLibraries(); ReadMemory(); 的getchar(); 返回0; } 以上来自于谷歌翻译 以下为原文 I accidentally sent the incomplete question and can't find a way to edit it. I wanted to ask, what is the policy of searching for the .cnf files in the file60.dll -- are the paths hard coded, or are they relative to the dll files, or can their path be set somehow? I enclose the complete source code of my attempts below: #include 'stdafx.h' #include #include #ifndef MAX_PATH #define MAX_PATH 260 #endif // MAX_PATH using namespace std; #define WARN(msg, ...) fprintf(stderr, msg 'n', ## __VA_ARGS__) #define WWARN(wmsg, ...) fwprintf(stderr, wmsg L'n', ## __VA_ARGS__) typedef int(*EAllAccess_t)(DWORD dwAreaId); typedef int(*EAreaAccess_t)(DWORD dwAreaId, long FirstAddr, long LastAddr); int(*ESelectDevice)(const char *szDevice); int (*ESelectHard)(const char *szCard, const char *szProtocol, BOOL bDemo); int(*ESelectPort)(const char *szPort); int(*ESetPreferences)(int iPreference, BOOL bState); int(*ESetProtection)(const char *szProtectMode, BOOL bState); int(*ECheckSum)(DWORD dwAreaId, long *FileCheckSum, long *MemoryCheckSum); int (*EGetId)(const char *szName, DWORD *pdwId); char *(*EGetImagePtr)(DWORD dwAreaId, long *MemSize); int(*ECloseComm)(); char *(*CGetLastError)() = NULL; char *LastErrorMessage() { if (CGetLastError) { return CGetLastError(); } return 'unknown error'; } #define TRY(action) if(!(action)) { WARN(# action ' failed: %s', LastErrorMessage()); return; } EAllAccess_t EBlankAll; EAreaAccess_t EBlankArea; EAllAccess_t EEraseAll; EAreaAccess_t EEraseArea; EAllAccess_t EProgAll; EAreaAccess_t EProgArea; //EAllAccess_t EReadAll; EAreaAccess_t EReadArea; EAllAccess_t EVerifyAll; EAreaAccess_t EVerifyArea; void LoadLibraries() { HINSTANCE eprcore, dbca, lef, file; TRY(eprcore = LoadLibrary(L'eprcore60.dll')); TRY(dbca = LoadLibrary(L'dbca60.dll')); TRY(lef = LoadLibrary(L'lef60.dll')); TRY(file = LoadLibrary(L'file60.dll')); TRY(CGetLastError = (char *(*)()) GetProcAddress(dbca, 'CGetLastError')); TRY(ESelectPort = (int(*)(const char *))GetProcAddress(eprcore, 'ESelectPort')); //TRY(EReadAll = (EAllAccess_t)GetProcAddress(eprcore, 'EReadAll')); TRY(ESelectHard = (int(*)(const char *, const char *, BOOL)) GetProcAddress(eprcore, 'ESelectHard')); TRY(EReadArea = (EAreaAccess_t)GetProcAddress(eprcore, 'EReadArea')); TRY(EVerifyAll = (EAllAccess_t)GetProcAddress(eprcore, 'EVerifyAll')); TRY(EVerifyArea = (EAreaAccess_t)GetProcAddress(eprcore, 'EVerifyArea')); TRY(EProgAll = (EAllAccess_t)GetProcAddress(eprcore, 'EProgAll')); TRY(EProgArea = (EAreaAccess_t)GetProcAddress(eprcore, 'EProgArea')); TRY(EEraseAll = (EAllAccess_t)GetProcAddress(eprcore, 'EEraseAll')); TRY(EEraseArea = (EAreaAccess_t)GetProcAddress(eprcore, 'EEraseArea')); TRY(EBlankAll = (EAllAccess_t)GetProcAddress(eprcore, 'EBlankAll')); TRY(EBlankArea = (EAreaAccess_t)GetProcAddress(eprcore, 'EBlankArea')); } void ReadMemory() { DWORD PROGRAM_MEMORY, DATA_MEMORY; TRY(ESelectHard('ST-LINK', 'SWIM', FALSE)); TRY(ESelectDevice('STM8L15xC6')); TRY(ESelectPort('USB')); TRY(EGetId('PROGRAM MEMORY', &PROGRAM_MEMORY)); TRY(EGetId('DATA MEMORY', &DATA_MEMORY)); WARN('PROGRAM MEMORY = %d, DATA MEMORY = %d', PROGRAM_MEMORY, DATA_MEMORY); } int main() { TCHAR pwd[MAX_PATH]; _wgetcwd(pwd, MAX_PATH); WWARN(L'Current Working Directory: %sn', pwd); SetDllDirectory(L'C:\st_toolset\stvp'); LoadLibraries(); ReadMemory(); getchar(); return 0; } |
|
|
|
我设法通过调用'CSetWorkingDir'函数来解决问题。对不起噪音。
以上来自于谷歌翻译 以下为原文 I managed to solve the problem by invoking the 'CSetWorkingDir' function. Sorry for the noise. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2580 浏览 1 评论
3194 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1765 浏览 1 评论
3589 浏览 6 评论
5968 浏览 21 评论
924浏览 4评论
1300浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
563浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1286浏览 3评论
1338浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-6 13:30 , Processed in 1.107141 second(s), Total 50, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号