intel Edison开发教程——MCU SDK(一)

1461

 

几个月前,intel提供的开发资料少之又少,但随edison用户的逐步增多,intel在吐槽声中也增加了不少资料。阅读这些资料,有如醍醐灌顶,让我了解到edison真正的牛逼之处。这里介绍的edison mcu sdk的开发也是源自intel的开发文档:https://software.intel.com/en-us/node/557537
以下为我阅读文档后的理解与复述,可能有不正确之处,望回复告知,谢谢。

intel-edison-mcu-sdk-1

组成intel Edison组成主要为两部分,Atom的核心quark的MCU
(不知道为何intel不说Quark,而只是称作MCU了,大家可以回帖揣测下)
这是一个双CPU,双系统的模块,Atom核心运行着yocto版的linux,而quark的MCU部分则运行着Viper RTOS,这是风河提供了一套系统,包含了线程调度、内存管理、中断调度等等功能。

MCU应用运行在Viper内核上,并独立控制着连接MCU的外围设备,我们使用GPIO读写传感器就是由MCU完成的,然后MCU再和Atom处理器进行通信,传回数据,用以完成更多功能。MCU还可以用于省电,他能促使Atom核心休眠,等到需要的时候再唤醒。

MCU驱动提供了IPC协议支持,使得可以下载应用到我们的设备上。
MCU子系统
MCU子系统基于486架构,对奔腾IA ISA兼容,集成了 I/O (IPC, I2C, GPIO, HSU, DMA)和SRAM。其主要特性如下:

  • 在fully active D0 device power状态,CPU频率是100MHz,在S0ix “active idle”休眠状态,CPU会降频到38.4 MHz。
  • SRAM: 192 KB SRAM(包括代码和数据)
  • IPC: 这个很重要,MCU提供了控制子系统的IPC机制,MCU和核心的thread-based通信也通过此进行。
  • I2C: I2C 8和I2C 9 in the system controller unit (SCU) cluster are assigned for MCU usage.
  • UART: MCU能访问UART1、UART2,which may be used as a Linux* kernel console as well.
  • GPIO: MCU能访问所有GPIO口,MCU和核心共用所有GPIO。
  • PWM: MCU和核心共用所有PWM
  • MCU 提供了微秒级 (1 µs)高精度延时API。详见:Auxiliary API部分。
  • MCU提供了不同等级的追踪能力,用以调试程序。
  • The MCU SDK是一套基于Eclipse的SDK,方便用户创建、编译、下载和调试MCU应用,并且他支持多系统。

图片是SDK包含的东西:
intel-edison-mcu-sdk-2

MCU应用
MCU应用运行在Viper上,它的二进制文件存储在linux RootFS中,在linux内核启动期间,会通过MCU driver将二进制文件下载到MCU上。MCU应用能独立控制外设、和atom核心通信,也能进入低功耗模式。通过intel提供的SDK就可以开发MCU应用。

核心端接口
以下列出了核心上暴露出的一些TTY通道和多个sysfs节点,这些接口都是用于核心和MCU间通信的。
TTY接口

  • /dev/ttymcu0: 核心与MCU的传输通道。核心和MCU间能通过这个接口相互发送和接受数据。
  • /dev/ttymcu1: 用于获取MCU的log信息

Sysfs接口

  • /sys/devices/platform/intel_mcu/control: A write-only control node to load the MCU application. Currently this node is for internal use only.
  • /sys/devices/platform/intel_mcu/fw_version: The version of the MCU SDK that is used to build MCU applications.
  • /sys/devices/platform/intel_mcu/log_level: A read/write node to set and get the current MCU application log level. Supported input strings include fatal, error, warning, info, and debug.

MCU SDK
MCU SDK主要是一个Eclipse plugin,它包含一个预建工具,能用于编译、下载和调试MCU应用。同时当创建项目时,会使用到其中包含的模板源码。MCU SDK主要有以下几个特性:

  • 创建MCU项目
  • 建立MCU应用
  • 下载MCU应用到目标设备
  • 显示调试信息

以下是一些intel官方提到的注意事项,主要为edison硬件的局限性说明,不做翻译了:

  • The maximum message size for interprocess communication between the CPU and the MCU is currently limited to 255 bytes.
  • The current Viper OS release does not support unloading an MCU user application after it is loaded. The user must reboot the device to unload the downloaded binary.
  • The MCU application update requires a Linux reboot.
  • Maximum MCU binary size is limited to 120 KB currently.
  • Due to the limitations of the current Viper OS release, the MCU OS tick value is 10 ms.
  • You cannot install the SDK in any directory that has spaces in the path name. (For example, Program Files or My Documents is not allowed.)
  • There is no floating point support in MCU. (You can build a floating point code using MCU, but it will generate runtime exceptions.)
  • The MCU is limited to 2xI2C.
  • The MCU application is limited to single-thread usage.
  • You cannot boot the MCU without first booting Linux.
  • There is no access coordination between the Intel Atom processor and the MCU. Both can configure the same I/O at once. This can potentially cause conflicts and must be user-managed.
  • The MCU SDK (Eclipse) is different and separate from the C/C++ Eclipse SDK for the Intel Atom processor.
  • The MCU I/O API is not aligned with the API for the Intel Atom processor. You must rewrite code to move from the Intel Atom processor to the MCU.
  • The MCU does not have a watchdog timer.
  • Currently, the SPI feature is not supported for the MCU.
  • It may take a long time to launch the MCU SDK on Windows under some network configurations due to Eclipse or Cygwin limitations.
  • Pin muxing (Arduino extension board configuration) must be done through the Linux interface before starting the MCU. For details, see Setting the Intel® Edison board up to test system on a chip (SoC) GPIOs.
  • PWM runtime power management must be disabled from the Linux side in order to access this module. For details, seeControlling PWM ports.
  • There are no programmable timer interrupts available on the MCU.

 

留下一个答复

Please enter your comment!
Please enter your name here