int main(void) { hal_system_clock(); // FIXME: this is platform-specific, add start-wait hooks to HAL log_init(); debug_puts("Initializing stuff!\r\n"); hal_system_init(); hal_system_info(); debug_puts("Starting Timers!\r\n"); hal_system_start(); debug_puts("Entering FreeEMS!\r\n"); setup_emulation(); main_freeems(); while(1) { debug_puts("STUCK IN MEANINGLESS INFINITE LOOP! (main.c 43)"); } debug_puts("Everything is over :-("); return 0; }
/** * main * * The main task for the project. This function initializes the packages, calls * init_tasks to initialize additional tasks (and possibly other objects), * then starts serving events from default event queue. * * @return int NOTE: this function should never return! */ int main(int argc, char **argv) { int rc; #ifdef ARCH_sim mcu_sim_parse_args(argc, argv); #endif sysinit(); rc = conf_register(&test_conf_handler); assert(rc == 0); cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF); log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL); /* Initialize the OIC */ log_register("oic", &oc_log, &log_console_handler, NULL, LOG_SYSLEVEL); stats_init(STATS_HDR(g_stats_gpio_toggle), STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32), STATS_NAME_INIT_PARMS(gpio_stats)); stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle)); conf_load(); reboot_start(hal_reset_cause()); #if MYNEWT_VAL(SPLIT_LOADER) { void *entry; rc = split_app_go(&entry, true); if(rc == 0) { hal_system_start(entry); } } #endif init_tasks(); while (1) { os_eventq_run(os_eventq_dflt_get()); } /* Never returns */ return rc; }
/** * main * * The main function for the project. This function initializes the os, calls * init_tasks to initialize tasks (and possibly other objects), then starts the * OS. We should not return from os start. * * @return int NOTE: this function should never return! */ int main(int argc, char **argv) { int rc; #ifdef ARCH_sim mcu_sim_parse_args(argc, argv); #endif sysinit(); rc = conf_register(&test_conf_handler); assert(rc == 0); cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF); log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL); stats_init(STATS_HDR(g_stats_gpio_toggle), STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32), STATS_NAME_INIT_PARMS(gpio_stats)); stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle)); conf_load(); log_reboot(HARD_REBOOT); #if MYNEWT_VAL(SPLIT_LOADER) { void *entry; rc = split_app_go(&entry, true); if(rc == 0) { hal_system_start(entry); } } #endif init_tasks(); os_start(); /* os start should never return. If it does, this should be an error */ assert(0); return rc; }