Device::GBA - Perl Interface to the Gameboy Advance
version 0.004
use Device::GBA; my $gba = Device::GBA->new(buspirate => '/dev/ttyUSB0') or die "No such device!\n"; $gba->upload('helloworld.gba');
The Nintendo Gameboy Advance can either boot from cartridge or over link cable. The latter is caled multiboot mode and is basically SPI and a homebrew encoding scheme. Unfortunately, the Bus Pirate doesn't have a 100k SPI mode, so we are using 125000 instead. If you encounter problems with booting, use the next lower speed (30000) as bitrate. This utility allows uploading multiboot GBA images via Device::Chip::Adapters. Don't forget to pass -specs=gba_mb.specs to devkitARM GCC if you want to link a multiboot image. The package's share/ subdirectory contains an example Makefile for cross-compilation. The wiring is as follows:
-specs=gba_mb.specs
share/
GBA Bus Pirate SO --> MISO SI <-- MOSI CLK <-- CLK GND --- GND
(Note to myself:) The cable I made looks like this:
___________________ .--------GND (white)----/ .-------._ | | .-----SD (black)------------|SD (B) |_ | | | .--SO (yellow)---, -|SC (R) |_--+-. _|__|__|_ \ -|GND (W)|_--' | / 6 4 2 \ \____-|SO (Y) |_ | \_5_ 3 _1_/ ___-|SI (O) |_ | | \_/ '-- VDD (n/a) / '-------' | | '----- SI (orange) ---/ | '-------- SC (red) --------------------------'
Note: This is still work in progress!
Opens specified device and returns the corresponding object reference. Returns undef if an attempt to open the device has failed. Accepts following parameters:
An instance of Device::Chip::Adapter capable of SPI communication.
if true, methods on this instance will narrate what they're doing. Default is 0.
0
$gba->upload($firmware_file)
Reads in $firmware_file and uploads it to the Gameboy Advance.
$miso = $gba->spi_readwrite($mosi)
reads and writes 32 bit from the SPI bus.
$c = Device::GBA::crc($w, [$c = 0x0000c387])
Calculates CRC for word $w and CRC $c according to the algrithm used by the GBA multiboot protocol.
$w
$c
http://github.com/athreef/Device-GBA
gba -- The command line utility
Ahmad Fatoum <athreef@cpan.org>, http://a3f.at
<athreef@cpan.org>
Based on The uploader written by Ken Kaarvik.
Copyright (C) 2018 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2.0 or later.
To install Device::GBA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::GBA
CPAN shell
perl -MCPAN -e shell install Device::GBA
For more information on module installation, please visit the detailed CPAN module installation guide.