digitalmars.D.announce - From the D Blog: Driving with D
- Mike Parker (8/8) Jun 01 2021 Dylan Graham writes about his experience using D in a
- Steven Schveighoffer (4/14) Jun 01 2021 FYI on hackernews as well, there are some questions for the author.
- Dylan Graham (5/21) Jun 01 2021 Thank you! :)
- Robert Schadek (1/1) Jun 02 2021 Very cool
- Piotrek (7/11) Jun 03 2021 At first, when I saw the title, I thought Ali applied some D code
- Dylan Graham (3/14) Jun 05 2021 Sorry to disappointment haha. My current project is an ECU, so
- Max Samukha (13/21) Jun 04 2021 FWIW, I tried D in a simple project using an atmega32a. It almost
- rikki cattermole (3/22) Jun 04 2021 Does this form of foreach work?
- Max Samukha (10/12) Jun 04 2021 That does work.
- Iain Buclaw (3/17) Jun 04 2021 You should have better luck using gdc on avr.
- Max Samukha (4/6) Jun 06 2021 Trying that, thank you. For now, two issues with GDC 11, which I
- Max Samukha (9/10) Jun 06 2021 GCC's bugzilla won't let me register.
- Iain Buclaw (6/16) Jun 06 2021 You'd have to use a non-gmail account IIRC, not sure if there's
- Max Samukha (3/6) Jun 07 2021 Would be great if you did. Not a blocker, though.
- Max Samukha (26/27) Jun 08 2021 However, this is a major pain:
- Iain Buclaw (6/34) Jun 08 2021 Thanks, that seems to be [this
- Max Samukha (2/6) Jun 08 2021 Thanks!
- Johan Engelen (8/24) Jun 06 2021 Hi Max,
- Max Samukha (2/3) Jun 07 2021 Hell Yeah! )
- Dylan Graham (3/7) Jul 16 2021 Golem has translated the article into German and republished it:
- zjh (3/4) Jul 16 2021 I have translate this article into `chinese`:
- Dylan Graham (2/6) Jul 17 2021 Thank you so much! :)
Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner. The blog: https://dlang.org/blog/2021/06/01/driving-with-d/ Reddit: https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/
Jun 01 2021
On 6/1/21 7:57 AM, Mike Parker wrote:Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner. The blog: https://dlang.org/blog/2021/06/01/driving-with-d/ Reddit: https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/FYI on hackernews as well, there are some questions for the author. Nice article! Succinctly identifies a lot of the reasons why D is awesome. -Steve
Jun 01 2021
On Tuesday, 1 June 2021 at 14:46:06 UTC, Steven Schveighoffer wrote:On 6/1/21 7:57 AM, Mike Parker wrote:Thank you! :) https://news.ycombinator.com/item?id=27354761 Wow, that's overwhelming.Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner. The blog: https://dlang.org/blog/2021/06/01/driving-with-d/ Reddit: https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/FYI on hackernews as well, there are some questions for the author. Nice article! Succinctly identifies a lot of the reasons why D is awesome. -Steve
Jun 01 2021
On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner.At first, when I saw the title, I thought Ali applied some D code to a Mercedes ECU;) But the story is really heartening to me. A great initiative. Congratulations :) Cheers, Piotrek
Jun 03 2021
On Thursday, 3 June 2021 at 09:14:52 UTC, Piotrek wrote:On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Sorry to disappointment haha. My current project is an ECU, so stay tuned for that!Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner.At first, when I saw the title, I thought Ali applied some D code to a Mercedes ECU;) But the story is really heartening to me. A great initiative. Congratulations :) Cheers, Piotrek
Jun 05 2021
On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner. The blog: https://dlang.org/blog/2021/06/01/driving-with-d/ Reddit: https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/FWIW, I tried D in a simple project using an atmega32a. It almost worked (thanks to Webfreak and LDC people), but there were a couple of issues: 1. No support for ISRs. I had to implement thunks in C calling D. 2. No slices, because 'length' is typed as 32-bit. Worked around by accessing the array's elements via .ptr. 3. No foreach (as a consequence of 2, I guess) 4. Integer promotion errors/warnings are very annoying when the primary integer type is byte. 5. A memory corruption bug (probably due to clobbered registers/corrupted stack/a stupid mistake of mine), which made me switch back to C++ for now.
Jun 04 2021
On 04/06/2021 8:50 PM, Max Samukha wrote:On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Does this form of foreach work? foreach(i; 0 .. 10)Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner. The blog: https://dlang.org/blog/2021/06/01/driving-with-d/ Reddit: https://www.reddit.com/r/programming/comments/nps6k5/driving_with_dlang/FWIW, I tried D in a simple project using an atmega32a. It almost worked (thanks to Webfreak and LDC people), but there were a couple of issues: 1. No support for ISRs. I had to implement thunks in C calling D. 2. No slices, because 'length' is typed as 32-bit. Worked around by accessing the array's elements via .ptr. 3. No foreach (as a consequence of 2, I guess)
Jun 04 2021
On Friday, 4 June 2021 at 15:48:50 UTC, rikki cattermole wrote:Does this form of foreach work? foreach(i; 0 .. 10)That does work. This doesn't: ubyte[] slice; foreach (ubyte i; slice) { } Invalid bitcast %17 = bitcast i16 %15 to i32 I guess the cause is the same - slice.length.sizeof == 4, while slice.sizeof == 4, slice.ptr.sizeof == 2, and size_t.sizeof == 2.
Jun 04 2021
On Friday, 4 June 2021 at 21:28:00 UTC, Max Samukha wrote:On Friday, 4 June 2021 at 15:48:50 UTC, rikki cattermole wrote:You should have better luck using gdc on avr. https://explore.dgnu.org/z/bos5eeDoes this form of foreach work? foreach(i; 0 .. 10)That does work. This doesn't: ubyte[] slice; foreach (ubyte i; slice) { } Invalid bitcast %17 = bitcast i16 %15 to i32 I guess the cause is the same - slice.length.sizeof == 4, while slice.sizeof == 4, slice.ptr.sizeof == 2, and size_t.sizeof == 2.
Jun 04 2021
On Friday, 4 June 2021 at 21:47:21 UTC, Iain Buclaw wrote:You should have better luck using gdc on avr. https://explore.dgnu.org/z/bos5eeTrying that, thank you. For now, two issues with GDC 11, which I hope to work around: 1) compiler complains about typeinfos of structs used in CTFE only, 2) 'align' is mishandled
Jun 06 2021
On Sunday, 6 June 2021 at 18:57:06 UTC, Max Samukha wrote:2) 'align' is mishandledGCC's bugzilla won't let me register. align(4) struct S { ubyte[4] bytes; } static assert (S.alignof == 4); // fail, S.alignof == 1 It's not specific to AVR. Worked around by placing 'align' inside the struct.
Jun 06 2021
On Sunday, 6 June 2021 at 20:11:04 UTC, Max Samukha wrote:On Sunday, 6 June 2021 at 18:57:06 UTC, Max Samukha wrote:You'd have to use a non-gmail account IIRC, not sure if there's any others that are in the "typically spam" blacklist.2) 'align' is mishandledGCC's bugzilla won't let me register.align(4) struct S { ubyte[4] bytes; } static assert (S.alignof == 4); // fail, S.alignof == 1 It's not specific to AVR. Worked around by placing 'align' inside the struct.That sounds a lot like this issue: https://issues.dlang.org/show_bug.cgi?id=17857 Can backport that for GCC-11.
Jun 06 2021
On Sunday, 6 June 2021 at 21:18:01 UTC, Iain Buclaw wrote:That sounds a lot like this issue: https://issues.dlang.org/show_bug.cgi?id=17857Most certainly.Can backport that for GCC-11.Would be great if you did. Not a blocker, though.
Jun 07 2021
On Monday, 7 June 2021 at 10:38:08 UTC, Max Samukha wrote:Would be great if you did. Not a blocker, though.However, this is a major pain: ```d struct FP { } alias parse = () { FP[] parts; parts ~= FP(); return parts; }; immutable s = parse(); extern(C) int main() { return 0; } ``` avr-gdc -fno-druntime ctfe.d ctfe.d:3:1: error: 'object.TypeInfo' cannot be used with '-fno-rtti' 3 | struct FP { | ^ ctfe.d:3:1: error: 'object.TypeInfo' could not be found, but is implicitly used 3 | struct FP { | ^ d21: internal compiler error: Segmentation fault 0x178ae29 internal_error(char const*, ...)
Jun 08 2021
On Tuesday, 8 June 2021 at 09:08:20 UTC, Max Samukha wrote:On Monday, 7 June 2021 at 10:38:08 UTC, Max Samukha wrote:Thanks, that seems to be [this issue](https://issues.dlang.org/show_bug.cgi?id=19234). Testing backports of both now ([here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100935) and [here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100964)).Would be great if you did. Not a blocker, though.However, this is a major pain: ```d struct FP { } alias parse = () { FP[] parts; parts ~= FP(); return parts; }; immutable s = parse(); extern(C) int main() { return 0; } ``` avr-gdc -fno-druntime ctfe.d ctfe.d:3:1: error: 'object.TypeInfo' cannot be used with '-fno-rtti' 3 | struct FP { | ^ ctfe.d:3:1: error: 'object.TypeInfo' could not be found, but is implicitly used 3 | struct FP { | ^ d21: internal compiler error: Segmentation fault 0x178ae29 internal_error(char const*, ...)
Jun 08 2021
On Tuesday, 8 June 2021 at 11:35:39 UTC, Iain Buclaw wrote:Testing backports of both now ([here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100935) and [here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100964)).Thanks!
Jun 08 2021
On Friday, 4 June 2021 at 21:47:21 UTC, Iain Buclaw wrote:On Friday, 4 June 2021 at 21:28:00 UTC, Max Samukha wrote:Hi Max, GDC and LDC are both happy to support many platforms (it's fun), so keep filing bug reports in our bug trackers! (LDC's bug tracker is on Github, please also mention the triple you are using) cheers, JohanThis doesn't [work]: ubyte[] slice; foreach (ubyte i; slice) { } Invalid bitcast %17 = bitcast i16 %15 to i32 I guess the cause is the same - slice.length.sizeof == 4, while slice.sizeof == 4, slice.ptr.sizeof == 2, and size_t.sizeof == 2.You should have better luck using gdc on avr. https://explore.dgnu.org/z/bos5ee
Jun 06 2021
On Sunday, 6 June 2021 at 22:39:34 UTC, Johan Engelen wrote:it's funHell Yeah! )
Jun 07 2021
On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Dylan Graham writes about his experience using D in a microcontroller project and why he chose it. Does anyone know of any similar projects using D? I don't. This may well be the first time it's been employed in this specific manner.Golem has translated the article into German and republished it: https://www.golem.de/news/programmiersprachen-durchstarten-mit-d-2107-157716.html
Jul 16 2021
On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Dylan Graham writes about his experience using D in aI have translate this article into `chinese`: [用d开车](https://fqbqrr.blog.csdn.net/article/details/118571177)
Jul 16 2021
On Saturday, 17 July 2021 at 00:56:24 UTC, zjh wrote:On Tuesday, 1 June 2021 at 11:57:34 UTC, Mike Parker wrote:Thank you so much! :)Dylan Graham writes about his experience using D in aI have translate this article into `chinese`: [用d开车](https://fqbqrr.blog.csdn.net/article/details/118571177)
Jul 17 2021