In order to adapt to our VFS interface, I re-target the newlib system call. However, when I invoke printf interface, it always does not call write/write_r interface, and the errno is 9 (EBADF, bad file number). How can I check this issue? And how to compile newlib by myself?
My reent initialization code:
Code: Select all
int reent_std_init(void)
{
FILE* std_console;
const char* console = "/dev/console";
std_console = fopen(console, "w"); // <-- I have checked this position, the open successfully.
_GLOBAL_REENT->_stdin = std_console;
_GLOBAL_REENT->_stdout = std_console;
_GLOBAL_REENT->_stderr = std_console;
return 0;
}