www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Arduino and D

reply "Ty Tower" <tytower hotmail.com.au> writes:
Has anybody tapped the massive Arduino programming explosion 
using D instead of C++ ?
I got started on Arduino a few years back and it has taken the 
microprocessor popularity through the roof .
Unfortunately you download the IDE (Integrated Development 
Environment) from Arduino.cc direct and then using a $3 
development board with a 328p chip on it ,proceed to program the  
chip to do pretty much whatever you can think of including 
turning stuff on with your mobile from anywhere in the world  and 
much much more .

I wondered if someone could adapt it to D ?
Oct 25 2014
next sibling parent reply "Israel" <tl12000 live.com> writes:
On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive Arduino programming explosion 
 using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of including 
 turning stuff on with your mobile from anywhere in the world  
 and much much more .

 I wondered if someone could adapt it to D ?
Well it is ARM so it should be possible.
Oct 25 2014
next sibling parent "Mike" <none none.com> writes:
On Saturday, 25 October 2014 at 22:55:12 UTC, Israel wrote:
 Well it is ARM so it should be possible.
There is a significant difference between ARM and ARM Thumb. ARM (which shares the name of ARM Ltd.) is the architecture primarily used for devices like smartphones, credit card PCs (Raspberry Pi, BeagleBone Black, etc...) and other portable consumer devices. ARM Thumb, on the other hand, is the architecture used for microcontroller programming like the Arduino. ARM is a 32-bit instructions set, and ARM Thumb is 16-bit or a mixture of 16-bit and 32-bit instructions. I've only done ARM Thumb programming, so I can't elaborate on the differences well, but I also believe the two have a different exception model and many other differences. I believe the mainline druntime has pretty good support for ARM, but nothing at all for ARM Thumb. One could probably use D pretty well for the Raspberry Pi, but they're going to have to make their own druntime to program the Arduino. Mike
Oct 25 2014
prev sibling next sibling parent reply Filipe =?UTF-8?B?TGHDrW5z?= <filipe.lains gmail.com> writes:
On Saturday, 25 October 2014 at 22:55:12 UTC, Israel wrote:
 On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive Arduino programming explosion 
 using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of 
 including turning stuff on with your mobile from anywhere in 
 the world  and much much more .

 I wondered if someone could adapt it to D ?
Well it is ARM so it should be possible.
Actually, most arduinos use Atmel's chips so most of them are AVR. Apparently, there was some work done to port GDC to AVR [1]. I don't really know the usability of this but I suspect it's not much. If you want a board with similar size too small arduino like the pro/pro mini that has an ARM chip, you should have a look at Teensy[2]. Using D to program ARM chips shouldn't be that hard. [1] https://github.com/D-Programming-microD/GDC/tree/microD-4.9 [2] https://www.pjrc.com/teensy/
May 15 2018
parent reply Russel Winder <russel winder.org.uk> writes:
On Tue, 2018-05-15 at 22:28 +0000, Filipe La=C3=ADns via Digitalmars-d wrot=
e:
[=E2=80=A6]
=20
 Actually, most arduinos use Atmel's chips so most of them are AVR.
 Apparently, there was some work done to port GDC to AVR [1]. I=20
 don't really know the usability of this but I suspect it's not=20
 much.
[1] Looks very old and unmaintained, i.e. 4 years since the last commit. Al= so D (gdc) is now a part of the GCC suite, which may explain [1] being retred. GCC has AVR backends, thus gdc has an AVR backend. Also it has an ARM backe= nd. Like ldc, gdc gets many backends (more or less) for free. GCC is now at 8.0.0, but what version of D is it using in gdc? Is a desire to see D used more in IoT projects a reason for more people to = be interested in gdc and help get it's version updated with each GCC release. Alternatively does D in IoT mean "use ldc". Does the LLVM suite support AVR and ARM backends as GCC does?
 If you want a board with similar size too small arduino like the=20
 pro/pro mini that has an ARM chip, you should have a look at=20
 Teensy[2]. Using D to program ARM chips shouldn't be that hard.
=20
 [1] https://github.com/D-Programming-microD/GDC/tree/microD-4.9
 [2] https://www.pjrc.com/teensy/
Someone sent me a couple of ESP8266 development boards and a ESP-WROOM-32 development board, the intention being to play with them as MicroPython devices. I see from the device websites, they are intended for use as stand= ard Arduino (presumably C) devices or as Lua controlled devices. Perhaps they should be D controlled devices as well. I guess though the problem is which firmware to load to then use as a D controlled device, and which toolchain = to use with it: Arduino mode has a full IDE/ICE set up. Also does D have the library to deal with controlling hardware. How easy is it to build D codes with gdc or ldc without Phobos, and without DRuntime?=20 Is D wthout Phobos useful for IoT or should one stick with C,Lua, and MicroPython? Is IoT an opportunity for D or is it a false direction given D= is an x86/x86_64 oriented programming language? --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
May 16 2018
next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
On 16/05/2018 8:48 PM, Russel Winder wrote:
 On Tue, 2018-05-15 at 22:28 +0000, Filipe Laíns via Digitalmars-d wrote:
 […]

 
 Actually, most arduinos use Atmel's chips so most of them are AVR.
 Apparently, there was some work done to port GDC to AVR [1]. I
 don't really know the usability of this but I suspect it's not
 much.
[1] Looks very old and unmaintained, i.e. 4 years since the last commit. Also D (gdc) is now a part of the GCC suite, which may explain [1] being retred. GCC has AVR backends, thus gdc has an AVR backend. Also it has an ARM backend. Like ldc, gdc gets many backends (more or less) for free. GCC is now at 8.0.0, but what version of D is it using in gdc? Is a desire to see D used more in IoT projects a reason for more people to be interested in gdc and help get it's version updated with each GCC release. Alternatively does D in IoT mean "use ldc". Does the LLVM suite support AVR and ARM backends as GCC does?
 If you want a board with similar size too small arduino like the
 pro/pro mini that has an ARM chip, you should have a look at
 Teensy[2]. Using D to program ARM chips shouldn't be that hard.

 [1] https://github.com/D-Programming-microD/GDC/tree/microD-4.9
 [2] https://www.pjrc.com/teensy/
Someone sent me a couple of ESP8266 development boards and a ESP-WROOM-32 development board, the intention being to play with them as MicroPython devices. I see from the device websites, they are intended for use as standard Arduino (presumably C) devices or as Lua controlled devices. Perhaps they should be D controlled devices as well. I guess though the problem is which firmware to load to then use as a D controlled device, and which toolchain to use with it: Arduino mode has a full IDE/ICE set up. Also does D have the library to deal with controlling hardware. How easy is it to build D codes with gdc or ldc without Phobos, and without DRuntime?
-betterC and it /should/ be pretty easy.
 Is D wthout Phobos useful for IoT or should one stick with C,Lua, and
 MicroPython? Is IoT an opportunity for D or is it a false direction given D is
 an x86/x86_64 oriented programming language?
D is a 32bit+ oriented programming language. Modern microchips are this :)
May 16 2018
prev sibling next sibling parent Mike Franklin <slavo5150 yahoo.com> writes:
On Wednesday, 16 May 2018 at 08:48:26 UTC, Russel Winder wrote:

 Is D wthout Phobos useful for IoT or should one stick with 
 C,Lua, and MicroPython? Is IoT an opportunity for D or is it a 
 false direction given D is an x86/x86_64 oriented programming 
 language?
Using D for programming ARM Cortex-M 32-bit microcontrollers is one of my primary interests for learning and contributing to D. https://github.com/JinShil/stm32f42_discovery_demo When 2.081 arrives at LDC, I'll hopefully get that demonstration working with LDC. -betterC is not necessary, but you have to be selective about which features you use in D. Some parts of Phobos could be used, but they'd have to be selectively pulled out of the source code. Mike
May 16 2018
prev sibling parent reply NAme <email example.org> writes:
On Wednesday, 16 May 2018 at 08:48:26 UTC, Russel Winder wrote:
 On Tue, 2018-05-15 at 22:28 +0000, Filipe Laíns via 
 Digitalmars-d wrote: […]
 
 Actually, most arduinos use Atmel's chips so most of them are 
 AVR. Apparently, there was some work done to port GDC to AVR 
 [1]. I don't really know the usability of this but I suspect 
 it's not much.
[1] Looks very old and unmaintained, i.e. 4 years since the last commit. Also D (gdc) is now a part of the GCC suite, which may explain [1] being retred. GCC has AVR backends, thus gdc has an AVR backend. Also it has an ARM backend. Like ldc, gdc gets many backends (more or less) for free. GCC is now at 8.0.0, but what version of D is it using in gdc? Is a desire to see D used more in IoT projects a reason for more people to be interested in gdc and help get it's version updated with each GCC release. Alternatively does D in IoT mean "use ldc". Does the LLVM suite support AVR and ARM backends as GCC does?
 If you want a board with similar size too small arduino like 
 the pro/pro mini that has an ARM chip, you should have a look 
 at Teensy[2]. Using D to program ARM chips shouldn't be that 
 hard.
 
 [1] 
 https://github.com/D-Programming-microD/GDC/tree/microD-4.9 
 [2] https://www.pjrc.com/teensy/
Someone sent me a couple of ESP8266 development boards and a ESP-WROOM-32 development board, the intention being to play with them as MicroPython devices. I see from the device websites, they are intended for use as standard Arduino (presumably C) devices or as Lua controlled devices. Perhaps they should be D controlled devices as well. I guess though the problem is which firmware to load to then use as a D controlled device, and which toolchain to use with it: Arduino mode has a full IDE/ICE set up. Also does D have the library to deal with controlling hardware. How easy is it to build D codes with gdc or ldc without Phobos, and without DRuntime? Is D wthout Phobos useful for IoT or should one stick with C,Lua, and MicroPython? Is IoT an opportunity for D or is it a false direction given D is an x86/x86_64 oriented programming language?
LLVM has an AVR target. I was able to run a simple LED blink program using betterC on an AVR attiny chip. I just output the IR from LDC, and put it through LLVM targeting AVR. No work needs to be done, D already works on AVR!
May 27 2019
parent Martin Tschierschke <mt smartdolphin.de> writes:
On Monday, 27 May 2019 at 15:13:31 UTC, NAme wrote:
 On Wednesday, 16 May 2018 at 08:48:26 UTC, Russel Winder wrote:
 On Tue, 2018-05-15 at 22:28 +0000, Filipe Laíns via 
 Digitalmars-d wrote: […]
[...]
 to deal with controlling hardware. How easy is it to build D 
 codes with gdc or ldc without Phobos, and without DRuntime?

 Is D wthout Phobos useful for IoT or should one stick with 
 C,Lua, and MicroPython? Is IoT an opportunity for D or is it a 
 false direction given D is an x86/x86_64 oriented programming 
 language?
LLVM has an AVR target. I was able to run a simple LED blink program using betterC on an AVR attiny chip. I just output the IR from LDC, and put it through LLVM targeting AVR. No work needs to be done, D already works on AVR!
Cool!
May 27 2019
prev sibling parent Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Saturday, 25 October 2014 at 22:55:12 UTC, Israel wrote:
 On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive Arduino programming explosion 
 using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of 
 including turning stuff on with your mobile from anywhere in 
 the world  and much much more .

 I wondered if someone could adapt it to D ?
Well it is ARM so it should be possible.
No, it's AVR not ARM (in fact it's both, AVR for the small devices and ARM for the big ones).
May 18 2019
prev sibling next sibling parent reply "Mike" <none none.com> writes:
On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive Arduino programming explosion 
 using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of including 
 turning stuff on with your mobile from anywhere in the world  
 and much much more .

 I wondered if someone could adapt it to D ?
As far as I know, none of the main D compilers (DMD, LDC, GDC) can generate code for 8-bit MCUs. I remember reading somewhere that GDC has turned on a flag that specifically disables it. However, I think it would be cool if a motivated individual would actually flip this flag and see how far they can get. I don't now if avr-gcc is part of the mainline GCC branch, though. In summary, the Atmel ATmega needs some infrastructure first. The ARM Cortex-M based Arduino boards (Arduino Due for example) can already be programmed with D using either the LDC compiler (with ARM Thumb backend) or the GDC compiler. I've encountered several bugs trying to get a bare-bones druntime compiled with the LDC compiler, but the LDC folks have been attentive and appear to be addressing them (Thank you!). A minimal "Hello World" how-to was created on the D Wiki [1] to help users get started with this. There are also instructions for building a GDC cross-compiler on a Linux host [2] (Thank you, GDC!). A presentation was also given at DConf 2014 providing an introduction to some work done on this platform [3]. Most of my work has stalled as I try to find a way to make the experience more polished, and less like patchwork. Bottom line, though, is druntime has not been ported to the ARM Cortex-M platform, so that is the barrier. The good news is that it's not necessary to have the entire druntime ported to do basic C-style programming in D. In fact, a simple object.d file with a few dummy implementations will get you quite far [4]. The current druntime isn't suited very well to bare-metal programming, and really expects an operating system to exist underneath. There have been efforts to try an change that, but they've mostly met resistance. All work on this platform currently exists outside of the main D programming language repositories. There also appears to be a more mature implementation of druntime for an STM32 MCU (ARM Cortex-M4) in minlibd [5]. I hope that gives you some of the information you were looking for. Mike [1] http://wiki.dlang.org/Minimal_semihosted_ARM_Cortex-M_%22Hello_World%22 [2] http://wiki.dlang.org/Bare_Metal_ARM_Cortex-M_GDC_Cross_Compiler [3] https://www.youtube.com/watch?v=o5m0m_ZG9e8 [4] https://github.com/JinShil/D_Runtime_ARM_Cortex-M_study/wiki/1.3-Structs [5] https://bitbucket.org/timosi/minlibd
Oct 25 2014
parent "Trass3r" <un known.com> writes:
 my work has stalled as I try to find a way to make the 
 experience more polished, and less like patchwork.
It's a shame this went nowhere: https://issues.dlang.org/show_bug.cgi?id=12270
Oct 26 2014
prev sibling next sibling parent Ethan Scott <ethanscott278 gmail.com> writes:
On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive 
 (https://hackr.io/tutorials/learn-arduino) Arduino programming 
 explosion using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of including 
 turning stuff on with your mobile from anywhere in the world  
 and much much more .

 I wondered if someone could adapt it to D ?
This was popular a few years ago, now 3 years later and it still is something amazing. Remote applications are truly countless. In fact this was one of my final year projects of engineering. I had actually developed a smart vehicle. I could control the headlights, infotainment system and the air conditioner from my phone. It took me over a year to get it done, but I did it. 3 years ago, I think I was taking these arduino programming classes where I was trying to figure out which port is GND. Time flies indeed
May 15 2018
prev sibling parent john <diveshjaindj6 gmail.com> writes:
On Saturday, 25 October 2014 at 21:49:53 UTC, Ty Tower wrote:
 Has anybody tapped the massive 
 (http://letsfindcourse.com/arduino Arduino) programming 
 explosion using D instead of C++ ?
 I got started on Arduino a few years back and it has taken the 
 microprocessor popularity through the roof .
 Unfortunately you download the IDE (Integrated Development 
 Environment) from Arduino.cc direct and then using a $3 
 development board with a 328p chip on it ,proceed to program 
 the  chip to do pretty much whatever you can think of including 
 turning stuff on with your mobile from anywhere in the world  
 and much much more .

 I wondered if someone could adapt it to D ?
NO
May 17 2019