embedded.scm 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
  3. ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
  4. ;;; Copyright © 2016 David Craven <david@craven.ch>
  5. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. (define-module (gnu packages embedded)
  24. #:use-module (guix utils)
  25. #:use-module (guix packages)
  26. #:use-module (guix download)
  27. #:use-module (guix svn-download)
  28. #:use-module (guix git-download)
  29. #:use-module ((guix licenses) #:prefix license:)
  30. #:use-module (guix build-system cmake)
  31. #:use-module (guix build-system gnu)
  32. #:use-module (guix build-system trivial)
  33. #:use-module (guix build utils)
  34. #:use-module (gnu packages)
  35. #:use-module (gnu packages autotools)
  36. #:use-module ((gnu packages base) #:prefix base:)
  37. #:use-module (gnu packages bison)
  38. #:use-module (gnu packages cross-base)
  39. #:use-module (gnu packages dejagnu)
  40. #:use-module (gnu packages flex)
  41. #:use-module (gnu packages gcc)
  42. #:use-module (gnu packages gdb)
  43. #:use-module (gnu packages guile)
  44. #:use-module (gnu packages libftdi)
  45. #:use-module (gnu packages libusb)
  46. #:use-module (gnu packages perl)
  47. #:use-module (gnu packages pkg-config)
  48. #:use-module (gnu packages python)
  49. #:use-module (gnu packages swig)
  50. #:use-module (gnu packages texinfo)
  51. #:use-module (gnu packages xorg)
  52. #:use-module (srfi srfi-1))
  53. ;; We must not use the released GCC sources here, because the cross-compiler
  54. ;; does not produce working binaries. Instead we take the very same SVN
  55. ;; revision from the branch that is used for a release of the "GCC ARM
  56. ;; embedded" project on launchpad.
  57. ;; See https://launchpadlibrarian.net/218827644/release.txt
  58. (define-public gcc-arm-none-eabi-4.9
  59. (let ((xgcc (cross-gcc "arm-none-eabi"
  60. #:xgcc gcc-4.9
  61. #:xbinutils (cross-binutils "arm-none-eabi")))
  62. (revision "1")
  63. (svn-revision 227977))
  64. (package (inherit xgcc)
  65. (version (string-append (package-version xgcc) "-"
  66. revision "." (number->string svn-revision)))
  67. (source
  68. (origin
  69. (method svn-fetch)
  70. (uri (svn-reference
  71. (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
  72. (revision svn-revision)))
  73. (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
  74. (sha256
  75. (base32
  76. "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
  77. ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
  78. ;; patch is for 4.9.4 and later but this svn snapshot is older).
  79. (patches (remove (lambda (patch)
  80. (string=? (basename patch)
  81. "gcc-arm-bug-71399.patch"))
  82. (origin-patches (package-source xgcc))))))
  83. (native-inputs
  84. `(("flex" ,flex)
  85. ,@(package-native-inputs xgcc)))
  86. (arguments
  87. (substitute-keyword-arguments (package-arguments xgcc)
  88. ((#:phases phases)
  89. `(modify-phases ,phases
  90. (add-after 'unpack 'fix-genmultilib
  91. (lambda _
  92. (substitute* "gcc/genmultilib"
  93. (("#!/bin/sh") (string-append "#!" (which "sh"))))
  94. #t))))
  95. ((#:configure-flags flags)
  96. ;; The configure flags are largely identical to the flags used by the
  97. ;; "GCC ARM embedded" project.
  98. `(append (list "--enable-multilib"
  99. "--with-newlib"
  100. "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
  101. "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
  102. "--enable-plugins"
  103. "--disable-decimal-float"
  104. "--disable-libffi"
  105. "--disable-libgomp"
  106. "--disable-libmudflap"
  107. "--disable-libquadmath"
  108. "--disable-libssp"
  109. "--disable-libstdcxx-pch"
  110. "--disable-nls"
  111. "--disable-shared"
  112. "--disable-threads"
  113. "--disable-tls")
  114. (delete "--disable-multilib" ,flags)))))
  115. (native-search-paths
  116. (list (search-path-specification
  117. (variable "CROSS_C_INCLUDE_PATH")
  118. (files '("arm-none-eabi/include")))
  119. (search-path-specification
  120. (variable "CROSS_CPLUS_INCLUDE_PATH")
  121. (files '("arm-none-eabi/include")))
  122. (search-path-specification
  123. (variable "CROSS_LIBRARY_PATH")
  124. (files '("arm-none-eabi/lib"))))))))
  125. (define-public gcc-arm-none-eabi-6
  126. (package
  127. (inherit gcc-arm-none-eabi-4.9)
  128. (version (package-version gcc-6))
  129. (source (origin (inherit (package-source gcc-6))
  130. (patches
  131. (append
  132. (origin-patches (package-source gcc-6))
  133. (search-patches "gcc-6-cross-environment-variables.patch"
  134. "gcc-6-arm-none-eabi-multilib.patch")))))))
  135. (define-public newlib-arm-none-eabi
  136. (package
  137. (name "newlib")
  138. (version "2.4.0")
  139. (source (origin
  140. (method url-fetch)
  141. (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
  142. version ".tar.gz"))
  143. (sha256
  144. (base32
  145. "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
  146. (build-system gnu-build-system)
  147. (arguments
  148. `(#:out-of-source? #t
  149. ;; The configure flags are identical to the flags used by the "GCC ARM
  150. ;; embedded" project.
  151. #:configure-flags '("--target=arm-none-eabi"
  152. "--enable-newlib-io-long-long"
  153. "--enable-newlib-register-fini"
  154. "--disable-newlib-supplied-syscalls"
  155. "--disable-nls")
  156. #:phases
  157. (modify-phases %standard-phases
  158. (add-after 'unpack 'fix-references-to-/bin/sh
  159. (lambda _
  160. (substitute* '("libgloss/arm/cpu-init/Makefile.in"
  161. "libgloss/arm/Makefile.in"
  162. "libgloss/libnosys/Makefile.in"
  163. "libgloss/Makefile.in")
  164. (("/bin/sh") (which "sh")))
  165. #t)))))
  166. (native-inputs
  167. `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
  168. ("xgcc" ,gcc-arm-none-eabi-4.9)
  169. ("texinfo" ,texinfo)))
  170. (home-page "http://www.sourceware.org/newlib/")
  171. (synopsis "C library for use on embedded systems")
  172. (description "Newlib is a C library intended for use on embedded
  173. systems. It is a conglomeration of several library parts that are easily
  174. usable on embedded products.")
  175. (license (license:non-copyleft
  176. "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
  177. (define-public newlib-nano-arm-none-eabi
  178. (package (inherit newlib-arm-none-eabi)
  179. (name "newlib-nano")
  180. (arguments
  181. (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
  182. ;; The configure flags are identical to the flags used by the "GCC ARM
  183. ;; embedded" project. They optimize newlib for use on small embedded
  184. ;; systems with limited memory.
  185. ((#:configure-flags flags)
  186. ''("--target=arm-none-eabi"
  187. "--enable-multilib"
  188. "--disable-newlib-supplied-syscalls"
  189. "--enable-newlib-reent-small"
  190. "--disable-newlib-fvwrite-in-streamio"
  191. "--disable-newlib-fseek-optimization"
  192. "--disable-newlib-wide-orient"
  193. "--enable-newlib-nano-malloc"
  194. "--disable-newlib-unbuf-stream-opt"
  195. "--enable-lite-exit"
  196. "--enable-newlib-global-atexit"
  197. "--enable-newlib-nano-formatted-io"
  198. "--disable-nls"))))
  199. (synopsis "Newlib variant for small systems with limited memory")))
  200. (define (make-libstdc++-arm-none-eabi xgcc newlib)
  201. (let ((libstdc++ (make-libstdc++ xgcc)))
  202. (package (inherit libstdc++)
  203. (name "libstdc++-arm-none-eabi")
  204. (arguments
  205. (substitute-keyword-arguments (package-arguments libstdc++)
  206. ((#:configure-flags flags)
  207. ``("--target=arm-none-eabi"
  208. "--host=arm-none-eabi"
  209. "--disable-libstdcxx-pch"
  210. "--enable-multilib"
  211. "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
  212. "--disable-shared"
  213. "--disable-tls"
  214. "--disable-plugin"
  215. "--with-newlib"
  216. ,(string-append "--with-gxx-include-dir="
  217. (assoc-ref %outputs "out")
  218. "/arm-none-eabi/include")))))
  219. (native-inputs
  220. `(("newlib" ,newlib)
  221. ("xgcc" ,xgcc)
  222. ,@(package-native-inputs libstdc++))))))
  223. (define (arm-none-eabi-toolchain xgcc newlib)
  224. "Produce a cross-compiler toolchain package with the compiler XGCC and the C
  225. library variant NEWLIB."
  226. (let ((newlib-with-xgcc (package (inherit newlib)
  227. (native-inputs
  228. (alist-replace "xgcc" (list xgcc)
  229. (package-native-inputs newlib))))))
  230. (package
  231. (name (string-append "arm-none-eabi"
  232. (if (string=? (package-name newlib-with-xgcc)
  233. "newlib-nano")
  234. "-nano" "")
  235. "-toolchain"))
  236. (version (package-version xgcc))
  237. (source #f)
  238. (build-system trivial-build-system)
  239. (arguments
  240. '(#:modules ((guix build union))
  241. #:builder
  242. (begin
  243. (use-modules (ice-9 match)
  244. (guix build union))
  245. (match %build-inputs
  246. (((names . directories) ...)
  247. (union-build (assoc-ref %outputs "out")
  248. directories)
  249. #t)))))
  250. (propagated-inputs
  251. `(("binutils" ,(cross-binutils "arm-none-eabi"))
  252. ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
  253. ("gcc" ,xgcc)
  254. ("newlib" ,newlib-with-xgcc)))
  255. (synopsis "Complete GCC tool chain for ARM bare metal development")
  256. (description "This package provides a complete GCC tool chain for ARM
  257. bare metal development. This includes the GCC arm-none-eabi cross compiler
  258. and newlib (or newlib-nano) as the C library. The supported programming
  259. languages are C and C++.")
  260. (home-page (package-home-page xgcc))
  261. (license (package-license xgcc)))))
  262. (define-public arm-none-eabi-toolchain-4.9
  263. (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
  264. newlib-arm-none-eabi))
  265. (define-public arm-none-eabi-nano-toolchain-4.9
  266. (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
  267. newlib-nano-arm-none-eabi))
  268. (define-public arm-none-eabi-toolchain-6
  269. (arm-none-eabi-toolchain gcc-arm-none-eabi-6
  270. newlib-arm-none-eabi))
  271. (define-public arm-none-eabi-nano-toolchain-6
  272. (arm-none-eabi-toolchain gcc-arm-none-eabi-6
  273. newlib-nano-arm-none-eabi))
  274. (define-public gdb-arm-none-eabi
  275. (package
  276. (inherit gdb)
  277. (name "gdb-arm-none-eabi")
  278. (arguments
  279. `(#:configure-flags '("--target=arm-none-eabi"
  280. "--enable-multilib"
  281. "--enable-interwork"
  282. "--enable-languages=c,c++"
  283. "--disable-nls")
  284. ,@(package-arguments gdb)))))
  285. (define-public libjaylink
  286. ;; No release tarballs available.
  287. (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
  288. (revision "2"))
  289. (package
  290. (name "libjaylink")
  291. (version (string-append "0.1.0-" revision "."
  292. (string-take commit 7)))
  293. (source (origin
  294. (method git-fetch)
  295. (uri (git-reference
  296. (url "https://git.zapb.de/libjaylink.git")
  297. (commit commit)))
  298. (file-name (string-append name "-" version "-checkout"))
  299. (sha256
  300. (base32
  301. "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
  302. (build-system gnu-build-system)
  303. (native-inputs
  304. `(("autoconf" ,autoconf)
  305. ("automake" ,automake)
  306. ("libtool" ,libtool)
  307. ("pkg-config" ,pkg-config)))
  308. (inputs
  309. `(("libusb" ,libusb)))
  310. (home-page "http://repo.or.cz/w/libjaylink.git")
  311. (synopsis "Library to interface Segger J-Link devices")
  312. (description "libjaylink is a shared library written in C to access
  313. SEGGER J-Link and compatible devices.")
  314. (license license:gpl2+))))
  315. (define-public jimtcl
  316. (package
  317. (name "jimtcl")
  318. (version "0.77")
  319. (source (origin
  320. (method url-fetch)
  321. (uri (string-append
  322. "https://github.com/msteveb/jimtcl"
  323. "/archive/" version ".tar.gz"))
  324. (file-name (string-append name "-" version ".tar.gz"))
  325. (sha256
  326. (base32
  327. "1cmk3qscqckg70chjyimzxa2qcka4qac0j4wq908kiijp45cax08"))))
  328. (build-system gnu-build-system)
  329. (arguments
  330. `(#:phases
  331. (modify-phases %standard-phases
  332. ;; Doesn't use autoconf.
  333. (replace 'configure
  334. (lambda* (#:key outputs #:allow-other-keys)
  335. (let ((out (assoc-ref outputs "out")))
  336. (invoke "./configure"
  337. (string-append "--prefix=" out))))))))
  338. (home-page "http://jim.tcl.tk")
  339. (synopsis "Small footprint Tcl implementation")
  340. (description "Jim is a small footprint implementation of the Tcl programming
  341. language.")
  342. (license license:bsd-2)))
  343. (define-public openocd
  344. (package
  345. (name "openocd")
  346. (version "0.10.0")
  347. (source (origin
  348. (method url-fetch)
  349. (uri (string-append "mirror://sourceforge/openocd/openocd/"
  350. version "/openocd-" version ".tar.gz"))
  351. (sha256
  352. (base32
  353. "09p57y3c2spqx4vjjlz1ljm1lcd0j9q8g76ywxqgn3yc34wv18zd"))
  354. ;; FIXME: Remove after nrf52 patch is merged.
  355. (patches
  356. (search-patches "openocd-nrf52.patch"))))
  357. (build-system gnu-build-system)
  358. (native-inputs
  359. `(("autoconf" ,autoconf)
  360. ("automake" ,automake)
  361. ("libtool" ,libtool)
  362. ("pkg-config" ,pkg-config)))
  363. (inputs
  364. `(("hidapi" ,hidapi)
  365. ("jimtcl" ,jimtcl)
  366. ("libftdi" ,libftdi)
  367. ("libjaylink" ,libjaylink)
  368. ("libusb-compat" ,libusb-compat)))
  369. (arguments
  370. '(#:configure-flags
  371. (append (list "--disable-werror"
  372. "--enable-sysfsgpio"
  373. "--disable-internal-jimtcl"
  374. "--disable-internal-libjaylink")
  375. (map (lambda (programmer)
  376. (string-append "--enable-" programmer))
  377. '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
  378. "gw16012" "jlink" "opendous" "osbdm"
  379. "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
  380. "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
  381. "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
  382. "presto" "openjtag")))
  383. #:phases
  384. (modify-phases %standard-phases
  385. ;; Required because of patched sources.
  386. (add-before 'configure 'autoreconf
  387. (lambda _ (invoke "autoreconf" "-vfi") #t))
  388. (add-after 'autoreconf 'change-udev-group
  389. (lambda _
  390. (substitute* "contrib/60-openocd.rules"
  391. (("plugdev") "dialout"))
  392. #t))
  393. (add-after 'install 'install-udev-rules
  394. (lambda* (#:key outputs #:allow-other-keys)
  395. (install-file "contrib/60-openocd.rules"
  396. (string-append
  397. (assoc-ref outputs "out")
  398. "/lib/udev/rules.d/"))
  399. #t)))))
  400. (home-page "http://openocd.org")
  401. (synopsis "On-Chip Debugger")
  402. (description "OpenOCD provides on-chip programming and debugging support
  403. with a layered architecture of JTAG interface and TAP support.")
  404. (license license:gpl2+)))
  405. ;; The commits for all propeller tools are the stable versions published at
  406. ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
  407. ;; personal correspondence with the developers in July 2017, more recent
  408. ;; versions are currently incompatible with the "Simple Libraries".
  409. (define propeller-binutils
  410. (let ((xbinutils (cross-binutils "propeller-elf"))
  411. (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  412. (revision "2"))
  413. (package
  414. (inherit xbinutils)
  415. (name "propeller-binutils")
  416. (version (string-append "0.0.0-" revision "." (string-take commit 9)))
  417. (source (origin (inherit (package-source xbinutils))
  418. (method git-fetch)
  419. (uri (git-reference
  420. (url "https://github.com/parallaxinc/propgcc.git")
  421. (commit commit)))
  422. (file-name (string-append name "-" commit "-checkout"))
  423. (sha256
  424. (base32
  425. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
  426. (patch-flags (list "-p1" "--directory=binutils"))))
  427. (arguments
  428. `(;; FIXME: For some reason there are many test failures. It's not
  429. ;; obvious how to fix the failures.
  430. #:tests? #f
  431. #:phases
  432. (modify-phases %standard-phases
  433. (add-after 'unpack 'chdir
  434. (lambda _ (chdir "binutils") #t)))
  435. ,@(substitute-keyword-arguments (package-arguments xbinutils)
  436. ((#:configure-flags flags)
  437. `(cons "--disable-werror" ,flags)))))
  438. (native-inputs
  439. `(("bison" ,bison)
  440. ("flex" ,flex)
  441. ("texinfo" ,texinfo)
  442. ("dejagnu" ,dejagnu)
  443. ,@(package-native-inputs xbinutils))))))
  444. (define-public propeller-gcc-6
  445. (let ((xgcc (cross-gcc "propeller-elf"
  446. #:xbinutils propeller-binutils))
  447. (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
  448. (revision "1"))
  449. (package (inherit xgcc)
  450. (name "propeller-gcc")
  451. (version (string-append "6.0.0-" revision "." (string-take commit 9)))
  452. (source (origin
  453. (method git-fetch)
  454. (uri (git-reference
  455. (url "https://github.com/totalspectrum/gcc-propeller.git")
  456. (commit commit)))
  457. (file-name (string-append name "-" commit "-checkout"))
  458. (sha256
  459. (base32
  460. "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
  461. (patches
  462. (append
  463. (origin-patches (package-source gcc-6))
  464. (search-patches "gcc-cross-environment-variables.patch")))))
  465. (native-inputs
  466. `(("flex" ,flex)
  467. ,@(package-native-inputs xgcc)))
  468. ;; All headers and cross libraries of the propeller toolchain are
  469. ;; installed under the "propeller-elf" prefix.
  470. (native-search-paths
  471. (list (search-path-specification
  472. (variable "CROSS_C_INCLUDE_PATH")
  473. (files '("propeller-elf/include")))
  474. (search-path-specification
  475. (variable "CROSS_LIBRARY_PATH")
  476. (files '("propeller-elf/lib")))))
  477. (home-page "https://github.com/totalspectrum/gcc-propeller")
  478. (synopsis "GCC for the Parallax Propeller"))))
  479. (define-public propeller-gcc-4
  480. (let ((xgcc propeller-gcc-6)
  481. (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  482. (revision "2"))
  483. (package (inherit xgcc)
  484. (name "propeller-gcc")
  485. (version (string-append "4.6.1-" revision "." (string-take commit 9)))
  486. (source (origin
  487. (method git-fetch)
  488. (uri (git-reference
  489. (url "https://github.com/parallaxinc/propgcc.git")
  490. (commit commit)))
  491. (file-name (string-append name "-" commit "-checkout"))
  492. (sha256
  493. (base32
  494. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
  495. (patch-flags (list "-p1" "--directory=gcc"))
  496. (patches
  497. (append
  498. (origin-patches (package-source gcc-4.7))
  499. (search-patches "gcc-4.6-gnu-inline.patch"
  500. "gcc-cross-environment-variables.patch")))))
  501. (arguments
  502. (substitute-keyword-arguments (package-arguments propeller-gcc-6)
  503. ((#:phases phases)
  504. `(modify-phases ,phases
  505. (add-after 'unpack 'chdir
  506. (lambda _ (chdir "gcc") #t))))))
  507. (native-inputs
  508. `(("gcc-4" ,gcc-4.9)
  509. ,@(package-native-inputs propeller-gcc-6)))
  510. (home-page "https://github.com/parallaxinc/propgcc")
  511. (supported-systems (delete "aarch64-linux" %supported-systems)))))
  512. ;; Version 6 is experimental and may not work correctly. This is why we
  513. ;; default to version 4, which is also used in the binary toolchain bundle
  514. ;; provided by Parallax Inc.
  515. (define-public propeller-gcc propeller-gcc-4)
  516. ;; FIXME: We do not build the tiny library because that would require C++
  517. ;; headers, which are not available. This may require adding a propeller-elf
  518. ;; variant of the libstdc++ package.
  519. (define-public proplib
  520. (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  521. (revision "2"))
  522. (package
  523. (name "proplib")
  524. (version (string-append "0.0.0-" revision "." (string-take commit 9)))
  525. (source (origin
  526. (method git-fetch)
  527. (uri (git-reference
  528. (url "https://github.com/parallaxinc/propgcc.git")
  529. (commit commit)))
  530. (file-name (string-append name "-" commit "-checkout"))
  531. (sha256
  532. (base32
  533. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
  534. (build-system gnu-build-system)
  535. (arguments
  536. `(#:tests? #f ; no tests
  537. #:make-flags
  538. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  539. (string-append "BUILD=" (getcwd) "/build"))
  540. #:phases
  541. (modify-phases %standard-phases
  542. (delete 'configure)
  543. (add-after 'unpack 'chdir
  544. (lambda _ (chdir "lib") #t))
  545. (add-after 'chdir 'fix-Makefile
  546. (lambda _
  547. (substitute* "Makefile"
  548. ;; Control the installation time of the headers.
  549. ((" install-includes") ""))
  550. #t))
  551. ;; The Makefile does not separate building from installation, so we
  552. ;; have to create the target directories at build time.
  553. (add-before 'build 'create-target-directories
  554. (lambda* (#:key make-flags #:allow-other-keys)
  555. (apply invoke "make" "install-dirs" make-flags)))
  556. (add-before 'build 'set-cross-environment-variables
  557. (lambda* (#:key outputs #:allow-other-keys)
  558. (setenv "CROSS_LIBRARY_PATH"
  559. (string-append (assoc-ref outputs "out")
  560. "/propeller-elf/lib:"
  561. (or (getenv "CROSS_LIBRARY_PATH") "")))
  562. (setenv "CROSS_C_INCLUDE_PATH"
  563. (string-append (assoc-ref outputs "out")
  564. "/propeller-elf/include:"
  565. (or (getenv "CROSS_C_INCLUDE_PATH") "")))
  566. #t))
  567. (add-before 'install 'install-includes
  568. (lambda* (#:key make-flags #:allow-other-keys)
  569. (apply invoke "make" "install-includes" make-flags))))))
  570. (native-inputs
  571. `(("propeller-gcc" ,propeller-gcc)
  572. ("propeller-binutils" ,propeller-binutils)
  573. ("perl" ,perl)))
  574. (home-page "https://github.com/parallaxinc/propgcc")
  575. (synopsis "C library for the Parallax Propeller")
  576. (description "This is a C library for the Parallax Propeller
  577. micro-controller.")
  578. ;; Most of the code is released under the Expat license. Some of the
  579. ;; included code is public domain and some changes are BSD licensed.
  580. (license license:expat))))
  581. (define-public propeller-toolchain
  582. (package
  583. (name "propeller-toolchain")
  584. (version (package-version propeller-gcc))
  585. (source #f)
  586. (build-system trivial-build-system)
  587. (arguments '(#:builder (begin (mkdir %output) #t)))
  588. (propagated-inputs
  589. `(("binutils" ,propeller-binutils)
  590. ("libc" ,proplib)
  591. ("gcc" ,propeller-gcc)))
  592. (synopsis "Complete GCC tool chain for Propeller micro-controllers")
  593. (description "This package provides a complete GCC tool chain for
  594. Propeller micro-controller development.")
  595. (home-page (package-home-page propeller-gcc))
  596. (license (package-license propeller-gcc))))
  597. (define-public openspin
  598. (package
  599. (name "openspin")
  600. (version "1.00.78")
  601. (source (origin
  602. (method url-fetch)
  603. (uri (string-append "https://github.com/parallaxinc/"
  604. "OpenSpin/archive/" version ".tar.gz"))
  605. (file-name (string-append name "-" version ".tar.gz"))
  606. (sha256
  607. (base32
  608. "1k2dbz1v604g4r2d9qhckg2m8dnhiya760mbsqfsg4waxal87yb7"))))
  609. (build-system gnu-build-system)
  610. (arguments
  611. `(#:tests? #f ; no tests
  612. #:phases
  613. (modify-phases %standard-phases
  614. (delete 'configure)
  615. (add-after 'unpack 'remove-timestamp
  616. (lambda _
  617. (substitute* "SpinSource/openspin.cpp"
  618. ((" Compiled on.*$") "\\n\");"))
  619. #t))
  620. ;; Makefile does not include "install" target
  621. (replace 'install
  622. (lambda* (#:key outputs #:allow-other-keys)
  623. (let ((bin (string-append (assoc-ref outputs "out")
  624. "/bin")))
  625. (mkdir-p bin)
  626. (install-file "build/openspin" bin)
  627. #t))))))
  628. (home-page "https://github.com/parallaxinc/OpenSpin")
  629. (synopsis "Spin/PASM compiler for the Parallax Propeller")
  630. (description "OpenSpin is a compiler for the Spin/PASM language of the
  631. Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
  632. code.")
  633. (license license:expat)))
  634. (define-public propeller-load
  635. (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  636. (revision "2"))
  637. (package
  638. (name "propeller-load")
  639. (version "3.4.0")
  640. (source (origin
  641. (method git-fetch)
  642. (uri (git-reference
  643. (url "https://github.com/parallaxinc/propgcc.git")
  644. (commit commit)))
  645. (file-name (string-append name "-" commit "-checkout"))
  646. (sha256
  647. (base32
  648. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
  649. (build-system gnu-build-system)
  650. (arguments
  651. `(#:tests? #f ; no tests
  652. #:make-flags
  653. (list "OS=linux"
  654. (string-append "TARGET=" (assoc-ref %outputs "out")))
  655. #:phases
  656. (modify-phases %standard-phases
  657. (add-after 'unpack 'chdir
  658. (lambda _ (chdir "loader") #t))
  659. (delete 'configure))))
  660. (native-inputs
  661. `(("openspin" ,openspin)
  662. ("propeller-toolchain" ,propeller-toolchain)))
  663. (home-page "https://github.com/parallaxinc/propgcc")
  664. (synopsis "Loader for Parallax Propeller micro-controllers")
  665. (description "This package provides the tool @code{propeller-load} to
  666. upload binaries to a Parallax Propeller micro-controller.")
  667. (license license:expat))))
  668. (define-public spin2cpp
  669. (package
  670. (name "spin2cpp")
  671. (version "3.6.4")
  672. (source (origin
  673. (method url-fetch)
  674. (uri (string-append "https://github.com/totalspectrum/spin2cpp/"
  675. "archive/v" version ".tar.gz"))
  676. (file-name (string-append name "-" version ".tar.gz"))
  677. (sha256
  678. (base32
  679. "05qak187sn0xg7vhrxw27b19xhmid1b8ab8kax3gv0faavzablfw"))))
  680. (build-system gnu-build-system)
  681. (arguments
  682. `(#:tests? #f ;; The tests assume that a micro-controller is connected.
  683. #:phases
  684. (modify-phases %standard-phases
  685. (delete 'configure)
  686. (add-before 'build 'set-cross-environment-variables
  687. (lambda* (#:key inputs #:allow-other-keys)
  688. (setenv "CROSS_LIBRARY_PATH"
  689. (string-append (assoc-ref inputs "propeller-toolchain")
  690. "/propeller-elf/lib"))
  691. (setenv "CROSS_C_INCLUDE_PATH"
  692. (string-append (assoc-ref inputs "propeller-toolchain")
  693. "/propeller-elf/include"))
  694. #t))
  695. (replace 'install
  696. (lambda* (#:key outputs #:allow-other-keys)
  697. (let ((bin (string-append (assoc-ref outputs "out")
  698. "/bin")))
  699. (for-each (lambda (file)
  700. (install-file (string-append "build/" file)
  701. bin))
  702. '("testlex" "spin2cpp" "fastspin")))
  703. #t)))))
  704. (native-inputs
  705. `(("bison" ,bison)
  706. ("propeller-load" ,propeller-load)
  707. ("propeller-toolchain" ,propeller-toolchain)))
  708. (home-page "https://github.com/totalspectrum/spin2cpp")
  709. (synopsis "Convert Spin code to C, C++, or PASM code")
  710. (description "This is a set of tools for converting the Spin language for
  711. the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
  712. directly into an executable binary. The binaries produced use LMM PASM, so
  713. they are much faster than regular Spin bytecodes (but also quite a bit
  714. larger).")
  715. (license license:expat)))
  716. (define-public spinsim
  717. (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
  718. (revision "1"))
  719. (package
  720. (name "spinsim")
  721. (version (string-append "0.75-" revision "." (string-take commit 9)))
  722. (source (origin
  723. (method git-fetch)
  724. (uri (git-reference
  725. (url "https://github.com/parallaxinc/spinsim.git")
  726. (commit commit)))
  727. (file-name (string-append name "-" commit "-checkout"))
  728. (sha256
  729. (base32
  730. "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
  731. (build-system gnu-build-system)
  732. (arguments
  733. `(#:tests? #f ; no tests
  734. #:phases
  735. (modify-phases %standard-phases
  736. (delete 'configure)
  737. (replace 'install
  738. (lambda* (#:key outputs #:allow-other-keys)
  739. (let ((bin (string-append (assoc-ref outputs "out")
  740. "/bin")))
  741. (install-file "build/spinsim" bin))
  742. #t)))))
  743. (home-page "https://github.com/parallaxinc/spinsim")
  744. (synopsis "Spin simulator")
  745. (description "This package provides the tool @code{spinsim}, a simulator
  746. and simple debugger for Spin programs written for a Parallax Propeller
  747. micro-controller. Spinsim supports execution from cog memory and hub
  748. execution, but it does not support multi-tasking. It supports about
  749. two-thirds of the opcodes in the P2 instruction set.")
  750. (license license:expat))))
  751. (define-public propeller-development-suite
  752. (package
  753. (name "propeller-development-suite")
  754. (version (package-version propeller-gcc))
  755. (source #f)
  756. (build-system trivial-build-system)
  757. (arguments '(#:builder (begin (mkdir %output) #t)))
  758. (propagated-inputs
  759. `(("toolchain" ,propeller-toolchain)
  760. ("openspin" ,openspin)
  761. ("propeller-load" ,propeller-load)
  762. ("spin2cpp" ,spin2cpp)
  763. ("spinsim" ,spinsim)))
  764. (synopsis "Complete development suite for Propeller micro-controllers")
  765. (description "This meta-package provides a complete environment for the
  766. development with Parallax Propeller micro-controllers. It includes the GCC
  767. toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
  768. simulator.")
  769. (home-page (package-home-page propeller-gcc))
  770. (license (package-license propeller-gcc))))
  771. (define-public binutils-vc4
  772. (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
  773. (package
  774. (name "binutils-vc4")
  775. (version (string-append "2.23.51-0." (string-take commit 7)))
  776. (source (origin
  777. (method git-fetch)
  778. (uri (git-reference
  779. (url "https://github.com/puppeh/binutils-vc4.git")
  780. (commit commit)))
  781. (file-name (string-append name "-" version "-checkout"))
  782. (sha256
  783. (base32
  784. "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
  785. (build-system gnu-build-system)
  786. (arguments
  787. `(#:configure-flags '("--target=vc4-elf"
  788. "--disable-werror"
  789. "--enable-cgen-maint")
  790. #:phases
  791. (modify-phases %standard-phases
  792. (add-after 'unpack 'unpack-cgen
  793. (lambda* (#:key inputs #:allow-other-keys)
  794. (copy-recursively (string-append (assoc-ref inputs "cgen")
  795. "/cgen") "cgen")
  796. #t))
  797. (add-after 'unpack-cgen 'fix-cgen-guile
  798. (lambda _
  799. (substitute* "opcodes/Makefile.in"
  800. (("guile\\{,-\\}1.8") "guile"))
  801. (invoke "which" "guile"))))))
  802. (native-inputs
  803. `(("cgen"
  804. ,(origin
  805. (method git-fetch)
  806. (uri (git-reference
  807. (url "https://github.com/puppeh/cgen.git")
  808. (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
  809. (sha256
  810. (base32
  811. "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
  812. ("texinfo" ,texinfo)
  813. ("flex" ,flex)
  814. ("bison" ,bison)
  815. ("guile-1.8" ,guile-1.8)
  816. ("which" ,base:which)))
  817. (synopsis "Binutils for VC4")
  818. (description "This package provides @code{binutils} for VideoCore IV,
  819. the Raspberry Pi chip.")
  820. (license license:gpl3+)
  821. (home-page "https://github.com/puppeh/vc4-toolchain/"))))
  822. (define-public gcc-vc4
  823. (let ((commit "165f6d0e11d2e76ee799533bb45bd5c92bf60dc2")
  824. (xgcc (cross-gcc "vc4-elf" #:xbinutils binutils-vc4)))
  825. (package (inherit xgcc)
  826. (name "gcc-vc4")
  827. (source (origin
  828. (method git-fetch)
  829. (uri (git-reference
  830. (url "https://github.com/puppeh/gcc-vc4.git")
  831. (commit commit)))
  832. (file-name (string-append name
  833. "-"
  834. (package-version xgcc)
  835. "-checkout"))
  836. (sha256
  837. (base32
  838. "13h30qjcwnlz6lfma1d82nnvfmjnhh7abkagip4vly6vm5fpnvf2"))))
  839. (native-inputs
  840. `(("flex" ,flex)
  841. ,@(package-native-inputs xgcc)))
  842. (synopsis "GCC for VC4")
  843. (description "This package provides @code{gcc} for VideoCore IV,
  844. the Raspberry Pi chip."))))
  845. (define-public python2-libmpsse
  846. (package
  847. (name "python2-libmpsse")
  848. (version "1.3")
  849. (source
  850. (origin
  851. (method url-fetch)
  852. (uri (string-append "https://storage.googleapis.com/"
  853. "google-code-archive-downloads/v2/"
  854. "code.google.com/libmpsse/"
  855. "libmpsse-" version ".tar.gz"))
  856. (sha256
  857. (base32
  858. "0jq7nhqq3na8675jnpfcar3pd3dp3adhhc4lw900swkla01a1wh8"))))
  859. (build-system gnu-build-system)
  860. (inputs
  861. `(("libftdi" ,libftdi)
  862. ("python" ,python-2)))
  863. (native-inputs
  864. `(("pkg-config" ,pkg-config)
  865. ("swig" ,swig)
  866. ("which" ,base:which)))
  867. (arguments
  868. `(#:tests? #f ; No tests exist.
  869. #:make-flags
  870. (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
  871. "$(shell pkg-config --cflags libftdi1)"))
  872. #:phases
  873. (modify-phases %standard-phases
  874. (add-after 'unpack 'set-environment-up
  875. (lambda* (#:key inputs outputs #:allow-other-keys)
  876. (chdir "src")
  877. (setenv "PYDEV" (string-append (assoc-ref inputs "python")
  878. "/include/python2.7"))
  879. #t))
  880. (add-after 'unpack 'patch-global-variable
  881. (lambda _
  882. ;; fast_rw_buf was defined in a header file which was making
  883. ;; the build not reproducible.
  884. (substitute* "src/fast.c"
  885. (("^int fast_build_block_buffer") "
  886. unsigned char fast_rw_buf[SPI_RW_SIZE + CMD_SIZE];
  887. int fast_build_block_buffer"))
  888. (substitute* "src/mpsse.h"
  889. (("unsigned char fast_rw_buf.*") "
  890. "))
  891. #t))
  892. (replace 'install
  893. (lambda* (#:key outputs make-flags #:allow-other-keys #:rest args)
  894. (let* ((out (assoc-ref outputs "out"))
  895. (out-python (string-append out
  896. "/lib/python2.7/site-packages"))
  897. (install (assoc-ref %standard-phases 'install)))
  898. (install #:make-flags (cons (string-append "PYLIB=" out-python)
  899. make-flags))))))))
  900. (home-page "https://code.google.com/archive/p/libmpsse/")
  901. (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
  902. (description "This package provides a library in order to support the
  903. MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
  904. SPI, I2C, JTAG.")
  905. (license license:gpl2+)))
  906. (define-public picprog
  907. (package
  908. (name "picprog")
  909. (version "1.9.1")
  910. (source (origin
  911. (method url-fetch)
  912. (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
  913. version ".tar.gz"))
  914. (file-name (string-append name "-" version ".tar.gz"))
  915. (sha256
  916. (base32
  917. "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
  918. (patches (search-patches "picprog-non-intel-support.patch"))))
  919. (build-system gnu-build-system)
  920. (arguments
  921. `(#:tests? #f ; No tests exist.
  922. #:phases
  923. (modify-phases %standard-phases
  924. (add-after 'unpack 'patch-paths
  925. (lambda* (#:key outputs #:allow-other-keys)
  926. (substitute* "Makefile"
  927. (("/usr/local") (assoc-ref outputs "out"))
  928. ((" -o 0 -g 0 ") " ")
  929. (("testport") ""))
  930. #t))
  931. (add-before 'install 'mkdir
  932. (lambda* (#:key outputs #:allow-other-keys)
  933. (let ((out (assoc-ref outputs "out")))
  934. (mkdir-p (string-append out "/bin"))
  935. (mkdir-p (string-append out "/man/man1"))
  936. #t)))
  937. (delete 'configure))))
  938. (synopsis "Programs Microchip's PIC microcontrollers")
  939. (description "This program programs Microchip's PIC microcontrollers.")
  940. (home-page "http://hyvatti.iki.fi/~jaakko/pic/picprog.html")
  941. (license license:gpl3+)))
  942. (define-public fc-host-tools
  943. (package
  944. (name "fc-host-tools")
  945. (version "9a")
  946. (source (origin
  947. (method url-fetch)
  948. (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
  949. "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
  950. (sha256
  951. (base32
  952. "15w1njlvbzzbr9bwj2hwy8na3a55p1z1cysk5h9iziz9y955ansg"))))
  953. (build-system gnu-build-system)
  954. (arguments
  955. `(#:tests? #f ; No tests exist.
  956. #:make-flags
  957. (list (string-append "INSTBIN=" %output "/bin")
  958. (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
  959. #:phases
  960. (modify-phases %standard-phases
  961. (delete 'configure)
  962. (add-after 'unpack 'handle-tarbomb
  963. (lambda _
  964. (chdir "..") ; url-fetch/tarbomb doesn't work for some reason.
  965. #t))
  966. (add-after 'handle-tarbomb 'patch-installation-paths
  967. (lambda* (#:key outputs #:allow-other-keys)
  968. (substitute* '("Makefile"
  969. "rvinterf/etmsync/fsiomain.c"
  970. "rvinterf/etmsync/fsnew.c"
  971. "rvinterf/asyncshell/help.c"
  972. "rvinterf/libinterf/launchrvif.c"
  973. "loadtools/defpath.c"
  974. "loadtools/Makefile"
  975. "miscutil/c139explore"
  976. "miscutil/pirexplore"
  977. "ffstools/tiffs-wrappers/installpath.c"
  978. "uptools/atcmd/atinterf.c")
  979. (("/opt/freecalypso/loadtools")
  980. (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
  981. (("/opt/freecalypso")
  982. (assoc-ref outputs "out")))
  983. #t)))))
  984. (inputs
  985. `(("libx11" ,libx11)))
  986. (synopsis "Freecalypso host tools")
  987. (description "This package provides some tools for debugging Freecalypso phones.
  988. @enumerate
  989. @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
  990. @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
  991. @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
  992. strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
  993. Calypso GSM device.
  994. @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
  995. @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
  996. source format into a voice memo file that can be uploaded into the FFS of a
  997. FreeCalypso device and played with the audio_vm_play_start() API or the
  998. AT@@VMP command that invokes the latter.
  999. @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
  1000. @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
  1001. @item rvtdump: produces a human-readable dump of all output emitted by a
  1002. TI-based GSM fw on the RVTMUX binary packet interface.
  1003. @item fc-shell: FreeCalypso firmwares have a feature of our own invention
  1004. (not present in any pre-existing ones) to accept AT commands over the RVTMUX
  1005. interface. It is useful when no second UART is available for a dedicated
  1006. standard AT command interface. fc-shell is the tool that allows you to send
  1007. AT commands to the firmware in this manner.
  1008. @item fc-memdump: Captures a memory dump from a GSM device.
  1009. @item fc-serterm: Trivial serial terminal. Escapes binary chars.
  1010. @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
  1011. allows you to manipulate the device's flash file system.
  1012. @item tiaud-compile: Compiles an audio mode configuration table for TI's
  1013. Audio Service from our own ASCII source format into the binary format for
  1014. uploading into FreeCalypso GSM device FFS with fc-fsio.
  1015. @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
  1016. FFS into our own ASCII format.
  1017. @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
  1018. the main *.cfg ones.
  1019. @item fc-compalram: Allows running programs on the device without writing
  1020. them to flash storage.
  1021. @item fc-xram: Allows running programs on the device without writing them
  1022. to flash storage.
  1023. @item fc-iram: Allows running programs on the device without writing them
  1024. to flash storage.
  1025. @item fc-loadtool: Writes programs to the device's flash storage.
  1026. @item pirffs: Allows listing and extracting FFS content captured as a raw
  1027. flash image from Pirelli phones.
  1028. @item mokoffs: Allows listing and extracting FFS content captured as a raw
  1029. flash image from OpenMoko phones.
  1030. @item tiffs: Allows listing and extracting FFS content captured as a raw
  1031. flash image from TI phones.
  1032. @item c139explore: Run-from-RAM program for C139 phones that
  1033. exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
  1034. @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
  1035. exercises their peripheral hardware, primarily their LCD.
  1036. @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
  1037. you to reflash locked phones with new firmware with fc-loadtool.
  1038. @item ctracedec: GSM firmwares built in TI's Windows environment have a
  1039. compressed trace misfeature whereby many of the ASCII strings
  1040. in debug trace messages get replaced with numeric indices at
  1041. build time, and these numeric indices are all that gets emitted
  1042. on the RVTMUX serial channel. This tools decodes these numeric indices
  1043. back to strings in trace output.
  1044. @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
  1045. directory subtree as input (either extracted in vitro with tiffs
  1046. or read out in vivo with fc-fsio) and converts all RF tables
  1047. found therein into a readable ASCII format.
  1048. @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
  1049. @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
  1050. target Calypso GSM device.
  1051. @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
  1052. out of FFS into hex strings.
  1053. @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
  1054. Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
  1055. our planned future HSMBP) by loading a buzplayer agent onto the target and
  1056. feeding melodies to be played to it.
  1057. @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
  1058. that can be issued through the RVTMUX (debug trace) serial channel.
  1059. This program is our test mode shell for sending Test Mode commands to targets
  1060. and displaying decoded target responses.
  1061. @item fcup-smsend Send a short message via SMS
  1062. @item fcup-smsendmult Send multiple short messages via SMS in one go
  1063. @item fcup-smsendpdu Send multiple short messages given in PDU format via SMS
  1064. @item sms-pdu-decode Decode PDU format messages
  1065. @end enumerate")
  1066. (home-page "https://www.freecalypso.org/")
  1067. (license license:public-domain)))
  1068. (define-public stlink
  1069. (package
  1070. (name "stlink")
  1071. (version "1.5.1")
  1072. (source
  1073. (origin
  1074. (method url-fetch)
  1075. (uri (string-append "https://github.com/texane/stlink/archive/v"
  1076. version ".tar.gz"))
  1077. (file-name (string-append name "-" version ".tar.gz"))
  1078. (sha256
  1079. (base32
  1080. "01z1cz1a5xbbhd163qrqcgp4bi1k145pb80jmwdz50g7sfzmy570"))))
  1081. (build-system cmake-build-system)
  1082. (arguments
  1083. `(#:tests? #f ;no tests
  1084. #:configure-flags
  1085. (let* ((out (assoc-ref %outputs "out"))
  1086. (etc (in-vicinity out "etc"))
  1087. (modprobe (in-vicinity etc "modprobe.d"))
  1088. (udev-rules (in-vicinity etc "udev/rules.d")))
  1089. (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
  1090. (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
  1091. (inputs
  1092. `(("libusb" ,libusb)))
  1093. (synopsis "Programmer for STM32 Discovery boards")
  1094. (description "This package provides a firmware programmer for the STM32
  1095. Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
  1096. STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
  1097. Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
  1098. commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
  1099. raw USB commands.")
  1100. (home-page "https://github.com/texane/stlink")
  1101. ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
  1102. ;; licensed under the GPLv2+.
  1103. (license (list license:bsd-3 license:gpl2+))))