Linux

From Pinguino
Jump to: navigation, search
Language: [[::Linux|English]]  • [[::Linux/es|español]]

Automatic installation

An installation script is available on the Download page.

This is the highly recommended method to install Pinguino on your computer.

Make the script executable with :

sudo chmod +x installer.sh

Launch it as a normal user, not as an admin :

./installer.sh

If you run in trouble, please read the following information relative to your distro.

Mandriva 2010.1

 libwxPythonGTK2.8
 libwxPythonGTK2.8-devel
 libusb1.0_0
 libusb1.0-devel
  • Download and unpack the last version of IDE in a directory (~/pinguino for example)
  • Run the following commands in a console (such as Konsole or Terminal) and type the following commands to allow full access to pinguino without being root (it will ask you your password for this administrative task)
cd "DIRECTORY WHERE YOU UNPACK THE IDE"
chmod a+x *.py
su (give root password)
cp 41-microchip.rules /etc/udev/rules.d/
cp 26-microchip.rules /etc/udev/rules.d/
groupadd microchip
usermod -a -G microchip $USER

Ubuntu Oneiric (11.10) amd64 64 bit

These instructions work on a fresh install of Oneiric Ocelot 64 bit and will install the SVN version:

  • Open a terminal window
  • Paste the following:
  sudo apt-get -y install subversion ia32-libs python-usb python-serial python-wxgtk2.8 lib32gmp3-dev lib32mpfr4 python-svn

Enter your password when prompted

  • Paste the following:
  cd /usr/lib32
  sudo ln -s libmpfr.so.4 libmpfr.so.1
  mkdir ~/src
  cd ~/src
  a=pinguino32

Should you wish to install the standard SVN version, paste the following:

  svn checkout http://pinguino32.googlecode.com/svn/trunk/ $a

Conversely, should you wish to install the x.3 version, paste the following:

  svn checkout http://pinguino32.googlecode.com/svn/branches/x.3/ $a
  • Paste the following:
  cd $a
  chmod a+x *\.py
  cd extra/rules
  sudo cp 41-microchip.rules /etc/udev/rules.d/
  sudo cp 26-microchip.rules /etc/udev/rules.d/
  sudo groupadd microchip
  sudo usermod -a -G microchip $USER
  cd ~/src/$a
  echo LD_LIBRARY_PATH="/usr/lib32:~/src/$a/linux/p32/bin:/usr/lib:/usr/lib64" ./pinguino.py > $a.sh
  chmod a+x $a.sh
  • Close the terminal window
  • Log out and back in again
  • Run ~/src/pinguino32/pinguino32.sh to start the IDE

Ubuntu Lucid (10.4)

  • Install the following packages using the package manager:
python-usb python-wxgtk2.8

Caution: the python-wxgtk2.6 should not be installed on your system, it's too old.

  • Download and unpack the last version of IDE in a directory (~/pinguino for example)
  • Run the following commands in a shell to allow full access to pinguino without being root (it will ask you your password for this administrative task)
cd "DIRECTORY WHERE YOU UNPACK THE IDE"
chmod a+x *.py
cd extra/rules
sudo cp 41-microchip.rules /etc/udev/rules.d/
sudo cp 26-microchip.rules /etc/udev/rules.d/
sudo groupadd microchip
sudo usermod -a -G microchip $USER

Ubuntu Lucid/Oneiric 64 bit (workaround)

  • Install the following packages using the package manager:
python-usb python-wxgtk2.8 lib32gmp-dev
  • Create a script for load pinguino:
echo "LD_LIBRARY_PATH="/usr/lib32:~/dev/Pinguino-svn/pinguino32/trunk/linux/p32/bin:/usr/lib:/usr/lib64" ./pinguino.py" > pinguino32.sh
chmod a+x pinguino32.sh
  • Now use that pinguino32.sh for load Pinguino32X IDE

Debian 32 bit or 64 bit

You have to give USB permissions to the user executing the IDE, otherwise you will get errors like "usb.core.USBError: [Errno 13] Access denied (insufficient permissions)" in file pinguinoPanic when trying to comunicate with PIC, resulting in the message "Pinguino found" frozen, or the board's green led blinking forever.

Doing this is accomplished by creating as root user the file /etc/udev/rules.d/99-pinguino.rules with the following content:

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="04d8", ATTR{idProduct}=="feaa", MODE="0666"

This works only for PICs 18F. For 32 bits PICs you should use instead the file provided with Pinguino in ./extra/rules/41-microchip.rules

Debian 64 bit (workaround)

Note (2012-07-28): The current version (SVN trunk) works flawlessly with Debian Testing 64 bit and libmpfr4-libgmp (64 bit). No symlinks needed or modifications of pinguino_start.sh needed.

  • Install the following packages using the package manager:
python-usb python-wxgtk2.8 lib32gmp-dev lib32mpfr4
  • Symlink the expected libmpfr.so.1 to libmpfr.so.4
cd /usr/lib32
sudo ln -s libmpfr.so.4 libmpfr.so.1
  • Create a script for load pinguino:
echo "LD_LIBRARY_PATH="/usr/lib32:~/dev/Pinguino-svn/pinguino32/trunk/linux/p32/bin:/usr/lib:/usr/lib64" ./pinguino.py" > pinguino32.sh
chmod a+x pinguino32.sh
  • Now use that pinguino32.sh to load Pinguino32X IDE

Gentoo 64-bit

First you need the standard Pinguino IDE package, and the 32-bit binaries - some of the binaries will still work, but probably not the compiler. The fastest way is to build your own toolchain is using CrossDev.

$ emerge crossdev
$ crossdev -t mipsel-elf

This should produce the binaries for the latest compiler package for the PIC32 platform. Now you need to change the compiler path in Makefile.linux in the 'sources' directory, find the CC definition, now it should read:

CC = mipsel-elf-gcc

One other file that needs to be replaced is the 'ubw32' binary in the 'linux/p32/bin' directory. Get the source from: Universal Bit Whacker Google Code page , unpack and just build.

$ make

Just copy the resulting binary to the directory mentioned earlier, and that's it!


Sabayon (64-bit)

The procedure for Sabayon (Sabayon Linux amd64 8 used here) is almost identical as for Gentoo (see above).

First, use equo to install crossdev (as root or sudo)

 $ equo install crossdev

Then

 $ emerge --sync

is necessary to pull the package definitions, that crossdev uses. Otherwise it will get lost, not knowing how to build this and that package.

Having done that

 $ crossdev -t mipsel-elf

should work fine.

Last step is to point sources/Makefile.linux to this compiler, rather than the compiler it ships with:

 CC = mipsel-elf-gcc

To make the IDE find ubw32 and ubw32 find the libraries it depends on (libhid.so), LD_LIBRARY_PATH needs to point to linux/p32/bin. (Linux, unlike other OS, will not add the executable's own directory to the places, where the dynamic linker looks for stuff.)

In pinguino_lin64.sh (x.3 branch) this is taken care of in like this:

 LOCALPATH=$(pwd)
 LD_LIBRARY_PATH=/usr/lib32:${LOCALPATH}/linux/p32/bin:/usr/lib:/usr/lib64 ./pinguino.py

If ubw32 still breaks then, a recompilation as explained in the Gentoo section above may be necessary.

Archlinux

  • Install the following packages
 python2-pyserilal
 wxpython
 aur/pyusb
 aur/pysvn-p2
  • Download and unpack the last version of IDE in a directory (~/pinguino for example).
  • In case of 64-bit systems you have to download ubw32, compile it and replace the provided in IDE one. You would also need aur/libhid installed to compile it:
 wget -nH -np -r -L 'http://vak-opensource.googlecode.com/svn/!svn/bc/117/trunk/utilities/ubw32/'
 cd svn/\!svn/bc/117/trunk/utilities/ubw32/
 make
 cp ubw32 ~/pinguino/linux/p32/bin/ubw32
  • Since the 'arch' command is not really something essential, you would like to edit pinguino_start.sh to reflect your architecture, or you can choose to edit pinguino_start.sh changing the link
$(arch)

with the line:

$(uname -m)
  • Due to early steps in introducing python3 as the main python version in Arch, change python to python2 and it won't hurt to change the shebang expression in the ~/pinguino/pinguino.py
  • You should be able to run the IDE, compile examples and upload it to the board if you start it with root rights. (sudo ./pinguino_start.sh)
  • Run the following commands in terminal and type the following commands to allow full access to pinguino without being root (it will ask you your password for this administrative task)
cd "DIRECTORY WHERE YOU UNPACK THE IDE"
sudo cp ./extra/rules/{41-microchip.rules,26-microchip.rules} /etc/udev/rules.d/
#archlinux by default doesn't provide plugdev group. If you already have this group in your /det/group skip the following line
sudo groupadd plugdev
sudo usermod -a -G plugdev $USER
sudo chgrp -R plugdev /dev/bus/usb/

Common troubles

My Pinguino doesn't seem to work

When connected to your computer, your Pinguino should be detected even without a driver if your Pinguino is either in bootloader mode or running a program that uses the USB interface, for example the program includes a CDC instruction such as CDC.printf.

To check that your Pinguino is detected, launch a terminal and run the following commands:

lsusb
This command list every USB device connected (even without any external devices connected you will see some system devices).
$ lsusb
Bus 0xx Device 0yy: ID 04d8:feaa Microchip Technology, Inc. 
...
dmesg
This command returns the last system messages, there are some when you connect an USB device.
$ dmesg
...
[ tttt.tttttt] usb 2-1.1.2: new full speed USB device using ehci_hcd and address yy
[ tttt.tttttt] usb 2-1.1.2: configuration #1 chosen from 3 choices

If there are a lot of system messages you can combine grep with dmesg to list only the system messages containing usb

$ dmesg | grep -i usb
...
[ tttt.tttttt] usb 2-1.1.2: new full speed USB device using ehci_hcd and address yy
[ tttt.tttttt] usb 2-1.1.2: configuration #1 chosen from 3 choices

Pinguino is a "full speed USB device", if you get "new low speed USB device", you have transposed the USB signal lines. You must have connected the D+ signal to the D- pin and the D- signal to the D+ pin.

Dark GTK themes

If you have a dark GTK theme configured, some parts of the IDE may look funny and rather unusable - using black fonts on dark backgrounds.

A common way to circumvent this problem with any GTK app is to make them load a different GTK-theme. The environment variable GTK2_RC_FILES can be used to override the theme used by a program.

In a shell or the Executable field in a desktop-link, prepend this to the name of the executable (pinguino.py or pinguino_lin64.sh):

 GTK2_RC_FILES=/usr/share/themes/Default/gtk-2.0-key/gtkrc /your/pinguino-IDE/executable

This is just an example. If this does not work for you, you may want to check, if /usr/share/themes/Default/gtk-2.0-key/gtkrc exists in your installation and adjust the path. You could then also try some other than the default theme, of course.

Other Problems

See also Common Bugs.