Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A critical real-time system must be implemented using the ESP8266 RTOS SDK. The system has 3 jobs: Job A - aperiodic triggered by a
A critical real-time system must be implemented using the ESP8266 RTOS SDK. The system has 3 jobs: Job A - aperiodic triggered by a high on a GPIO pin Job B- periodic with a period of 10 units Job C- periodic with a period of 5 units Figure Q1.b on page 3 contains two potential C listings for the implementation. Which listing would you prefer? Justify your choice. Your answer should iden- tify the specific aspects of each listing that would make it preferable in specific contexts. 1 2 static void JobA() {...}; static void JobB () {...}; static void JobC() {...}; 4 const TickType_t xPeriodB = 10; const TickType_t xPeriodC = 5; 3 5 6 7 8 9 14 15 16 17 18 19 20 10 11 12 static void per_taskB (void *arg) 13 { 21 22 23 24 25 26 27 28 29 30 31 32 33 36 37 38 39 40 41 42 43 44 } 45 46 47 static void isr_hdler (void) { JobA(); } Listing I Pre-emptive Priority with Interrupt } Figure Q1.b: Implementation of a Critical System using the ESP8266 RTOS SDK } TickType_t xLastWake Time; for (;;) { } static void per_taskC(void *arg) { TickType_t xLastWakeTime; for (;;) { } xLastWakeTime = xTaskGetTickCount(); JobB (); 34 void app_main(void) 35 { xLastWakeTime = xTaskGetTickCount(); JobB(); 1 2 gpio_config_t io_conf; io_conf.intr_type= GPIO_INTR_HIGH_LEVEL; io_conf.pin_bit_mask = GPIO_PIN_0; io_conf.mode= GPIO_MODE_INPUT; gpio_config(&io_conf); 3 4 5 6 7 18 vTaskDelayUntil( &xLastWakeTime, xPeriodB); 19 20 8 9 10 11 12 13 14 15 16 17 21 22 23 24 25 33 34 35 36 xTaskCreate (per_taskB, "B", 2048, NULL, 10, NULL); xTaskCreate (per_taskC, "C", 2048, NULL, 11, NULL); gpio_install_isr_service(0); gpio_isr_handler_add (GPIO_NUM_0, isr_hdler, NULL); static void JobA() {...}; static void JobB () {...}; static void JobC() {...}; const TickType_t xSlot = 5; } 37 38 39 } static void cyclicx (void *arg) { TickType_t xLastWake Time; for (;;) { } 26 27 28 void app_main(void) 29 { vTaskDelayUntil( &xLastWakeTime, xPeriodC ); 30 31 32 Listing II Cyclic Executive JobC(); } // Slot 1 of 2 xLastWakeTime = xTaskGetTickCount(); if (gpio_get_level (GPIO INPUT_O)) JobA(); - JobB(); JobC(); vTaskDelayUntil( &xLastWakeTime, xSlot); //Slot 2 of 2 xLastWakeTime = xTaskGetTickCount(); if (gpio_get_level (GPIO_NUM_0)) JobA(); 5 marks vTaskDelayUntil( &xLastWakeTime, xSlot ); for (;;) { gpio_config_t io_conf; io_conf.pin_bit_mask = GPIO_INPUT_10_0; io_conf.mode = GPIO_MODE_INPUT; gpio_config(kio_conf); cyclicx();
Step by Step Solution
★★★★★
3.48 Rating (161 Votes )
There are 3 Steps involved in it
Step: 1
Listing II Cyclic Executive is preferable in this context as it is a better fit for the realtime sys...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started