8 ms·
This is an incredibly useful tool. I have a large C codebase for an embedded device, and I've often thought about the work involved in one day porting it to Em
by randyrand 4y ago
This is an incredibly useful tool.
I have a large C codebase for an embedded device, and I've often thought about the work involved in one day porting it to Embedded Linux with a higher level & safer language.
This kind of tool is a game changer.
- brabel 4y agoThe transpiled Go code seems to end up having to use lots of unsafe code, as even this little sample shows... it would probably be impossible to translate C without doing that. Is the resulting binary actually memory safe in any meaningful way, or even safer than the original C?
- xyzzy_plugh 4y agoThe unsafe parts, surely not. That's not entirely the point though. Dropping a dependency on C is a big deal in Go: faster calls, no CGO means faster builds and static binaries. Go also let's you hand-write assembly and link it in, usually for performance reasons, which very much lacks safety guarantees, but has proven to be incredibly useful for optimizing hot code paths.
- turminal 4y agoUnfortunately a lot of embedded devices can't handle the size of go executables.
- randomdata 4y agoThe gc compiler produces notoriously large executables but Go programs need not be so large. A small program compiled using the tinygo compiler can be as small as 10s of kilobytes.
- Fnoord 4y agoSomeone even developed a complete SOHO router in Go: Router7 [1]. [1] https://router7.org/ https://router7.org/
- m45t3r 4y agoThis certainly doesn't look like a embedded device though: > The reference hardware platform is the PC Engines™ apu2c4 system board. It features a 1 GHz quad core amd64 CPU, 4 GB of RAM, 3 Ethernet ports and a DB9 serial port.
- p_l 4y ago"Embedded" has no relationship with size, though. And that's moderately big for "embedded" anyway.
- detaro 4y agoThat's an embedded device, sure. Embedded doesn't mean "microcontroller only".
- m45t3r 4y agoI didn't mean to imply this. I consider most router hardware embedded, but they includes CPUs. It is just that they're CPUs that you would generally consider embedded (like a SoC). And BTW, my reply was mostly because of the context: people were talking about binary sizes for Go, but if you're using PC-like hardware you wouldn't care about binary sizes anyway (you can simply put more storage, even something like a 1GB SD Card would be way bigger than something like OpenWRT that can run with hardware as low as 8MB of Flash memory).