Playdate SDK for Linux?

Oof, I meant to say "neither the Windows nor Linux simulator" in the first sentence. :smiley:

1 Like

Awesome, thanks for the update! I'm getting by on OS X right now, but I'd much rather be helping test the Linux toolchain.

Any update on this? I see that SDK 0.10.2 was published, but a linux build wasn't included.

PlaydateSDK-0.10.2.zip (4.8 MB)

Thanks for the reminder. Here's a Linux version of the 0.10.2 SDK. It has had hardly any testing, which is why it didn't make it into the general release, but maybe you can help us with that.

You can leave feedback or questions in this thread.

4 Likes

:star_struck: thank you, that's awesome!

Thank you! I've received my Developer Preview hardware so I'm gonna start playing with this all. :playdate_sideways_smile:. I downloaded the SDK and am reading through the docs now!

One question: is the simulator included in this release? I seem to have the pdc and pdutil binaries, but can't find the simulator.

The Linux simulator didn't land in the 0.10.2 SDK but here's the latest build from our CI server which does have it.

Please let me know how it goes. As I said earlier, it's had very little testing!

PlaydateSDK-0.10.2.zip (7.7 MB)

2 Likes

Thanks for including the simulator! A couple of notes for anyone else trying to use it on linux:

On first launch, the simulator couldn't find the PlaydateSDK. I had unzipped it to ~/playdate, so I edited ~/.Playdate\ Simulator/Playdate\ Simulator.ini as follows:

SDKDirectory=/home/dorthu/playdate/
SimulateDeviceAppearance=1
ShowConsole=1

(In this case /home/dorthu is ~ - the ini file requires an absolute path)

I also had to mkdir ~/playdate/Disk. With that done, the simulator runs great.

Additioanlly, I integrated it into my Makefile for easy testing:

PDC ?= ~/playdate/PlaydateSDK-0.10.2/bin/pdc
PLAYDATE_SIMULATOR ?= ~/playdate/PlaydateSDK-0.10.2/bin/PlaydateSimulator
PLAYDATE_SDK_PATH ?= ~/playdate/PlaydateSDK-0.10.2/
PDX_NAME ?= 'Big Head'

@PHONEY: build
build:
	$(PDC) -sdkpath $(PLAYDATE_SDK_PATH) src/ $(PDX_NAME)

@PHONEY: simulate
simulate: build
	$(PLAYDATE_SIMULATOR) $(PDX_NAME).pdx

In this case, my pdx is named "Big Head" - this can be changed to anything. I am assuming that all code and assets for the game live in a directory named src in the same folder as the Makefile.

With the above setup, I can run make simulate to build and run this in the simulator immediately. So far, no issues.

Thank you again for sharing this build, it's really nice to be developing on Linux :playdate_heart_eyes:

3 Likes
Usage: pdutil <device> <action> [options]
  device: 
    path to Playdate serial port, ie; /dev/ttyACM0
  actions:
    datadisk           - Mount Playdate data partition
    recoverydisk       - Mount Playdate recovery partition
    run <path>         - Run .pdx from device's data partition

pdutil "install" command intentionally missing? Looks like I can upload stuff via datadisk and copying files around.

1 Like

I've been installing games with something like this:

pdutil /dev/ttyACM0 datadisk
cp -r MyGame.pdx /media/$(whoami)/PLAYDATE/Games/

I haven't figured out how to correctly unmount the playdate through the console yet, which is why this is missing from my Makefile (the unmount button in Nautilus works though, I'm probably just missing something obvious).

How to Unmount looks like it should work on Linux.

I thought so too, but while umount /media/$(whoami)/PLAYDATE did unmount the filesystem, the playdate remained in datadisk mode - I assume there's another step I missed.

"install" is missing because I, as a fairly inexperienced Linux programmer, couldn't figure out how to determine the mount point for the disk (it's not /media on all distros). And I'm also not sure how to "eject" the disk, especially if umount doesn't do the trick. We'll keep looking into this, but if anyone happens to know, it might speed things up. :slight_smile:

1 Like

You're correct, "pdutil install" is just a shortcut for datadisk, copying the file to the PLAYDATE volume, then ejecting the disk. So that is a workaround that can be used for now.

It looks like there is an eject command too.

1 Like

Yep, sudo eject /media/dorthu/PLAYDATE did it :playdate_happy:

1 Like

Sadly not really one standard to go by :frowning:

I might do a little more digging on what standard apps do, but I've done some hacks for now. It's standard for any app to use udev rules, at least. The mounting bits are less standard as linux doesn't really want non-root users to mount things by default.

/etc/udev/rules.d/80-playdate.rules

SUBSYSTEM=="tty", ATTRS{manufacturer}=="Panic Inc", ATTRS{product}=="Playdate" SYMLINK+="playdateACM%n", GROUP="dormando"

SUBSYSTEM=="block", SUBSYSTEMS=="scsi", ATTRS{model}=="Playdate        ", SYMLINK+="playdate%n", GROUP="dormando"

May also need:

SUBSYSTEM=="tty", ATTRS{manufacturer}=="Panic Inc", ATTRS{product}=="Playdate", ENV{ID_MM_DEVICE_IGNORE}="1"

... as its own line or in the first line to avoid an issue opening the device when first plugged in.

Added to /etc/fstab:

/dev/playdate1 /mnt/playdate vfat noatime,noauto,group 0 0

... which creates some stable symlinks when the device is plugged in (for those of us who may have many ttyACM's...). The "group" option to the fstab line lets my user mount and unmount the device without sudo or root. eject also works.

A simple upload script would look like:

#!/bin/bash
pdutil /dev/playdateACM0 datadisk
sleep 2
mount /mnt/playdate
cp -R $1 /mnt/playdate/Games/
umount /mnt/playdate
eject /dev/playdate

... which you could then call from a makefile.

... I'll probably write a better script that waits for the devices to show up before doing things. There's also a bit of delay before you can re-run the mount routine (think I need another rule to disable the modemmanager). I also don't know if you're supposed to leave it mounted while testing or not :stuck_out_tongue: easy enough to adjust the script if so.

Also depending on your distro it will automount somewhere via the label PLAYDATE once the datadisk command is sent. So the rest of this might not make sense. :slight_smile:

[edit]: to expand a bit: all the various devices I have that are accessed under linux, either mount somewhere by default when plugged in (without being poked first, and then they stay mounted), or stream firmware over the /dev/ttyACM* device since distro's usually have a 'dialout' or similar group that it's easy to add your user to. Playdate seems to want to do both.

3 Likes

Just had a few minutes to poke today: compile/test/install lua games works okay. C does not out of the box.

on ubuntu: apt-get install gcc-arm-none-eabi is enough to run the compile for the on-device bin (almost) but the simulator one is calling clang with dylib stuff still, and isn't passing -lm to my main.c.

the cmake on my ubuntu 19.10 is apparently too old to rebuild the files and I haven't done any cmake in over a decade so I don't have time to go any further tonight. :frowning: I'll try again tomorrow night but posting now in case anyone cares.

I also couldn't get the simulator's device dropdown to do anything, but didn't try very hard yet.

I haven't tried building C, but I can confirm the simulator's device dropdown doesn't do anything, and that I also didn't try very hard to figure it out.

1 Like

The Linux build of the Playdate Simulator currently does not support:

  • Serial communication with PlayDate device
  • Loading C API games

We probably should have mentioned that earlier ... :slightly_smiling_face:

2 Likes