Jump to page: 1 2 3
Thread overview
June 01

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/

June 01
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
June 01
On Tuesday, 1 June 2021 at 14:46:06 UTC, Steven Schveighoffer wrote:
> 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

Thank you! :)

https://news.ycombinator.com/item?id=27354761

Wow, that's overwhelming.
June 02

Very cool

June 03

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

June 04

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.
June 05
On 04/06/2021 8:50 PM, Max Samukha wrote:
> 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)

Does this form of foreach work?

foreach(i; 0 .. 10)


June 04
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.

June 04
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:
>> 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.

You should have better luck using gdc on avr.

https://explore.dgnu.org/z/bos5ee
June 05

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:

>

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

Sorry to disappointment haha. My current project is an ECU, so stay tuned for that!

« First   ‹ Prev
1 2 3