1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
3 ;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
4 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
5 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages flashing-tools)
23 #:use-module (guix licenses)
24 #:use-module (guix download)
25 #:use-module (guix packages)
26 #:use-module (gnu packages)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages elf)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages libusb)
33 #:use-module (gnu packages libftdi)
34 #:use-module (gnu packages pciutils)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages admin))
38 (define-public flashrom
45 "http://download.flashrom.org/releases/flashrom-"
49 "1s9pc4yls2s1gcg2ar4q75nym2z5v6lxq36bl6lq26br00nj2mas"))
50 (patches (search-patches "flashrom-use-libftdi1.patch"))))
51 (build-system gnu-build-system)
52 (inputs `(("dmidecode" ,dmidecode)
53 ("pciutils" ,pciutils)
55 ("libftdi" ,libftdi)))
56 (native-inputs `(("pkg-config" ,pkg-config)))
58 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
59 #:tests? #f ; no 'check' target
64 'build 'patch-exec-paths
65 (lambda* (#:key inputs #:allow-other-keys)
69 (string-append (assoc-ref inputs "dmidecode")
70 "/sbin/dmidecode")))))
72 (home-page "http://flashrom.org/")
73 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
75 "flashrom is a utility for identifying, reading, writing,
76 verifying and erasing flash chips. It is designed to flash
77 BIOS/EFI/coreboot/firmware/optionROM images on mainboards,
78 network/graphics/storage controller cards, and various other
82 (define-public avrdude
89 (uri (string-append "mirror://savannah/avrdude/avrdude-"
93 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
94 (build-system gnu-build-system)
97 ("libusb" ,libusb-compat)
98 ("libftdi" ,libftdi)))
102 (home-page "http://www.nongnu.org/avrdude/")
103 (synopsis "AVR downloader and uploader")
105 "AVRDUDE is a utility to download/upload/manipulate the ROM and
106 EEPROM contents of AVR microcontrollers using the in-system programming
110 (define-public dfu-programmer
112 (name "dfu-programmer")
117 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
118 version "/dfu-programmer-" version ".tar.gz"))
121 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
122 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
123 (build-system gnu-build-system)
125 `(("pkg-config" ,pkg-config)))
127 `(("libusb" ,libusb)))
128 (home-page "http://dfu-programmer.github.io/")
129 (synopsis "Device firmware update programmer for Atmel chips")
131 "Dfu-programmer is a multi-platform command-line programmer for
132 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
136 (define-public dfu-util
143 "http://dfu-util.sourceforge.net/releases/dfu-util-"
147 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
148 (build-system gnu-build-system)
150 `(("libusb" ,libusb)))
152 `(("pkg-config" ,pkg-config)))
153 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
155 "The DFU (Universal Serial Bus Device Firmware Upgrade) protocol is
156 intended to download and upload firmware to devices connected over USB. It
157 ranges from small devices like micro-controller boards up to mobile phones.
158 With dfu-util you are able to download firmware to your device or upload
160 (home-page "http://dfu-util.sourceforge.net/")
163 (define-public teensy-loader-cli
164 ;; The repo does not tag versions nor does it use releases, but a commit
165 ;; message says "Importing 2.1", while the sourcce still says "2.0". So pin
166 ;; to a fixed commit.
167 (let ((commit "f289b7a2e5627464044249f0e5742830e052e360"))
169 (name "teensy-loader-cli")
170 (version (string-append "2.1-1." (string-take commit 7)))
174 (uri (string-append "https://github.com/PaulStoffregen/"
175 "teensy_loader_cli/archive/" commit ".tar.gz"))
176 (sha256 (base32 "17wqc2q4fa473cy7f5m2yiyb9nq0qw7xal2kzrxzaikgm9rabsw8"))
177 (file-name (string-append "teensy-loader-cli-" version ".tar.gz" ))
178 (modules '((guix build utils)))
181 ;; Remove example flash files and teensy rebooter flash binaries.
182 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
184 (substitute* "teensy_loader_cli.c"
185 (("Teensy Loader, Command Line, Version 2.0\\\\n")
186 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
188 (patches (search-patches "teensy-loader-cli-help.patch"))))
189 (build-system gnu-build-system)
191 '(#:tests? #f ;; Makefile has no test target
192 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
194 (modify-phases %standard-phases
197 (lambda* (#:key outputs #:allow-other-keys)
198 (let* ((out (assoc-ref outputs "out"))
199 (bin (string-append out "/bin")))
200 (install-file "teensy_loader_cli" bin)
203 `(("libusb-compat" ,libusb-compat)))
204 (synopsis "Command line firmware uploader for Teensy development boards")
206 "The Teensy loader program communicates with your Teensy board when the
207 HalfKay bootloader is running, so you can upload new programs and run them.
209 You need to add the udev rules to make the Teensy update available for
211 (home-page "https://www.pjrc.com/teensy/loader_cli.html")