Giter Site home page Giter Site logo

chip-sdk's Introduction

CHIP-SDK

Everything needed to develop software for C.H.I.P.

While it is possible to install the SDK natively, currently the only supported way is to run it from a virtual machine.

System Requirements

You'll need VirtualBox and Vagrant. For the virtual machine at least of free 1 GB RAM are necessary. Up to 40 GB of disk space may be used.

Installation

VirtualBox

  1. Install VirtualBox
  2. Install the Oracle VM VirtualBox Extension Pack for the host - this is necessary to flash C.H.I.P from inside the virtual machine.
  3. Operating system specific stuff:
    • If you are on Windows, you need to add the VirtualBox installation directory to your PATH.
    • In case of a Ubuntu host: add your user to the vboxusers group!

Vagrant

You may need to install Vagrant. There are a couple options:

  • Download from the Vagrant website
  • On OS X, you can use the homebrew package manager:
    1. you'll need Cask, so if you don't have it: brew install caskroom/cask/brew-cask
    2. then brew cask install vagrant

Git

Installation of Git depends on your operating system:

Clone the CHIP-SDK Git repository

Assuming you have git in your PATH, open up a terminal and type:

git clone https://github.com/NextThingCo/CHIP-SDK

Start up the virtual machine

In a shell on the host, change to the the CHIP-SDK directory and start up the virtual machine:

cd CHIP-SDK
vagrant up

A couple notes for the bleary eyed. If you get an error like:

error: The guest machine entered an invalid state while waiting for it to boot.

This probably means your version of VirtualBox needs updating and/or needs the Extension Pack. Update as necessary and try vagrant up again.

If you get the error:

error: Couldn't open file /Volumes/Satellite/gitbins/CHIP-SDK/base

that means you didn't cd CHIP-SDK.

Login

In the same shell on the host type the following:

vagrant ssh

If everything went well you should see the following prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

Now run the setup script that installs the necessary software inside of the virtual machine:

./CHIP-SDK/setup_ubuntu1404.sh

Congratulations! Your C.H.I.P. SDK is almost ready! To finish up and apply the updated permissions, log out of the virtual machine...

exit

Now you're ready to Flash a C.H.I.P. from your SDK!

Prepare your C.H.I.P. for Flashing

First, prepare CHIP with a jumper wire between the FEL pin and GND. In other words, connect Pin 7 and Pin 39 on header U14.

Here's a diagram that labels the headers and pins assuming the components are facing you and the USB port is oriented up:

Image of CHIP

And here's a photo with the jumper plugged in...

Image of CHIP

It's worth noting that this jumper needs to be present only when you connect CHIP to power. If for some reason the wire becomes disconnected after you have powered CHIP, there is no problem or need to panic.

Now connect CHIP to your computer with a micro-USB→USB-B cable. The power LED will illuminate.

It's time to begin! Open a terminal on your computer, and let's start up a virtual machine.

cd CHIP-SDK
vagrant up
vagrant ssh

If everything went well you should see the following prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

Now we're into C.H.I.P. and ready to flash an image.

Flash a new C.H.I.P. with the NTC buildroot image...

If you want to flash C.H.I.P. with a custom image, scroll down the page...If you're cool with our current buildroot image, keep going!

With our virtual machine running, we'll start at our trusty prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

Now let's download the latest firmware (i.e. a Linux kernel, U-Boot and a root filesystem all built with buildroot) and flash it to CHIP.

cd ~/CHIP-tools
./chip-update-firmware.sh

The flashing script will boot CHIP automatically for the first time, login and power off CHIP to make sure everything went well. This may take a while - please be patient.

If everything went OK, you can now power up your CHIP again and connect by typing:

cu -l /dev/ttyACM0 -s 115200

You can login to CHIP as chip or if you feel more powerful as root. In both cases the password is chip. Now let's give it a quick hardware test...

hwtest

If everything passed, your C.H.I.P. is ready to go! Have fun!

Flash a C.H.I.P. with Debian

Flashing C.H.I.P with Debian is very similar to flashing with buildroot. Actually, you only have to add the parameter -d to the chip-update-firmware.sh command. Just log in to the virtual machine again and start from our trusty prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

Follow these steps to flash your C.H.I.P with debian:

cd ~/CHIP-tools
./chip-update-firmware.sh -d

The flashing script will boot CHIP automatically for the first time, login and power off CHIP to make sure everything went well. This may take a while - please be patient.

If everything went OK, you can now power up your CHIP again and connect by typing:

cu -l /dev/ttyACM0 -s 115200

You can login to CHIP as chip or if you feel more powerful as root. In both cases the password is chip.

To Flash C.H.I.P. with your own custom buildroot image...

Start the build process

Logged in to the virtual machine again starting from our trusty prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

Lets' get in there and make something.

cd ~/CHIP-buildroot
make chip_defconfig
make nconfig

From here, you can navigate the menu and select what you want to flash onto your C.H.I.P. and what you don't. Detailing custom buildroot images is outside the scope of this tutorial. If you're curious, read Free Electrons wonderful buildroot documentation.

When you're finished with your selections, exit by hitting the F9 key, which will automatically save your custom buildroot to...

/home/vagrant/CHIP-buildroot/.config

NOTE: You can save an alternate build by hitting the F6 key, but only the image save to the above path will flash to C.H.I.P.

Now let's build your buildroot...

make

This will take a while. Depending on your computer, maybe an hour. Maybe grab some coffee...

Flash your own buildroot image

Logged in to the virtual machine again starting from our trusty prompt:

vagrant@vagrant-ubuntu-trusty-32:~$

type...

cd ~/CHIP-tools
BUILDROOT_OUTPUT_DIR=../CHIP-buildroot/output ./chip-fel-flash.sh

The flashing script will boot CHIP automatically for the first time, login and power off CHIP to make sure everything went well. This may take a while - please be patient.

If everything went OK, you can now power up your CHIP again and connect by typing:

cu -l /dev/ttyACM0 -s 115200

Unless you changed the users or passwords, you can login to CHIP as chip or root using the password chip.

Shutdown

To log out of the virtual machine at anytime, type:

exit

The virtual machine will still be running. To shut it down, type:

vagrant halt

Troubleshooting'

In case you run into trouble because the kernel in the VM was updated and the shared vagrant folder can no longer be mounted, update the guest additions by typing the following in the CHIP-SDK directory on the host:

vagrant plugin install vagrant-vbguest

Also look at this blog post

In case you get the error

`ERROR: You don't have permission to access Allwinner USB FEL device`

You'll need to run ./chip-update-firmware.sh as sudo:

sudo ./chip-update-firmware.sh

chip-sdk's People

Contributors

flybucket avatar kaplan2539 avatar soderstrom-rikard avatar

Watchers

 avatar  avatar

Forkers

pengguoguo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.