comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: Ada: A beginners experience
Date: Fri, 20 Jul 2018 05:00:44 -0700 (PDT)
Date: 2018-07-20T05:00:44-07:00	[thread overview]
Message-ID: <611759ac-2b7f-4d12-9cc9-4769f7382d01@googlegroups.com> (raw)
In-Reply-To: <2e79b691-61d0-4ed4-8fb8-5d2187bbf06f@googlegroups.com>

On Monday, July 16, 2018 at 5:38:58 PM UTC-4, Maciej Sobczak wrote:
> > Back a few years ago, I started similarly to where you did.  I did find
> > the Inspirel book to be very good, but you had to understand the context
> > it was coming from.  It seemed to assume you were natively (not cross)
> > compiling your code.
> 
> Hi there, thank you for taking the time to check that tutorial. Still, I think there is some correction needed here - the examples in the tutorial were written with the assumption of native compilation (for example on RaspberryPi), simply because this makes the command-line the most compact and kind of neutral as well. All commands should give the same results in the cross-compilation environment. If you found any troubles with this, let me know. This can help improve the future tutorial revisions.

This was a few years ago, so this is from memory (take it with a
grain of salt).

The biggest troubles I had with it was I was coming from cross-compile
instead of native.  In bare metal, it is somewhat rare to compile from
native since you won't have an OS or shell.  Just following along blindly
came up with various errors like that it needed system.ads.  A new 
beginner is not going to immediately link this to not having and RTS. 

My first workaround was to find a system.ads and add it.  This placated
the compiler so I moved on.  Next I think I needed system.storage_elements,
so I added the spec for that to my source.  I was moving along fairly 
well until I needed something from the package body for
system.storage_elements.  When I tried to add s-stoele.adb then the compiler
said it could compile system files (or a similar error).  This was where
I had to stop with your book as I hit a road block.  I needed an actual
RTS and there was really no help there.  I spent a couple of weeks 
trying to find a simple ZFP package that I could modify that didn't come
from Adacore (I didn't want the base GPL license from GNAT GPL).  Once
I got one working, I went back to your book.

Like I said, it was good.  I just wanted the OP to understand that 
while it mentions cross-compile, just blinding following the steps
and replacing the commands with the cross compile ones doesn't work.
This isn't a deficiency of the book, it is written from a native
context, but as a beginner it can be really confusing if one doesn't
understand the implications of that.

The only other thing I found different was the section on shared
state.  I didn't have a full runtime as alluded to (I had a ZFP,
which was much more bare).  However, I was able to correctly
create:

package body Program is

   X : Integer := 123; -- This actually worked correctly for me

   procedure Run is
   -- ...

end Program;

I'm guessing it had something to do with how my linker script was
setup, but it surprised me as it contrasted what was stated in
the book.  I don't think this is an error or anything, but 
bringing this up to you just incase.

> 
> > I ran into trouble because I wanted to work on
> > a controller bare-metal (it was too small for a full Ada runtime).
> 
> The tutorial was exactly focusing on zero-foot-print, bare-metal development. There are other sources that cover the (more or less) full runtime approach, with ready runtimes and driver libraries, so the tutorial tried to fill the niche for smaller chips or those projects that chose zero-foot-print for other reasons (traceability, IP politics, etc.).

I would say the major thing here is if it really is meant to be for
bare-metal ZFP style development, it was missing some more detailed
discussion on how to get and setup a quick ZFP runtime.  For beginners
this will be a huge deal.  Developing on a Raspberry Pi really isn't
bare-metal since you are compiling native with in an OS.  Yes, you can
emulate bare-metal programming on it, but it isn't exactly the same.
Note, I am not saying have an exhaustive section on how the ZFP runtime
works or anything, but just some resource on how to setup your environment
for one of the book's targeted boards.

I really think your book is great, so please don't take any comments
as antagonistic.  I recommend it to anyone I see getting started in
micro-controller development.

  reply	other threads:[~2018-07-20 12:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-14  2:36 Ada: A beginners experience blakemichael073
2018-07-14  2:53 ` Dan'l Miller
2018-07-14  3:53   ` blakemichael073
2018-07-14 11:26     ` Brian Drummond
2018-07-14 12:11       ` blakemichael073
2018-07-14 13:27     ` Dan'l Miller
2018-07-14 14:57     ` Jere
2018-07-16 21:38       ` Maciej Sobczak
2018-07-20 12:00         ` Jere [this message]
2018-07-20 21:05           ` Maciej Sobczak
2018-07-21  8:25             ` Simon Wright
2018-07-14  3:36 ` Paul Rubin
2018-07-14  4:08   ` blakemichael073
2018-07-14  6:21     ` Paul Rubin
2018-07-14  8:30       ` Rene
2018-07-14 15:10         ` Paul Rubin
2018-07-14 15:13   ` Jere
2018-07-14 15:42     ` Paul Rubin
2018-07-14 16:01       ` Dmitry A. Kazakov
2018-07-14 19:05         ` Dennis Lee Bieber
2018-07-15  0:31         ` Paul Rubin
2018-07-14 15:55     ` Simon Wright
2018-07-15 22:44     ` Bill Findlay
2018-07-16  1:17       ` Jere
2018-07-16  1:41         ` Paul Rubin
2018-07-16  2:01         ` Bill Findlay
2018-07-16  2:46       ` Dan'l Miller
2018-07-16 15:54         ` Bill Findlay
2018-07-14  8:01 ` Dmitry A. Kazakov
2018-07-14 12:20   ` blakemichael073
2018-07-14 13:15     ` Dmitry A. Kazakov
2018-07-14 14:15       ` blakemichael073
2018-07-14  8:19 ` Jeffrey R. Carter
2018-07-16  9:25 ` fabien.chouteau
2018-07-17  1:18   ` blakemichael073
2018-07-17  1:44     ` Dennis Lee Bieber
2018-07-17 12:59     ` fabien.chouteau
2018-07-20  1:08     ` Philip Munts
2018-07-23  4:04       ` blakemichael073
2018-07-23 13:15         ` Dennis Lee Bieber
2018-07-26 10:20   ` fabien.chouteau
2018-07-16 17:36 ` G. B.
2018-07-16 18:43   ` Simon Wright
2018-07-16 19:08     ` Paul Rubin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox