add core argument for run command

This commit is contained in:
Aurel Feer 2022-06-01 17:22:15 +02:00
parent ea71de7c8b
commit 2901caad24
2 changed files with 10 additions and 5 deletions

View File

@ -89,7 +89,7 @@ static void handle_lpuart_interrupt(void * arg) {
shelly_reset_buffer();
err = shelly_write_str("\n\r>");
err = shelly_write_str("\n\ryou@windows me > ");
if (err_is_fail(err)) USER_PANIC_ERR(err, "while trying to write string");
} else {
err = shelly_buffer_append(input_char);

View File

@ -16,9 +16,11 @@ static errval_t shelly_cmd_help(char * line) {
errval_t err;
err = shelly_write_str("commands implemented:\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- echo\n\r");
err = shelly_write_str("- echo [string]\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- run\n\r");
err = shelly_write_str("- run [core] [binary]\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str(" run a module from bootinfo\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- ps\n\r");
if (err_is_fail(err)) return err;
@ -40,12 +42,15 @@ static errval_t shelly_cmd_run(char * line) {
SHELLY_DEBUG("[shelly_cmd_run] line=%s\n", line);
char * module_line;
long core_id = strtol(line, &module_line, 10);
module_line += 1;
// start process
domainid_t pid;
struct aos_rpc * rpc = aos_rpc_get_process_channel();
err = aos_rpc_process_spawn(rpc, line, 0, &pid);
err = aos_rpc_process_spawn(rpc, module_line, core_id, &pid);
if (err == SPAWN_ERR_FIND_MODULE) {
err = shelly_write_str("[run]:couldn't find module:\n\r");
err = shelly_write_str("[run] couldn't find module:\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str(line);
if (err_is_fail(err)) return err;