+
+(define-public python-libmpsse
+ (package
+ (name "python-libmpsse")
+ (version "1.4")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/daym/libmpsse.git")
+ (commit (string-append "v" version))))
+ (file-name "libmpsse-checkout")
+ (sha256
+ (base32
+ "14f1kiiia4kfd9mzwx4h63aa8bpz9aknbrrr7mychnsp3arw0z25"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("libftdi" ,libftdi)
+ ("python" ,python)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("swig" ,swig)
+ ("which" ,base:which)))
+ (arguments
+ `(#:tests? #f ; No tests exist.
+ #:parallel-build? #f ; Would be buggy.
+ #:make-flags
+ (list (string-append "CFLAGS=-Wall -fPIC -fno-strict-aliasing -g -O2 "
+ "$(shell pkg-config --cflags libftdi1)"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'set-environment-up
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((python (assoc-ref inputs "python")))
+ (chdir "src")
+ (setenv "PYDEV" (string-append python
+ "/include/python"
+ ,(version-major+minor (package-version python))
+ "m"))
+ #t)))
+ (replace 'install
+ (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
+ (let* ((out (assoc-ref outputs "out"))
+ (out-python (string-append out
+ "/lib/python"
+ ,(version-major+minor (package-version python))
+ "/site-packages"))
+ (install (assoc-ref %standard-phases 'install)))
+ (install #:make-flags (cons (string-append "PYLIB=" out-python)
+ make-flags))))))))
+ (home-page "https://code.google.com/archive/p/libmpsse/")
+ (synopsis "Python library for MPSSE SPI I2C JTAG adapter by FTDI")
+ (description "This package provides a library in order to support the
+MPSSE (Multi-Protocol Synchronous Serial Engine) adapter by FTDI that can do
+SPI, I2C, JTAG.")
+ (license license:gpl2+)))
+
+(define-public python2-libmpsse
+ (package
+ (inherit python-libmpsse)
+ (name "python2-libmpsse")
+ (arguments
+ (substitute-keyword-arguments (package-arguments python-libmpsse)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (replace 'set-environment-up
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((python (assoc-ref inputs "python")))
+ (chdir "src")
+ (setenv "PYDEV" (string-append python
+ "/include/python"
+ ,(version-major+minor (package-version python-2))))
+ #t)))
+ (replace 'install
+ (lambda* (#:key inputs outputs make-flags #:allow-other-keys #:rest args)
+ (let* ((out (assoc-ref outputs "out"))
+ (out-python (string-append out
+ "/lib/python"
+ ,(version-major+minor (package-version python-2))
+ "/site-packages"))
+ (install (assoc-ref %standard-phases 'install)))
+ (install #:make-flags (cons (string-append "PYLIB=" out-python)
+ make-flags)))))))))
+ (inputs
+ (alist-replace "python" (list python-2)
+ (package-inputs python-libmpsse)))))
+
+(define-public picprog
+ (package
+ (name "picprog")
+ (version "1.9.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://www.iki.fi/hyvatti/pic/picprog-"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1r04hg1n3v2jf915qr05la3q9cxy7a5jnh9cc98j04lh6c9p4x85"))
+ (patches (search-patches "picprog-non-intel-support.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ; No tests exist.
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-paths
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "Makefile"
+ (("/usr/local") (assoc-ref outputs "out"))
+ ((" -o 0 -g 0 ") " ")
+ (("testport") ""))
+ #t))
+ (add-before 'install 'mkdir
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (mkdir-p (string-append out "/bin"))
+ (mkdir-p (string-append out "/man/man1"))
+ #t)))
+ (delete 'configure))))
+ (synopsis "Programs Microchip's PIC microcontrollers")
+ (description "This program programs Microchip's PIC microcontrollers.")
+ (home-page "http://hyvatti.iki.fi/~jaakko/pic/picprog.html")
+ (license license:gpl3+)))
+
+(define-public fc-host-tools
+ (package
+ (name "fc-host-tools")
+ (version "11")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "ftp://ftp.freecalypso.org/pub/GSM/"
+ "FreeCalypso/fc-host-tools-r" version ".tar.bz2"))
+ (sha256
+ (base32
+ "0s87lp6gd8i8ivrdd7mnnalysr65035nambcm992rgla7sk76sj1"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ; No tests exist.
+ #:make-flags
+ (list (string-append "INSTALL_PREFIX=" %output)
+ (string-append "INCLUDE_INSTALL_DIR=" %output "include/rvinterf"))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-installation-paths
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* '("Makefile"
+ "rvinterf/etmsync/fsiomain.c"
+ "rvinterf/etmsync/fsnew.c"
+ "rvinterf/asyncshell/help.c"
+ "rvinterf/libinterf/launchrvif.c"
+ "loadtools/defpath.c"
+ "loadtools/Makefile"
+ "miscutil/c139explore"
+ "miscutil/pirexplore"
+ "ffstools/tiffs-wrappers/installpath.c"
+ "uptools/atcmd/atinterf.c")
+ (("/opt/freecalypso/loadtools")
+ (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
+ (("\\$\\{INSTALL_PREFIX\\}/loadtools")
+ (string-append (assoc-ref outputs "out") "/lib/freecalypso/loadtools"))
+ (("\\$\\{INSTALL_PREFIX\\}/target-bin")
+ (string-append (assoc-ref outputs "out") "/lib/freecalypso/target-bin"))
+ (("/opt/freecalypso")
+ (assoc-ref outputs "out")))
+ #t))
+ (delete 'configure))))
+ (inputs
+ `(("libx11" ,libx11)))
+ (synopsis "Freecalypso host tools")
+ (description "This package provides some tools for debugging FreeCalypso phones and the FreeCalypso FCDEV3B dev board.
+
+@enumerate
+@item fc-e1decode: Decodes a binary Melody E1 file into an ASCII source file.
+@item fc-e1gen: Encodes an ASCII Melody E1 file into a binary Melody E1 file.
+@item fc-fr2tch: Converts a GSM 06.10 speech recording from libgsm to hex
+strings of TCH bits to be fed to the GSM 05.03 channel encoder of a TI
+Calypso GSM device.
+@item fc-tch2fr: Converts hex strings of TCH bits to libgsm.
+@item fc-gsm2vm: utility converts a GSM 06.10 speech sample from the libgsm
+source format into a voice memo file that can be uploaded into the FFS of a
+FreeCalypso device and played with the audio_vm_play_start() API or the
+AT@@VMP command that invokes the latter.
+@item fc-rgbconv: Convers RGB 5:6:5 to RGB 8:8:8 and vice versa.
+@item rvinterf: Communicates with a TI Calypso GSM device via RVTMUX.
+@item rvtdump: produces a human-readable dump of all output emitted by a
+TI-based GSM fw on the RVTMUX binary packet interface.
+@item fc-shell: FreeCalypso firmwares have a feature of our own invention
+(not present in any pre-existing ones) to accept AT commands over the RVTMUX
+interface. It is useful when no second UART is available for a dedicated
+standard AT command interface. fc-shell is the tool that allows you to send
+AT commands to the firmware in this manner.
+@item fc-memdump: Captures a memory dump from a GSM device.
+@item fc-serterm: Trivial serial terminal. Escapes binary chars.
+@item fc-fsio: Going through rvinterf, this tool connects to GSM devices and
+allows you to manipulate the device's flash file system.
+@item tiaud-compile: Compiles an audio mode configuration table for TI's
+Audio Service from our own ASCII source format into the binary format for
+uploading into FreeCalypso GSM device FFS with fc-fsio.
+@item tiaud-decomp: Decodes TI's audio mode configuration files read out of
+FFS into our own ASCII format.
+@item tiaud-mkvol: Generates the *.vol binary files which need to accompany
+the main *.cfg ones.
+@item fc-compalram: Allows running programs on the device without writing
+them to flash storage.
+@item fc-xram: Allows running programs on the device without writing them
+to flash storage.
+@item fc-iram: Allows running programs on the device without writing them
+to flash storage.
+@item fc-loadtool: Writes programs to the device's flash storage.
+@item pirffs: Allows listing and extracting FFS content captured as a raw
+flash image from Pirelli phones.
+@item mokoffs: Allows listing and extracting FFS content captured as a raw
+flash image from OpenMoko phones.
+@item tiffs: Allows listing and extracting FFS content captured as a raw
+flash image from TI phones.
+@item c139explore: Run-from-RAM program for C139 phones that
+exercises their peripheral hardware: LCD, keypad backlight, buzzer, vibrator.
+@item pirexplore: Run-from-RAM program for Pirelli DP-L10 phones that
+exercises their peripheral hardware, primarily their LCD.
+@item tfc139: Breaks into Mot C1xx phones via shellcode injection, allowing
+you to reflash locked phones with new firmware with fc-loadtool.
+@item ctracedec: GSM firmwares built in TI's Windows environment have a
+compressed trace misfeature whereby many of the ASCII strings
+in debug trace messages get replaced with numeric indices at
+build time, and these numeric indices are all that gets emitted
+on the RVTMUX serial channel. This tools decodes these numeric indices
+back to strings in trace output.
+@item fc-cal2text: This utility takes a dump of TI's /gsm/rf flash file system
+directory subtree as input (either extracted in vitro with tiffs
+or read out in vivo with fc-fsio) and converts all RF tables
+found therein into a readable ASCII format.
+@item imei-luhn: Computes or verifies the Luhn check digit of an IMEI number.
+@item fc-dspapidump: Reads and dumps the contents of the DSP API RAM in a
+target Calypso GSM device.
+@item fc-vm2hex: Converts the old-fashioned (non-AMR) voice memo files read
+out of FFS into hex strings.
+@item fc-buzplay: Plays piezoelectic buzzer melodies on an actual
+Calypso device equipped with such a buzzer (Mot C1xx, TI's D-Sample board,
+our planned future HSMBP) by loading a buzplayer agent onto the target and
+feeding melodies to be played to it.
+@item fc-tmsh: TI-based GSM firmwares provide a rich set of Test Mode commands
+that can be issued through the RVTMUX (debug trace) serial channel.
+This program is our test mode shell for sending Test Mode commands to targets
+and displaying decoded target responses.
+@item fcup-smsend: Send a short message via SMS
+@item fcup-smsendmult: Send multiple short messages via SMS in one go
+@item fcup-smsendpdu: Send multiple short messages given in PDU format via SMS
+@item sms-pdu-decode: Decode PDU format messages
+@end enumerate")
+ (home-page "https://www.freecalypso.org/")
+ (license license:public-domain)))
+
+(define-public stlink
+ (package
+ (name "stlink")
+ (version "1.5.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/texane/stlink/archive/v"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "01z1cz1a5xbbhd163qrqcgp4bi1k145pb80jmwdz50g7sfzmy570"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:tests? #f ;no tests
+ #:configure-flags
+ (let* ((out (assoc-ref %outputs "out"))
+ (etc (in-vicinity out "etc"))
+ (modprobe (in-vicinity etc "modprobe.d"))
+ (udev-rules (in-vicinity etc "udev/rules.d")))
+ (list (string-append "-DSTLINK_UDEV_RULES_DIR=" udev-rules)
+ (string-append "-DSTLINK_MODPROBED_DIR=" modprobe)))))
+ (inputs
+ `(("libusb" ,libusb)))
+ (synopsis "Programmer for STM32 Discovery boards")
+ (description "This package provides a firmware programmer for the STM32
+Discovery boards. It supports two versions of the chip: ST-LINK/V1 (on
+STM32VL discovery kits) and ST-LINK/V2 (on STM32L discovery and later kits).
+Two different transport layers are used: ST-LINK/V1 uses SCSI passthru
+commands over USB, and ST-LINK/V2 and ST-LINK/V2-1 (seen on Nucleo boards) use
+raw USB commands.")
+ (home-page "https://github.com/texane/stlink")
+ ;; The flashloaders/stm32l0x.s and flashloaders/stm32lx.s source files are
+ ;; licensed under the GPLv2+.
+ (license (list license:bsd-3 license:gpl2+))))
+
+(define-public west
+ (package
+ (name "west")
+ (version "0.6.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "west" version))
+ (sha256
+ (base32
+ "0ql6ij1hrj2ir5wkxm96zgig5qwvfwa75w77wh2y13w6b9cqcr4b"))))
+ (propagated-inputs
+ `(("python-colorama" ,python-colorama)
+ ("python-configobj" ,python-configobj)
+ ("python-pykwalify" ,python-pykwalify)
+ ("python-pyyaml" ,python-pyyaml)))
+ (build-system python-build-system)
+ (home-page "https://github.com/zephyrproject-rtos/west")
+ (synopsis "Zephyr RTOS Project meta-tool")
+ (description "West is the swiss-army knife command line tool of the Zephyr
+project. Its built-in commands provide a multiple repository management
+system with features inspired by Google’s Repo tool and Git submodules. West
+simplifies configuration and is also pluggable: you can write your own west
+\"extension commands\" which add additional features to west. Zephyr uses
+this feature to provide conveniences for building applications, flashing and
+debugging them, and more.")
+ (license license:expat)))