Skip to content

Instantly share code, notes, and snippets.

@tribals
Last active January 2, 2024 18:37
Show Gist options
  • Save tribals/988f183644edd9b7a5011ae9b53b0800 to your computer and use it in GitHub Desktop.
Save tribals/988f183644edd9b7a5011ae9b53b0800 to your computer and use it in GitHub Desktop.
*.hex
*.s
*.elf

Blink in (Micro)Scheme

You can write programs even for 8-bit microcontrollers in Scheme. Here is very simple one - it just blinks. Try it:

$ guix shell
$ make
$ # avrdude ...

See it blinks...

blink.elf: blink.ms
microscheme -va -m UNO blink.ms
.PHONY: clean
clean:
rm -f blink.{hex,s,elf}
(use-modules
(gnu packages avr)
(gnu packages avr-xyz)
(gnu packages base)
(gnu packages flashing-tools)
(gnu packages llvm)
(guix profiles)
(guix packages))
(packages->manifest
(list
(package
(inherit microscheme)
(inputs
(modify-inputs
(package-inputs microscheme)
(delete clang)))) ; not needed - save bandwidth a bit
(make-avr-toolchain)
gnu-make
avrdude))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment