void osStartKernel(void) { //Check CMSIS-RTOS API version #if (osCMSIS >= 0x10001) //Start the kernel osKernelStart(); #else //Start the kernel osKernelStart(NULL, NULL); #endif }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Configure the system clock to 216 Mhz */ SystemClock_Config(); /* Initialize LEDs */ BSP_LED_Init(LED1); /* Thread 1 definition */ osThreadDef(LED1, LED_Thread1, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Start thread 1 */ LED1_ThreadId = osThreadCreate(osThread(LED1), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Initialize all configured peripherals */ MX_GPIO_Init(); /* Create the threads and semaphore */ osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL); osThreadDef(blinkTask, BlinkTask, osPriorityNormal, 0, 128); blinkTaskHandle = osThreadCreate(osThread(blinkTask), NULL); osSemaphoreDef(sem); semHandle = osSemaphoreCreate(osSemaphore(sem), 1); osSemaphoreWait(semHandle, osWaitForever); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ /* Infinite loop */ while (1); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F2xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 120 MHz */ SystemClock_Config(); /* Start task */ osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(USER_Thread), NULL); /* Create Application Queue */ osMessageQDef(osqueue, 1, uint16_t); AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
extern "C" void user_main() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET); osKernelInitialize(); osKernelStart(); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET); key_event_init(); keymat_init(); keymat_callback = key_event_handler; keymat_start(); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET); while (1) { osEvent ose = osMailGet(key_events, osWaitForever); if (ose.status == osEventMail) { KeyEvent* e = (KeyEvent*)ose.value.p; // NOTE: MIDI handling is hardcoded for now buf[0] = (e->state ? 0x90 : 0x80); // use ch0 buf[1] = e->keycode; buf[2] = 100; // use hard-coded velocity osMailFree(key_events, e); send_n(3); // blocking call } } }
/* * Application entry point. */ int main(void) { /* HAL initialization, this also initializes the configured device drivers and performs the board-specific initializations.*/ halInit(); /* The kernel is initialized but not started yet, this means that main() is executing with absolute priority but interrupts are already enabled.*/ osKernelInitialize(); /* Activates the serial driver 2 using the driver default configuration. PA2(TX) and PA3(RX) are routed to USART2.*/ sdStart(&SD2, NULL); palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7)); palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7)); /* Creates the example thread, it does not start immediately.*/ osThreadCreate(osThread(Thread1), NULL); /* Kernel started, the main() thread has priority osPriorityNormal by default.*/ osKernelStart(); /* In the ChibiOS/RT CMSIS RTOS implementation the main() is an usable thread, here we just sleep in a loop printing a message.*/ while (true) { sdWrite(&SD2, (uint8_t *)"Hello World!\r\n", 14); osDelay(500); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 168 MHz */ SystemClock_Config(); /* Configure LED1 and LED2 */ BSP_LED_Init(LED1); BSP_LED_Init(LED2); /* Thread 1 definition */ osThreadDef(LED1, LED_Thread1, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Thread 2 definition */ osThreadDef(LED2, LED_Thread2, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Start thread 1 */ LEDThread1Handle = osThreadCreate(osThread(LED1), NULL); /* Start thread 2 */ LEDThread2Handle = osThreadCreate(osThread(LED2), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
/* * Main function: initializes all system values and components, then starts * operation of the two threads. * * @author HP Truong, Jacob Barnett * * @param void * @return void */ int main (void) { CC2500_LowLevel_Init(); CC2500_Reset(); osKernelInitialize (); // initialize CMSIS-RTOS // initialize peripherals here /* LCD initiatization */ LCD_Init(); /* LCD Layer initiatization */ LCD_LayerInit(); /* Enable the LTDC controler */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer as the current layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetFont(&Font16x24); LCD_Clear(LCD_COLOR_WHITE); receive_and_plot_thread = osThreadCreate(osThread(receive_and_plot), NULL); print_lcd_debug_thread = osThreadCreate(osThread(print_lcd_debug), NULL); osKernelStart (); // start thread execution }
int main() { printf("main() started\n"); #if 0 runTests(0); while (1); #else osThreadDef_t testRunnerThread = {&runTests, osPriorityNormal, 1, 0}; if (osKernelInitialize() != osOK || osKernelStart() != osOK || osThreadCreate(&testRunnerThread, 0) == NULL) { showError(); } while (1) { osDelay(10000); } #endif }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Init task */ #if defined(__GNUC__) osThreadDef(Start, StartThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE * 5); #else osThreadDef(Start, StartThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE * 2); #endif osThreadCreate (osThread(Start), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
int main() { InitGPIO(); InitBKP(); Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); rtc_init(); /* RTC_t date; date.year = 2015; date.month = 10; date.mday = 24; date.hour = 23; date.min = 20; date.sec = 0; rtc_settime(&date); */ // Start Task // xTaskCreate(vLcdTask, "vLcdTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleLcdTask); xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask); // Start scheduler // osKernelStart(NULL, NULL); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); /* Init task */ osThreadDef(Start, StartThread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE *2); osThreadCreate (osThread(Start), NULL); /* Start the scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
int main() { InitGPIO(); //InitTIM3(); //InitTIM4(); InitIWDG(); // Init Watch Dog InitBKP(); #ifdef DEBUG_OUTPUT_USB Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); #else rtc_init(); #endif RTC_t date; date.year = 2015; date.month = 10; date.mday = 24; date.hour = 23; date.min = 20; date.sec = 0; rtc_settime(&date); // Start Task // xTaskCreate(vLcdPcf, "vLcdPcf", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandlevLcdPcfTask); xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask); // Start scheduler // osKernelStart(NULL, NULL); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F446xx HAL library initialization */ HAL_Init(); /* Configure the system clock to 180 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Start task */ osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(USER_Thread), NULL); /* Create Application Queue */ osMessageQDef(osqueue, 1, uint16_t); AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
/*--------------------------------------------------------------------------- TITLE : thread_main WORK : ARG : void RET : void ---------------------------------------------------------------------------*/ void thread_main(void) { Mutex_Loop = osMutexCreate( osMutex(MUTEX1) ); if( Mutex_Loop == NULL ) DEBUG_PRINT("Mutex Fail\r\n"); //-- Thread 1 definition // osThreadDef(TASK1, thread_mw , osPriorityNormal, 0, configMINIMAL_STACK_SIZE); osThreadDef(TASK2, thread_menu, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); osThreadDef(TASK3, thread_lcd, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); //-- Start thread // Thread_Handle_mw = osThreadCreate(osThread(TASK1), NULL); Thread_Handle_menu = osThreadCreate(osThread(TASK2), NULL); Thread_Handle_lcd = osThreadCreate(osThread(TASK3), NULL); //-- Start scheduler // osKernelStart(NULL, NULL); while(1); }
int main(int argc, char* argv[]) { // Send a greeting to the trace device (skipped on Release). trace_puts("Hello ARM World!"); // At this stage the system clock should have already been configured // at high speed. trace_printf("System clock: %uHz\n", SystemCoreClock); /* Configure GPIO's to AN to reduce power consumption */ GPIO_ConfigAN(); /* Initialize LED1 */ BSP_LED_Init(LED1); /* Create the queue used by the two threads */ osMessageQDef(osqueue, QUEUE_LENGTH, uint16_t); osQueue = osMessageCreate (osMessageQ(osqueue), NULL); /* Note the Tx has a lower priority than the Rx when the threads are spawned. */ osThreadDef(RxThread, QueueReceiveThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); osThreadCreate(osThread(RxThread), NULL); osThreadDef(TxThread, QueueSendThread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE); osThreadCreate(osThread(TxThread), NULL); /* Start scheduler */ osKernelStart (NULL, NULL); /* We should never get here as control is now taken by the scheduler */ for(;;); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /* Create Timer */ osTimerDef(LEDTimer, osTimerCallback); osTimerId osTimer = osTimerCreate (osTimer(LEDTimer), osTimerPeriodic, NULL); /* Start Timer */ osTimerStart(osTimer, 200); /* Create LED Thread */ osThreadDef(LEDThread, ToggleLEDsThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); osThreadCreate (osThread(LEDThread), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
int main(void){ //Set procesor speed setToMaxSpeed(); //Initialize kernel osKernelInitialize(); //Hardware initialize led_init(); //Initialize encoder timer_3_encoder_init(); //Initialize PWM short myPrescaler=47;//set Tick time to 1us (Fclk/(Prescaler+1)) int myAutorreload=1000;//set cycle time to 1ms TIMER2_CH2_PWM_Init(myPrescaler,myAutorreload); //Initialize serial os_serial_init(); os_usart2_init(9600); //Initialize adc adc_poll_init(); //Start Thread switching osKernelStart(); //User Application float adc_reading; os_usart2_puts("Hello, World\n"); while(1){ adc_reading = adc_poll_read()*(100.0/4095); encoder_position=TIM_GetCounter(TIM3); os_serial_printf(os_usart2_puts,">>%d\n",turns_counter); TIMER2_CH2_PWM_SetDutyCycle((unsigned int) adc_reading,myAutorreload); osDelay(200); } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32L0xx HAL library initialization: - Configure the Flash prefetch, Flash preread and Buffer caches - Systick timer is configured by default as source of time base, but user can eventually implement his proper time base source (a general purpose timer for example or other time source), keeping in mind that Time base duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and handled in milliseconds basis. - Low Level Initialization */ HAL_Init(); /* Configure the System clock to 2 MHz */ SystemClock_Config(); /* Initialize LEDs */ BSP_LED_Init(LED3); /* Thread 1 definition */ osThreadDef(LED, LED_Thread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Start thread */ LED_ThreadId = osThreadCreate(osThread(LED), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 180 MHz */ SystemClock_Config(); /* Configure LED1 and LED3 */ BSP_LED_Init(LED1); BSP_LED_Init(LED3); /*##-1- Start task #########################################################*/ osThreadDef(RAMDiskThread, StartThread, osPriorityNormal, 0, 2 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(RAMDiskThread), NULL); /*##-2- Start scheduler ####################################################*/ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F3xx HAL library initialization: - Configure the Flash prefetch - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Configure the System clock to 64 MHz */ SystemClock_Config(); /* Initialize LED */ BSP_LED_Init(LED2); /* Create Timer */ osTimerDef(LEDTimer, osTimerCallback); osTimerId osTimer = osTimerCreate(osTimer(LEDTimer), osTimerPeriodic, NULL); /* Start Timer */ osTimerStart(osTimer, 200); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for (;;); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F3xx HAL library initialization: - Configure the Flash prefetch - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Initialize LED */ BSP_LED_Init(LED2); /* Configure the System clock to 64 MHz */ SystemClock_Config(); /* Thread 1 definition */ osThreadDef(THREAD_1, LED_Thread1, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Thread 2 definition */ osThreadDef(THREAD_2, LED_Thread2, osPriorityNormal, 0, configMINIMAL_STACK_SIZE); /* Start thread 1 */ LEDThread1Handle = osThreadCreate(osThread(THREAD_1), NULL); /* Start thread 2 */ LEDThread2Handle = osThreadCreate(osThread(THREAD_2), NULL); /* Start scheduler */ osKernelStart(NULL, NULL); /* We should never get here as control is now taken by the scheduler */ for (;;); }
/** * Main function */ int main (void) { osKernelInitialize(); /* initialize CMSIS-RTOS */ HAL_Init(); /* Initialize the HAL Library */ SystemClock_Config(); /* Configure the System Clock */ /* User codes goes here*/ // initializeLED_IO(); /* Initialize LED GPIO Buttons */ // start_Thread_LED(); /* Create LED thread */ init_acc_kstate(0.01f, 0.1f, 0.0f, 0.1f, 0.0f); init_temp_kstate(0.005f, 0.05f, 0.0f, 5.0f, 0.0f); MAIL_CONTROLLER_init_mailboxes(); ConfigureADC(); accelerometer_init(); LED_init_io(); KP_init(); TIM3_init(); TIM4_init(); MAIL_CONTROLLER_start_thread(); LED_start_thread(); temperature_start_thread(); accelerometer_start_thread(); KEYPAD_start_thread(); /* User codes ends here*/ osKernelStart(); /* start thread execution */ }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Low Level Initialization */ HAL_Init(); /* Configure the System clock to have a frequency of 200 Mhz */ SystemClock_Config(); /* Initialize IO expander */ BSP_IO_Init(); /* Start task */ osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, 8 * configMINIMAL_STACK_SIZE); osThreadCreate(osThread(USER_Thread), NULL); /* Create Application Queue */ osMessageQDef(osqueue, 1, uint16_t); AppliEvent = osMessageCreate(osMessageQ(osqueue), NULL); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for( ;; ); }
/** * @brief Main program * @param None * @retval None */ int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 168 MHz */ SystemClock_Config(); /* Configure LED1, LED2, LED3 and LED4 */ BSP_LED_Init(LED1); /* Configure Key Button */ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); /* Define used semaphore */ osSemaphoreDef(SEM); /* Create the semaphore used by the two threads. */ osSemaphore = osSemaphoreCreate(osSemaphore(SEM) , 1); /* Create the Thread that toggle LED1 */ osThreadDef(SEM_Thread, SemaphoreTest, osPriorityNormal, 0, semtstSTACK_SIZE); osThreadCreate(osThread(SEM_Thread), (void *) osSemaphore); /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ for(;;); }
int main() { osKernelInitialize(); get_temperature_id = osThreadCreate(osThread(GetTemperature),NULL); rx_id = osThreadCreate(osThread(RX_Thread),NULL); tx_id = osThreadCreate(osThread(TX_Thread),NULL); osKernelStart(); }
int main (void) { osKernelInitialize(); /* initialize CMSIS-RTOS */ HAL_Init(); /* Initialize the HAL Library */ SystemClock_Config(); /* Configure the System Clock */ //start_Thread_SPI(); start_Thread_Temperature(); /* Create a thread for sampling CPU temperature */ start_Thread_Acc(); /* Create a thread for sampling accelerometer data */ start_Thread_LED(); osKernelStart(); /* start thread execution */ }
int main(void){ led_init(); osKernelInitialize(); init_myThread(); osKernelStart();//after this main beocmes a thread and the os starts running while(1){ mainThreadCounter++; GPIO_WriteBit(GPIOB,GPIO_Pin_8,!GPIO_ReadOutputDataBit(GPIOB,GPIO_Pin_8)); osDelay(250); } }
/* * main: initialize and start the system */ int main (void) { uint8_t buf, reg; osKernelInitialize (); // initialize CMSIS-RTOS // initialize peripherals here Blinky_GPIO_Init(); wireless_init(); Rx_thread = osThreadCreate(osThread(RxPacket), NULL); osKernelStart(); }
int main (void) { SystemCoreClockUpdate(); osKernelInitialize(); // Initialize CMSIS-RTOS osThreadNew(app_main, NULL, NULL); // Create application main thread if (osKernelGetState() == osKernelReady) { osKernelStart(); // Start thread execution } for (;;) {}; }