After more than a decade without touching C and have been playing a lot with ruby and coffee script in the last years i really wonder if it would be possible to write the firmware using something like http://terralang.org or http://moonscript.org ?
Does anybody has experience / any input regarding this sort of jazz?
thanks for the links, i hadn’t seen either of these meta-languages. i’ve been considering integrating lua into some future projects for deep-customization.
it’d be a terrific task to make a cross-compiler or something to simplify euro modules. my best suggestion is to consider a module that uses the arduino front-end, like nw2s. then you’re dealing with sortof-js
monome-specific, hacking the firmware is pretty straightfoward if you’re just making a new grid app. process keypresses, draw the LEDs, and do something with clocks. C syntax for this sort of stuff is easy. we already did the hard parts that don’t make sense right away, and there’s really no need to look at them anyway.
@tehn: I think @hems was specifically looking at the whitehwale as he just got one recently . What architecture is it based on? With terra it is possible to produce object code for any architecture supported by LLVM\clang.
The modules are all based on the Atmel AVR32 platform (this is different from the 8-bit AVR that Arduinos use), this isn’t supported by LLVM, as far as I know the only compiler is GCC 4.4, that limits you to C and C++ (no STL for C++ either). The AVR32 platform isn’t really going anywhere in general, ARM has basically won the embedded CPU battle.
@hems, in general most embedded platforms need to use a low-level programming languages to manage memory as you don’t usually have very much, high-level languages nearly always use a garbage collector, for which you need a lot of RAM and then you still have to put up with GC pauses.
IMO, C++ tends to be a bit easier to use as you don’t have to deal with pointers quite so much, you just need to stick to a particular style of C++ to stop yourself getting in trouble (e.g. RAII), this is basically the approach that Arduinos take.
Otherwise if you’re trying to do stuff with WW in C, as @tehn says, it should be fairly easy, the hardest bit is not what language to use, but writing all the low level hardware access, and that’s already done for you. I’d also add, don’t
malloc, statically allocate your arrays to a fixed size, and wrap all your pointer access with functions, the compiler will optimise them away for you if they’re all in a single file (and there are tricks to do the same if they’re in different files).
I went through the source and yes, it’s definitely not the end of the world to write C when most of the hard work was done for you ( thank you guys so much! ) still i’m so used to indentation based programming and to don’t use curly braces and a lot of other treats that i got kind lazy to deal with C.
If i really want to write something ( and i want ), surely is not C that will hold me back, but i would love to find a way of writing code for the modules in a “cozy” way
teletype was made for super high-level scripting, but i understand you’re aiming for something in between. have you checked out teletype? of course, this isn’t for grid app design, which is what i expect you’re seeking.
Also, it’s pretty easy to add extra functions (a.k.a. operators in Teletype speak) to the code, if you’re adept at using git, it’s pretty to easy to maintain these in a private branch if they’re a bit too bespoke to be contributed back. There is a limit to how far you can take them and it’s not grid based, but if it fits with want you want to do…
Does the target platform actually need to support LLVM, or is that just for the development platform? I get the impression Terra object code can work with gcc from this page, but I’m certainly no expert:
@jasonw22: from here: http://terralang.org/api.html#targets I understand that the target platform needs to be supported by LLVM in order to cross-compile object code for that platform.
@sam: seems like LLVM might support AVR after all: https://github.com/avr-llvm/llvm
terra is a statically typed, low level language with manual memory management, which doesn’t need Lua during runtime ( it can also run within lua runtime with terra code generate\compiled on the fly when it is needed ). The advantage of using it over C is that it supports meta-programming, using Lua to generate terra code. Its like Macros and C++ templates on steroids
Thanks for clarifying. Terra seems intriguing!
@adrian-gierakowski at a quick glance i suspect avr32 is not supported as it is not as popular as avr8.
terra does seem interested though!
yes i just wanted to keep moding white whale. i’ll dig the C code, just feels like the right thing to do…
Anyway i was tingling with the idea of writing firmware stuff with something slightly more phun than C.
i used git and zsh everyday for years, and recently i’m also playing http://zty.pe if that matters, LOL
i been playing with writing a grid application using coffee script, using the nodejs modules, and it’s a bliss, specially if you do on top of Meteor, i’m calling the project “mononster”.
But unfortunately my modular don’t run node.js ( and surely not Meteor, LOL ).
Maybe something like a beaglebone could actually output CV and Triggers and run node.js and be descent at it, but i have not enough hardware experience to know if that is actually a doomed idea, specially regarding clocking and other issues which seems to be common when using higher level languages.
The Owl, Nebulae, and terminal_tedium are all eurorack modules that can run Pd, for which there are a few monome apps and grid studies. terminal_tedium is basically a raspberry pi + ADC. I’m eagerly awaiting the next batch of PCBs. I imagine running node.js or any of several other grid studies platforms should be feasible, but I haven’t used a raspberry pi myself just yet.
very interesting. specially because i have a rpi2 hanging out here.