www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Dlang on $4 microcontroller board from Raspberry Pi RP2040

reply Igor Myronov <wolfram.chrome gmail.com> writes:
I'm wondering if a such nice programming language should be 
possible to use on small MCU's like RP2040,PIC32 and so on.
Thanks.
Feb 28 2022
next sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
I've used it on cortex A (A53, 2b+), and so I presume you could use it on cortex M's. GDC may have a backend for PIC, but LDC doesn't. Both of them should be able to support ARM. There's some blog post series kicking around somewhere of people using D on microcontrollers, that explain using all the quirks of microcontrollers.
Feb 28 2022
prev sibling next sibling parent reply forkit <forkit gmail.com> writes:
On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
Feb 28 2022
next sibling parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
Out of curiosity, what baggage?
Mar 01 2022
parent reply forkit <forkit gmail.com> writes:
On Tuesday, 1 March 2022 at 10:08:54 UTC, Iain Buclaw wrote:
 On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
Out of curiosity, what baggage?
Huh? Are you suggesting there's no baggage associated with maintaining 32bit compatability? Just to start with.. the build and release would be much simpler, for example. As for source.. I expect you're in a better postion than I, do identify that baggage. Of course if 'real' D users are using 32bit.. it's probably not correct to consider it 'baggage' as such. But that day is fast approaching ;-)
Mar 01 2022
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 02/03/2022 9:08 AM, forkit wrote:
 Huh? Are you suggesting there's no baggage associated with maintaining 
 32bit compatability?
 
 Just to start with.. the build and release would be much simpler, for 
 example.
 
 As for source.. I expect you're in a better postion than I, do identify 
 that baggage.
 
 Of course if 'real' D users are using 32bit.. it's probably not correct 
 to consider it 'baggage' as such. But that day is fast approaching ;-)
Build processors are always going to be complex due to us supporting multiple platforms. Adding in an extra address width, really isn't an issue. Our only problems are related to dmd's backend and Optlink and I wouldn't be surprised if it still supported m68k (although I couldn't find anything referencing it). But Optlink is now going away so all of those issues are going away hopefully in this decade.
Mar 02 2022
prev sibling next sibling parent reply norm <normowtree gmail.com> writes:
On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
32 bit has smaller codegen, is less complex in PCB design, HW interfaces and driver development, more energy efficient, physically smaller, runs cooler, generally runs faster and is a cheaper component. It does depend on the project but in the last decade where I work we have had only 1 project using a 64-bit micro. The rest have been 32 bit and two or three 8-bit devices. We have a 8-bit project running atm, which has been really fun to work on! We surveyed D and had to turn it down unfortunately because it wasn't suitable for micro development at the time. We may revisit, but currently C++17 & C++20 dominate with support on some projects from micropython, CPython and Go. We also surveyed Rust and found the cognitive load for old embedded devs led to more bugs, sure we had fewer memory issues but the memory safety of Rust leaks into the code like Perl noise. Our devs didn't like that because the code was too hard to grok and reason about on the page. I am sure they would have gotten used to it but it wasn't worth the investment when we have Go and C++20.
Mar 01 2022
parent reply forkit <forkit gmail.com> writes:
On Tuesday, 1 March 2022 at 22:22:11 UTC, norm wrote:
 It does depend on the project but in the last decade where I 
 work we have had only 1 project using a 64-bit micro. The rest 
 have been 32 bit and two or three 8-bit devices. We have a 
 8-bit project running atm, which has been really fun to work on!
It's interesting to see people talking about hardware ;-) I guess those of us who program at a higher-level (of abstraction), often forget that: "There isn't any software! Only different internal states of hardware. It's all hardware! It's a shame programmers don't grok that better."
Mar 01 2022
parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Tue, Mar 01, 2022 at 10:43:38PM +0000, forkit via Digitalmars-d wrote:
 On Tuesday, 1 March 2022 at 22:22:11 UTC, norm wrote:
 It does depend on the project but in the last decade where I work we
 have had only 1 project using a 64-bit micro. The rest have been 32
 bit and two or three 8-bit devices. We have a 8-bit project running
 atm, which has been really fun to work on!
[...]
 It's interesting to see people talking about hardware ;-)
 
 I guess those of us who program at a higher-level (of abstraction),
 often forget that:
 
 "There isn't any software! Only different internal states of hardware.
 It's all hardware! It's a shame programmers don't grok that better."
"People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird." -- D. Knuth T -- Debian GNU/Linux: Cray on your desktop.
Mar 01 2022
prev sibling next sibling parent dangbinghoo <dangbinghoo gmail.com> writes:
On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
FYI. For the MCU market (as we are now in the IoT age), most of the market share will be 32Bit, and even there's a big part is still 16bit (for industrial). 64bit for MCU now shares very very little part. And for Dlang, the core dev is focusing on only PC and bigger computers, but, we actually have a chance.
Mar 01 2022
prev sibling next sibling parent dangbinghoo <dangbinghoo gmail.com> writes:
On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 Arhggg...32bit controllers! In 2022!

 There goes any hope of ridding D of its 32bit baggage.
FYI. For the MCU market (as we are now in the IoT age), most of the market share will be 32Bit, and even there's a big part is still 16bit (for industrial). 64bit for MCU now shares very very little part. And for Dlang, the core dev is focusing on only PC and bigger computers, but, we actually have a chance.
Mar 01 2022
prev sibling parent reply Igor Myronov <wolfram.chrome gmail.com> writes:
On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
From what i got already learned in these days it looks like Dlang is pretty useless on any kind of MCU. There's no solid stuff happening for Dlang on MCU's,so i suppose that this kind of theme should be postponed for a few years yet before getting Dlang for real embedded system development. Unfortunately :(
Mar 05 2022
parent reply dangbinghoo <dangbinghoo gmail.com> writes:
On Saturday, 5 March 2022 at 17:54:02 UTC, Igor Myronov wrote:
 On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
From what i got already learned in these days it looks like Dlang is pretty useless on any kind of MCU. There's no solid stuff happening for Dlang on MCU's,so i suppose that this kind of theme should be postponed for a few years yet before getting Dlang for real embedded system development. Unfortunately :(
yeah, embedded is not focused in D community, Rust and Nim is doing this, they all have `embedded` channel in their Discord.
Mar 06 2022
parent reply max haughton <maxhaton gmail.com> writes:
On Monday, 7 March 2022 at 01:14:50 UTC, dangbinghoo wrote:
 On Saturday, 5 March 2022 at 17:54:02 UTC, Igor Myronov wrote:
 On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
From what i got already learned in these days it looks like Dlang is pretty useless on any kind of MCU. There's no solid stuff happening for Dlang on MCU's,so i suppose that this kind of theme should be postponed for a few years yet before getting Dlang for real embedded system development. Unfortunately :(
yeah, embedded is not focused in D community, Rust and Nim is doing this, they all have `embedded` channel in their Discord.
People have been using D on embedded targets for longer than Rust and Nim have existed. What you're looking for is basically the peacock's tail rather than the stuff that actually carries the DNA. Ask a specific question and someone will help you, quite possibly me, but just moaning about how there isn't an embedded channel discord (If you're in the D discord server you'll notice that there are several people who run D on embedded targets fairly regularly). If you want help from scratch then that is OK but there is literally nothing special about targeting controllers, beyond having to probably set up your own toolchain. In fact I have just asked the discord admins to add an embedded channel in the server.
Mar 06 2022
parent dangbinghoo <dangbinghoo gmail.com> writes:
On Monday, 7 March 2022 at 02:15:14 UTC, max haughton wrote:
 On Monday, 7 March 2022 at 01:14:50 UTC, dangbinghoo wrote:
 On Saturday, 5 March 2022 at 17:54:02 UTC, Igor Myronov wrote:
 On Tuesday, 1 March 2022 at 07:24:07 UTC, forkit wrote:
 On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
Arhggg...32bit controllers! In 2022! There goes any hope of ridding D of its 32bit baggage.
From what i got already learned in these days it looks like Dlang is pretty useless on any kind of MCU. There's no solid stuff happening for Dlang on MCU's,so i suppose that this kind of theme should be postponed for a few years yet before getting Dlang for real embedded system development. Unfortunately :(
yeah, embedded is not focused in D community, Rust and Nim is doing this, they all have `embedded` channel in their Discord.
People have been using D on embedded targets for longer than Rust and Nim have existed.
Yeah, you're right.
 What you're looking for is basically the peacock's tail rather 
 than the stuff that actually carries the DNA.

 Ask a specific question and someone will help you, quite 
 possibly me, but just moaning about how there isn't an embedded 
 channel discord (If you're in the D discord server you'll 
 notice that there are several people who run D on embedded 
 targets fairly regularly). If you want help from scratch then 
 that is OK but there is literally nothing special about 
 targeting controllers, beyond having to probably set up your 
 own toolchain.

 In fact I have just asked the discord admins to add an embedded 
 channel in the server.
OK, that's basically right. But, What I mean `not focused` is that: Rust and Nim is doing more stuff (or ecosystem) than D do. Rust: embedded is mentioned on their Home-Page as a language goal. And they've done svd2* tool to do bindings and library generation for Rust programming on MCU targets. Nim: it's easier to Do configuration for toolchain in nim.cfg than What D do. And nim's stdlib even has support for `freertos` and `zephyr` for OS target. yes, embedded is a common concept, for Big CPU or Soc like ARM Cortex-A or MIPS and etc With Linux-OS, D is ready for almost everything. But for MCU target, D has only betterC mode, and I know there's lwdr, but the ecosystem is actually a another story compared to Rust&Nim. thanks!
Mar 06 2022
prev sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Tuesday, 1 March 2022 at 05:07:09 UTC, Igor Myronov wrote:
 I'm wondering if a such nice programming language should be 
 possible to use on small MCU's like RP2040,PIC32 and so on.
 Thanks.
I remember using it on 32-bit pi using LDC. Ported intel-intrinsics so you can even get SIMD.
Mar 01 2022