Trust about D programming.

Freddie Chopin freddie_chopin at op.pl
Tue Jan 22 08:19:11 PST 2013


On Tuesday, 22 January 2013 at 15:42:04 UTC, Paulo Pinto wrote:
> It is possible to do C free development in embedded systems, 
> using system programming languages with GC.

Instead of just ditching C or C++ for something related to 
Delphi, it would be nicer to use D, as it's multithreading 
options look quite nice (;

> There are of course embedded systems, where the only way to 
> program is either Assembly or a crippled down version of C due 
> to hardware constraints.

Well, a typical ARM Cortex-M3 is not THAT crippled, it just does 
not have that much RAM to waste - rarely there's more than 64kB, 
usually less than 32kB...

> However, if the hardware is able to execute full ANSI C code, 
> then there are other options becoming available.

Well, it's not about "full ANSI C", because you could do that on 
8051 30 years ago... it just the matter of:
a. RAM usage
b. heap usage
c. real-time constraints

For a typical ARM bare-metal microcontroller C++ exceptions are 
a-bit-too-much (taking ~60kB of flash code when almost not used, 
and 60kB quite often would be 95% of available code memory, but 
in more common cases 25-50%), in D these are probably inevitable 
and I could live with that (; But I just cannot imagine a GC on a 
microcontroller that has so little RAM and which has to do 
something in real-time - you probably will just get annoyed if an 
app on PC freezes for a second, but if a 100-tonne crane 
controller freezes for that time it can end really bad (;

Yes, GC and dynamic memory is really cool, but it costs just a 
lot of RAM... You can sometimes live with mallocs() (but modestly 
used), yet I cannot imaging GC in so small memory. It can be 
easily assumed that such applications don't do a lot of memory 
allocation at run-time (usually none), so the GC would just waste 
time and memory...

> It is just a matter to get a more widespread acceptance.

I think it's just a matter of realistic expectations (; A LOT 
(and I really mean that) people think that ARM based 
microcontrollers are an overkill for most of the tasks, so you'll 
just not convince them to use an even more expensive chip, which 
has 4x the amount of RAM just to use "a fancy language".

And do remember we're not talking about routers and smartphones 
that have 128MB of RAM, but rather about home automation systems, 
some industrial controllers (but not HMI with a fancy GUI, but 
the devices that really do the monitoring and control), maybe 
some electronics embedded in toys (RC models etc.).

4\/3!!


More information about the Digitalmars-d mailing list