Giter Club home page Giter Club logo

mix_grisp's Introduction

GRiSP Mix plug-in

Mix plug-in to build and deploy GRiSP applications for the GRiSP board.

Summary

The package can be installed by adding mix_grisp to your list of dependencies in mix.exs:

def deps do
  [
    {:mix_grisp, "~> 0.2.0", only: :dev}
  ]
end

New Project Step-By-Step

Create New Project

Create a project using Elixir default project template:

```
$ mix new testex --module TestEx
$ cd testex
```

Add Dependencies

Add the following dependencies in the project mix.exs:

```
    defp deps do
        [
            ...
            {:grisp, "~> 2.4"},
            {:mix_grisp, "~> 0.2.0", only: :dev},
        ]
    end
```

Configure Grisp

Add the following configuration to your project:

```
    def project do
        [
            ...
            grisp: grisp(),
            releases: releases()
        ]
    end

    def grisp do
        [
            otp: [verson: "26"],
            deploy: [
                # pre_script: "rm -rf /Volumes/GRISP/*",
                # destination: "tmp/grisp"
                # post_script: "diskutil unmount /Volumes/GRISP",
            ]
        ]
    end

    def releases do
        [
            {:myapp,
                [
                    overwrite: true,
                    cookie: "grisp",
                    include_erts: &MixGrisp.Release.erts/0,
                    steps: [&MixGrisp.Release.init/1, :assemble],
                    include_executables_for: [],
                    strip_beams: Mix.env() == :prod
                ]}
            ]
    end
```

You can uncomment the lines in the deploy list after setting the proper mount point for your SD card if you want to deploy directly to it. The destination can be a normal path if you want to deploy to a local directory.

Add the following boot configuration files after changing GRISP_HOSTNAME to the hostname you want the grisp board to have, WLAN_SSID and WLAN_PASSWORD to the ssid and password of the WiFi network the Grisp board should connect to.

* `grisp/grisp2/common/deploy/files/grisp.ini.mustache`

    ```
    [erlang]
    args = erl.rtems -C multi_time_warp -- -mode embedded -home . -pa . -root {{release_name}} -bindir {{release_name}}/erts-{{erts_vsn}}/bin -boot {{release_name}}/releases/{{release_version}}/start -boot_var RELEASE_LIB {{release_name}}/lib  -config {{release_name}}/releases/{{release_version}}/sys.config -s elixir start_iex -extra --no-halt
    shell = none

    [network]
    ip_self=dhcp
    wlan=enable
    hostname=GRISP_HOSTNAME
    wpa=wpa_supplicant.conf
    ```


* `grisp/grisp2/common/deploy/files/wpa_supplicant.conf`

    ```
    network={
        ssid="WLAN_SSID"
        key_mgmt=WPA-PSK
        psk="WLAN_PASSWORD"
    }
    ```

Add Configuration

If not generated bu Mix template, add the file config/config.exs:

```
import Config
```

Check OTP Version

Verify that your default erlang version matches the one configured (26 in the example).

This is required because the beam files are compiled locally and need to be compiled by the same version of the VM.

Get Dependencies

Get all the dependencies:

```
$ mix deps.get
```

Deploy The Project

To deploy, use the grisp command provided by mix_grisp:

```
$ mix grisp.deploy
```

Troubleshooting

This BEAM file was compiled for a later version of the run-time system

Some bema files were compiled with a newer version of OTP, delete _build and deps, get the fresh dependencies (mix deps.get), and redeploy (mix grisp.deploy).

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.