Atmel Cortex-A5跑Nuttx是如此酸爽

时间:2021-06-17 20:14:01

开源RTOS Nuttx已经支持Atmel SAMA5系列MPU,而且看到Nuttx还支持Graphic API,决定尝试在Ateml SAMA5D3 Xplained上跑下Nuttx。Nuttx是一款开源RTOS,具备非常优秀的实时特性,支持TCP/IP,IPv4, IPv6等网络协议栈,能够支持USB Host/Device协议栈,支持多种文件系统,支持像Linux一样的shell命令行操作。开源PX4无人机飞控平台就是采用的这款RTOS. Nuttx具备以下优秀特性:

  • Standards Compliant
  • Core Task Management
  • Modular design
  • Fully preemptible
  • Naturally scalable
  • Highly configurable
  • Easily extensible to new processor architectures, SoC architecture, or board architectures
  • FIFO, round-robin, and “sporadic” scheduling
  • Realtime, deterministic, with support for priority inheritance
  • Tickless operation
  • POSIX/ANSI-like task controls, named message queues, counting semaphores, clocks/timers, signals, pthreads, robust mutexes, cancellation points, environment variables, filesystem
  • VxWorks-like task management and watchdog timers
  • BSD socket interface
  • Optional tasks with address environments (Processes)
  • Symmetric Multi-Processing (SMP)
  • Loadable kernel modules; lightweight, embedded shared libraries
  • Memory Configurations: (1) Flat embedded build, (2) Protected build with MPU, and (3) Kernel build with MMU
  • Memory Allocators: (1) standard heap memory allocation, (2) granule allocator, (3) shared memory, and (4) dynamically sized, per-process heaps
  • Thread Local Storage (TLS)
  • Inheritable “controlling terminals” and I/O redirection. Pseudo-terminals
  • On-demand paging
  • System logging
  • May be built either as an open, flat embedded RTOS or as a separtely built, secure kernel with a system call gate interface
  • Built-in, per-thread CPU load measurements
  • Custom NuttX C library
  • Application interface well documented in the NuttX User Guide

支持的ARM平台

  • ARM7TDMI (TI TMS320 C5471, Calypso, MoxART, NXP LPC214x, LPC2378, STMicro STR71x)
  • ARM920T (Freescale i.MX1)`
  • ARM926EJS (TI DM320, NXP LPC31xx)
  • ARM Cortex-A5 (Atmel SAMA5D2, SAMA5D3, SAMA5D4)
  • ARM Cortex-A8 (Allwinner A10)
  • ARM Cortex-A9 (NXP/Freescale i.MX6)
  • ARM Cortex-R4/R4F (TI TMS570)
  • ARM Cortex-M0 (nuvoTon NUC120, NXP/Freescale KL25Z, KL26Z, Atmel SAMD20/21, SAML21, ST Micro STM32 F0)
  • ARM Cortex-M3 (ST Micro STM32 F1/L4/F2, TI/Stellaris LM3S, NXP LPC17xx, Atmel SAM3U/3X, SiliconLabs EFM32)
  • ARM Cortex-M4 (with/without floating point unit: ST Micro STM32 F3/F4/L4, TI/Stellaris LM4F/TM4C, NXP LPC43xx, Freescale Kinetis K20/K40/60/64/66, Atmel SAM4C/4E/4S/4L, Infineon XMC4xxx)
  • ARM Cortex-M7 (Atmel SAMV71/SAME70, ST Micro STM32 F7)

支持的文件系统

  • Tiny in-memory, root pseudo-file-system
  • ARM920T (Freescale i.MX1)`
  • Generic system logging (SYSLOG) support
  • FAT12/16/32 filesystem support
  • NFS Client. Client side support for a Network File System (NFS, version 3, UDP)
  • NXFFS. The tiny NuttX wear-leveling FLASH file system
  • SMART. FLASH file system from Ken Pettit
  • ROMFS file system support
  • BINFS pseudo-file system support
  • HOSTFS file system support (simulation only)
  • Union file system. Supports combining and overlaying file systems
  • procfs/ pseudo-file system
  • Generic driver for SPI-based MMC/SD/SDH cards
  • A Binary Loader with support for the following formats:
    Separately linked ELF modules.
    Separately linked NXFLATmodules. NXFLAT is a binary format that can be XIP from a file system.
  • PATH variable support
  • File transfers via TFTP and FTP (get and put), HTML (wget), and Zmodem (sz and rz)
  • Intel HEX conversions

支持的图像Graphic特性

  • Framebuffer drivers
  • Graphic LCD drivers for both parallel and SPI LCDs and OLEDs
  • Segment LCD drivers
  • VNC Server
  • NX Graphics Subsystem: A graphics library, windowing system and font support that works with either framebuffer or LCD drivers
  • NuttX Widgets: A graphical user interface written in conservative C++ that integrates with NX Graphics
  • SMART. FLASH file system from Ken Pettit
  • NuttX Window Manager: A tiny window manager based on the NX Graphics Subsystem and NuttX Widgets

Nuttx在Atmel SAMA5D3 MPU的移植

Nuttx源码已经支持Atmel Cortex-A5系列MPU平台,开发人员只需要参照Nuttx源码目录下configs/sama5d3-xplained/README.txt帮助文件,就可以完成Nuttx的编译工作。需要注意的是Nuttx OS是放在外部的DDR2里面运行的,需要一个bootloader将代码从Nand Flash搬移到外部DDR2。这个bootloader我所采用的也是来自于Atmel官网的bootstrap,一款小巧方便的轻量级bootloader,可以直接用来加载Nuttx或者Linux kernel,移植方面需要做简单的配置即可。 —— [ Atmel SAMA5D3 Xplained官网链接 ]

Nuttx在SAMA5D3 Xplained上运行的效果如下,支持linux一样的命令行操作,每个用户代码都可以单独编译成一个可执行文件,非常的便利,让我又不禁感叹Nuttx的强大,让我很快从uCos/FreeRTOS粉迅速转变为Nuttx粉:
Atmel Cortex-A5跑Nuttx是如此酸爽

Nuttx Graphic运行的效果如下(支持多窗口叠层操作,内置多种字体):
Atmel Cortex-A5跑Nuttx是如此酸爽

后续希望在实际项目中用到这款身材小巧而内心强大的RTOS,Nuttx最早在2007年发布出来,作者是 - [Gregory Nutt]

Greg本身也是牛人一个,有兴趣的可以看下他个人的简历,在Yahoo Group上有个Nuttx开发者群,所有相关的问题都可以在上面提出,Greg会很快给你回复。笔者当时调试时遇到问题,周六半夜2点(北京时间)将问题提交上去,5分钟不到就收到Greg本人亲自给出的回复,一个很nice的人 - [Gregory Nutt Resume]

Nuttx提供了简单的设备驱动模型,方便开发者将自己的应用代码移植到不同的MCU/MPU平台。另外发现Nuttx对Atmel Cortex-M7芯片(一颗非常强大的MCU,DMIP强于ARM Cortex-A8,主频可以到300MHz的单片机) SAMV71 Xplained和SAME70 Xplained也有支持,目前也在上面简单跑过一些例程,非常的好用。Nuttx也支持GDB调试,对于单片机/ARM MCU开发人员来说是个巨大的福利。

对Nuttx的简单介绍就到这里,如果有兴趣的朋友可以发邮件给我 atmel_mpu_support@163.com。