Live data from Hacker News

Mruby/C and picoruby: high level langs in low-level devices?

github.com

21–30 of 33 posts

Re: Mruby/C and picoruby: high level langs in low-level devices?

#21
post #17

Earlier quoted context omitted.

Yeah, but 1990 was 35 years ago and Ruby even didn't exist. And the average computer was quite bigger than a RP2040, and consumed much more power :) I mean, it's very difficult to compare those things. It's a high level language runtime weighting a very small fraction of the JavaScript we're loading on any silly webpage, and we can run in on an stamp sized microcontroller that costs a couple dollars and you'd typical…

Yeah. Many of the 8bit machines were lower than 128K stock, but those were uncommon by 90s. Even then, RAM expanders were common. The XT and AT had more than 128K, and the 286 was released in 1982 (volume production in 1983). The 386 was out, and had way more. The 486 was 1989, and it was commonly found with far more. So, really, 128K was only really a good amount of RAM in the early 80s.

Yeah, I'd need to ask my dad, but we got the Amstrad around '86 or '87 maybe, then a Nokia branded(weird, I know) 386sx/16 with 4MB, maybe around '90/'92, then a generic clone with a Pentium 120 and and magnificent Sound Blaster AWE32 around 96.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#22
post #17

Earlier quoted context omitted.

Yeah. Many of the 8bit machines were lower than 128K stock, but those were uncommon by 90s. Even then, RAM expanders were common. The XT and AT had more than 128K, and the 286 was released in 1982 (volume production in 1983). The 386 was out, and had way more. The 486 was 1989, and it was commonly found with far more. So, really, 128K was only really a good amount of RAM in the early 80s.

Yeah, I'd need to ask my dad, but we got the Amstrad around '86 or '87 maybe, then a Nokia branded(weird, I know) 386sx/16 with 4MB, maybe around '90/'92, then a generic clone with a Pentium 120 and and magnificent Sound Blaster AWE32 around 96.

My household was Atari and then PCs, so I missed out on many different machines. Exploring them now is fun, but always time limited unlike childhood.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#24
post #4

Earlier quoted context omitted.

It is a return to the age when we had BASIC and Z80/6502 Assembly, and yes doing memcpy/strcpy all over the place instead of having proper arrays and strings is that bad. At very least, C++. "C++14 For The Commodore 64" https://www.youtube.com/watch?v=nLv_INgaLq8

> doing memcpy/strcpy all over the place instead of having proper arrays and strings is that bad This presupposes that you're doing string manipulation and raw memory moves. I don't know about other people's code, but in my own experience neither of those things are likely to be happening in embedded code. You're much more likely to pre-allocate all your memory, and use zero-copy patterns where ever possible. I never…

What is embedded nowadays was a home computer in 1980's, so maybe you aren't, as someone that started coding on a Timex 2068, I very much doubt that in general.

MISRA and similar exists for a reason.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#25
post #7

256KB ROM/128KB RAM isn't very small. That is larger than the average computer through about 1990 ... (I know people will say I'm being pedantic. However, RAM and Flash define most of the price of a microcontroller. So, a factor of two--especially in RAM--means a significantly smaller and cheaper chip.)

Yeah, but 1990 was 35 years ago and Ruby even didn't exist. And the average computer was quite bigger than a RP2040, and consumed much more power :) I mean, it's very difficult to compare those things. It's a high level language runtime weighting a very small fraction of the JavaScript we're loading on any silly webpage, and we can run in on an stamp sized microcontroller that costs a couple dollars and you'd typical…

No, but BASIC did.

And by the time of Amstrad PC1512, BASIC compilers became an option as well, although originally Darthmound BASIC was compiled, CP/M systems also had compilers available, it just did not fit into 8 bit home computers, which had to wait for the 16 bit wave of home computers.

There were other high level dynamic languages with compilers like Lisp subsets, xBase/Clipper.

So if we managed back then, there is no reason to not have a tiny Ruby version nowadays for similar environments.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#26
post #7

256KB ROM/128KB RAM isn't very small. That is larger than the average computer through about 1990 ... (I know people will say I'm being pedantic. However, RAM and Flash define most of the price of a microcontroller. So, a factor of two--especially in RAM--means a significantly smaller and cheaper chip.)

Yeah, but 1990 was 35 years ago and Ruby even didn't exist. And the average computer was quite bigger than a RP2040, and consumed much more power :) I mean, it's very difficult to compare those things. It's a high level language runtime weighting a very small fraction of the JavaScript we're loading on any silly webpage, and we can run in on an stamp sized microcontroller that costs a couple dollars and you'd typical…

i share the same sentiment as you. why suffer writing C when one can enjoy the fruits of language features? it's certainly not optimal, but neither is 99+% of software nowadays. There's the feeling of waste and bloat, but the trade-off is language features!

on the other hand, nowadays, we can just generate C code using ai.. as long as the project doesn't get too big to grasp without abstractions. ;)

Re: Mruby/C and picoruby: high level langs in low-level devices?

#27
post #2

some people hate to use C. Some people embrace it, even love it (including many game devs!). You have full control! But i wonder, what do HN folks think about these pico implementations of ruby, a complex language made for the tiniest devices, such as sensors? I mean.. is C really that bad?? also, it's very cool they're still being maintained!

Then you should use assembly. I mean..is assembly really that bad?

no. assembly really is that bad.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#28

No idea about mruby/C or picoruby but MicroPython is very popular, enough that I'd just settle on it for devices can handle it. It runs nicely in 256k of flash and 32k of ram, on the small adafruit trinket devices. It was shoehorned into the v1 BBC microbit which had 256k of flash and just 16k of ram, but that was apparently painful. Smaller include Lua and maybe Hedgehog Lisp. Below that there is ulisp but that is s…

ah yeah, i forgot about Lua! that's def the way to go.

Re: Mruby/C and picoruby: high level langs in low-level devices?

#29
post #13

picoruby is a lot of fun. It's a reimplementation of mruby/c which is even smaller. You might be interested in my friend and creator HASUMI Hitoshi's presentation. He shows off his Ruby REPL that runs on the Raspberry Pi pico. Recently he ported picoruby to other microcontrollers. https://youtu.be/WxZNE5zTAjg?si=7DQUcQg80RMZoU0b

thank you for this!! I <3 Taiwan. lol star wars font. I knew he was special from his GitHub photo XD

Re: Mruby/C and picoruby: high level langs in low-level devices?

#30
post #13

picoruby is a lot of fun. It's a reimplementation of mruby/c which is even smaller. You might be interested in my friend and creator HASUMI Hitoshi's presentation. He shows off his Ruby REPL that runs on the Raspberry Pi pico. Recently he ported picoruby to other microcontrollers. https://youtu.be/WxZNE5zTAjg?si=7DQUcQg80RMZoU0b

oooooooooooh snap! irb/ruby repl on a micro-controller is soooo sick!!
Post reply on HN