Register
handmade.network»Forums»Finding a system or embedded library for making Pi Zero into a faster Arduino?
107 posts / 1 project
Finding a system or embedded library for making Pi Zero into a faster Arduino?
2 months, 2 weeks ago Edited by Dawoodoz on Feb. 4, 2021, 6:31 p.m.
The horrible mess
Whenever I search for embedded Raspberry Pi Zero projects, almost everything is made with super slow Python and some insanely buggy library full of hacks that are already broken from existing system patches and relying on low-level libraries that are not even maintained anymore, only to call 10 lines of assembly code at the bottom of the mess. They even have redundant security permissions to make calls that are directly exposed in assembler.

The main problem
The boot times of Raspbian in CLI mode is not nearly enough for robotic C++ projects and there are too many things that can go wrong when starting and stopping the program. Now I'm looking for a cleaner read-only-system that can be flashed the SD card via USB and maybe debug via wifi using SSH.

A good starting point, but a library might help
Found a guide for older Pi computers using pure assembly without any operating system which is a little lower than what I need.
https://www.studica.com/blog/program-embedded-systems-raspberry-pi
Writing a large scale application needs at least Micro-C/C/C++ for hardware portability and some abstraction for accessing the camera. I don't like mixing C and whole assembler functions due to undefined behavior in call conventions.

My goal is to actually use the system, so I'm not going to spend the rest of my life writing a whole operating system from scratch, just need something in between the bloated mess and nothing at all.
Mārtiņš Možeiko
2205 posts / 1 project
Finding a system or embedded library for making Pi Zero into a faster Arduino?
2 months, 2 weeks ago
You don't need to use Python - there are C API's for all Pi's functionality on regular Linux. It is under /opt/vc. If you use some lightweight distro like ArchLinuxARM or Alpine, it can boot minimal setup to user cli in 2 or so seconds (not counting bootloader).

For development though you would want to boot over NFS which is well supported for Linux, and which simplifies turnaround time. Then you won't need to reboot or reflash sdcard. Just put compile/modify your files on your host system and run the relevant binary over ssh.
107 posts / 1 project
Finding a system or embedded library for making Pi Zero into a faster Arduino?
2 months, 2 weeks ago
mmozeiko
You don't need to use Python - there are C API's for all Pi's functionality on regular Linux. It is under /opt/vc. If you use some lightweight distro like ArchLinuxARM or Alpine, it can boot minimal setup to user cli in 2 or so seconds (not counting bootloader).

For development though you would want to boot over NFS which is well supported for Linux, and which simplifies turnaround time. Then you won't need to reboot or reflash sdcard. Just put compile/modify your files on your host system and run the relevant binary over ssh.


Thanks, I'll have a look. :)