10

Is there a Scheme compiler (not interpreter) for ARM processors, specifically Cortex-M3? I'm looking for a compiler, not an interpreter, to get a predictable and small execution times on a (relatively) slow processors. It probably will omit some parts of specification (continuations, maybe); that's fine.

I should note that I only have a 8 kB (maybe 2-4 times more) of RAM.

I'll try to use everything in the answers, and then reply with my findings. That may take some time, through.

Catherine
  • 22,492
  • 3
  • 32
  • 47
  • Bigloo is known to work. Stalin is likely to work (but I have not tried it with ARM). Practically, any other Scheme to C compiler should be ok as well. – SK-logic Aug 17 '11 at 06:34
  • And, btw., do you really need Scheme? Would not something like BitC be more appropriate in an embedded environment? – SK-logic Aug 17 '11 at 06:35
  • @SK-logic, if Bigloo "is known to work", can you provide a link? Cortex-M3s are from low-end segment of ARM controllers, they cannot run Linux, for example, and I don't see any support for bare uCs in Bigloo. Also, it's quite big. BitC looks like a good project, but I'd like to stick with something more standardized and documented. – Catherine Aug 17 '11 at 10:58
  • @SK-logic, the problem with most Scheme-to-C compilers is that they require a runtime, which is often quite big and sometimes dependent on OS features. – Catherine Aug 17 '11 at 11:34

3 Answers3

4

This question was on Common Lisp, but one particular answer referenced Picobit, which is essentially a Scheme for microcontrollers. It very well fits in my conditions, as the paper says it can work on as little as 7 kb of memory.

I've decided to fork Picobit and port it to ARM processors.

Community
  • 1
  • 1
Catherine
  • 22,492
  • 3
  • 32
  • 47
2

Have you looked at Chicken Scheme?

cam
  • 14,192
  • 1
  • 44
  • 29
  • Very interesting! I'll look into the way of making it work with Cortex-M3 CPUs, through. They're quite limited in RAM. – Catherine Aug 16 '11 at 21:22
  • Chicken Scheme is indeed a very good piece of software, but its runtime library is [around 240k](http://wiki.call-cc.org/man/4/faq#how-can-i-obtain-smaller-executables) in size, and I don't even know the RAM footprint. Sadly, that's a bit too much. (Also, it lacks any support for running on bare-metal microcontrollers, but that's less of a problem.) – Catherine Aug 16 '11 at 21:43
  • @whitequark: ah, sorry. I don't have any experience running scheme in constrained environments, but I had used chicken scheme to compile to C before so I had hoped that would work out. – cam Aug 16 '11 at 23:30
1

Gambit-C also provides Scheme to C compiler. Also take a look on Stalin

paul
  • 1,100
  • 1
  • 8
  • 14
  • As far as I can see, Gambit has a very big runtime, and Stalin generates quite bloated code -- maybe it is really faster, but definitely also RAM-hungry, which is unacceptable. – Catherine Aug 17 '11 at 11:42
  • Out of the box the gambit runtime is very big, but there has been some work done to trim a lot of the fat, and only provide enough runtime for what is needed, rather then every gambit primitive and function. – Jonathan Arkell Aug 20 '12 at 22:30