semihosting fopen path

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

semihosting fopen path

跳至解决方案
3,604 次查看
billchadwick
Contributor III

I am using the semihosting library with file support and a JLink debugger for an iMXRT1064 project.

I can fopen a file for write just fine if I use an absolute path e.g. "C:\\MyProject\\my_log.csv".

As I am working with others, it would be nice to use a project working directory relative path.

If I use a path with just a filename in fopen e.g.  "my_log.csv", the file appears to open and fprintf looks to work. However the file can't be found in any obvious location on my PC. Where would such a file be written to by default? Is there perhaps a project setting for the default working folder that I have missed?

Thanks,

Bill

 

0 项奖励
回复
1 解答
3,559 次查看
ErichStyger
Specialist I

Yes, the IDE folder is really not ideal, and the process might not have write permission.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
3,580 次查看
ErichStyger
Specialist I

This is what I have in my gcov library (see https://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/

  /*
   * Creating a file without absolute path.
   * With J-Link and MCUXpresso IDE 11.4.1, this file gets created in the IDE installation directory (C:\NXP\MCUXpressoIDE_11.4.1_6260\ide).
   * Where the file gets created (current directory of the semihosting process on the host) really depends on the probe firmware and is non-standard.
   * See as well:
   * https://developer.arm.com/documentation/dui0058/d/semihosting/semihosting-swis/sys-open--0x01-?lang=en
   */
  file = fopen ("gcov_text.txt", "w");
  fputs("hello world with file I/O\r\n", file);
  fclose(file);

 

I hope this helps

Erich

0 项奖励
回复
3,562 次查看
billchadwick
Contributor III

Thanks for that Erich.

I have had some success using __FILE__  and popping up a few directories.

I doubt my co-developers would expect/want log files going to the IDE folder.

Bill

 

0 项奖励
回复
3,560 次查看
ErichStyger
Specialist I

Yes, the IDE folder is really not ideal, and the process might not have write permission.

0 项奖励
回复
3,601 次查看
billchadwick
Contributor III

MCUXpresso IDE v11.3.1 [Build 5262] [2021-04-02]

0 项奖励
回复