int _fstat (int fd, struct stat * st) { write_std_out("_fstat", 6); write_std_out((char *)&fd, 4); write_std_out("\r\n", 2); if (fd == STDOUT_FILENO) { memset(st, 0, sizeof (* st)); st->st_mode = S_IFCHR; st->st_blksize = 1024; return 0; } else if (fd >= FIRST_DISC_FILENO) { sdfat_stat(fd - FIRST_DISC_FILENO, st); return 0; } else { write_std_err("Error: _fstat\r\n", 15); return(-1); } }
caddr_t _sbrk_r(void *reent, size_t incr) { extern char end asm ("end"); // Defined by the linker static char *heap_end; char *prev_heap_end; write_std_out("_sbrk\r\n", 6); if( heap_end == NULL ) heap_end = &end; prev_heap_end = heap_end; if(( heap_end + incr ) > stack_ptr ) { write_std_out("heap<>stack collision\n", 22); exit(1); return (caddr_t) -1; } heap_end += incr; return (caddr_t) prev_heap_end; }
int _write(int fd, const void *data, unsigned int count) { if (fd == STDOUT_FILENO) { count = write_std_out(data, count); } else if (fd == STDERR_FILENO) { count = write_std_err(data, count); } else { write_std_err("Error: _write\r\n", 15); count = -1; } return(count); }
void vAssertCalled(const char *file, const char *line) { char *msg; taskDISABLE_INTERRUPTS(); write_std_out("Assert called ", strlen("Assert called ")); write_std_out(file, strlen(file)); write_std_out(":", 1); write_std_out(line, strlen(line)); write_std_out("\r\n", 2); msg = "In thread "; write_std_out(msg, strlen(msg)); msg = pcTaskGetName(NULL); write_std_out(msg, strlen(msg)); while(1) {;} }
int32_t NativeProcess::run_impl() { write_std_out("Hello thar\n"); return 0; }
int LuaIOLib::io_close(lua_State *lua) { auto process = proc(lua); process->write_std_out("Close!"); return 0; }
void HardFault_HandlerC(uint32_t *hardfault_args) { write_std_out("Hard fault handler\r\n", strlen("Hard fault handler\r\n")); }