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
Solved! Go to Solution.
Yes, the IDE folder is really not ideal, and the process might not have write permission.
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
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
Yes, the IDE folder is really not ideal, and the process might not have write permission.
MCUXpresso IDE v11.3.1 [Build 5262] [2021-04-02]