RT thread เทียบเปรียบกับ FreeRTOS
Introduction
ประมาณเดือนธันวาคมปี 2017 Amazon ได้เปิดตัวระบบปฏิบัติการสำหรับงาน Internet of Things ที่ชื่อ Amazon FreeRTOS โดยมีจุดประสงค์เพื่อช่วยให้การพัฒนางานทางด้าน Internet of Things บนไมโครคอนโทรลเลอร์สะดวกขึ้นคำว่าสะดวกขึ้นในที่นี้คืออะไร FreeRTOS เป็น Real-Time Operating System ที่ถูกใช้มาอย่างยาวนานมากบนไมโครคอนโทรลเลอร์ จุดเด่นคือได้รับการพัฒนา kernel จนเสถียร และเทียบชั้น RTOS ที่ต้องเสียค่าใช้จ่ายได้เลย และที่สำคัญคือ API ในการพัฒนาส่วนของ System programming ตัวอย่างเช่น Multitasking scheduler สามารถสร้าง Application ที่ต้องการทำงานแบบ Multitasking ได้
RT-Thread ถือกำเนิดในปี 2549 เป็นระบบปฏิบัติการแบบเรียลไทม์ (RTOS) แบบโอเพนซอร์ส เป็นกลาง และอิงตามชุมชน ซอฟต์แวร์มีลักษณะการใช้ทรัพยากรต่ำมาก มีความน่าเชื่อถือสูง ปรับขนาดได้สูง สามารถใช้ในโหนดตรวจจับ ชิปเชื่อมต่อไร้สาย และฉากที่มีข้อจำกัดด้านทรัพยากรจำนวนมาก นอกจากนี้ยังใช้กันอย่างแพร่หลายในเกตเวย์ IPC ลำโพงอัจฉริยะ และอื่นๆ อีกมากมาย - แอปพลิเคชั่นประสิทธิภาพ
Architecture
RT -Thread
![]() |
| Source: https://www.rt-thread.io/document/site/#code-catalogue |
จากรูปด้านบนส่วนสีส้มจะเห็นว่า Amazon จะเข้าไปพัฒนาปรับแต่งจนถึงส่วนของ FreeRTOS Kernel เลย และนอกจากนั้น จะเป็น Library ที่ใช้เชื่อมต่อกับ AWS IoT เอง
แต่สิ่งที่ทั้งสอง Architecture ทำได้เหมือนกันคือ
- การ Deploy อุปกรณ์ใหม่จะต้องง่าย เช่นการลงทะเบียน การจัดการอุปกรณ์ ( เพิ่ม, ลบ เป็นต้น )
- การจัดการเรื่องพลังงาน และเชื่อมต่อ Internet
- การรักษาความปลอดภัยของข้อมูล ในการสื่อสารกับเซอเวอร์
- สามารถย้ายแพลตฟอร์มฮาร์ดแวร์ได้โดยง่าย
- อัพเกรดเฟริมแวร์หลังจากติดตั้งอุปกรณ์หรือ OTA ( Over The Air )
Support
Supported Architectures
RT-thread
- ARM Cortex-M0/M0+:manufacturers like ST
- ARM Cortex-M3:manufacturers like ST、Winner Micro、MindMotion, ect.
- ARM Cortex-M4:manufacturers like ST、Nuvton、NXP、GigaDevice、Realtek、Ambiq Micro, ect.
- ARM Cortex-M7:manufacturers like ST、NXP
- ARM Cortex-M23:manufacturers like GigaDevice
- ARM Cortex-M33:manufacturers like ST
- ARM Cortex-R4
- ARM Cortex-A8/A9:manufacturers like NXP
- ARM7:manufacturers like Samsung
- ARM9:manufacturers like Allwinner、Xilinx 、GOKE
- ARM11:manufacturers like Fullhan
- MIPS32:manufacturers like loongson、Ingenic
- RISC-V:manufacturers like Hifive、Kendryte、Nuclei
- ARC:manufacturers like SYNOPSYS
- DSP:manufacturers like TI
- C-Sky
- x86
FreeRTOS
- Cyclone V SoC (ARM Cortex-A9), Nios II
- ARM Cortex-M33 simulator
- SAMV7 (ARM Cortex-M7), SAM3 (ARM Cortex-M3), SAM4 (ARM Cortex-M4 ), SAMD20 (ARM Cortex-M0+), SAMA5 (ARM Cortex-A5), SAM7 (ARM7), SAM9 (ARM9), AT91, AVR and AVR32 UC3
- Tensilica Xtensa
- SensPro, SensPro2, CEVA-BX1, CEVA-BX2, CEVA-X1, CEVA-X2, CEVA-XC16, CEVA-XM6, CEVA-XM4, CEVA-XC12, CEVA-XC4500
- APS3
- PSoC 5 ARM Cortex-M3
- Kinetis ARM Cortex-M4, Coldfire V2, Coldfire V1, other Coldfire families, HCS12, PPC405 & PPC440 (Xilinx implementations) (small and banked memory models), plus contributed ports
- TriCore, XMC4000 (ARM Cortex-M4F), XMC1000 (ARM Cortex-M0)
- FM3 ARM Cortex-M3, 32bit (for example MB91460) and 16bit (for example MB96340 16FX)
- All Luminary Micro ARM Cortex-M3 and ARM Cortex-M4 based Stellaris microcontrollers
- PIC32MX, PIC32MZ, PIC32MZ EF, PIC24, PIC24EP, dsPIC, MEC14xx, CEC13xx, CEC17xx, MEC17xx, MEC51xx
- MiFive (RISC-V), SmartFusion, SmartFusion2
- V850 (32bit), 78K0R (16bit)
- NuMicro M2351 (ARM Cortex-M23)
- VEGAboard (RISC-V), LPC55S6x(ARM Cortex-M33), LPC1500 (ARM Cortex-M3), LPC1700 (ARM Cortex-M3), LPC1800 (ARM Cortex-M3), LPC1100 (ARM Cortex-M0), LPC2000 (ARM7), LPC4000 (ARM Cortex-M4F/ ARM Cortex-M0)
- RZ/A1 / RZ/A2M, (ARM Cortex-A9), RZ/T, RX700 / RX71M, RX600 / RX64M / RX62N / RX63N / RX65N, RX200, RX100, SuperH, RL78, H8/S plus contributed ports
- RISC-V RV32
- EFM32 Gecko (Cortex-M3 and Cortex-M4F), 8051 compatible microcontrollers.
- FM3 ARM Cortex-M3, 32bit (for example MB91460) and 16bit (for example MB96340 16FX)
- STM32 (ARM Cortex-M0, ARM Cortex-M7, ARM Cortex-M3 and ARM Cortex-M4F), STR7 (ARM7), STR9 (ARM9)
- RM48, TMS570, ARM Cortex-M4F MSP432, MSP430, MSP430X, SimpleLink, Stellaris (ARM Cortex-M3, ARM Cortex-M4F)
- Zynq, Zynq UltraScale+ MPSoC (64-bit ARM Cortex-A53 and 32-bit ARM Cortex-R5), Microblaze, PPC405 running on a Virtex4 FPGA, PPC440 running on a Virtex5 FPGA.
- IA32 (32-bit flat memory model), Quark SoC X1000 (32-bit flat memory model), any x86 compatible running in Real mode only, plus a Win32 port. A port for the Linux Simulator is available as well
Supported IDE and Compiler
RT-Thread
- RT-Thread Studio IDE
- MDK KEIL
- IAR
- GCC
FreeRTOS
- Altera SoC EDS (ARM DS-5 with GCC), Nios II IDE with GCC
- IAR, GCC, Keil, Rowley CrossWorks
- XCC with the Xtensa Xplora IDE
- LLVM
- Cortus IDE with GCC
- GCC, ARM Keil and RVDS - all in the PSoC Creator IDE
- Codewarrior, GCC, Eclipse, IAR
- MPLAB C32, MPLAB C30
- Freedom Studio (GCC), IAR
- GCC, Visual Studio 2010 Express, MingW, Open Watcom, Borland, Paradigm
License
RT-Thread License: open source ภายใต้ Apache License Version 2.0
FreeRTOS License: open source ภายใต้ MIT open source license
FreeRTOS มี Hardware Partner ที่เยอะทำให้มีการ Support Processor families เเละ Supported tools เยอะกว่าทาง RT-Thread ที่มีเฉพาะพื้นฐานเเละของตัวมันเอง
สิ่งที่เหมือนกัน
การสื่อสารระหว่าง Thread ที่ Free RTOS เเละ RT-thread มีเหมือนกัน
- Queues
- Message
- Semaphore
- Mutexes
- Event flags
สิ่งที่เเตกต่างกัน
การสื่อสารระหว่าง Thread ที่ Free RTOS เเละ RT-thread มีเหมือนกัน
Rt-thread
- MailBox: ใน RT-thread จะสามารถสื่อสารระหว่าง Thread โดยใช้ MailBox ได้
- Signal : ใน RT-thread จะมีจะสามารถใช้ signal ในการส่งสัญญาณ request ไปให้ processor เพื่อ Interrupt ได้
Library
FreeRTOS จะมี Amazon FreeRTOS Library แต่ RT-Thread ไม่มี ที่สามารถใช้กับ Service ของ Amazon ได้อย่างเช่น
- Amazon Cloud connectivity การเชื่อมต่อกับ Cloud หรือ AWS IoT จะทำผ่าน MQTT Protocol โดยมีส่วนของการเชื่อมต่อกับ Device shadow มาให้ด้วย ใช้ในกรณีที่อุปกรณ์ Offline จะรับข้อมูลจาก Device shadow โดยอัตโนมัต
- Greengrass connectivity Greengrass discovery API ใช้ในกรณีที่ระบบของเรามี Amazon Greengrass ที่อยู่บน gateway ในระบบ
- Amazon FreeRTOS Security
- FreeRTOS Wi-FI interface หลักๆ ตอนนี้ฮาร์ดแวร์ยังใช้ Wi-FI อยู่ จะเป็น API สำหรับการเชื่อมต่อ WiFI ธรรมดา หรือ สั่งปิด WiFi เป็นต้น
- OTA Agent Library จัดการเรื่อง notification, verify firmware, download firmware จาก Cloud
Conclusion
FreeRTOS มี Partner มากกว่าเเละรองรับ service ต่างๆได้มากกว่า เเละ FreeRTOS เเละมีเครื่องมือที่ดีกว่า ทางการเชื่อมต่อ การรักษาความปลอดภัย เรื่องการจัดการพลังงาน
RT-Thread สามารถทำงานทาง IoT ได้เช่นเดียวกันแต่เครื่องมือเเละ Service อาจจะต้องใช้ของทาง RT-thread เองเเละหากต้องการนำไปใช้กับทาง Hardware หรือ service ตัวอื่นอาจจะเกิดความลำบากเล็กน้อยควรศึกษาเเละอ่าน Document ให้ดีซะก่อน
Source
FreeRTOS
- https://www.freertos.org/index.html
RT-thread
- https://www.rt-thread.io/document/site/programming-manual/ipc1/ipc1/#mutex


ความคิดเห็น
แสดงความคิดเห็น