semihosting fopen path

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

semihosting fopen path

ソリューションへジャンプ
3,600件の閲覧回数
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,555件の閲覧回数
ErichStyger
Specialist I

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

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
3,576件の閲覧回数
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,558件の閲覧回数
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,556件の閲覧回数
ErichStyger
Specialist I

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

0 件の賞賛
返信
3,597件の閲覧回数
billchadwick
Contributor III

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

0 件の賞賛
返信