GithubHelp home page GithubHelp logo

zsoltmazlo / cpshw-firmware Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jw3/cmake-particle-firmware

0.0 0.0 0.0 70 KB

Proof of concept: Using CMake to build Particle apps

License: GNU General Public License v3.0

CMake 41.43% C++ 55.73% Shell 2.84%

cpshw-firmware's Introduction

Example CMake Cross Compile Particle Firmware

An example of using CMake to build firmware for particle devices.

goals

  • use cmake to build firmware
  • use clion as an ide
  • support third party library integration
  • do not install the particle cli
  • be simple to setup and use
  • dont brick my boards

status

As of 04/2018 using this without issue to flash photons and electrons while working exclusively out of JetBrains CLion without any connection to cloud.

Development flow in CLion is typical to what you would expect in a CMake project.

The flashing app works well, the python tweaks seem to have eliminated all misfires.

Have not bricked any boards. Still want to test what happens if a board is flashed when specifying the wrong platform...

Working on repository and patterns for sharing CMake modules for particle libraries; https://github.com/jw3/particle-cmakes

Conan integration is on the radar but nothing planned yet.

building

The build.sh script requires a single parameter that identifies the platform

build.sh photon

Only photon or electron are acceptable values.

An additional parameter can be passed to perform a quick build (dont delete previous compilation)

'build.sh photon quick'

flashing

Do so at your own risk!

  • flash <app> <connection>

Currently the only supported connection is usb.

Example: flash tinker usb

If running from the flash script in the root of the source dir you must provide the build directory:

BUILD_DIR=build flash tinker usb

This then uses the build configured flash script in the root of the build directory.

The flasher script is setup to use auto dfu mode. Its hardcoded as this for now

PARTICLE_SERIAL_DEV = /dev/ttyACM0
START_DFU_FLASHER_SERIAL_SPEED = 14400

hacking references

development

particle calls for

Currently, the 4.9-2015-q3-update is recommended. The 5.3.1 version can be used now and will be used for cloud compiles starting with system firmware 0.7.0. The 5.4.x and 6.x versions are not recommended at this time.

By default, dfu-util requires sudo (root access) to run. This will cause a problem using the program-dfu option in make, and many other locations.

Add the particle rules from https://docs.particle.io/assets/files/50-particle.rules

sudo cp 50-particle.rules /etc/udev/rules.d/

errors

  • 'bytecode stream generated with LTO version 4.0 instead of the expected 3.0'
    • the firmware was built with different gcc than is being used to compile the app
    • ran into this switching between 4.9 and 5.3
  • firmware 0.7.0
  • 'build.mk:65: *** "No sources found in /tmp/.mount_jetbraUvOxBx/". Stop.'
    • when compiling firmware 0.7.0 from clion console
    • use a non-clion console and builds fine

using elsewhere

Include the three main components

include(${PLATFORM})
include(particle)
include(flasher)

At this time there is no convenient way of obtaining the files these includes require. Eventually there will be a conan package that provides all of this.

Also this project will be progressing at some undefinable rate, https://github.com/jw3/particle-cmakes

downloads

udev rules

system firmware updates

currently using manual process described here, including downloading the firmware binaries from the github releases.

going into safe mode immediately after establishing connection is a symptom of mismatched firmware.

steps

  1. enter DFU mode
  2. dfu-util -d 2b04:d00a -a 0 -s 0x8060000 -D system-part1-x.y.z-electron.bin
  3. dfu-util -d 2b04:d00a -a 0 -s 0x8020000 -D system-part2-x.y.z-electron.bin
  4. dfu-util -d 2b04:d00a -a 0 -s 0x8040000:leave -D system-part3-x.y.z-electron.bin

missing the :leave modifier on the last step will cause the device to remain in DFU mode, resetting manually will work

the only firmware that I have patched with remote user compilation is the 0.6.4 release.

notes

  • successfully flashed both photon and electron with multiple firmwares
    • sanity checked round trips after flashing using the tinker mobile app
  • targets must be compiled sequentially at this time (ie. -j1)
  • patched firmware repository to enabled remote user module
  • to use nested cmake directories use include
    • do include(dir/CMakeLists.txt)
    • dont add_subdirectory(dir)

related works

credits

  • tracker2 is an example from NeoGPS

cpshw-firmware's People

Contributors

jw3 avatar

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.