embedded.scm 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016, 2017, 2018, 2019 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, 2020 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2018, 2019, 2021 Clément Lassieur <clement@lassieur.org>
  8. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  9. ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
  10. ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
  11. ;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
  12. ;;;
  13. ;;; This file is part of GNU Guix.
  14. ;;;
  15. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  16. ;;; under the terms of the GNU General Public License as published by
  17. ;;; the Free Software Foundation; either version 3 of the License, or (at
  18. ;;; your option) any later version.
  19. ;;;
  20. ;;; GNU Guix is distributed in the hope that it will be useful, but
  21. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  22. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. ;;; GNU General Public License for more details.
  24. ;;;
  25. ;;; You should have received a copy of the GNU General Public License
  26. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  27. (define-module (gnu packages embedded)
  28. #:use-module (guix utils)
  29. #:use-module (guix packages)
  30. #:use-module (guix download)
  31. #:use-module (guix svn-download)
  32. #:use-module (guix git-download)
  33. #:use-module ((guix licenses) #:prefix license:)
  34. #:use-module (guix build-system cmake)
  35. #:use-module (guix build-system gnu)
  36. #:use-module (guix build-system python)
  37. #:use-module (guix build-system trivial)
  38. #:use-module ((guix build utils) #:select (alist-replace delete-file-recursively))
  39. #:use-module (gnu packages)
  40. #:use-module (gnu packages admin)
  41. #:use-module (gnu packages autotools)
  42. #:use-module ((gnu packages base) #:prefix base:)
  43. #:use-module (gnu packages bison)
  44. #:use-module (gnu packages boost)
  45. #:use-module (gnu packages compression)
  46. #:use-module (gnu packages cross-base)
  47. #:use-module (gnu packages dejagnu)
  48. #:use-module (gnu packages flex)
  49. #:use-module (gnu packages gcc)
  50. #:use-module (gnu packages gdb)
  51. #:use-module (gnu packages guile)
  52. #:use-module (gnu packages libftdi)
  53. #:use-module (gnu packages libusb)
  54. #:use-module (gnu packages messaging)
  55. #:use-module (gnu packages perl)
  56. #:use-module (gnu packages pkg-config)
  57. #:use-module (gnu packages python)
  58. #:use-module (gnu packages python-crypto)
  59. #:use-module (gnu packages python-xyz)
  60. #:use-module (gnu packages swig)
  61. #:use-module (gnu packages texinfo)
  62. #:use-module (gnu packages xorg)
  63. #:use-module (srfi srfi-1))
  64. ;; We must not use the released GCC sources here, because the cross-compiler
  65. ;; does not produce working binaries. Instead we take the very same SVN
  66. ;; revision from the branch that is used for a release of the "GCC ARM
  67. ;; embedded" project on launchpad.
  68. ;; See https://launchpadlibrarian.net/218827644/release.txt
  69. (define-public gcc-arm-none-eabi-4.9
  70. (let ((xgcc (cross-gcc "arm-none-eabi"
  71. #:xgcc gcc-4.9
  72. #:xbinutils (cross-binutils "arm-none-eabi")))
  73. (revision "1")
  74. (svn-revision 227977))
  75. (package (inherit xgcc)
  76. (version (string-append (package-version xgcc) "-"
  77. revision "." (number->string svn-revision)))
  78. (source
  79. (origin
  80. (method svn-fetch)
  81. (uri (svn-reference
  82. (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
  83. (revision svn-revision)))
  84. (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
  85. (sha256
  86. (base32
  87. "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
  88. ;; Remove the one patch that doesn't apply to this 4.9 snapshot (the
  89. ;; patch is for 4.9.4 and later but this svn snapshot is older).
  90. (patches (remove (lambda (patch)
  91. (string=? (basename patch)
  92. "gcc-arm-bug-71399.patch"))
  93. (origin-patches (package-source xgcc))))))
  94. (native-inputs
  95. `(("flex" ,flex)
  96. ("gcc@5" ,gcc-5)
  97. ,@(package-native-inputs xgcc)))
  98. (arguments
  99. (substitute-keyword-arguments (package-arguments xgcc)
  100. ((#:phases phases)
  101. `(modify-phases ,phases
  102. (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
  103. (lambda* (#:key inputs #:allow-other-keys)
  104. (let ((gcc (assoc-ref inputs "gcc")))
  105. ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
  106. ;; prevent header conflict with the GCC from native-inputs.
  107. (setenv "CPLUS_INCLUDE_PATH"
  108. (string-join
  109. (delete (string-append gcc "/include/c++")
  110. (string-split (getenv "CPLUS_INCLUDE_PATH")
  111. #\:))
  112. ":"))
  113. (format #t
  114. "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
  115. (getenv "CPLUS_INCLUDE_PATH"))
  116. #t)))
  117. (add-after 'unpack 'fix-genmultilib
  118. (lambda _
  119. (substitute* "gcc/genmultilib"
  120. (("#!/bin/sh") (string-append "#!" (which "sh"))))
  121. #t))))
  122. ((#:configure-flags flags)
  123. ;; The configure flags are largely identical to the flags used by the
  124. ;; "GCC ARM embedded" project.
  125. `(append (list "--enable-multilib"
  126. "--with-newlib"
  127. "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
  128. "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
  129. "--enable-plugins"
  130. "--disable-decimal-float"
  131. "--disable-libffi"
  132. "--disable-libgomp"
  133. "--disable-libmudflap"
  134. "--disable-libquadmath"
  135. "--disable-libssp"
  136. "--disable-libstdcxx-pch"
  137. "--disable-nls"
  138. "--disable-shared"
  139. "--disable-threads"
  140. "--disable-tls")
  141. (delete "--disable-multilib" ,flags)))))
  142. (native-search-paths
  143. (list (search-path-specification
  144. (variable "CROSS_C_INCLUDE_PATH")
  145. (files '("arm-none-eabi/include")))
  146. (search-path-specification
  147. (variable "CROSS_CPLUS_INCLUDE_PATH")
  148. (files '("arm-none-eabi/include"
  149. "arm-none-eabi/include/c++"
  150. "arm-none-eabi/include/c++/arm-none-eabi")))
  151. (search-path-specification
  152. (variable "CROSS_LIBRARY_PATH")
  153. (files '("arm-none-eabi/lib"))))))))
  154. (define-public gcc-arm-none-eabi-6
  155. (package
  156. (inherit gcc-arm-none-eabi-4.9)
  157. (version (package-version gcc-6))
  158. (source (origin (inherit (package-source gcc-6))
  159. (patches
  160. (append
  161. (origin-patches (package-source gcc-6))
  162. (search-patches "gcc-6-cross-environment-variables.patch"
  163. "gcc-6-arm-none-eabi-multilib.patch")))))))
  164. (define-public newlib-arm-none-eabi
  165. (package
  166. (name "newlib")
  167. (version "2.4.0")
  168. (source (origin
  169. (method url-fetch)
  170. (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
  171. version ".tar.gz"))
  172. (sha256
  173. (base32
  174. "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
  175. (build-system gnu-build-system)
  176. (arguments
  177. `(#:out-of-source? #t
  178. ;; The configure flags are identical to the flags used by the "GCC ARM
  179. ;; embedded" project.
  180. #:configure-flags '("--target=arm-none-eabi"
  181. "--enable-newlib-io-long-long"
  182. "--enable-newlib-register-fini"
  183. "--disable-newlib-supplied-syscalls"
  184. "--disable-nls")
  185. #:phases
  186. (modify-phases %standard-phases
  187. (add-after 'unpack 'fix-references-to-/bin/sh
  188. (lambda _
  189. (substitute* '("libgloss/arm/cpu-init/Makefile.in"
  190. "libgloss/arm/Makefile.in"
  191. "libgloss/libnosys/Makefile.in"
  192. "libgloss/Makefile.in")
  193. (("/bin/sh") (which "sh")))
  194. #t)))))
  195. (native-inputs
  196. `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
  197. ("xgcc" ,gcc-arm-none-eabi-4.9)
  198. ("texinfo" ,texinfo)))
  199. (home-page "https://www.sourceware.org/newlib/")
  200. (synopsis "C library for use on embedded systems")
  201. (description "Newlib is a C library intended for use on embedded
  202. systems. It is a conglomeration of several library parts that are easily
  203. usable on embedded products.")
  204. (license (license:non-copyleft
  205. "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
  206. (define-public newlib-nano-arm-none-eabi
  207. (package (inherit newlib-arm-none-eabi)
  208. (name "newlib-nano")
  209. (arguments
  210. (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
  211. ;; The configure flags are identical to the flags used by the "GCC ARM
  212. ;; embedded" project. They optimize newlib for use on small embedded
  213. ;; systems with limited memory.
  214. ((#:configure-flags flags)
  215. ''("--target=arm-none-eabi"
  216. "--enable-multilib"
  217. "--disable-newlib-supplied-syscalls"
  218. "--enable-newlib-reent-small"
  219. "--disable-newlib-fvwrite-in-streamio"
  220. "--disable-newlib-fseek-optimization"
  221. "--disable-newlib-wide-orient"
  222. "--enable-newlib-nano-malloc"
  223. "--disable-newlib-unbuf-stream-opt"
  224. "--enable-lite-exit"
  225. "--enable-newlib-global-atexit"
  226. "--enable-newlib-nano-formatted-io"
  227. "--disable-nls"))
  228. ((#:phases phases)
  229. `(modify-phases ,phases
  230. ;; XXX: Most arm toolchains offer both *.a and *_nano.a as newlib
  231. ;; and newlib-nano respectively. The headers are usually
  232. ;; arm-none-eabi/include/newlib.h for newlib and
  233. ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano. We
  234. ;; have two different toolchain packages for each which works but
  235. ;; is a little strange.
  236. (add-after 'install 'hardlink-newlib
  237. (lambda* (#:key outputs #:allow-other-keys)
  238. (let ((out (assoc-ref outputs "out")))
  239. ;; The nano.specs file says that newlib-nano files should end
  240. ;; in "_nano.a" instead of just ".a". Note that this applies
  241. ;; to all the multilib folders too.
  242. (for-each
  243. (lambda (file)
  244. (link file
  245. (string-append
  246. ;; Strip ".a" off the end
  247. (substring file 0 (- (string-length file) 2))
  248. ;; Add "_nano.a" onto the end
  249. "_nano.a")))
  250. (find-files
  251. out
  252. "^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|libsupc\\+\\+.a)$"))
  253. ;; newlib.h is usually in this location instead so both
  254. ;; newlib and newlib-nano can be in the toolchain at the same
  255. ;; time
  256. (mkdir (string-append out "/arm-none-eabi/include/newlib-nano"))
  257. (symlink
  258. "../newlib.h"
  259. (string-append out "/arm-none-eabi/include/newlib-nano/newlib.h"))
  260. #t)))))))
  261. (synopsis "Newlib variant for small systems with limited memory")))
  262. ;;; The following definitions are for the "7-2018-q2-update" variant of the
  263. ;;; ARM cross toolchain as offered on https://developer.arm.com
  264. (define-public gcc-arm-none-eabi-7-2018-q2-update
  265. (let ((xgcc (cross-gcc "arm-none-eabi"
  266. #:xgcc gcc-7
  267. #:xbinutils (cross-binutils "arm-none-eabi")))
  268. (revision "1")
  269. (svn-revision 261907))
  270. (package (inherit xgcc)
  271. (version (string-append "7-2018-q2-update-"
  272. revision "." (number->string svn-revision)))
  273. (source
  274. (origin
  275. (method svn-fetch)
  276. (uri (svn-reference
  277. (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/")
  278. (revision svn-revision)))
  279. (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
  280. (sha256
  281. (base32
  282. "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5"))
  283. (patches
  284. (append
  285. (origin-patches (package-source gcc-7))
  286. (search-patches "gcc-7-cross-environment-variables.patch")))))
  287. (native-inputs
  288. `(("flex" ,flex)
  289. ("isl" ,isl-0.18)
  290. ,@(alist-delete "isl" (package-native-inputs xgcc))))
  291. (arguments
  292. (substitute-keyword-arguments (package-arguments xgcc)
  293. ((#:phases phases)
  294. `(modify-phases ,phases
  295. (add-after 'unpack 'expand-version-string
  296. (lambda _
  297. (make-file-writable "gcc/DEV-PHASE")
  298. (with-output-to-file "gcc/DEV-PHASE"
  299. (lambda ()
  300. (display "7-2018-q2-update")))
  301. #t))
  302. (add-after 'unpack 'fix-genmultilib
  303. (lambda _
  304. (substitute* "gcc/genmultilib"
  305. (("#!/bin/sh") (string-append "#!" (which "sh"))))
  306. #t))
  307. (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
  308. (lambda* (#:key inputs #:allow-other-keys)
  309. (let ((gcc (assoc-ref inputs "gcc")))
  310. ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
  311. ;; prevent header conflict with the GCC from native-inputs.
  312. (setenv "CPLUS_INCLUDE_PATH"
  313. (string-join
  314. (delete (string-append gcc "/include/c++")
  315. (string-split (getenv "CPLUS_INCLUDE_PATH")
  316. #\:))
  317. ":"))
  318. (format #t
  319. "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
  320. (getenv "CPLUS_INCLUDE_PATH"))
  321. #t)))))
  322. ((#:configure-flags flags)
  323. ;; The configure flags are largely identical to the flags used by the
  324. ;; "GCC ARM embedded" project.
  325. `(append (list "--enable-multilib"
  326. "--with-newlib"
  327. "--with-multilib-list=rmprofile"
  328. "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
  329. "--enable-plugins"
  330. "--disable-decimal-float"
  331. "--disable-libffi"
  332. "--disable-libgomp"
  333. "--disable-libmudflap"
  334. "--disable-libquadmath"
  335. "--disable-libssp"
  336. "--disable-libstdcxx-pch"
  337. "--disable-nls"
  338. "--disable-shared"
  339. "--disable-threads"
  340. "--disable-tls")
  341. (delete "--disable-multilib" ,flags)))))
  342. (native-search-paths
  343. (list (search-path-specification
  344. (variable "CROSS_C_INCLUDE_PATH")
  345. (files '("arm-none-eabi/include")))
  346. (search-path-specification
  347. (variable "CROSS_CPLUS_INCLUDE_PATH")
  348. (files '("arm-none-eabi/include"
  349. "arm-none-eabi/include/c++"
  350. "arm-none-eabi/include/c++/arm-none-eabi")))
  351. (search-path-specification
  352. (variable "CROSS_LIBRARY_PATH")
  353. (files '("arm-none-eabi/lib"))))))))
  354. (define-public newlib-arm-none-eabi-7-2018-q2-update
  355. ;; This is the same commit as used for the 7-2018-q2-update release
  356. ;; according to the release.txt.
  357. (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4")
  358. (revision "0"))
  359. (package
  360. (inherit newlib-arm-none-eabi)
  361. (version (git-version "3.0.0" revision commit))
  362. (source
  363. (origin
  364. (method git-fetch)
  365. (uri (git-reference
  366. (url "http://sourceware.org/git/newlib-cygwin.git")
  367. (commit commit)))
  368. (file-name (git-file-name "newlib" commit))
  369. (sha256
  370. (base32
  371. "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy"))))
  372. (arguments
  373. (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
  374. ;; The configure flags are identical to the flags used by the "GCC ARM
  375. ;; embedded" project.
  376. ((#:configure-flags flags)
  377. `(cons* "--enable-newlib-io-c99-formats"
  378. "--enable-newlib-retargetable-locking"
  379. "--with-headers=yes"
  380. ,flags))))
  381. (native-inputs
  382. `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
  383. ("xgcc" ,gcc-arm-none-eabi-7-2018-q2-update)
  384. ("texinfo" ,texinfo))))))
  385. (define-public newlib-nano-arm-none-eabi-7-2018-q2-update
  386. (package (inherit newlib-arm-none-eabi-7-2018-q2-update)
  387. (name "newlib-nano")
  388. (arguments
  389. (package-arguments newlib-nano-arm-none-eabi))
  390. (synopsis "Newlib variant for small systems with limited memory")))
  391. (define (make-libstdc++-arm-none-eabi xgcc newlib)
  392. (let ((libstdc++ (make-libstdc++ xgcc)))
  393. (package (inherit libstdc++)
  394. (name "libstdc++-arm-none-eabi")
  395. (arguments
  396. (substitute-keyword-arguments (package-arguments libstdc++)
  397. ((#:configure-flags flags)
  398. ``("--target=arm-none-eabi"
  399. "--host=arm-none-eabi"
  400. "--disable-libstdcxx-pch"
  401. "--enable-multilib"
  402. "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
  403. "--disable-shared"
  404. "--disable-tls"
  405. "--disable-plugin"
  406. "--with-newlib"
  407. ,(string-append "--with-gxx-include-dir="
  408. (assoc-ref %outputs "out")
  409. "/arm-none-eabi/include/c++")))))
  410. (native-inputs
  411. `(("newlib" ,newlib)
  412. ("xgcc" ,xgcc)
  413. ,@(package-native-inputs libstdc++))))))
  414. (define (arm-none-eabi-toolchain xgcc newlib)
  415. "Produce a cross-compiler toolchain package with the compiler XGCC and the C
  416. library variant NEWLIB."
  417. (let ((newlib-with-xgcc (package (inherit newlib)
  418. (native-inputs
  419. (alist-replace "xgcc" (list xgcc)
  420. (package-native-inputs newlib))))))
  421. (package
  422. (name (string-append "arm-none-eabi"
  423. (if (string=? (package-name newlib-with-xgcc)
  424. "newlib-nano")
  425. "-nano" "")
  426. "-toolchain"))
  427. (version (package-version xgcc))
  428. (source #f)
  429. (build-system trivial-build-system)
  430. (arguments
  431. '(#:modules ((guix build union))
  432. #:builder
  433. (begin
  434. (use-modules (ice-9 match)
  435. (guix build union))
  436. (match %build-inputs
  437. (((names . directories) ...)
  438. (union-build (assoc-ref %outputs "out")
  439. directories)
  440. #t)))))
  441. (propagated-inputs
  442. `(("binutils" ,(cross-binutils "arm-none-eabi"))
  443. ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc))
  444. ("gcc" ,xgcc)
  445. ("newlib" ,newlib-with-xgcc)))
  446. (synopsis "Complete GCC tool chain for ARM bare metal development")
  447. (description "This package provides a complete GCC tool chain for ARM
  448. bare metal development. This includes the GCC arm-none-eabi cross compiler
  449. and newlib (or newlib-nano) as the C library. The supported programming
  450. languages are C and C++.")
  451. (home-page (package-home-page xgcc))
  452. (license (package-license xgcc)))))
  453. (define-public arm-none-eabi-toolchain-4.9
  454. (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
  455. newlib-arm-none-eabi))
  456. (define-public arm-none-eabi-nano-toolchain-4.9
  457. (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9
  458. newlib-nano-arm-none-eabi))
  459. (define-public arm-none-eabi-toolchain-6
  460. (arm-none-eabi-toolchain gcc-arm-none-eabi-6
  461. newlib-arm-none-eabi))
  462. (define-public arm-none-eabi-nano-toolchain-6
  463. (arm-none-eabi-toolchain gcc-arm-none-eabi-6
  464. newlib-nano-arm-none-eabi))
  465. (define-public arm-none-eabi-toolchain-7-2018-q2-update
  466. (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
  467. newlib-arm-none-eabi-7-2018-q2-update))
  468. (define-public arm-none-eabi-nano-toolchain-7-2018-q2-update
  469. (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update
  470. newlib-nano-arm-none-eabi-7-2018-q2-update))
  471. (define-public gdb-arm-none-eabi
  472. (package
  473. (inherit gdb)
  474. (name "gdb-arm-none-eabi")
  475. (arguments
  476. `(#:configure-flags '("--target=arm-none-eabi"
  477. "--enable-multilib"
  478. "--enable-interwork"
  479. "--enable-languages=c,c++"
  480. "--disable-nls")
  481. ,@(package-arguments gdb)))))
  482. (define-public libjaylink
  483. (package
  484. (name "libjaylink")
  485. (version "0.2.0")
  486. (source (origin
  487. (method git-fetch)
  488. (uri (git-reference
  489. (url "https://repo.or.cz/libjaylink.git")
  490. (commit version)))
  491. (file-name (git-file-name name version))
  492. (sha256
  493. (base32
  494. "0ndyfh51hiqyv2yscpj6qd091w7myxxjid3a6rx8f6k233vy826q"))))
  495. (build-system gnu-build-system)
  496. (native-inputs
  497. `(("autoconf" ,autoconf)
  498. ("automake" ,automake)
  499. ("libtool" ,libtool)
  500. ("pkg-config" ,pkg-config)))
  501. (inputs
  502. `(("libusb" ,libusb)))
  503. (home-page "https://repo.or.cz/w/libjaylink.git")
  504. (synopsis "Library to interface Segger J-Link devices")
  505. (description "libjaylink is a shared library written in C to access
  506. SEGGER J-Link and compatible devices.")
  507. (license license:gpl2+)))
  508. (define-public jimtcl
  509. (package
  510. (name "jimtcl")
  511. (version "0.80")
  512. (source (origin
  513. (method git-fetch)
  514. (uri (git-reference
  515. (url "https://github.com/msteveb/jimtcl")
  516. (commit version)))
  517. (file-name (git-file-name name version))
  518. (sha256
  519. (base32
  520. "06rn60cx9sapc175vxvan87b8j5rkhh5gvvz7343xznzwlr0wcgk"))))
  521. (build-system gnu-build-system)
  522. (arguments
  523. `(#:phases
  524. (modify-phases %standard-phases
  525. (replace 'configure
  526. ;; This package doesn't use autoconf.
  527. (lambda* (#:key outputs #:allow-other-keys)
  528. (let ((out (assoc-ref outputs "out")))
  529. (invoke "./configure"
  530. (string-append "--prefix=" out)))))
  531. (add-before 'check 'delete-failing-tests
  532. (lambda _
  533. ;; XXX All but 1 TTY tests fail (Inappropriate ioctl for device).
  534. (delete-file "tests/tty.test")
  535. #t))
  536. )))
  537. (native-inputs
  538. ;; For tests.
  539. `(("inetutils" ,inetutils))) ; for hostname
  540. (home-page "http://jim.tcl.tk/index.html")
  541. (synopsis "Small footprint Tcl implementation")
  542. (description "Jim is a small footprint implementation of the Tcl programming
  543. language.")
  544. (license license:bsd-2)))
  545. (define-public openocd
  546. (let ((commit "9a877a83a1c8b1f105cdc0de46c5cbc4d9e8799e")
  547. (revision "0"))
  548. (package
  549. (name "openocd")
  550. (version (string-append "0.10.0-" revision "."
  551. (string-take commit 7)))
  552. (source (origin
  553. (method git-fetch)
  554. (uri (git-reference
  555. (url "https://git.code.sf.net/p/openocd/code")
  556. (commit commit)))
  557. (file-name (string-append name "-" version "-checkout"))
  558. (sha256
  559. (base32
  560. "1q536cp80v2bcy6xwk08f1r2ljyw13jchx3a1z7d3ni3vqql7rc6"))))
  561. (build-system gnu-build-system)
  562. (native-inputs
  563. `(("autoconf" ,autoconf)
  564. ("automake" ,automake)
  565. ("libtool" ,libtool)
  566. ("which" ,base:which)
  567. ("pkg-config" ,pkg-config)
  568. ("texinfo" ,texinfo)))
  569. (inputs
  570. `(("hidapi" ,hidapi)
  571. ("jimtcl" ,jimtcl)
  572. ("libftdi" ,libftdi)
  573. ("libjaylink" ,libjaylink)
  574. ("libusb-compat" ,libusb-compat)))
  575. (arguments
  576. '(#:configure-flags
  577. (append (list "LIBS=-lutil"
  578. "--disable-werror"
  579. "--enable-sysfsgpio"
  580. "--disable-internal-jimtcl"
  581. "--disable-internal-libjaylink")
  582. (map (lambda (programmer)
  583. (string-append "--enable-" programmer))
  584. '("amtjtagaccel" "armjtagew" "buspirate" "ftdi"
  585. "gw16012" "jlink" "opendous" "osbdm"
  586. "parport" "aice" "cmsis-dap" "dummy" "jtag_vpi"
  587. "remote-bitbang" "rlink" "stlink" "ti-icdi" "ulink"
  588. "usbprog" "vsllink" "usb-blaster-2" "usb_blaster"
  589. "presto" "openjtag")))
  590. #:phases
  591. (modify-phases %standard-phases
  592. (replace 'bootstrap
  593. (lambda _
  594. (patch-shebang "bootstrap")
  595. (invoke "./bootstrap" "nosubmodule")))
  596. (add-after 'autoreconf 'change-udev-group
  597. (lambda _
  598. (substitute* "contrib/60-openocd.rules"
  599. (("plugdev") "dialout"))
  600. #t))
  601. (add-after 'install 'install-udev-rules
  602. (lambda* (#:key outputs #:allow-other-keys)
  603. (install-file "contrib/60-openocd.rules"
  604. (string-append
  605. (assoc-ref outputs "out")
  606. "/lib/udev/rules.d/"))
  607. #t)))))
  608. (home-page "http://openocd.org")
  609. (synopsis "On-Chip Debugger")
  610. (description "OpenOCD provides on-chip programming and debugging support
  611. with a layered architecture of JTAG interface and TAP support.")
  612. (license license:gpl2+))))
  613. ;; The commits for all propeller tools are the stable versions published at
  614. ;; https://github.com/propellerinc/propgcc in the release_1_0. According to
  615. ;; personal correspondence with the developers in July 2017, more recent
  616. ;; versions are currently incompatible with the "Simple Libraries".
  617. (define propeller-binutils
  618. (let ((xbinutils (cross-binutils "propeller-elf"))
  619. (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  620. (revision "2"))
  621. (package
  622. (inherit xbinutils)
  623. (name "propeller-binutils")
  624. (version (string-append "0.0.0-" revision "." (string-take commit 9)))
  625. (source (origin (inherit (package-source xbinutils))
  626. (method git-fetch)
  627. (uri (git-reference
  628. (url "https://github.com/parallaxinc/propgcc")
  629. (commit commit)))
  630. (file-name (string-append name "-" commit "-checkout"))
  631. (sha256
  632. (base32
  633. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
  634. (patch-flags (list "-p1" "--directory=binutils"))))
  635. (arguments
  636. `(;; FIXME: For some reason there are many test failures. It's not
  637. ;; obvious how to fix the failures.
  638. #:tests? #f
  639. #:phases
  640. (modify-phases %standard-phases
  641. (add-after 'unpack 'chdir
  642. (lambda _ (chdir "binutils") #t)))
  643. ,@(substitute-keyword-arguments (package-arguments xbinutils)
  644. ((#:configure-flags flags)
  645. `(cons "--disable-werror" ,flags)))))
  646. (native-inputs
  647. `(("bison" ,bison)
  648. ("flex" ,flex)
  649. ("texinfo" ,texinfo)
  650. ("dejagnu" ,dejagnu)
  651. ,@(package-native-inputs xbinutils))))))
  652. (define-public propeller-gcc-6
  653. (let ((xgcc (cross-gcc "propeller-elf"
  654. #:xbinutils propeller-binutils))
  655. (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867")
  656. (revision "1"))
  657. (package (inherit xgcc)
  658. (name "propeller-gcc")
  659. (version (string-append "6.0.0-" revision "." (string-take commit 9)))
  660. (source (origin
  661. (method git-fetch)
  662. (uri (git-reference
  663. (url "https://github.com/totalspectrum/gcc-propeller")
  664. (commit commit)))
  665. (file-name (string-append name "-" commit "-checkout"))
  666. (sha256
  667. (base32
  668. "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb"))
  669. (patches
  670. (append
  671. (origin-patches (package-source gcc-6))
  672. (search-patches "gcc-cross-environment-variables.patch")))))
  673. (native-inputs
  674. `(("flex" ,flex)
  675. ,@(package-native-inputs xgcc)))
  676. ;; All headers and cross libraries of the propeller toolchain are
  677. ;; installed under the "propeller-elf" prefix.
  678. (native-search-paths
  679. (list (search-path-specification
  680. (variable "CROSS_C_INCLUDE_PATH")
  681. (files '("propeller-elf/include")))
  682. (search-path-specification
  683. (variable "CROSS_LIBRARY_PATH")
  684. (files '("propeller-elf/lib")))))
  685. (home-page "https://github.com/totalspectrum/gcc-propeller")
  686. (synopsis "GCC for the Parallax Propeller"))))
  687. (define-public propeller-gcc-4
  688. (let ((xgcc propeller-gcc-6)
  689. (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  690. (revision "2"))
  691. (package (inherit xgcc)
  692. (name "propeller-gcc")
  693. (version (string-append "4.6.1-" revision "." (string-take commit 9)))
  694. (source (origin
  695. (method git-fetch)
  696. (uri (git-reference
  697. (url "https://github.com/parallaxinc/propgcc")
  698. (commit commit)))
  699. (file-name (string-append name "-" commit "-checkout"))
  700. (sha256
  701. (base32
  702. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))
  703. (patch-flags (list "-p1" "--directory=gcc"))
  704. (patches
  705. (append
  706. (origin-patches (package-source gcc-4.7))
  707. (search-patches "gcc-4.6-gnu-inline.patch"
  708. "gcc-cross-environment-variables.patch")))))
  709. (arguments
  710. (substitute-keyword-arguments (package-arguments propeller-gcc-6)
  711. ((#:phases phases)
  712. `(modify-phases ,phases
  713. (add-after 'unpack 'chdir
  714. (lambda _ (chdir "gcc") #t))))))
  715. (native-inputs
  716. `(("gcc-4" ,gcc-4.9)
  717. ,@(package-native-inputs propeller-gcc-6)))
  718. (home-page "https://github.com/parallaxinc/propgcc")
  719. (supported-systems (delete "aarch64-linux" %supported-systems)))))
  720. ;; Version 6 is experimental and may not work correctly. This is why we
  721. ;; default to version 4, which is also used in the binary toolchain bundle
  722. ;; provided by Parallax Inc.
  723. (define-public propeller-gcc propeller-gcc-4)
  724. ;; FIXME: We do not build the tiny library because that would require C++
  725. ;; headers, which are not available. This may require adding a propeller-elf
  726. ;; variant of the libstdc++ package.
  727. (define-public proplib
  728. (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  729. (revision "2"))
  730. (package
  731. (name "proplib")
  732. (version (string-append "0.0.0-" revision "." (string-take commit 9)))
  733. (source (origin
  734. (method git-fetch)
  735. (uri (git-reference
  736. (url "https://github.com/parallaxinc/propgcc")
  737. (commit commit)))
  738. (file-name (string-append name "-" commit "-checkout"))
  739. (sha256
  740. (base32
  741. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
  742. (build-system gnu-build-system)
  743. (arguments
  744. `(#:tests? #f ; no tests
  745. #:make-flags
  746. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  747. (string-append "BUILD=" (getcwd) "/build"))
  748. #:phases
  749. (modify-phases %standard-phases
  750. (delete 'configure)
  751. (add-after 'unpack 'chdir
  752. (lambda _ (chdir "lib") #t))
  753. (add-after 'chdir 'fix-Makefile
  754. (lambda _
  755. (substitute* "Makefile"
  756. ;; Control the installation time of the headers.
  757. ((" install-includes") ""))
  758. #t))
  759. ;; The Makefile does not separate building from installation, so we
  760. ;; have to create the target directories at build time.
  761. (add-before 'build 'create-target-directories
  762. (lambda* (#:key make-flags #:allow-other-keys)
  763. (apply invoke "make" "install-dirs" make-flags)))
  764. (add-before 'build 'set-cross-environment-variables
  765. (lambda* (#:key outputs #:allow-other-keys)
  766. (setenv "CROSS_LIBRARY_PATH"
  767. (string-append (assoc-ref outputs "out")
  768. "/propeller-elf/lib:"
  769. (or (getenv "CROSS_LIBRARY_PATH") "")))
  770. (setenv "CROSS_C_INCLUDE_PATH"
  771. (string-append (assoc-ref outputs "out")
  772. "/propeller-elf/include:"
  773. (or (getenv "CROSS_C_INCLUDE_PATH") "")))
  774. #t))
  775. (add-before 'install 'install-includes
  776. (lambda* (#:key make-flags #:allow-other-keys)
  777. (apply invoke "make" "install-includes" make-flags))))))
  778. (native-inputs
  779. `(("propeller-gcc" ,propeller-gcc)
  780. ("propeller-binutils" ,propeller-binutils)
  781. ("perl" ,perl)))
  782. (home-page "https://github.com/parallaxinc/propgcc")
  783. (synopsis "C library for the Parallax Propeller")
  784. (description "This is a C library for the Parallax Propeller
  785. micro-controller.")
  786. ;; Most of the code is released under the Expat license. Some of the
  787. ;; included code is public domain and some changes are BSD licensed.
  788. (license license:expat))))
  789. (define-public propeller-toolchain
  790. (package
  791. (name "propeller-toolchain")
  792. (version (package-version propeller-gcc))
  793. (source #f)
  794. (build-system trivial-build-system)
  795. (arguments '(#:builder (begin (mkdir %output) #t)))
  796. (propagated-inputs
  797. `(("binutils" ,propeller-binutils)
  798. ("libc" ,proplib)
  799. ("gcc" ,propeller-gcc)))
  800. (synopsis "Complete GCC tool chain for Propeller micro-controllers")
  801. (description "This package provides a complete GCC tool chain for
  802. Propeller micro-controller development.")
  803. (home-page (package-home-page propeller-gcc))
  804. (license (package-license propeller-gcc))))
  805. (define-public openspin
  806. (package
  807. (name "openspin")
  808. (version "1.00.78")
  809. (source (origin
  810. (method git-fetch)
  811. (uri (git-reference
  812. (url "https://github.com/parallaxinc/OpenSpin")
  813. (commit version)))
  814. (file-name (git-file-name name version))
  815. (sha256
  816. (base32
  817. "0ghk8hj4717ydhqzx2pfs6737s1cxng6sgg2xgbkwvcfclxdbrd0"))))
  818. (build-system gnu-build-system)
  819. (arguments
  820. `(#:tests? #f ; no tests
  821. #:phases
  822. (modify-phases %standard-phases
  823. (delete 'configure)
  824. (add-after 'unpack 'remove-timestamp
  825. (lambda _
  826. (substitute* "SpinSource/openspin.cpp"
  827. ((" Compiled on.*$") "\\n\");"))
  828. #t))
  829. ;; Makefile does not include "install" target
  830. (replace 'install
  831. (lambda* (#:key outputs #:allow-other-keys)
  832. (let ((bin (string-append (assoc-ref outputs "out")
  833. "/bin")))
  834. (mkdir-p bin)
  835. (install-file "build/openspin" bin)
  836. #t))))))
  837. (home-page "https://github.com/parallaxinc/OpenSpin")
  838. (synopsis "Spin/PASM compiler for the Parallax Propeller")
  839. (description "OpenSpin is a compiler for the Spin/PASM language of the
  840. Parallax Propeller. It was ported from Chip Gracey's original x86 assembler
  841. code.")
  842. (license license:expat)))
  843. (define-public propeller-load
  844. (let ((commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3")
  845. (revision "2"))
  846. (package
  847. (name "propeller-load")
  848. (version "3.4.0")
  849. (source (origin
  850. (method git-fetch)
  851. (uri (git-reference
  852. (url "https://github.com/parallaxinc/propgcc")
  853. (commit commit)))
  854. (file-name (string-append name "-" commit "-checkout"))
  855. (sha256
  856. (base32
  857. "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck"))))
  858. (build-system gnu-build-system)
  859. (arguments
  860. `(#:tests? #f ; no tests
  861. #:make-flags
  862. (list "OS=linux"
  863. (string-append "TARGET=" (assoc-ref %outputs "out")))
  864. #:phases
  865. (modify-phases %standard-phases
  866. (add-after 'unpack 'chdir
  867. (lambda _ (chdir "loader") #t))
  868. (delete 'configure))))
  869. (native-inputs
  870. `(("openspin" ,openspin)
  871. ("propeller-toolchain" ,propeller-toolchain)))
  872. (home-page "https://github.com/parallaxinc/propgcc")
  873. (synopsis "Loader for Parallax Propeller micro-controllers")
  874. (description "This package provides the tool @code{propeller-load} to
  875. upload binaries to a Parallax Propeller micro-controller.")
  876. (license license:expat))))
  877. (define-public spin2cpp
  878. (package
  879. (name "spin2cpp")
  880. (version "3.6.4")
  881. (source (origin
  882. (method git-fetch)
  883. (uri (git-reference
  884. (url "https://github.com/totalspectrum/spin2cpp")
  885. (commit (string-append "v" version))))
  886. (file-name (git-file-name name version))
  887. (sha256
  888. (base32
  889. "0wznqvsckzzz4hdy2rpvj6jqpxw4yn7i0c7zxfm6i46k8gg9327b"))))
  890. (build-system gnu-build-system)
  891. (arguments
  892. `(#:tests? #f ;; The tests assume that a micro-controller is connected.
  893. #:phases
  894. (modify-phases %standard-phases
  895. (delete 'configure)
  896. (add-before 'build 'set-cross-environment-variables
  897. (lambda* (#:key inputs #:allow-other-keys)
  898. (setenv "CROSS_LIBRARY_PATH"
  899. (string-append (assoc-ref inputs "propeller-toolchain")
  900. "/propeller-elf/lib"))
  901. (setenv "CROSS_C_INCLUDE_PATH"
  902. (string-append (assoc-ref inputs "propeller-toolchain")
  903. "/propeller-elf/include"))
  904. #t))
  905. (replace 'install
  906. (lambda* (#:key outputs #:allow-other-keys)
  907. (let ((bin (string-append (assoc-ref outputs "out")
  908. "/bin")))
  909. (for-each (lambda (file)
  910. (install-file (string-append "build/" file)
  911. bin))
  912. '("testlex" "spin2cpp" "fastspin")))
  913. #t)))))
  914. (native-inputs
  915. `(("bison" ,bison)
  916. ("propeller-load" ,propeller-load)
  917. ("propeller-toolchain" ,propeller-toolchain)))
  918. (home-page "https://github.com/totalspectrum/spin2cpp")
  919. (synopsis "Convert Spin code to C, C++, or PASM code")
  920. (description "This is a set of tools for converting the Spin language for
  921. the Parallax Propeller micro-controller into C or C++ code, into PASM, or even
  922. directly into an executable binary. The binaries produced use LMM PASM, so
  923. they are much faster than regular Spin bytecodes (but also quite a bit
  924. larger).")
  925. (license license:expat)))
  926. (define-public spinsim
  927. (let ((commit "66915a7ad1a3a2cf990a725bb341fab8d11eb620")
  928. (revision "1"))
  929. (package
  930. (name "spinsim")
  931. (version (string-append "0.75-" revision "." (string-take commit 9)))
  932. (source (origin
  933. (method git-fetch)
  934. (uri (git-reference
  935. (url "https://github.com/parallaxinc/spinsim")
  936. (commit commit)))
  937. (file-name (string-append name "-" commit "-checkout"))
  938. (sha256
  939. (base32
  940. "1n9kdhlxsdx7bz6c80w8dhi96zp633gd6qs0x9i4ii8qv4i7sj5k"))))
  941. (build-system gnu-build-system)
  942. (arguments
  943. `(#:tests? #f ; no tests
  944. #:phases
  945. (modify-phases %standard-phases
  946. (delete 'configure)
  947. (replace 'install
  948. (lambda* (#:key outputs #:allow-other-keys)
  949. (let ((bin (string-append (assoc-ref outputs "out")
  950. "/bin")))
  951. (install-file "build/spinsim" bin))
  952. #t)))))
  953. (home-page "https://github.com/parallaxinc/spinsim")
  954. (synopsis "Spin simulator")
  955. (description "This package provides the tool @code{spinsim}, a simulator
  956. and simple debugger for Spin programs written for a Parallax Propeller
  957. micro-controller. Spinsim supports execution from cog memory and hub
  958. execution, but it does not support multi-tasking. It supports about
  959. two-thirds of the opcodes in the P2 instruction set.")
  960. (license license:expat))))
  961. (define-public propeller-development-suite
  962. (package
  963. (name "propeller-development-suite")
  964. (version (package-version propeller-gcc))
  965. (source #f)
  966. (build-system trivial-build-system)
  967. (arguments '(#:builder (begin (mkdir %output) #t)))
  968. (propagated-inputs
  969. `(("toolchain" ,propeller-toolchain)
  970. ("openspin" ,openspin)
  971. ("propeller-load" ,propeller-load)
  972. ("spin2cpp" ,spin2cpp)
  973. ("spinsim" ,spinsim)))
  974. (synopsis "Complete development suite for Propeller micro-controllers")
  975. (description "This meta-package provides a complete environment for the
  976. development with Parallax Propeller micro-controllers. It includes the GCC
  977. toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin
  978. simulator.")
  979. (home-page (package-home-page propeller-gcc))
  980. (license (package-license propeller-gcc))))
  981. (define-public binutils-vc4
  982. (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36"))
  983. (package
  984. (name "binutils-vc4")
  985. (version (string-append "2.23.51-0." (string-take commit 7)))
  986. (source (origin
  987. (method git-fetch)
  988. (uri (git-reference
  989. (url "https://github.com/puppeh/binutils-vc4")
  990. (commit commit)))
  991. (file-name (string-append name "-" version "-checkout"))
  992. (sha256
  993. (base32
  994. "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"))))
  995. (build-system gnu-build-system)
  996. (arguments
  997. `(#:configure-flags '("--target=vc4-elf"
  998. "--disable-werror"
  999. "--enable-cgen-maint")
  1000. #:phases
  1001. (modify-phases %standard-phases
  1002. (add-after 'unpack 'unpack-cgen
  1003. (lambda* (#:key inputs #:allow-other-keys)
  1004. (copy-recursively (string-append (assoc-ref inputs "cgen")
  1005. "/cgen") "cgen")
  1006. #t))
  1007. (add-after 'unpack-cgen 'fix-cgen-guile
  1008. (lambda _
  1009. (substitute* "opcodes/Makefile.in"
  1010. (("guile\\{,-\\}1.8") "guile"))
  1011. (invoke "which" "guile"))))))
  1012. (native-inputs
  1013. `(("cgen"
  1014. ,(origin
  1015. (method git-fetch)
  1016. (uri (git-reference
  1017. (url "https://github.com/puppeh/cgen")
  1018. (commit "d8e2a9eb70425f180fdd5bfd032884b0855f2032")))
  1019. (sha256
  1020. (base32
  1021. "14b3h2ji740s8zq5vwm4qdcxs4aa4wxi6wb9di3bv1h39x14nyr9"))))
  1022. ("texinfo" ,texinfo)
  1023. ("flex" ,flex)
  1024. ("bison" ,bison)
  1025. ("guile-1.8" ,guile-1.8)
  1026. ("which" ,base:which)))
  1027. (synopsis "Binutils for VC4")
  1028. (description "This package provides @code{binutils} for VideoCore IV,
  1029. the Raspberry Pi chip.")
  1030. (license license:gpl3+)
  1031. (home-page "https://github.com/puppeh/vc4-toolchain/"))))
  1032. (define-public gcc-vc4
  1033. (let ((commit "0fe4b83897341742f9df65797474cb0feab4b377")
  1034. (xgcc (cross-gcc "vc4-elf" #:xgcc gcc-6 #:xbinutils binutils-vc4)))
  1035. (package (inherit xgcc)
  1036. (name "gcc-vc4")
  1037. (source (origin
  1038. (method git-fetch)
  1039. (uri (git-reference
  1040. (url "https://github.com/puppeh/gcc-vc4")
  1041. (commit commit)))
  1042. (file-name (string-append name
  1043. "-"
  1044. (package-version xgcc)
  1045. "-checkout"))
  1046. (sha256
  1047. (base32
  1048. "0kvaq4s0assvinmmicwqp07d0wwldcw0fv6f4k13whp3q5909jnr"))
  1049. (patches
  1050. (search-patches "gcc-6-fix-buffer-size.patch"
  1051. "gcc-6-fix-isl-includes.patch"))))
  1052. (native-inputs
  1053. `(("flex" ,flex)
  1054. ,@(package-native-inputs xgcc)))
  1055. (synopsis "GCC for VC4")
  1056. (description "This package provides @code{gcc} for VideoCore IV,
  1057. the Raspberry Pi chip."))))
  1058. (define-public python-libmpsse
  1059. (package
  1060. (name "python-libmpsse")
  1061. (version "1.4.1")
  1062. (source
  1063. (origin
  1064. (method git-fetch)
  1065. (uri (git-reference
  1066. (url "https://github.com/daym/libmpsse")
  1067. (commit (string-append "v" version))))
  1068. (file-name "libmpsse-checkout")
  1069. (sha256
  1070. (base32
  1071. "1rypfb96k2szqgygp3jnwg2zq9kwmfz0460dsahn3r2vkzml8wn7"))))
  1072. (build-system gnu-build-system)
  1073. (inputs
  1074. `(("libftdi" ,libftdi)
  1075. ("python" ,python)))
  1076. (native-inputs
  1077. `(("pkg-config" ,pkg-config)
  1078. ("swig" ,swig)
  1079. ("which" ,base:which)))
  1080. (arguments
  1081. `(#:tests? #f ; No tests exist.
  1082. #:parallel-build? #f ; Would be buggy.
  1083. #:make-flags
  1084. (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
  1085. "$(shell pkg-config --cflags libftdi1)"))
  1086. #:phases
  1087. (modify-phases %standard-phases
  1088. (add-after 'unpack 'set-environment-up
  1089. (lambda* (#:key inputs outputs #:allow-other-keys)
  1090. (let ((python (assoc-ref inputs "python")))
  1091. (chdir "src")
  1092. (setenv "PYDEV" (string-append python
  1093. "/include/python"
  1094. ,(version-major+minor (package-version python))))
  1095. #t)))
  1096. (replace 'install
  1097. (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
  1098. (let* ((out (assoc-ref outputs "out"))
  1099. (out-python (string-append out
  1100. "/lib/python"
  1101. ,(version-major+minor (package-version python))
  1102. "/site-packages"))
  1103. (install (assoc-ref %standard-phases 'install)))
  1104. (install #:make-flags (cons (string-append "PYLIB=" out-python)
  1105. make-flags))))))))
  1106. (home-page "https://code.google.com/archive/p/libmpsse/")
  1107. (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
  1108. (description "This package provides a library in order to support the
  1109. MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
  1110. SPI, I2C, JTAG.")
  1111. (license license:gpl2+)))
  1112. (define-public python2-libmpsse
  1113. (package
  1114. (inherit python-libmpsse)
  1115. (name "python2-libmpsse")
  1116. (arguments
  1117. (substitute-keyword-arguments (package-arguments python-libmpsse)
  1118. ((#:phases phases)
  1119. `(modify-phases ,phases
  1120. (replace 'set-environment-up
  1121. (lambda* (#:key inputs outputs #:allow-other-keys)
  1122. (let ((python (assoc-ref inputs "python")))
  1123. (chdir "src")
  1124. (setenv "PYDEV" (string-append python
  1125. "/include/python"
  1126. ,(version-major+minor (package-version python-2))))
  1127. #t)))
  1128. (replace 'install
  1129. (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
  1130. (let* ((out (assoc-ref outputs "out"))
  1131. (out-python (string-append out
  1132. "/lib/python"
  1133. ,(version-major+minor (package-version python-2))
  1134. "/site-packages"))
  1135. (install (assoc-ref %standard-phases 'install)))
  1136. (install #:make-flags (cons (string-append "PYLIB=" out-python)
  1137. make-flags)))))))))
  1138. (inputs
  1139. (alist-replace "python" (list python-2)
  1140. (package-inputs python-libmpsse)))))
  1141. (define-public picprog
  1142. (package
  1143. (name "picprog")
  1144. (version "1.9.1")
  1145. (source (origin
  1146. (method url-fetch)
  1147. (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
  1148. version ".tar.gz"))
  1149. (file-name (string-append name "-" version ".tar.gz"))
  1150. (sha256
  1151. (base32
  1152. "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
  1153. (patches (search-patches "picprog-non-intel-support.patch"))))
  1154. (build-system gnu-build-system)
  1155. (arguments
  1156. `(#:tests? #f ; No tests exist.
  1157. #:phases
  1158. (modify-phases %standard-phases
  1159. (add-after 'unpack 'patch-paths
  1160. (lambda* (#:key outputs #:allow-other-keys)
  1161. (substitute* "Makefile"
  1162. (("/usr/local") (assoc-ref outputs "out"))
  1163. ((" -o 0 -g 0 ") " ")
  1164. (("testport") ""))
  1165. #t))
  1166. (add-before 'install 'mkdir
  1167. (lambda* (#:key outputs #:allow-other-keys)
  1168. (let ((out (assoc-ref outputs "out")))
  1169. (mkdir-p (string-append out "/bin"))
  1170. (mkdir-p (string-append out "/man/man1"))
  1171. #t)))
  1172. (delete 'configure))))
  1173. (synopsis "Programs Microchip's PIC microcontrollers")
  1174. (description "This program programs Microchip's PIC microcontrollers.")
  1175. (home-page "https://hyvatti.iki.fi/~jaakko/pic/picprog.html")
  1176. (license license:gpl3+)))
  1177. (define-public fc-host-tools
  1178. (package
  1179. (name "fc-host-tools")
  1180. (version "15")
  1181. (source (origin
  1182. (method url-fetch)
  1183. (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
  1184. "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
  1185. (sha256
  1186. (base32
  1187. "17v3xc44mmlvp0irwm1p55zdgzd31ic3nsjxnv8y28a1i85103cv"))))
  1188. (build-system gnu-build-system)
  1189. (arguments
  1190. `(#:tests? #f ; No tests exist.
  1191. #:make-flags
  1192. (list (string-append "INSTALL_PREFIX=" %output)
  1193. (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
  1194. #:phases
  1195. (modify-phases %standard-phases
  1196. (add-after 'unpack 'patch-installation-paths
  1197. (lambda* (#:key outputs #:allow-other-keys)
  1198. (substitute* (cons* "miscutil/c139explore"
  1199. "miscutil/pirexplore"
  1200. (find-files "." "^(.*\\.[ch]|Makefile)$"))
  1201. (("/opt/freecalypso/bin/fc-simtool")
  1202. "fc-simtool")
  1203. (("/opt/freecalypso/bin/fc-uicc-tool")
  1204. "fc-uicc-tool")
  1205. (("/opt/freecalypso/loadtools")
  1206. (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
  1207. (("\\$\\{INSTALL_PREFIX\\}/loadtools")
  1208. (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
  1209. (("\\$\\{INSTALL_PREFIX\\}/target-bin")
  1210. (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
  1211. (("/opt/freecalypso")
  1212. (assoc-ref outputs "out")))
  1213. #t))
  1214. (delete 'configure))))
  1215. (inputs
  1216. `(("libx11" ,libx11)))
  1217. (synopsis "Freecalypso host tools")
  1218. (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
  1219. @enumerate
  1220. @item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
  1221. @item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
  1222. @item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
  1223. strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
  1224. Calypso GSM device.
  1225. @item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
  1226. @item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
  1227. source format into a voice memo file that can be uploaded into the FFS of a
  1228. FreeCalypso device and played with the audio_vm_play_start() API or the
  1229. AT@@VMP command that invokes the latter.
  1230. @item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
  1231. @item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
  1232. @item rvtdump: produces a human-readable dump of all output emitted by a
  1233. TI-based GSM fw on the RVTMUX binary packet interface.
  1234. @item fc-shell: FreeCalypso firmwares have a feature of our own invention
  1235. (not present in any pre-existing ones) to accept AT commands over the RVTMUX
  1236. interface. It is useful when no second UART is available for a dedicated
  1237. standard AT command interface. fc-shell is the tool that allows you to send
  1238. AT commands to the firmware in this manner.
  1239. @item fc-memdump: Captures a memory dump from a GSM device.
  1240. @item fc-serterm: Trivial serial terminal. Escapes binary chars.
  1241. @item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
  1242. allows you to manipulate the device's flash file system.
  1243. @item tiaud-compile: Compiles an audio mode configuration table for TI's
  1244. Audio Service from our own ASCII source format into the binary format for
  1245. uploading into FreeCalypso GSM device FFS with fc-fsio.
  1246. @item tiaud-decomp: Decodes TI's audio mode configuration files read out of
  1247. FFS into our own ASCII format.
  1248. @item tiaud-mkvol: Generates the *.vol binary files which need to accompany
  1249. the main *.cfg ones.
  1250. @item fc-compalram: Allows running programs on the device without writing
  1251. them to flash storage.
  1252. @item fc-xram: Allows running programs on the device without writing them
  1253. to flash storage.
  1254. @item fc-iram: Allows running programs on the device without writing them
  1255. to flash storage.
  1256. @item fc-loadtool: Writes programs to the device's flash storage.
  1257. @item fc-simint: Loads and runs simagent on the phone, then calls fc-simtool
  1258. (see @url{https://www.freecalypso.org/hg/fc-sim-tools,fc-sim-tools
  1259. repository}) on the host to connect to it.
  1260. @item pirffs: Allows listing and extracting FFS content captured as a raw
  1261. flash image from Pirelli phones.
  1262. @item mokoffs: Allows listing and extracting FFS content captured as a raw
  1263. flash image from OpenMoko phones.
  1264. @item tiffs: Allows listing and extracting FFS content captured as a raw
  1265. flash image from TI phones.
  1266. @item c139explore: Run-from-RAM program for C139 phones that
  1267. exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
  1268. @item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
  1269. exercises their peripheral hardware, primarily their LCD.
  1270. @item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
  1271. you to reflash locked phones with new firmware with fc-loadtool.
  1272. @item ctracedec: GSM firmwares built in TI's Windows environment have a
  1273. compressed trace misfeature whereby many of the ASCII strings
  1274. in debug trace messages get replaced with numeric indices at
  1275. build time, and these numeric indices are all that gets emitted
  1276. on the RVTMUX serial channel. This tools decodes these numeric indices
  1277. back to strings in trace output.
  1278. @item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
  1279. directory subtree as input (either extracted in vitro with tiffs
  1280. or read out in vivo with fc-fsio) and converts all RF tables
  1281. found therein into a readable ASCII format.
  1282. @item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
  1283. @item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
  1284. target Calypso GSM device.
  1285. @item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
  1286. out of FFS into hex strings.
  1287. @item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
  1288. Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
  1289. our planned future HSMBP) by loading a buzplayer agent onto the target and
  1290. feeding melodies to be played to it.
  1291. @item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
  1292. that can be issued through the RVTMUX (debug trace) serial channel.
  1293. This program is our test mode shell for sending Test Mode commands to targets
  1294. and displaying decoded target responses.
  1295. @item fcup-smsend: Send a short message via SMS
  1296. @item fcup-smsendmult: Send multiple short messages via SMS in one go
  1297. @item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
  1298. @item sms-pdu-decode: Decode PDU format messages
  1299. @item fc-dspromdump: Dump DSP ROM.
  1300. @item pcm-sms-decode: Decode /pcm/SMS binary files read out of FFS maintained
  1301. by Pirelli DP-L10. Display the SMS in human-readable form.
  1302. @item srec-regions: Parse S-record (TI's *.m0), identify the set of
  1303. discontiguous regions into which this SREC image deposits bits, and list
  1304. these identified regions.
  1305. @end enumerate")
  1306. (home-page "https://www.freecalypso.org/")
  1307. (license license:public-domain)))
  1308. (define-public stlink
  1309. (package
  1310. (name "stlink")
  1311. (version "1.5.1")
  1312. (source
  1313. (origin
  1314. (method git-fetch)
  1315. (uri (git-reference
  1316. (url "https://github.com/texane/stlink")
  1317. (commit (string-append "v" version))))
  1318. (file-name (git-file-name name version))
  1319. (sha256
  1320. (base32
  1321. "1d5gxiqpsm8fc105cxlp27af9fk339fap5h6nay21x5a7n61jgyc"))))
  1322. (build-system cmake-build-system)
  1323. (arguments
  1324. `(#:tests? #f ;no tests
  1325. #:configure-flags
  1326. (let* ((out (assoc-ref %outputs "out"))
  1327. (etc (in-vicinity out "etc"))
  1328. (modprobe (in-vicinity etc "modprobe.d"))
  1329. (udev-rules (in-vicinity etc "udev/rules.d")))
  1330. (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
  1331. (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
  1332. (inputs
  1333. `(("libusb" ,libusb)))
  1334. (synopsis "Programmer for STM32 Discovery boards")
  1335. (description "This package provides a firmware programmer for the STM32
  1336. Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
  1337. STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
  1338. Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
  1339. commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
  1340. raw USB commands.")
  1341. (home-page "https://github.com/texane/stlink")
  1342. ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
  1343. ;; licensed under the GPLv2+.
  1344. (license (list license:bsd-3 license:gpl2+))))
  1345. (define-public west
  1346. (package
  1347. (name "west")
  1348. (version "0.6.3")
  1349. (source
  1350. (origin
  1351. (method url-fetch)
  1352. (uri (pypi-uri "west" version))
  1353. (sha256
  1354. (base32
  1355. "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
  1356. (propagated-inputs
  1357. `(("python-colorama" ,python-colorama)
  1358. ("python-configobj" ,python-configobj)
  1359. ("python-pykwalify" ,python-pykwalify)
  1360. ("python-pyyaml" ,python-pyyaml)))
  1361. (build-system python-build-system)
  1362. (home-page "https://github.com/zephyrproject-rtos/west")
  1363. (synopsis "Zephyr RTOS Project meta-tool")
  1364. (description "West is the swiss-army knife command line tool of the Zephyr
  1365. project. Its built-in commands provide a multiple repository management
  1366. system with features inspired by Google’s Repo tool and Git submodules. West
  1367. simplifies configuration and is also pluggable: you can write your own west
  1368. \"extension commands\" which add additional features to west. Zephyr uses
  1369. this feature to provide conveniences for building applications, flashing and
  1370. debugging them, and more.")
  1371. (license license:expat)))
  1372. (define-public ebusd
  1373. (package
  1374. (name "ebusd")
  1375. (version "3.4")
  1376. (source (origin
  1377. (method git-fetch)
  1378. (uri (git-reference
  1379. (url "https://github.com/john30/ebusd")
  1380. (commit (string-append "v" version))))
  1381. (file-name (string-append name "-" version "-checkout"))
  1382. (sha256
  1383. (base32
  1384. "0iva70bam7wdx60bpd3an9kxr28zxlvp3vprivgqshwwdhqa0hzp"))))
  1385. (build-system gnu-build-system)
  1386. (arguments
  1387. `(#:phases
  1388. (modify-phases %standard-phases
  1389. (add-after 'install 'install-config
  1390. (lambda* (#:key inputs outputs #:allow-other-keys)
  1391. (let ((config-destination
  1392. (string-append (assoc-ref outputs "out")
  1393. "/share/ebusd")))
  1394. (copy-recursively (string-append (assoc-ref inputs "config")
  1395. "/ebusd-2.1.x")
  1396. config-destination)
  1397. #t))))))
  1398. (inputs
  1399. `(("mosquitto" ,mosquitto)))
  1400. (native-inputs
  1401. `(("automake" ,automake)
  1402. ("autoconf" ,autoconf)
  1403. ("config"
  1404. ,(origin
  1405. (method git-fetch)
  1406. (uri (git-reference
  1407. (url "https://github.com/john30/ebusd-configuration")
  1408. (commit "666c0f6b9c4d7545eff7f43ab28a1c7baeab7913")))
  1409. (file-name "config-checkout")
  1410. (sha256
  1411. (base32
  1412. "0yxnx8p4lbk614l16854r9s9d8s9c7ixgczfs8mph94xz0wkda7x"))))))
  1413. (synopsis "Daemon for communicating with eBUS devices")
  1414. (description "This package provides @command{ebusd}, a daemon for
  1415. handling communication with eBUS devices connected to a 2-wire bus system
  1416. (\"energy bus\" used by numerous heating systems).")
  1417. (home-page "https://ebusd.eu/")
  1418. (license license:gpl3+)))
  1419. (define-public ucsim
  1420. (package
  1421. (name "ucsim")
  1422. (version "0.6-pre68")
  1423. (source (origin
  1424. (method url-fetch)
  1425. (uri (string-append
  1426. "http://mazsola.iit.uni-miskolc.hu/ucsim/download/unix/"
  1427. "devel/ucsim-" version ".tar.gz"))
  1428. (sha256
  1429. (base32
  1430. "1bfj21f5pcfcg1xqqynlcfr8mn6qj5705cgc2lfr2s3n97qsd9df"))))
  1431. (build-system gnu-build-system)
  1432. (arguments
  1433. `(#:configure-flags '("--enable-avr-port"
  1434. "--enable-m6809-port"
  1435. "--enable-p1516-port"
  1436. "--enable-st7-port")
  1437. #:phases
  1438. (modify-phases %standard-phases
  1439. (add-after 'unpack 'patch-makefiles
  1440. (lambda _
  1441. (substitute* (find-files "." "(\\.mk$|\\.in$)")
  1442. (("/bin/sh") (which "sh")))
  1443. #t))
  1444. (add-after 'install 'remove-empty-directory
  1445. (lambda* (#:key outputs #:allow-other-keys)
  1446. (delete-file-recursively
  1447. (string-append (assoc-ref outputs "out") "/share/man"))
  1448. #t)))))
  1449. (native-inputs
  1450. `(("bison" ,bison)
  1451. ("flex" ,flex)))
  1452. (home-page "http://mazsola.iit.uni-miskolc.hu/ucsim/")
  1453. (synopsis "Simulators for various microcontroller families")
  1454. (description "μCsim is a collection of software simulators for
  1455. microcontrollers in the Atmel AVR; Intel MCS-51 (8051); Motorola 68HC08 and
  1456. 6809; P1516; Padauk PDK13, PDK14 and PDK15; STMicroelectronics ST7 and STM8;
  1457. and Zilog Z80 families, plus many of their variants.")
  1458. (license license:gpl2+)))
  1459. (define-public sdcc
  1460. (package
  1461. (name "sdcc")
  1462. (version "4.1.0")
  1463. (source (origin
  1464. (method url-fetch)
  1465. (uri (string-append
  1466. "mirror://sourceforge/sdcc/sdcc"
  1467. "/" version "/sdcc-src-" version ".tar.bz2"))
  1468. (sha256
  1469. (base32
  1470. "0gskzli17ghnn5qllvn4d56qf9bvvclqjh63nnj63p52smvggvc1"))
  1471. (modules '((guix build utils)))
  1472. (snippet
  1473. '(begin
  1474. ;; Remove non-free source files
  1475. (delete-file-recursively "device/non-free")
  1476. ;; Remove bundled μCsim source
  1477. (delete-file-recursively "sim")
  1478. #t))
  1479. (patches (search-patches "sdcc-disable-non-free-code.patch"))))
  1480. (build-system gnu-build-system)
  1481. (native-inputs
  1482. `(("bison" ,bison)
  1483. ("boost" ,boost)
  1484. ("flex" ,flex)
  1485. ("python-2" ,python-2)
  1486. ("texinfo" ,texinfo)
  1487. ("zlib" ,zlib)))
  1488. (arguments
  1489. `(;; GPUTILS is required for the PIC ports, but the licensing status of
  1490. ;; some of the files contained in its distribution is unclear (see
  1491. ;; https://issues.guix.gnu.org/44557). For this reason it is not yet
  1492. ;; available as a package in Guix.
  1493. #:configure-flags
  1494. '("--disable-pic14-port" "--disable-pic16-port" "--disable-ucsim")
  1495. #:phases
  1496. (modify-phases %standard-phases
  1497. (add-after 'unpack 'patch-makefiles
  1498. (lambda _
  1499. (substitute* (find-files "." "(\\.mk$|\\.in$)")
  1500. (("/bin/sh") (which "sh")))
  1501. ;; --disable-ucsim disables sdcc-misc, patch it back in.
  1502. (substitute* "Makefile.in"
  1503. (("debugger/mcs51" line)
  1504. (string-append line "\n"
  1505. "TARGETS += sdcc-misc\n"
  1506. "PKGS += $(SDCC_MISC)")))
  1507. #t)))))
  1508. (home-page "http://sdcc.sourceforge.net")
  1509. (synopsis "C compiler suite for 8-bit microcontrollers")
  1510. (description "SDCC is a retargetable, optimizing Standard C compiler suite
  1511. that targets 8-bit microcontrollers in the Intel MCS-51 (8051); Motorola
  1512. 68HC08; Padauk PDK13, PDK14 and PDK15; STMicroelectronics STM8; and Zilog Z80
  1513. families, plus many of their variants.")
  1514. (license (list license:gpl2+
  1515. license:gpl3+
  1516. license:lgpl2.0+
  1517. license:lgpl2.1+
  1518. license:lgpl3+
  1519. license:public-domain
  1520. license:zlib))))
  1521. (define-public python-psptool
  1522. (package
  1523. (name "python-psptool")
  1524. (version "2.2")
  1525. (source (origin
  1526. (method url-fetch)
  1527. (uri (pypi-uri "psptool" version))
  1528. (sha256
  1529. (base32
  1530. "1kx0xpfx67m4zclk4gs97wiwjms8i7z4f6b6m68y8sfgpshy4rf3"))
  1531. (modules '((guix build utils)))
  1532. (snippet
  1533. '(begin
  1534. ;; IPython is not used by the package at all
  1535. (substitute* '("psptool/directory.py" "psptool/entry.py")
  1536. (("from IPython.*") ""))))))
  1537. (build-system python-build-system)
  1538. (propagated-inputs
  1539. `(("python-cryptography" ,python-cryptography)
  1540. ("python-prettytable" ,python-prettytable)))
  1541. (home-page "https://github.com/PSPReverse/psptool")
  1542. (synopsis "Tool for dealing with AMD binary blobs")
  1543. (description "PSPTool is a tool for dealing with AMD binary blobs")
  1544. (license license:gpl3+)))
  1545. (define-public agent-proxy
  1546. (let ((commit "8927798a71d246871ea8fc22b4512296a3fa1765")
  1547. (revision "0"))
  1548. (package
  1549. (name "agent-proxy")
  1550. (version (git-version "1.98" revision commit))
  1551. (home-page
  1552. "https://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git")
  1553. (source (origin
  1554. (method git-fetch)
  1555. (uri (git-reference (url home-page) (commit commit)))
  1556. (file-name (git-file-name name version))
  1557. (sha256
  1558. (base32
  1559. "1bxkzwsqfld4pknmiq8j3k55pv90n8s6kzh0xh42bhy2jv1wxz2z"))))
  1560. (build-system gnu-build-system)
  1561. (arguments
  1562. `(#:tests? #f
  1563. #:phases
  1564. (modify-phases %standard-phases
  1565. (delete 'configure)
  1566. (add-after 'build 'build-kdmx
  1567. (lambda _
  1568. (invoke "make" "-C" "kdmx")
  1569. #t))
  1570. (replace 'install
  1571. (lambda* (#:key outputs #:allow-other-keys)
  1572. (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
  1573. (install-file "agent-proxy" bin)
  1574. (install-file "kdmx/kdmx" bin)
  1575. #t))))))
  1576. (synopsis "Proxies to run kgdb/gdbserver and console on a serial port")
  1577. (description "These programs are proxies allowing to run kgdb/gdbserver
  1578. and console on a single serial port. agent-proxy creates network sockets,
  1579. whereas kdmx creates pseudo-ttys.")
  1580. (license license:gpl2))))