void host_command(int n, char *argv[]){ if(n>1){ int len=strlen(argv[1]), rnt; if(argv[1][0]=='\''){ argv[1][len-1]='\0'; rnt=host_system(argv[1]+1); }else rnt=host_system(argv[1]); fio_printf(1, "\r\nfinish with exit code %d.\r\n", rnt); }else fio_printf(2, "\r\nUsage: host 'command'\r\n"); }
void semihost_sysinfo(void *pvParameters) { int rnt = host_system("echo \'Write system info to \"./sysinfo\" periodically.\'"); char buf[1024]; while(1) { /* Clear buf */ strcpy (buf, "echo \'"); /* Retrieve task list */ vTaskList((signed char *)&buf[strlen(buf)], "\0"); strcat (&buf[ strlen(buf) ], (const char*) "\' > ./sysinfo"); rnt = host_system(buf); vTaskDelay(200); } }