From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2316ae9df2d6bb2c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-18 02:28:44 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: rolf.ebert@gmx.net (Rolf Ebert) Newsgroups: comp.lang.ada Subject: GNAT (gcc-3.3) on AVR microcontrolers, need help for compiler debugging Date: 18 Nov 2002 02:28:44 -0800 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 194.97.67.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1037615324 26998 127.0.0.1 (18 Nov 2002 10:28:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 18 Nov 2002 10:28:44 GMT Xref: archiver1.google.com comp.lang.ada:31031 Date: 2002-11-18T10:28:44+00:00 List-Id: 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.