tests: hackage: Fix mock urls.
[jackhill/guix/guix.git] / gnu / packages / flashing-tools.scm
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>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
37
38 (define-public flashrom
39 (package
40 (name "flashrom")
41 (version "0.9.7")
42 (source (origin
43 (method url-fetch)
44 (uri (string-append
45 "http://download.flashrom.org/releases/flashrom-"
46 version ".tar.bz2"))
47 (sha256
48 (base32
49 "1s9pc4yls2s1gcg2ar4q75nym2z5v6lxq36bl6lq26br00nj2mas"))
50 (patches (search-patches "flashrom-use-libftdi1.patch"))))
51 (build-system gnu-build-system)
52 (inputs `(("dmidecode" ,dmidecode)
53 ("pciutils" ,pciutils)
54 ("libusb" ,libusb)
55 ("libftdi" ,libftdi)))
56 (native-inputs `(("pkg-config" ,pkg-config)))
57 (arguments
58 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
59 #:tests? #f ; no 'check' target
60 #:phases
61 (alist-delete
62 'configure
63 (alist-cons-before
64 'build 'patch-exec-paths
65 (lambda* (#:key inputs #:allow-other-keys)
66 (substitute* "dmi.c"
67 (("\"dmidecode\"")
68 (format #f "~S"
69 (string-append (assoc-ref inputs "dmidecode")
70 "/sbin/dmidecode")))))
71 %standard-phases))))
72 (home-page "http://flashrom.org/")
73 (synopsis "Identify, read, write, erase, and verify ROM/flash chips")
74 (description
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
79 programmer devices.")
80 (license gpl2)))
81
82 (define-public avrdude
83 (package
84 (name "avrdude")
85 (version "6.1")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append "mirror://savannah/avrdude/avrdude-"
90 version ".tar.gz"))
91 (sha256
92 (base32
93 "0frxg0q09nrm95z7ymzddx7ysl77ilfbdix1m81d9jjpiv5bm64y"))))
94 (build-system gnu-build-system)
95 (inputs
96 `(("libelf" ,libelf)
97 ("libusb" ,libusb-compat)
98 ("libftdi" ,libftdi)))
99 (native-inputs
100 `(("bison" ,bison)
101 ("flex" ,flex)))
102 (home-page "http://www.nongnu.org/avrdude/")
103 (synopsis "AVR downloader and uploader")
104 (description
105 "AVRDUDE is a utility to download/upload/manipulate the ROM and
106 EEPROM contents of AVR microcontrollers using the in-system programming
107 technique (ISP).")
108 (license gpl2+)))
109
110 (define-public dfu-programmer
111 (package
112 (name "dfu-programmer")
113 (version "0.7.2")
114 (source
115 (origin
116 (method url-fetch)
117 (uri (string-append "mirror://sourceforge/dfu-programmer/dfu-programmer/"
118 version "/dfu-programmer-" version ".tar.gz"))
119 (sha256
120 (base32
121 "15gr99y1z9vbvhrkd25zqhnzhg6zjmaam3vfjzf2mazd39mx7d0x"))
122 (patches (search-patches "dfu-programmer-fix-libusb.patch"))))
123 (build-system gnu-build-system)
124 (native-inputs
125 `(("pkg-config" ,pkg-config)))
126 (inputs
127 `(("libusb" ,libusb)))
128 (home-page "http://dfu-programmer.github.io/")
129 (synopsis "Device firmware update programmer for Atmel chips")
130 (description
131 "Dfu-programmer is a multi-platform command-line programmer for
132 Atmel (8051, AVR, XMEGA & AVR32) chips with a USB bootloader supporting
133 ISP.")
134 (license gpl2+)))
135
136 (define-public dfu-util
137 (package
138 (name "dfu-util")
139 (version "0.9")
140 (source (origin
141 (method url-fetch)
142 (uri (string-append
143 "http://dfu-util.sourceforge.net/releases/dfu-util-"
144 version ".tar.gz"))
145 (sha256
146 (base32
147 "0czq73m92ngf30asdzrfkzraag95hlrr74imbanqq25kdim8qhin"))))
148 (build-system gnu-build-system)
149 (inputs
150 `(("libusb" ,libusb)))
151 (native-inputs
152 `(("pkg-config" ,pkg-config)))
153 (synopsis "Host side of the USB Device Firmware Upgrade (DFU) protocol")
154 (description
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
159 firmware from it.")
160 (home-page "http://dfu-util.sourceforge.net/")
161 (license gpl2+)))
162
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"))
168 (package
169 (name "teensy-loader-cli")
170 (version (string-append "2.1-1." (string-take commit 7)))
171 (source
172 (origin
173 (method url-fetch)
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)))
179 (snippet
180 `(begin
181 ;; Remove example flash files and teensy rebooter flash binaries.
182 (for-each delete-file (find-files "." "\\.(elf|hex)$"))
183 ;; Fix the version
184 (substitute* "teensy_loader_cli.c"
185 (("Teensy Loader, Command Line, Version 2.0\\\\n")
186 (string-append "Teensy Loader, Command Line, " ,version "\\n")))
187 #t))
188 (patches (search-patches "teensy-loader-cli-help.patch"))))
189 (build-system gnu-build-system)
190 (arguments
191 '(#:tests? #f ;; Makefile has no test target
192 #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
193 #:phases
194 (modify-phases %standard-phases
195 (delete 'configure)
196 (replace 'install
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)
201 #t))))))
202 (inputs
203 `(("libusb-compat" ,libusb-compat)))
204 (synopsis "Command line firmware uploader for Teensy development boards")
205 (description
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.
208
209 You need to add the udev rules to make the Teensy update available for
210 non-root users.")
211 (home-page "https://www.pjrc.com/teensy/loader_cli.html")
212 (license gpl3))))