ARA: Automatic Instance-Level Analysis in Real- Time Systems Gerion Entrup , Benedikt Steinmeier, Christian Dietrich Leibniz Universität Hannover July 9, 2019 supported by
A Hard Beginning Repository size: 65 MiB Time Systems – Motivation ARA: Automatic Instance-Level Analysis in Real- LUH What is the systems architecture? 134 000 lines of code 2 – 21 Getting a FreeRTOS project from Github: remote: Total 9544 (delta 683), reused 992 (delta 567), pack-reused 8299 Cloning into 'GPSLogger'... % git clone https://github.com/grafalex82/GPSLogger remote: Enumerating objects: 1245, done. remote: Counting objects: 100% (1245/1245), done. remote: Compressing objects: 100% (666/666), done. Receiving objects: 100% (9544/9544), 52.33 MiB | 9.47 MiB/s, done. Resolving deltas: 100% (6615/6615), done.
A Hard Beginning Repository size: 65 MiB Time Systems – Motivation ARA: Automatic Instance-Level Analysis in Real- LUH What is the systems architecture? 134 000 lines of code 2 – 21 Getting a FreeRTOS project from Github: remote: Total 9544 (delta 683), reused 992 (delta 567), pack-reused 8299 Cloning into 'GPSLogger'... % git clone https://github.com/grafalex82/GPSLogger remote: Enumerating objects: 1245, done. remote: Counting objects: 100% (1245/1245), done. remote: Compressing objects: 100% (666/666), done. Receiving objects: 100% (9544/9544), 52.33 MiB | 9.47 MiB/s, done. Resolving deltas: 100% (6615/6615), done.
The Instance Graph OSPERT’18: Time Systems – Motivation ARA: Automatic Instance-Level Analysis in Real- LUH Get interactions between them. Get instances of OS abstractions. 3 – 21 Levels of Specialization in Real-Time Operating Systems wait Serial DMA GPS Logging SD Writer put get ISR Thread Queue Thread wakeup wakeup lock wait LED Lock Display lock SPI DMA Semaphore Thread Thread wait ISR get wakeup sleep I 2 C DMA Button Events put sleep Thread Queue ISR
The Instance Graph OSPERT’18: Time Systems – Motivation ARA: Automatic Instance-Level Analysis in Real- LUH Not possible for larger code bases. We need automation! We have extracted the graph manually! 3 – 21 Levels of Specialization in Real-Time Operating Systems wait Serial DMA GPS Logging SD Writer put get ISR Thread Queue Thread wakeup wakeup lock wait LED Lock Display lock SPI DMA Semaphore Thread Thread wait ISR get wakeup sleep I 2 C DMA Button Events put sleep Thread Queue ISR
A utomatic R eal-Time Systems A nalyzer (ARA) Automatic instance graph extraction Static source code analysis Application as input Supports multiple RTOS interfaces. (currently FreeRTOS and OSEK/AUTOSAR) Fields of use: System overview Knowledge extraction for specialization OS-API usage validation LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Motivation 4 – 21
Agenda Motivation Technique Experiments Conclusion LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Motivation 5 – 21
ARA in a Nutshell RTOS mapping void vTask2 ( void ∗ param) { do_long_operation ( ) ; xTaskDelete (h) } RTOS-API Control fmow analysis Control fmow analysis RTOS mapping Value analysis } Value analysis Source Instance graph Instance graph programmed against LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Technique } 6 – 21 vTaskDelay (100); vTaskStartScheduler ( ) ; ”Task1” , NULL) ; xTaskCreate (vTask1 , main () { i n t TaskHandle_t h = NULL; ARA xTaskCreate (vTask2 , ”Task2” , &h ) ; do_stuff ( ) ; // should 0; reach while (1) { void vTask1 ( void ∗ param) { t h i s } while (1 ); never return wait Serial DMA GPS put Logging get SD Writer ISR Thread Queue Thread wakeup wakeup lock wait LED Lock lock Display SPI DMA Thread Semaphore Thread wait ISR get wakeup sleep Button put Events I 2 C DMA sleep Thread Queue ISR
ARA in a Nutshell RTOS mapping void vTask2 ( void ∗ param) { do_long_operation ( ) ; xTaskDelete (h) } RTOS-API Control fmow analysis Control fmow analysis RTOS mapping Value analysis } Value analysis Source Instance graph Instance graph programmed against LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Technique } 6 – 21 vTaskDelay (100); vTaskStartScheduler ( ) ; ”Task1” , NULL) ; xTaskCreate (vTask1 , main () { i n t TaskHandle_t h = NULL; ARA xTaskCreate (vTask2 , ”Task2” , &h ) ; do_stuff ( ) ; // should 0; reach while (1) { void vTask1 ( void ∗ param) { t h i s } while (1 ); never return wait Serial DMA GPS put Logging get SD Writer ISR Thread Queue Thread wakeup wakeup lock wait LED Lock lock Display SPI DMA Thread Semaphore Thread wait ISR get wakeup sleep Button put Events I 2 C DMA sleep Thread Queue ISR
OSEK/AUTOSAR vs. FreeRTOS ulTaskNotifyTake(); t2 = xTaskCreate(task_2 , 1); vTaskStartScheduler(); } vTaskNotifyGive(t1); } while (true) { vTaskDelete(NULL); TASK t1 { } } .cpp FreeRTOS LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Technique t1 = xTaskCreate(task_1 , 2); int main() { TaskHandle_t t1, t2; .oil PRIORITY = 1; SCHEDULE = FULL; AUTOSTART = TRUE; } TASK t2 { PRIORITY = 2; SCHEDULE = FULL; } OSEK/AUTOSAR .cpp TASK(t1) { ActivateTask(t2); } TASK(t2) { TerminateTask(); } 7 – 21 task_1 { // priority: 2 task_2 { // priority: 1
RTOS Mapping (os_type.create , ...) Time Systems – Technique ARA: Automatic Instance-Level Analysis in Real- LUH Create parser for extra data (like OIL fjle). "xQueueGiveMutexRecursive": (os_type.commit , ...) "xQueueTakeMutexRecursive": (os_type.take, ...) (os_type.take, ...) "ulTaskNotifyTake" : (os_type.commit , ...) "vTaskNotifyGive": "xTaskCreate": Detect all system calls # FreeRTOS (os_type.commit , ...) "ReleaseResource": (os_type.take, ...) "GetResource": (os_type.destroy , ...) "TerminateTask": (os_type.activate , ...) "ActivateTask": # OSEK Create unifjed model 8 – 21
ARA in a Nutshell RTOS mapping void vTask2 ( void ∗ param) { do_long_operation ( ) ; xTaskDelete (h) } RTOS-API Control fmow analysis Control fmow analysis RTOS mapping Value analysis } Value analysis Source Instance graph Instance graph programmed against LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Technique } 9 – 21 vTaskDelay (100); vTaskStartScheduler ( ) ; ”Task1” , NULL) ; xTaskCreate (vTask1 , main () { i n t TaskHandle_t h = NULL; ARA xTaskCreate (vTask2 , ”Task2” , &h ) ; do_stuff ( ) ; // should 0; reach while (1) { void vTask1 ( void ∗ param) { t h i s } while (1 ); never return wait Serial DMA GPS put Logging get SD Writer ISR Thread Queue Thread wakeup wakeup lock wait LED Lock lock Display SPI DMA Thread Semaphore Thread wait ISR get wakeup sleep Button put Events I 2 C DMA sleep Thread Queue ISR
ARA in a Nutshell RTOS mapping void vTask2 ( void ∗ param) { do_long_operation ( ) ; xTaskDelete (h) } RTOS-API Control fmow analysis Control fmow analysis RTOS mapping Value analysis } Value analysis Source Instance graph Instance graph programmed against LUH ARA: Automatic Instance-Level Analysis in Real- Time Systems – Technique } 9 – 21 vTaskDelay (100); vTaskStartScheduler ( ) ; ”Task1” , NULL) ; xTaskCreate (vTask1 , main () { i n t TaskHandle_t h = NULL; ARA xTaskCreate (vTask2 , ”Task2” , &h ) ; do_stuff ( ) ; // should 0; reach while (1) { void vTask1 ( void ∗ param) { t h i s } while (1 ); never return wait Serial DMA GPS put Logging get SD Writer ISR Thread Queue Thread wakeup wakeup lock wait LED Lock lock Display SPI DMA Thread Semaphore Thread wait ISR get wakeup sleep Button put Events I 2 C DMA sleep Thread Queue ISR
Recommend
More recommend