diff --git a/epicardium/main.c b/epicardium/main.c index a44f73d81e15b04882c8e27e8394585b7f055d2d..384ee3dbe98c3d0d8073a72028bcb7c737f23c29 100644 --- a/epicardium/main.c +++ b/epicardium/main.c @@ -1,6 +1,8 @@ #include <stdio.h> #include <stdlib.h> +#include <ff.h> + #include "max32665.h" #include "uart.h" #include "cdcacm.h" @@ -100,17 +102,28 @@ int main(void) LOG_INFO("startup", "Initializing dispatcher ..."); api_dispatcher_init(); - LOG_INFO("startup", "Testing l0der ..."); - struct l0dable_info info; - int res = l0der_load_path("blinky.elf", &info); - if (res != 0) { - LOG_ERR("startup", "l0der failed: %d\n", res); + /* + * See if there's a l0dable.elf to run. If not, run pycardium. + * This is temporary until epicardium gets a l0dable API from pycardium. + */ + const char *l0dable = "l0dable.elf"; + if (f_stat(l0dable, NULL) == FR_OK) { + LOG_INFO("startup", "Running %s ...", l0dable); + struct l0dable_info info; + int res = l0der_load_path(l0dable, &info); + if (res != 0) { + LOG_ERR("startup", "l0der failed: %d\n", res); + } else { + LOG_INFO("startup", "Starting %s on core1 ...", l0dable); + core1_start(info.isr_vector); + } } else { - LOG_INFO("startup", "Starting core1 payload ..."); - core1_start(info.isr_vector); + LOG_INFO("startup", "Starting pycardium on core1 ..."); + core1_start((void *)0x10080000); } + LOG_INFO("startup", "Starting FreeRTOS ..."); vTaskStartScheduler();