Giter Site home page Giter Site logo

nrobinson2000 / po Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 7.0 430 KB

The Future of po-util: Refactored, Modular, and Cross-Compatible

License: GNU General Public License v3.0

Shell 96.41% Ruby 0.65% Makefile 1.69% C 1.25%
particle offline utility cli linux mac particle-photon library local installer toolchain firmware po-util po new future dfu-util particle-cli particle-toolchain

po's Introduction

This tool has been deprecated. Please upgrade to neopo.

Build Status Join the chat at https://gitter.im/po-util/Lobby

po - The Future of po-util: Refactored, Modular, and Cross-Compatible

Why?

When I first created po-util, it was a single script, po-util.sh, that could be "installed" on Mac and Linux. It soon became very cumbersome, and I chose to split po-util into two repositories, po-util and homebrew-po. Maintaining the two repositories was tedious, as I had to do double the work every time I wanted to release a feature or make a fix.

My solution was to reunite the Mac and Linux versions back into a single repository, breaking the script into several modular files.

┌── bin/po
├── share/po-common
├── share/po-linux
└── share/po-mac
  • po is the main file, and the script that gets executed when a user runs po at the command line.
  • po-common is sourced by po, and contains all OS independent functions.
  • po-linux and po-mac contain the OS dependent settings and functions.

Regardless of OS:

  • po is installed at /usr/local/bin/po
  • po-common is installed at /usr/local/share/po-common

On Linux:

  • po-linux is installed at /usr/local/share/po-linux

On Mac:

  • po-mac is installed at /usr/local/share/po-mac

Install:

Universal Installer:

$ bash <(curl -sL https://raw.githubusercontent.com/nrobinson2000/po/master/install)

Caveats:

None at the moment. Just make sure to use the Universal Installer.

FAQ:

Is this really the future of po-util?

Yes. All future development will be on po. The legacy po-util repositories will remain supported, but future work will be focused on po.

po's People

Contributors

larseggert avatar nrobinson2000 avatar tomg736 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

po's Issues

Allow devices to be skipped

Could you please allow devices to be skipped if offline when doing multi ota updates

possibly with a cli switch like --skip-offline or just by default

[bug][ci] Fail to find header files relative to ./firmware directory

Using po for ci through travis-ci in NGenetzky/particle-project-serial-pub-sub.

build failed with: fatal error: iot/Serial_S1.h: No such file or directory

The header file is located relative to the compile directory. I used a symlink from firmware to src so that I could replicate particle project structure.

→ ls -l firmware ; find src/
lrwxrwxrwx 1 ngenetzky ngenetzky 3 Nov 12 22:31 firmware -> src
src/
src/serial_pub_sub.cpp
src/iot
src/iot/Serial_S1.h
src/iot/RateLimit.h

I verified that local builds using po photon build work as expected and produce a working binary.

Do I need to add include flags somewhere? Do I need to move them into a different location?

Notify user of user tracking in po?

I just noticed that po has some functionality for installations and updates. While I do see why this could be useful, it may be a good idea to at least notify the user about it, if not give them a way to disable it as well. Even Microsoft notifies users about telemetry in the dotnet command line tools.

I'd be willing to do this, but I'm planning on submitting a PR within the next few days already for Cygwin support, and I don't know if you would want both in one PR. (planning on doing both Cygwin and WSL, but Cygwin is currently the easiest of the two I'd say.)

`po dfu open` not working

On Ubuntu 20.04, I have installed po-util as well as dfu-util. However, po dfu open doesn't work anymore. It used to work in previous Ubuntu versions. po dfu close works however. Do I need to install something else as well to make it work?

po update throws error

Hi just was updating to the latest version and I get the error below:
nrobinson2000/newpo/newpo 0.2.8 -> 0.3.5

I tried running po update again (after po install) to see if this happens in 0.3.5 and indeed the same error was thrown.

Updating particle-cli...
Password:
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

Include sources from a directory outside project structure

My firmware depends upon a framework which resides in a different directory. This framework is generic and is needed by more such firmware. Is there any way to include sources from that folder in build process?
Any help is much appreciated.
Thanks.

Update po documentation

I really need to work on the documentation for po.

https://po-util.com

  • Provides information and links to documentation, GitHub, Gitter, etc.
  • I'd like to update the information on the site and change the look of the site to improve po marketing.

https://docs.po-util.com/

  • Provides documentation, tutorials, FAQ etc.
  • I'd like to get the documentation up to date with the latest po features.

Issues with compiling for & flashing xenon on arch linux

(This is a summary of our discussion on gitter.im)

Issue 1

po xenon flash-beta fails for me on arch linux in the linker step:

tve@soumak /h/s/g/p/gps-test> po xenon flash-beta

          ______    ______
         /      \  /      \    Building firmware...
        /██████  |/██████  |
        ██ |  ██ |██ |  ██ |   Build Parameters:
        ██ |__██ |██ \__██ |     xenon
        ██    ██/ ██    ██/      gps-test
        ███████/   ██████/
        ██ |
        ██ |
        ██/  po xenon build gps-test

/home/tve/.po-util/bin/gcc-arm-embedded/gcc-arm-none-eabi-5_3-2016q1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file module_user_memory.ld: No such
file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [../../../build/module.mk:235: /home/src/goobies/particle/gps-test/target/gps-test.elf] Error 1
make[1]: *** [../build/recurse.mk:12: modules/xenon/user-part] Error 2
make: *** [/home/tve/.po-util/src/particle.mk:46: flash-user] Error 2

This can be most easily fixed by adding the all target to the make invocations in particle.mk https://github.com/nrobinson2000/po/blob/master/share/particle.mk#L44-L54:

# Compile and flash the user part
flash-user: preprocess
        cd "${DEVICE_OS_PATH}/main" && make all program-dfu

# Compile and flash the user and system parts
flash-all: preprocess
        cd "${DEVICE_OS_PATH}/modules" && make all program-dfu

# Compile and flash debug build
flash-debug:
        cd "${DEVICE_OS_PATH}/main" && make all program-dfu MODULAR=n USE_SWD_JTAG=y

Issue 2

po dfu fails to find my xenon because I have another /dev/ttyACM device. This can be improved by changing the default setting of MODEM in https://github.com/nrobinson2000/po/blob/master/share/po-linux#L432-L435 to

for modem in /dev/ttyACM* /dev/serial/by-id/usb-Particle*; do
    if [ -e "$modem" ]; then
        MODEM="$modem"
        MODEM_DUO="$modem"
    fi
done

Thanks for creating po-util!!!

Windows support (possibly via Cygwin or WSL)?

Is there a possibility of running po on Windows using something like Cygwin or Windows Subsystem for Linux? I'd be willing to assist in porting to one of those, if need be (although it would probably be WSL if I do it).

installing po and USER

When installing po using

bash <(curl -sL https://raw.githubusercontent.com/nrobinson2000/po/master/install)

the process choked on a user name (USER) with a space under OS X, though I bet it's the same for Linux. Changing USER to be something without spaces fixed that problem. Not sure it warrants a change, but perhaps a warning or something?

Argon stuck with flashing green light

When I build and flash my Argon with po, I get no errors and the CLI reports a successful flash, but nothing seems to happen. The on-board LED is flashing green, which means it is trying to connect to WiFi.

I'm not sure if it isn't actually flashing despite the fact that I get Firmware successfully flashed to argon on /dev/ttyACM0, or if it did flash but it is just stuck looking for wifi despite the fact that I put it in MANUAL mode. I also tried disabling the wifi with WiFi.off(); and Particle.disconnect(); but it didn't do anything.

My firmware/main.cpp looks like this:

I'm just running po argon build && po argon flash but my LED isn't coming on and nothing is being printed to po serial monitor.

#include "Particle.h"

int led = D7;

SYSTEM_MODE(MANUAL);

void setup() // Put setup code here to run once
{
    Serial.begin(115200);
    Serial.println("starting");

    pinMode(led, OUTPUT);
}

void loop() // Put code here to loop forever
{
    Serial.println("loop");
    digitalWrite(led, HIGH);
    
    delay(500);

    digitalWrite(led, LOW);
    delay(500);

}

[po-docker] Minor "caveats" and missing dependencies

I was just running through a fresh build server creation on an official Ubuntu Server Docker image and noticed a couple minor details with the installer process. It's greatly improved over the last time I tried!

  • I don't use root for interactive shells. Using a user on Docker is not directly supported due to missing requisite sudo's on files curl'd into directories like /usr/local/share which are canonically owned by root:root. I installed by prepending sudo to the universal installer command; this has the consequence of making ~/.po-util owned by root:root instead of whoami. I've worked around this by running chown -R <whoami>:<whoami> ~/.po-util
  • /usr/local/share/po-docker: line 223: npm: command not found This is resolved by sudo apt-get -y install npm and re-running the universal installer.
  • [...] Run "man po" for help.
    ~ man po
    zsh: command not found: man
    :-) Ubuntu Server is really bare, even after unminimizeing.

Aside from these small issues, an empty project successfully builds with po on Ubuntu Server, and does not require sudo after initial installation. 👍🎉

Custom firmware

Is is possible to allow custom selection of firmware such as a fork of the particle firmware?

I am interested in changing the USB device descriptor as suggested in this post
Can the USB device’s descriptor be changed

However it would appear that the firmware needs to be forked to make the changes required, and then for that forked firmware be used in po

Hopefully this forked firmware could be selected from a local or git server of my own instead of github

Old Node version

Currently po pulls in node 9 which is no longer supported.
It gets the node version from curl -Ss https://api.github.com/repos/nodesource/distributions/contents/deb | grep "name" | grep "setup_"| grep -v "setup_iojs"| grep -v "setup_dev" | tail -1 which needs to be updated to select the newest version not just the last.

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.