Closed alexchandel closed 10 years ago
It's unlikely Zinc will ever support the Raspberry Pi as it is a much larger machine than we are targeting (e.g. Cortex-scale devices). Really you are better off running Rust on Linux when working with Beagle Bone/Raspberry Pi-scale devices. However, even if the RPi were in the machine class that we target the poor state of Broadcom's documentation would make it quite unappealing to work on.
The RPi is an ARMv6 core, whereas we are targetting ARMv6m and ARMv7m. It doesn't look like it would be too big a stretch to cover RPi too, but I'm not sure Broadcom has shared the required reference manuals?
I don't think a bare-metal RPi support is reasonable to target now. I'd rather add support for "native-linux" platform to zinc/os stack when there's something other than a bare-bones scheduler so that you can run that one on RPi same way as e.g. contiki.
To elaborate a bit more: I'm fine with a PR that adds GPIO support for RPi based on linux file interface.
I would really like to be able to code only I'm rust on the pi.
Knowing my code can relatively easy move from stb hardware up to a PI is a big win.
If you dont need bare metal RPi, you can already build binaries for linux on the RPi https://github.com/npryce/rusty-pi/blob/master/doc/compile-the-compiler.asciidoc
That's a really nice aspect !
Would the actual code be portable between rust on Linux & zinc ?
I assume the instrumentation attributes would ? Maybe many other bits. It would be good for these differences to be well know for newbies like me.
No, it wouldn't really be portable. rust building natively for linux uses libc that talks to linux kernel. zinc is something like linux kernel + libc, so there's a different set of APIs.
E.g. if zinc implements any filesystem support it might be quite different from what you use in rust to open files (for the sake of keeping code simple and low profile).
It would be really nice if we could write rust code not for the beaglebone per say, but for the PRUs on the beaglebone...
AFAIK there's no llvm support for beaglebone's PRUs, so it's not a valid target for rustc so far.
@bgamari @bharrisau There's documentation for the RPi's SoC (the Broadcom BCM2835) here. It should be possible to support the RPi's timers, interrupts, the system clock, GPIO, UART, SPI, I2C, and even USB.
To elaborate a bit more: I'm fine with a PR that adds GPIO support for RPi based on linux file interface.
@farcaller Wouldn't that be outside in the scope of this project? Zinc wouldn't really be a "bare-metal" "RTOS stack" if it's running in userspace on Linux.
Any chance of moving this forward? Compiling to bare metal Raspberry Pi is definitely possible with Rust (http://blog.thiago.me/raspberry-pi-bare-metal-programming-with-rust/), but without Zinc using plain Cargo it's difficult.
Also check out this blog series: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/ and this repository: https://github.com/dwelch67/raspberrypi I would love to replicate these tutorials in Rust.
I reconsidered my stance that it's out of zinc scope and I'm ok with incoming PRs.
RPi is a pretty commonly held ARM board, support would allow lots of others to test zinc.rs. It would mean adding support for the Broadcom SoC that the RPi uses.