embedded.scm 71 KB

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