I have updated po-util a lot recently. Most importantly, I have:
- Added the
po serial
command for monitoring device output - Cleaned up code and removed redundancies
- Created a promotional poster
- Created a better logo
- Purchased po-util.com domain
I have updated po-util a lot recently. Most importantly, I have:
po serial
command for monitoring device outputPo-util is a handy script for installing and using the Particle Toolchain on Ubuntu-based distros and OSX. It downloads and installs: dfu-util, nodejs, gcc-arm-embedded, particle-cli, and the Particle Firmware source code. Information about po-util can be found on my website. https://po-util.com
po update
and po install
to update and re-install.You can get a copy of po-util at the Github repository. The easiest way is to download po-util.sh
from this link and run:
./po-util.sh install
To setup po-util and install dependencies.
Alternatively, you can clone po-util with git:
git clone https://github.com/nrobinson2000/po-util
cd po-util
./po-util.sh install
When installing po-util, an alias is added to your .bashrc
that allows you to run po
from anywhere to use po-util.
# Quick Install / Update
curl po-util.com/download | bash
Copy and paste this into your terminal.
Note: We download everything from well known locations and Github. While we believe this is a reasonable method as a quick start, it’s always a good idea to know what is going on under the hood.
Please use the Manual Install/Update instructions in the post above.
Hi guys!
Can you please join my Thunderclap Campaign to help people discover po-util? https://www.thunderclap.it/projects/44489-help-support-po-util
Particle Offline Utility, pronounced po-util, is a script for installing and using the Particle Toolchain on Ubuntu-based distros and OSX.
Po-util makes it easy for developers to download the Particle Toolchain and install the required dependencies to quickly begin creating projects using the Particle Platform.
Po-util features a responsive experience, giving developers the tools they need for seamless local development. Po-util provides understandable commands for simplifying complex tasks like properly compiling and flashing firmware.
Po-util downloads and installs: dfu-util, nodejs, gcc-arm-embedded, particle-cli, and the Particle Firmware source code.
Nathan Robinson
@nrobinson2000
Po-util now supports building directories relative and un-relative to the current working directory. Support for other Linux Distributions, (Fedora, Arch) is being developed.
Hello nrobinson,
Po-util is a very handy script–thanks much for sharing. How exactly does po-util trigger DFU mode on a Photon/P1 without pressing the SETUP and RESET buttons? Can po-util trigger DFU on a Photon/P1 straight from the factory?
-shm45
@shm45
To make po-util use the default Particle baud rate you need to edit the ~/.po
configuration file and change the DFUBAUDRATE=19200
line to DFUBAUDRATE=14400
This is explained in the Triggering DFU mode on your Device(s) section of po-util.com.
po-util uses the stty
command to change the baud rate of a device. When a Particle device detects a specific baud rate (14400 is Particle’s default), it goes into DFU mode.
Yes, this is supported on all Particle devices out of the box after editing the po-util config file.
Excellent–thank you ScruffR and nrobinson.
Cheers,
shm45
I have added support am working on adding support for RHEL and Arch Linux distributions. I have also added a po config
command which lets users easily select what branch of Paticle firmware they want to use and what baud rated they want to use to put devices into DFU mode.
I need users on distros like Fedora and Arch to test if po-util installs properly on their system. https://github.com/nrobinson2000/po-util/issues/24
Edit:
I am testing po-util in an Arch virtual machine and it is not working. I’m getting a similar error as this thread. Even if I completely delete arm-none-eabi, it still looks for it, saying:
/bin/sh: 1: /home/nrobinson/bin/gcc-arm-embedded/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc: not found
This is driving me crazy. I have checked po-util for anything that is causing this error, but I have not found anything. Note: Arch did not have a desktop environment, and I am beginning to think that no DE correlates to po-util not working.
I am now trying po-util on Fedora in another virtual machine.
Edit:
On Fedora 24 I get this error:
Building firmware for Production Photon, platform ID: 6, product ID: 6
/bin/sh: /usr/local/bin/arm-none-eabi-gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
/home/nrobinson/github/firmware/build/arm-tools.mk:43: *** "ARM gcc version 4.8.4 or later required, but found ". Stop.
build/recurse.mk:11: recipe for target 'communication' failed
make: *** [communication] Error 2
A bit different, but still not working. Basically, it’s having the same problem as Arch, where it “can not find” the executables, even though they exist, and so do their links. They are visible to which
, and found by which
.
Does anyone have any input on this problem?
Some thoughts:
Check the permissions for the file that you are trying to execute. I presume you install as root and then run another another username.
Check /var/log/secure for permissions violations or other errors.
Do you have SELinux enabled? Check using sestatus. That can upset a few things.
Using strace might help if you can narrow the problem down to a single command otherwise you will get too much diagnostic trace. For example, if I call zcat I get this:
[tim@c7va ~]$ strace zcat
execve("/usr/bin/zcat", ["zcat"], [/* 31 vars */]) = 0
If I then remove permissions to zcat I get this:
[tim@c7va ~]$ strace zcat
execve("/usr/bin/zcat", ["zcat"], [/* 31 vars */]) = -1 EACCES (Permission denied)
write(2, "strace: exec: Permission denied\n", 32strace: exec: Permission denied
) = 32
exit_group(1) = ?
+++ exited with 1 +++
The other thing that I can think of is that environments can be slightly different depending on how a shell is invoked. Google “bash_profile or .bashrc” and see whether that might be affecting you.
On the Fedora virtual machine I get this when running sestatus
:
[nrobinson@localhost po-util]$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: error (Permission denied)
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 30
When I use which
and strace
, I get:
[nrobinson@localhost po-util]$ which arm-none-eabi-gcc
/usr/local/bin/arm-none-eabi-gcc
[nrobinson@localhost po-util]$ strace arm-none-eabi-gcc
execve("/usr/local/bin/arm-none-eabi-gcc", ["arm-none-eabi-gcc"], [/* 49 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
I’m going to see what happens when I follow this guide.
Edit:
No change after changing SELinux to permissive mode.
Edit:
I get similar results on Arch for strace
:
execve("/usr/local/bin/arm-none-eabi-gcc", ["arm-none-eabi-gcc"], [/* 19 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
Edit:
This problem has also happened in the past on Ubuntu (14.04) on Travis CI.
However, Circle CI (Also Ubuntu 14.04) does not have any problems.
Neither does my Ubuntu VPS (16.04), which is able to use po-util just fine.
I Googled and found an article that says you can get the not found message if one of the dependent libraries isn’t available. I guess that attempting to execute the compiler causes a cascade load of other modules and it’s one of those that wasn’t found.
Ref: https://ubuntuforums.org/showthread.php?t=2183052
I therefore tried the following on one of my Centos 7 VMs (64 bit):
Downloaded https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
unzipped it
[root@c7va bin]# ./arm-none-eabi-gcc
-bash: ./arm-none-eabi-gcc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[root@c7va bin]# strace ./arm-none-eabi-gcc
execve("./arm-none-eabi-gcc", ["./arm-none-eabi-gcc"], [/* 24 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
[root@c7va bin]# file arm-none-eabi-gcc
arm-none-eabi-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
yum install glibc.i686
[root@c7va bin]# ./arm-none-eabi-gcc
arm-none-eabi-gcc: fatal error: no input files
compilation terminated.
So I was able pretty much reproduce the error that you get. That last command suggests that the code can now be loaded and it simply needs an input file. The reason why I installed glibc.i686 was because it was one of the packages that I used to install when I was building my own Docker containers for compiling the Particle firmware. That was 18 months ago so I’ve forgotten why I had to do it but this is probably why
@timx
Thank you for your help. Installing the glibc.i686
package fixed the arm-none-eabi-gcc
part of the problem, but I also had to install vim-common
to provide the xxd
command, and perl-Archive-Zip-1.58-1.fc24.noarch
to provide to crc32
command. Installing these 3 extra packages makes po-util work perfectly on my Fedora virtual machine.
I suspect that to fix the problem on Arch, I will have to install something like glibc
.
Update:
Installing lib32-glibc
, vim
and yaourt
with pacman
and installing perl-archive-zip
from yaourt
worked for Arch.
Update:
Installing the libc6-i386
package on Ubuntu fixes the problem for Travis CI.
I have added these packages to the installation part of po-util, and it should now work on all of these distributions.
Update:
I think arm-none-eabi-gcc
requires the 32bit libraries for C.
I just made a guide on Hackster about po-util. Read it here https://www.hackster.io/nrobinson2000/use-po-util-to-build-code-for-particle-devices-37629f
I have now built a Library manager into po-util. It lets you download and use libraries hosted on GitHub easily in multiple project directories by creating symbolic links. Here is a preview of the commands for the Libray manager:
"po library": The Particle Library manager for po-util.
Libraries are kept in ~/.po-util/lib
Commands:
get Download a Particle Library from GitHub and optionally name it.
install Example:
po lib get https://github.com/user/libraryName libraryName
add Add a downloaded library to a po-util project.
import Libraries are added in the firmware directory as soft links.
Example:
po lib add libraryName
remove Remove a library from a po-util project.
rm Just the soft links are deleted.
Example:
po lib rm libraryName
create Create a library from C++ files in the project directory.
Example:
po lib create someLibrary
purge Uninstall (delete) a library from ~/.po-util/lib
Example:
po lib purge someLibrary
list Show all libraries in ~/.po-util/lib
help Show this help documentation.
I have also fixed some minor bugs.
UPDATE:
I made a post about how to use the library manager to download a library available on the Web IDE.
I can’t heart this enough!
Thanks. The only thing po-util is missing now is a Windows version, although people should just be using GNU/Linux anyway.
I have added support for Atom Build shortcuts for po-util. The shortcuts are interpreted by the atom build package, and the corresponding po-util command is run.
Atom Build Shortcuts:
Build CTRL-ALT-1 These shortcuts allow you This requires the
Flash CTRL-ALT-2 to run common po-util "build" package for
Clean CTRL-ALT-3 commands quickly while Atom. Get it with:
DFU CTRL-ALT-4 using Atom. "apm install build"
OTA CTRL-ALT-5
As always, po-util can be installed with:
curl -fsSLO https://raw.githubusercontent.com/nrobinson2000/po-util/master/po-util.sh
./po-util.sh install
Or if you already have po-util just run:
po update