BastilleBSDのPIOでATTiny85

ちょっと思うところあって、BastilleBSDのLinuxエミュレーションのPIOでATTiny85のプログラムを作ってみようと思いました。

pio init board attiny85して以下をplatformio.iniに追加します。

```
upload_protocol = usbtiny
```

コンパイルはちゃんとできるのですが、uploadがエラーになります。

Arduinoの書き込みはシリアルのISPでできますが、ATTinyはUSBTinyなどのISPになるのでUSBがjail内で見えないといけません。以下をホストの設定に追加します。

```:/etc/devfs.rules 
add path 'usb/*' mode 0666
add path 'usbctl' mode 0666
add path 'ugen*' mode 0666
```

できました。

```
% pio run --target upload
Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny85.html
PLATFORM: Atmel AVR (4.0.0) > Generic ATtiny85
HARDWARE: ATTINY85 8MHz, 512B RAM, 8KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES: 
 - framework-arduino-avr-attiny @ 1.5.2 
 - tool-avrdude @ 1.60300.200527 (6.3.0) 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/attiny85/src/main.ino.cpp.o
Archiving .pio/build/attiny85/libFrameworkArduinoVariant.a
Indexing .pio/build/attiny85/libFrameworkArduinoVariant.a
Compiling .pio/build/attiny85/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/Print.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/TinySoftwareSerial.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/WInterrupts.c.o
Compiling .pio/build/attiny85/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/WString.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/abi.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/main.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/new.cpp.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring.c.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring_analog.c.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring_digital.c.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring_pulse.S.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/attiny85/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/attiny85/libFrameworkArduino.a
Indexing .pio/build/attiny85/libFrameworkArduino.a
Linking .pio/build/attiny85/firmware.elf
Checking size .pio/build/attiny85/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   1.8% (used 9 bytes from 512 bytes)
Flash: [=         ]   5.7% (used 464 bytes from 8192 bytes)
Building .pio/build/attiny85/firmware.hex
Configuring upload protocol...
AVAILABLE: usbtiny
CURRENT: upload_protocol = usbtiny
Looking for upload port...
Uploading .pio/build/attiny85/firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e930b (probably t85)
avrdude: erasing chip
avrdude: reading input file ".pio/build/attiny85/firmware.hex"
avrdude: writing flash (464 bytes):

Writing | ################################################## | 100% 1.71s

avrdude: 464 bytes of flash written
avrdude: verifying flash memory against .pio/build/attiny85/firmware.hex:

Reading | ################################################## | 100% 1.19s

avrdude: 464 bytes of flash verified

avrdude done.  Thank you.

========================= [SUCCESS] Took 4.30 seconds =========================
```