0 Replies Latest reply on Oct 25, 2016 10:38 PM by nniles

    a Yocto recipe for the MCU scripts


      First, I like to use Yocto to keep track of, and implement, the configuration of my Edison,


      There are shell scripts available with release 2.1 to configure the I/O for the MCU.  For some reason, these scripts have to be downloaded and installed separately - even individually.


      It is almost trivial to write a Yocto recipe to include the scripts in the device image.  I don't know why this wasn't done for the release, but I find it useful to have them available as part of the "system".


      I call the recipe "mcu-scripts", and there are just a few steps to include it in the default image.  As written, the recipe will place the scripts in /usr/local/bin.


      1. create directories in one of the provided layers to hold the recipe (or, better, put it into your local layer, if you maintain one):

      cd /path/to/edison-src/meta-intel-edison/meta-intel-edison-bsp
      mkdir recipes-mcu
      cd recipes-mcu
      mkdir mcu-scripts


      2. Place the recipe into the new mcu-scripts directory.  Note that Yocto forces there to be a license, and no license is suggested anywhere in the scirpts or documentation that I could find, so I assumed GPLv2, mostly because it was easy to find a plain text link to an official copy.  Feel free to suggest/use something else.


      SUMMARY = "Scripts for configuring I/O for the Intel Edison MCU"
      HOMEPAGE = "https://software.intel.com/en-us/node/557356"
      LICENSE = "GPLv2"
      LIC_FILES_CHKSUM = "file://gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"
      # download the MCU scripts ("examples") from Intel mirror
      SRC_URI = "http://downloadmirror.intel.com/24910/eng/init_DIG.sh;name=init_DIG \
                 http://downloadmirror.intel.com/24910/eng/init_i2c8.sh;name=init_i2c8 \
                 http://downloadmirror.intel.com/24910/eng/init_mcu_PWM.sh;name=init_mcu_PWM \
                 http://downloadmirror.intel.com/24910/eng/set_DIG.sh;name=set_DIG \
                 http://downloadmirror.intel.com/24910/eng/read_DIG.sh;name=read_DIG \
                 http://downloadmirror.intel.com/24910/eng/init_UART1.sh;name=init_UART1 \
                 https://www.gnu.org/licenses/gpl-2.0.txt;name=gpl2 \
      SRC_URI[init_DIG.md5sum]     = "46b3d6f948d856c126cb33b922b20c37"
      SRC_URI[init_i2c8.md5sum]    = "016946e02cb47aab8480eabb2dffaed7"
      SRC_URI[init_mcu_PWM.md5sum] = "f5140aee56f4c8e15c1ae281df79db7c"
      SRC_URI[set_DIG.md5sum]      = "d3ac2518593a0d8d4ab776b7e6e38702"
      SRC_URI[read_DIG.md5sum]     = "9658f7c6760e327d2e0e12b14e31b4d6"
      SRC_URI[init_UART1.md5sum]   = "4be1cd844cb95181e0e276db3e53f7e3"
      SRC_URI[gpl2.md5sum]         = "b234ee4d69f5fce4486a80fdaf4a4263"
      S = "${WORKDIR}"
      do_install () {
          install -d -m 755 ${D}${exec_prefix}/local/bin/
          install -p -m 755 init_DI.sh ${D}${exec_prefix}/local/bin/
          install -p -m 755 init_i2c8.sh ${D}${exec_prefix}/local/bin/
          install -p -m 755 init_mcu_PWM.sh ${D}${exec_prefix}/local/bin/
          install -p -m 755 init_UART1.sh ${D}${exec_prefix}/local/bin/
          install -p -m 755 read_DIG.sh ${D}${exec_prefix}/local/bin/
          install -p -m 755 set_DIG.sh ${D}${exec_prefix}/local/bin/
      FILES_${PN} = "${exec_prefix}/local/bin/ \
                     ${exec_prefix}/local/bin/init_DIG.sh \
                     ${exec_prefix}/local/bin/init_i2c8.sh \
                     ${exec_prefix}/local/bin/init_mcu_PWM.sh \
                     ${exec_prefix}/local/bin/init_UART1.sh \
                   ${exec_prefix}/local/bin/set_DIG.sh \


      3. Add a line to the edison-image recipe:


      IMAGE_INSTALL += "mcu-scripts"


      Note that step 3 describes one of at least three ways to get a package into an image.  The BSP User's Guide suggests a different method involving .../build/local.conf.  One could also place the IMAGE_INSTALL line into a file edison-image.bbappend in the same directory as the recipe.  I prefer to have my package install commands centralized.


      4. build and deploy the image to include the new package (see the BSP User's Guide)


      (edit) Yocto now appears to require a checksum for all downloaded sources.


      Message was edited by: Nathaniel Niles