comp.lang.ada
 help / color / mirror / Atom feed
* GNAT (gcc-3.3) on AVR microcontrolers, need help for compiler debugging
@ 2002-11-18 10:28 Rolf Ebert
  2002-11-18 16:14 ` Bernd Trog
  0 siblings, 1 reply; 2+ messages in thread
From: Rolf Ebert @ 2002-11-18 10:28 UTC (permalink / raw)


I have managed to get my first Ada program running on an AVR
microcontroler just tonight!  I simply reads out the keys pressed and
shows the corresponding LEDs on my STK-500 board.

pragma No_Run_Time;
with Avr.IO;              use AVR.IO;

procedure SwitchLed is
   Port_B_In_Addr  : constant IO_Address := 16#16#;
   Port_B_DDR_Addr : constant IO_Address := 16#17#;
   Port_D_Out_Addr : constant IO_Address := 16#12#;
   Port_D_DDR_Addr : constant IO_Address := 16#11#;
begin
   -- set port B as input
   Set_IO(IO_Reg => Port_B_DDR_Addr, Value => 16#FF#);
   -- set port D as output
   Set_IO(IO_Reg => Port_D_DDR_Addr, Value => 16#00#);

   loop
      Set_IO(IO_Reg => Port_D_Out_Addr,
             Value  => Get_IO(IO_Reg => Port_B_In_Addr));
   end loop;
end SwitchLed;

The above program translates to just five assembler instructions (with
full optimization and no run time checks)!

The easy part was the setup of a cross-compiler on Linux/GNU, although
it took me quite some time to find a working set of gcc, binutil, and
libc sources.  Eventually I now have a more or less working gnat1 and
gnatbind for AVR.  If anybody cares, I can make the binaries
available.

The difficult part (at least for me) was to figure out how to pass
literal addresses (for the IO-ports) to the corresponding assembler
code without crashing the compiler or the assembler (you actually have
to inline the assembler routines and must not compile the body where
they are programmed).

Anyway, I now need a helping hand who knows a bit about the GNAT
internals.  The compiler dies quite often (e.g. when using Integer,
when not inlining assembler code, sometimes when compiling child
units, etc).  I'd like to get at least some of them fixed.

Who is willing to exchange some email with me and point me to
interessing locations in the GNAT sources?

TIA

    Rolf

P.S. This is just a hobbyist project.  I shall not invest any money
and only some limited time.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GNAT (gcc-3.3) on AVR microcontrolers, need help for compiler debugging
  2002-11-18 10:28 GNAT (gcc-3.3) on AVR microcontrolers, need help for compiler debugging Rolf Ebert
@ 2002-11-18 16:14 ` Bernd Trog
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Trog @ 2002-11-18 16:14 UTC (permalink / raw)


rolf.ebert@gmx.net (Rolf Ebert) wrote in message 
> I have managed to get my first Ada program running on an AVR
> microcontroler just tonight!  I simply reads out the keys pressed and
> shows the corresponding LEDs on my STK-500 board.
[..]
> The easy part was the setup of a cross-compiler on Linux/GNU, although
> it took me quite some time to find a working set of gcc, binutil, and
> libc sources.  

Good! Please tell us which versions of gcc,binutil,etc works for you!


> Anyway, I now need a helping hand who knows a bit about the GNAT
> internals.  The compiler dies quite often (e.g. when using Integer,
> when not inlining assembler code, sometimes when compiling child
> units, etc).  I'd like to get at least some of them fixed.

Well, Denis Chertykov <denisc@overta.ru> is the author of the avr-backend - but
he is quite busy :(

But he wrote me he will fix GNAT related bugs in his
gcc-backend(gcc/config/avr/avr.c)

The problem is to find out if a bug is located in the frontend or the backend.
Note, that the frontend has only be used for 16-32(64?) bit CPUs, AFAIK.

 
> Who is willing to exchange some email with me and point me to
> interessing locations in the GNAT sources?

I did some very small tests with Ada on AVR - but failed to get a
working 'for' loop :-/

gcc@gcc.gnu.org migth be a better place to discuss GNAT internals.

Bernd



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-18 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-18 10:28 GNAT (gcc-3.3) on AVR microcontrolers, need help for compiler debugging Rolf Ebert
2002-11-18 16:14 ` Bernd Trog

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