Skip to content
mxmxmx edited this page May 1, 2019 · 63 revisions

setting up piCore

  • if you don't mind a little more config-tediousness, piCore (tinycore for ARMv6/v7) seems to offer slightly better performance than raspbian. +/- a few quirks, setting things up is pretty similar. the easiest thing is probably using a older raspberry with ethernet or usb/serial dongle, if you have one. then port your working pd sketches. you can then also set up wireless, of course (s.b.)

steps:

  • get piCore here (9.0.3 at the time of writing)

  • move the image onto your SD card.

  • ssh into piCore. ssh tc@192.168.xx.xx; password is piCore

  • first thing you have to do is expand the partition:

    • type: sudo fdisk -u /dev/mmcblk0
    • type p, that will list two partitions: /dev/mmcblk0p1 and /dev/mmcblk0p2
    • write down the start cylinder of /dev/mmcblk0p2
    • delete /dev/mmcblk0p2: type d, then 2 (= partition #2)
    • write the changes: type w
    • reboot: type sudo reboot
    • ssh into piCore again, as above
    • type sudo fdisk -u /dev/mmcblk0
    • recreate /dev/mmcblk0p2: type type n (new), then p (primary), then 2 (= partition #2), then the number you've written down (start cylinder); enter (default stop cylinder) and then save: w
    • reboot: type sudo reboot
  • once rebooted, resize the filesystem: sudo resize2fs /dev/mmcblk0p2

  • now, we can install/configure the few things we need to make things work; the concept involved are bit different, if you're used to raspbian, ubuntu, or the like but not drastically different. to install stuff ("extensions") you use tce-load; to make persistent changes, you have to use filetool.sh -b.

  • first then, install some things we'll need (the -wi flag meaning the app will be available "onboot"):

    • tce-load -wi alsa.tcz (alsa)
    • tce-load -wi alsa-utils.tcz (more things for alsa)
    • also install (using tce-load -wi): git.tcz, make.tcz, gcc.tcz, compiletc.tcz, wget.tcz, tar.tcz, acl.tcz, wiringpi.tcz, wiringpi-dev.tcz, libunistring.tcz , and nano.tcz (or whichever editor you prefer)
  • if you intend to use wifi, you'll also need wireless_tools.tcz and wpa_supplicant.tcz

  • next, edit the device-tree overlay. in piCore, the file in question is /mnt/mmcblk0p1/config.txt:

    • mount the partition: mount /mnt/mmcblk0p1

    • open the file: sudo nano /mnt/mmcblk0p1/config.txt (you may have to export TERM=xterm first)

    • and add the following:

       dtparam=audio=off
       gpu_mem=16
       dtparam=i2c_arm=on
       dtparam=spi=on
       dtparam=i2s=on
       device_tree_overlay=i2s-mmap
       ### wm8731:
       device_tree_overlay=rpi-proto
      
    • save the file.

  • next, get pd and the externals:

    • get pd from the man himself: wget http://msp.ucsd.edu/Software/pd-0.46-7.armv6.tar.gz (note this is for ARMv6. you'll need a different .gz file for ARMv7. see http://msp.ucsd.edu/Software)
    • untar the zip file: tar -zxvf pd-0.46-7.armv6.tar.gz, and remove it: rm pd-0.46-7.armv6.tar.gz
    • get the terminal tedium stuff: git clone git://github.com/mxmxmx/terminal_tedium
    • compile the externals using gcc or simply move the pre-compiled ones to the ../pd-0.46-7/extra/ folder; for example:

    mv /home/tc/terminal_tedium/software/externals/*.pd_linux /home/tc/pd-0.46-7/extra/

  • back up everything: filetool.sh -b and reboot

  • once rebooted, give pd a testrun: e.g. sudo /home/tc/pd-0.46-7/bin/pd -nogui -noadc -rt /home/tc/terminal_tedium/software/adc_test.pd (this shouldn't complain)

start up script:

  • at this point, things should be ready to use. a start up script will start things at set-up; in the following example, we put one called start.sh into the home directory:
    • touch /home/tc/start.sh

    • nano /home/tc/start.sh

    • the contents of the file might simply look like so:

      #!/bin/sh
      
      sudo /home/tc/pd-0.46-7/bin/pd -nogui -noadc -rt -audiobuf XX /path/to/patchname.pd &
      
    • where patchname.pd is your patch, XX some number that works for you (= size of audiobuffer; the lower, the less latency)

    • make it executable: sudo chmod 755 /home/tc/start.sh

    • and add it to bootlocal.sh (which runs after the boot): sudo nano /opt/bootlocal.sh (also change the CPU frequency governor to performance ):

#!/bin/sh

# Start serial terminal
/usr/sbin/startserialtty &

# Set CPU frequency governor to performance
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Load modules
/sbin/modprobe i2c-dev

# Start openssh daemon
/usr/local/etc/init.d/openssh start

# ------ Put other system startup commands below this line

/home/tc/start.sh
  • back up everything: filetool.sh -b. pd should now be running your patch after piCore booted up.

wireless:

One way that works is the following:

  • first run wpa_passphrase [SSID] [password], where SSID is your network name and password the password; copy the output, you'll need it in the next step
  • now, create a file called wpa_configure.conf in /opt: sudo nano /opt/wpa_configure.conf
  • it'll look somewhat like so (details will depend on your network):
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="[the name of your network]"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        psk=[the long number you've just copied]
}
  • add the path (ie /opt/wpa_configure.conf) to /opt/.filetool.lst

  • now add you can add the wlan stuff to your start-up script:

#!/bin/sh

sudo /home/tc/pd-0.46-7/bin/pd -nogui -noadc -rt -audiobuf 15 /home/tc/mypatch.pd &

sleep 2

sudo wpa_supplicant -B -D wext -i wlan0 -c /opt/wpa_configure.conf &

sleep 2

sudo /sbin/udhcpc -b -i wlan0 -x hostname:$(/bin/hostname) -p /var/run/udhcpc.wlan0.pid &
  • note: to make this work reliably with my wifi dongle, i also had to add

options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

to /etc/modprobe.conf . (and add /etc/modprobe.conf to /opt/.filetool.lst)

  • filetool.sh -b