/** Late init hook, called before c++ static constructors. */ void __late_init(void) { /* C++ Static initializer requires working chibios. */ halInit(); chSysInit(); malloc_lock_init(); }
int main( void ) { TRACE_INIT(); TRACE_INFO("Image Boot.\n\r"); malloc_lock_init(); /* i2c_init(); rtc_init(); event_init(100); */ prvSetupHardware(); #ifdef CFG_SCHEDULER_RTT // MV RTT setup // boot loader enables PIT we have to turn it off AT91C_BASE_PITC->PITC_PIMR = 0; /* Configure the RTT period. */ AT91C_BASE_RTTC->RTTC_RTMR = 32 | AT91C_RTTC_RTTRST; AT91C_BASE_RTTC->RTTC_RTSR; void sys_isr_wrapper( void ); AT91F_AIC_ConfigureIt( AT91C_ID_SYS, IRQ_SYS_PRI, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, ( void (*)(void) )sys_isr_wrapper ); /* Enable the interrupt. Global interrupts are disables at this point so this is safe. */ AT91C_BASE_AIC->AIC_IECR = 0x1 << AT91C_ID_SYS; #endif #if 1 //screen scrInit(); fontSetCharPos(0,110); fontColor = SCR_COLOR_WHITE; TRACE_SCR("FreeRTOS Image\n\r"); #endif //button_init(); xTaskCreate( StarterTask, "starter", TASK_STACK_SIZE(TASK_STARTER_STACK), NULL, TASK_STARTER_PRI, NULL ); // new Task( MakeStarterTask, "Make", 1200, NULL, 4 ); /*NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. The processor MUST be in supervisor mode when vTaskStartScheduler is called. The demo applications included in the FreeRTOS.org download switch to supervisor mode prior to main being called. If you are not using one of these demo application projects then ensure Supervisor mode is used here. */ TRACE_INFO("Starting scheduler\r\n"); uint32_t mkcr = AT91C_BASE_PMC->PMC_MCKR; uint32_t sr = AT91C_BASE_PMC->PMC_SR; TRACE_INFO("pmc pcsr %x mckr %x sr %x\r\n", AT91C_BASE_PMC->PMC_PCSR, mkcr, sr); //Led_init(&led); //Led_setState(&led, 0); vTaskStartScheduler(); return 0; // Should never get here! }