1 / 29

SVTH: Văn Quốc Dũng Lê Quang Vũ

SVTH: Văn Quốc Dũng Lê Quang Vũ. 1. 2. 3. 4. 5. Tổng quan. Task và Co-routine. Soft-timer. Support Architecture. Inter-task Communication. CONTENT. TỔNG QUAN. FreeRTOS TM hỗ trợ chính thức 27 kiến trúc (PIC32, AVR32,…) Portable, open source , mini Real Time Kernel

ethel
Download Presentation

SVTH: Văn Quốc Dũng Lê Quang Vũ

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SVTH: VănQuốcDũng LêQuangVũ

  2. 1 2 3 4 5 Tổngquan Task và Co-routine Soft-timer Support Architecture Inter-task Communication CONTENT

  3. TỔNG QUAN • FreeRTOSTMhỗtrợchínhthức27 kiếntrúc(PIC32, AVR32,…) • Portable, open source, mini Real Time Kernel • Cóthểsửdụngtrongcácứngdụngthươngmại? -> GPL (General Public License)

  4. TỔNG QUAN • OpenRTOSTM : fully featured professional grade USB, file system and TCP/IP components • SafeRTOSTM : sửdụngtrong “safety critical applications”

  5. TỔNG QUAN • Thiếtkếnhỏgọn, dễsửdụng. (4K to 9K bytes). • Ngônngữlậptrình C. • Sửdụngtasks and co-routines.

  6. TỔNG QUAN • Queues, binary semaphores, counting semaphores, recursive semaphores and mutexeschogiaotiếpvàđồngbộgiữacáctask,vàgiữacác task và interrupt. • Mutexesvới “priority inheritance”. • Hỗtrợsoftware timers.

  7. TASK VÀ CO-ROUTINE • Task: • Ready • Running • Block • Suspended

  8. TASK VÀ CO-ROUTINE • Task: • Multitasking – with full preemption • Fully prioritised • Each task maintains its own stack • Priority: • 0 -> configMAX_PRIORITIES – 1 • Low -> High • = 0 : idle task

  9. TASK VÀ CO-ROUTINE • Implement task: void vATaskFunction( void *pvParameters ) { for( ;; ) { -- Task application code here. } } • Create: xTaskCreate() • Delete : vTaskDelete()

  10. TASK VÀ CO-ROUTINE • Idle task: • created automatically when the scheduler is started • free memory allocated • which will execute only when there are no other tasks able to do • Other tasks can share the idle task priority

  11. TASK VÀ CO-ROUTINE • Idle task:

  12. TASK VÀ CO-ROUTINE • Share a single stack • Co-routine: • Running • Ready • Block • Priority: • 0 -> configMAX_CO_ROUTINE_PRIORITIES - 1

  13. TASK VÀ CO-ROUTINE • Implement co-routine: void vACoRoutineFunction( xCoRoutineHandlexHandle, unsigned portBASE_TYPEuxIndex ) { crSTART( xHandle ); for( ;; ) { -- Co-routine application code here. – } crEND(); }

  14. TASK VÀ CO-ROUTINE • Scheduling co-routine: • scheduled by repeated calls to vCoRoutineSchedule() • tasks and co-routines to be easily mixed within the same application • execute when there are no tasks of priority higher than the idle task

  15. inter-task communication • Queues • Binary Semaphores • Counting Semaphores • Mutexes, and • Recursive Mutexes.

  16. inter-task communication • Queues • Là dạng chính trong inter-task communication. • Tasks – tasks, tasks – interrupts. • Thường được dùng ở dạng FIFO. • Phần tử trong queue có kích thước cố định: có thể ở dạng con trỏ nếu cần thiết. • Có 3 trạng thái trống, đầy và bình thường. • Ticks.

  17. inter-task communication

  18. inter-task communication • Binary Semaphores • Chủ yếu dùng với mục đích đồng bộ.

  19. inter-task communication • Counting Semaphores • Đếm sự kiện • Semaphoes khởi tạo là 0. • Khi có sự kiện Semaphore tăng . • Khi task nhận sự kiện Semaphore giảm. • Quản lý tài nguyên • Semaphoes khởi tạo là số lượng tài nguyên. • Khi task lấy tài nguyên thì Semaphore giảm. • Khi task trả tài nguyên thì Semaphore tăng.

  20. inter-task communication • Mutexes('MUT'ual 'EX'clusion) • Dùng để giải quyết đụng độ. • Thay đổi priority cho phù hợp.

  21. inter-task communication • Recursive Mutexes

  22. Software Timers • In a nutshell • One-Shot and Auto-reload • Resetting a Timer

  23. Software Timers • In a nutshell • Gọi hàm tại một thời điểm xác định trong tương lai. • NOTE: Software timers phải được khởi tạo trước khi sử dụng.

  24. Software Timers • One-Shot and Auto-reload

  25. Software Timers • Resetting a Timer

  26. Support Architecture AlteraAtmelCortusCypressEnergy MicroFreescaleFujitsuLuminary MicroMicrochipNECMicrosemi (formally Actel)NXPRenesasSilicon LabsST MicroelectronicsTexas InstrumentsXilinxx86 (real mode)x86 / Windows Simulator

  27. Support Architecture the PIC32, a MIPS based 32bit microcontroller offerings from Microchip

  28. Support Architecture he TCP/IP demo uses the lwIP TCP/IP stack and includes a basic web and TFTP server implementation

  29. Thank You

More Related