Page 1 of 1

Lambdaya - Haskell library

Posted: Tue Jan 05, 2016 6:22 pm
by ralu
Instead of running only C and C++ this project enables running and controlling RP using Haskell.
It enables actually both. Trough unified interface one can control RP natively using ghc crosscopmiler or remotely over TCP/IP.

https://hackage.haskell.org/package/Lambdaya

Quick start:
(should work any OS)
1. Install ghc and cabal or haskell-platform. https://www.haskell.org/platform/
2. Install lambdaya using cabal

Code: Select all

cabal update
cabal install lambdaya
3. make file client.hs with such code

Code: Select all

import System.RedPitaya.Fpga
import System.RedPitaya.Tcp

rpIp = "10.42.0.219" -- fix for ip for RP
rpPort = 4242

main = runRemoteRp rpIp rpPort (setLed 0x55)
4. Compile file using ghc

Code: Select all

ghc -O2 client.hs 
Before running client we need server to run on RP. There is pre compiled binary available if you dont have GHC crosscompiler

5. Download https://github.com/ra1u/Lambdaya/blob/m ... r?raw=true on RP and run.

6. Run client you have compiled on PC and stare in Leds.

There is also some notes on how to crosscompile GHC on github. https://github.com/ra1u/Lambdaya/blob/m ... c/build.md in case you want running binaries natively, or extend communication protocol for example.

Currently supported features:
  • Documentaion and tutorial available from hackage https://hackage.haskell.org/package/Lambdaya
  • Native and remote controlling.
  • Functions for acesssing Houskeeping, Oscilloscope ans ASG registers in Fpga are available and also documented. (doc can be accessed from hackage page)
Missing
  • Testing
  • PID, ASM, Daisy chain, Power test controlling functions
  • World domination

Re: Lambdaya - Haskell library

Posted: Wed Jan 06, 2016 12:18 pm
by Nils Roos
Wellwellwell, functional programming comes to the Red Lambdaya. Nice effort !

You should probably put a note somewhere that the pre-compiled server binary is for the 'old' ecosystems <= 0.93 and/or prepare instructions and executables for the new one (hard-float architecture), too.

I'd also like to see a roadmap for the last deliverable ... :mrgreen:

Re: Lambdaya - Haskell library

Posted: Wed Jan 06, 2016 2:54 pm
by ralu
I think that there is only issue with pre compiled server binaries for arm.

I guess I will need either different cross compiler or just link against different lib.
Can someone tells me what gcc and libraries I need for cross-compilation and I can rebuild ghc and server binary for latest platform.

Last change on http://wiki.redpitaya.com/index.php?tit ... oper_Guide seems to be from sept 2014 and I am not sure they are relevant.

Re: Lambdaya - Haskell library

Posted: Thu Jan 07, 2016 6:07 pm
by ralu
I was able to recompile ghc with gcc-arm-linux-gnueabihf toolchain and then compiled bin/server.hs with arm-unknown-linux-gnueabihf-ghc.
Now both pre-compiled binaries for RP are available in bin folder and server works with latest - red_pitaya_OS_v0.94-RC23_29-Dec-2015.img

I hope someone will have some fun with it.