comp.lang.ada
 help / color / mirror / Atom feed
* GPS 2010 for AVR
@ 2010-07-29 19:06 Warren
  2010-07-29 19:19 ` Tero Koskinen
  2010-07-29 20:08 ` Simon Wright
  0 siblings, 2 replies; 12+ messages in thread
From: Warren @ 2010-07-29 19:06 UTC (permalink / raw)


I'm trying to do a simple project build for avr (not
expecting to run the code).  I just want to test the
tool chain for avr. I'm running into GPS configuration 
issues (and I'm still RTFMing).

What is happening is that when I request a "Build all"
it tries to execute "gnatmake" and doesn't find it, 
which is right -- I installed the win-avr version. It
needs to run avr-<tool>.exe.  I'm a bit surprised that
the win-avr version doesn't do this out of the box. :(

I have in my C:\GNAT-AVR\2010\bin directory the
necessary executables, including avr-gnatmake.exe,
etc.

So where do I configure this for GPS?  

How can I set this for ALL projects -- after all,
this is the win-avr version of GPS.

I'll be doing some more RTFM, but any hints on
this is appreciated.  It would be cool to do some
Arduino work in Ada, this coming winter.

Warren



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

* Re: GPS 2010 for AVR
  2010-07-29 19:06 GPS 2010 for AVR Warren
@ 2010-07-29 19:19 ` Tero Koskinen
  2010-07-29 19:36   ` Warren
  2010-07-30 13:40   ` Warren
  2010-07-29 20:08 ` Simon Wright
  1 sibling, 2 replies; 12+ messages in thread
From: Tero Koskinen @ 2010-07-29 19:19 UTC (permalink / raw)


On 07/29/2010 10:06 PM, Warren wrote:
> I'm trying to do a simple project build for avr (not
> expecting to run the code).
..
> I'll be doing some more RTFM, but any hints on
> this is appreciated.  It would be cool to do some
> Arduino work in Ada, this coming winter.

I haven't tried AVR programming with GPS or GNAT GPL toolchain, but I 
have been using AVR-Ada 1.0 and 1.1 from http://avr-ada.sf.net/
for Arduino. So far it has worked pretty well on OpenBSD, Fedora Linux,
and Windows XP.

Quick tutorial for Windows XP:
1. Install Win-AVR somewhere
2. Install AVR-Ada into same location
3. Set PATH to point Win-AVR's bin directory.
4. Compile with avr-gnatmake.

I have used following Hello World example (Mercurial repository) with 
AVR-Ada 1.0 (and 1.1) to test the setup:
http://bitbucket.org/tkoskine/arduino-hello

For AVR-Ada 1.1 you can use command:
avr-gnatmake -XMCU=atmega328p -Phello.gpr

to compile the source files for Arduino.

>
> Warren

-Tero



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

* Re: GPS 2010 for AVR
  2010-07-29 19:19 ` Tero Koskinen
@ 2010-07-29 19:36   ` Warren
  2010-07-30 13:40   ` Warren
  1 sibling, 0 replies; 12+ messages in thread
From: Warren @ 2010-07-29 19:36 UTC (permalink / raw)


Tero Koskinen expounded in news:4c51d42b$0$12211$7b1e8fa0@news.nbl.fi:

> On 07/29/2010 10:06 PM, Warren wrote:
>> I'm trying to do a simple project build for avr (not
>> expecting to run the code).
> ..
> I haven't tried AVR programming with GPS or GNAT GPL toolchain, but I 
> have been using AVR-Ada 1.0 and 1.1 from http://avr-ada.sf.net/
> for Arduino. So far it has worked pretty well on OpenBSD, Fedora Linux,
> and Windows XP.
..
> I have used following Hello World example (Mercurial repository) with 
> AVR-Ada 1.0 (and 1.1) to test the setup:
> http://bitbucket.org/tkoskine/arduino-hello
> 
> For AVR-Ada 1.1 you can use command:
> avr-gnatmake -XMCU=atmega328p -Phello.gpr
> 
> to compile the source files for Arduino.

I've looked at that project and wondered which
toolset to invest my time in (time is my shortest 
commodity). I was drawn to GPS because it looked 
like it would require minimal setup. But me thinks 
this is not the case.

While I prefer Linux, I generally use Cygwin and XP
because of my company provided laptop and the fact
that my music recording software only runs Windows
at home. On my to do list is to see if I can get
my home PC to boot from an external USB drive. If
so, I'll put Linux there.

I may try to get this win-avr toolset to work from
cygwin, by using a driver script to modify the
path temporarily etc.  I prefer command lines and
makefiles anyway. ;-)

One nice addition, which is perhaps in the works, 
is a way to set up simple tasking, even if it is 
non-preemptive with a Yield() call.  Certainly this 
is first on my to-do list, once I can get something 
simple to work on the hardware.

Thanks, Warren



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

* Re: GPS 2010 for AVR
  2010-07-29 19:06 GPS 2010 for AVR Warren
  2010-07-29 19:19 ` Tero Koskinen
@ 2010-07-29 20:08 ` Simon Wright
  2010-07-30  9:12   ` sjw
  2010-07-30 13:22   ` Warren
  1 sibling, 2 replies; 12+ messages in thread
From: Simon Wright @ 2010-07-29 20:08 UTC (permalink / raw)


Warren <ve3wwg@gmail.com> writes:

> I have in my C:\GNAT-AVR\2010\bin directory the
> necessary executables, including avr-gnatmake.exe,
> etc.
>
> So where do I configure this for GPS?  

Go into Project > Edit Project Properties, select the Language tab. In
the lower half (Tools) > Compiler, click on 'gnatmake'. I see a little
diaog with an option pulldown - click on this and there is avr-gnatmake!

Might be as well to do the others as well (I see no avr-gdb, better
GIRFT. Or build/test the main app logic on the host).

> How can I set this for ALL projects -- after all,
> this is the win-avr version of GPS.

GPS is a host application, which supports multiple targets. The way
we've worked in a GNAT Pro environment is that gnatmake and
powerpc-wrs-vxworks-gnatmake (in your case, avr-gnatmake) and friends
all live in the same folder. Indeed, the way to install the
cross-environment is to install the host compiler first and then the
cross; on Windows it defaults to the same install head. That's part of
the reason for having <target>-gnatmake.

Our GPRs are set up to use environment variables to choose whether to
build for the host or the target. I don't know whether you can do this
from the project properties editor in GPS, but you can certainly do it
in Emacs! (nor Notepad, come to that).




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

* Re: GPS 2010 for AVR
  2010-07-29 20:08 ` Simon Wright
@ 2010-07-30  9:12   ` sjw
  2010-07-30 13:22   ` Warren
  1 sibling, 0 replies; 12+ messages in thread
From: sjw @ 2010-07-30  9:12 UTC (permalink / raw)


On Jul 29, 9:08 pm, Simon Wright <si...@pushface.org> wrote:

>                                           but you can certainly do it
> in Emacs! (nor Notepad, come to that).

*or* Notepad.



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

* Re: GPS 2010 for AVR
  2010-07-29 20:08 ` Simon Wright
  2010-07-30  9:12   ` sjw
@ 2010-07-30 13:22   ` Warren
  1 sibling, 0 replies; 12+ messages in thread
From: Warren @ 2010-07-30 13:22 UTC (permalink / raw)


Simon Wright expounded in news:m2wrseqcep.fsf@pushface.org:

> Warren <ve3wwg@gmail.com> writes:
> 
>> I have in my C:\GNAT-AVR\2010\bin directory the
>> necessary executables, including avr-gnatmake.exe,
>> etc.
>>
>> So where do I configure this for GPS?  
> 
> Go into Project > Edit Project Properties, select the Language tab. In
> the lower half (Tools) > Compiler, click on 'gnatmake'. I see a little
> diaog with an option pulldown - click on this and there is
> avr-gnatmake! 

Ok, I found that. The one thing I thought that was unintuitive, 
is all the other tools had drop down widgets to make a choice
on.   I saw the 'gnatmake' there, but I couldn't see how to
change it. After puzzling a bit and trying other stuff I gave
a frustrated double-click on it, that suddenly brought up a 
new dialog box.  That's unintuitive, because it doesn't look like
it should work.  Maybe it's just me.

It's certainly a pain to have to go changing everything for
each new avr project.   So after playing with GPS a bit, I 
moved back to makefile and emacs. 

Warren



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

* Re: GPS 2010 for AVR
  2010-07-29 19:19 ` Tero Koskinen
  2010-07-29 19:36   ` Warren
@ 2010-07-30 13:40   ` Warren
  2010-07-30 15:43     ` sjw
  2010-07-30 18:13     ` Warren
  1 sibling, 2 replies; 12+ messages in thread
From: Warren @ 2010-07-30 13:40 UTC (permalink / raw)


Tero Koskinen expounded in news:4c51d42b$0$12211$7b1e8fa0@news.nbl.fi:

> On 07/29/2010 10:06 PM, Warren wrote:
>> I'm trying to do a simple project build for avr (not
>> expecting to run the code).
> ..
>> I'll be doing some more RTFM, but any hints on
>> this is appreciated.  It would be cool to do some
>> Arduino work in Ada, this coming winter.
> 
> I haven't tried AVR programming with GPS or GNAT GPL toolchain, but I 
> have been using AVR-Ada 1.0 and 1.1 from http://avr-ada.sf.net/
> for Arduino. So far it has worked pretty well on OpenBSD, Fedora Linux,
> and Windows XP.
..
> For AVR-Ada 1.1 you can use command:
> avr-gnatmake -XMCU=atmega328p -Phello.gpr

I installed AVR-Ada on my home computer. I'm interested in using
some of the library support for it, so I gave it a go.  But I
ran into a problem in getting it to link:

avr-gnatmake -Ptestavr.gpr
avr-gnatbind -aIc:/WinAVR-20100110/lib/gcc/avr/4.3.3/rts/avr5/adainclude -
aOc:/WinAVR-20100110/lib/gcc/avr/4.3.3/rts/avr5/adalib -I- -x F:\cygwin
\home\Warren\avr\testavr\testavr.ali
avr-gnatlink F:\cygwin\home\Warren\avr\testavr\testavr.ali -mmcu=avr5 -lgcc 
-o F:\cygwin\home\Warren\avr\testavr\testavr
b~testavr.o: In function `adafinal':
b~testavr.adb:(.text+0x16): undefined reference to 
`system__standard_library__adafinal'
b~testavr.o: In function `main':
b~testavr.adb:(.text+0x44): undefined reference to `__gnat_initialize'
b~testavr.adb:(.text+0x54): undefined reference to 
`system__standard_library__adafinal'
b~testavr.adb:(.text+0x58): undefined reference to `__gnat_finalize'
avr-gnatlink: error when calling C:\WinAVR-20100110\bin\avr-gcc.exe
avr-gnatmake: *** link failed.
make: *** [testavr.ihex] Error 4

I also tried using the -RTS= parameter.  If I leave out the -RTS=
or the -aI and -aO options, it then complains about not being
able to find -lgnat.

I also tried -nostdlib, but that didn't seem to make any
difference.

There seems to be an undocumented step in configuring the
platform.  I would have thought that -mmcu=... would have
taken care of that, but evidently it is not enough.

Also: are you sure the parameter is '-XMCU=...' ?  It
didn't seem to matter when I used -mmcu=... (I tried 
both). 

Oh the fun in getting embedded stuff to work. ;-)

Warren



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

* Re: GPS 2010 for AVR
  2010-07-30 13:40   ` Warren
@ 2010-07-30 15:43     ` sjw
  2010-07-30 16:33       ` Warren
  2010-07-30 18:13     ` Warren
  1 sibling, 1 reply; 12+ messages in thread
From: sjw @ 2010-07-30 15:43 UTC (permalink / raw)


On Jul 30, 2:40 pm, Warren <ve3...@gmail.com> wrote:

> avr-gnatlink F:\cygwin\home\Warren\avr\testavr\testavr.ali -mmcu=avr5 -lgcc
> -o F:\cygwin\home\Warren\avr\testavr\testavr

Just -lgcc on its own? you'd expect it to call up -lgnat & possibly -
lgnarl. Hmm.



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

* Re: GPS 2010 for AVR
  2010-07-30 15:43     ` sjw
@ 2010-07-30 16:33       ` Warren
  2010-07-30 19:36         ` Simon Wright
  0 siblings, 1 reply; 12+ messages in thread
From: Warren @ 2010-07-30 16:33 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

sjw expounded in news:d00563f7-b2a4-4a8c-8d53-adcbe72d62d8
@j9g2000yqn.googlegroups.com:

> On Jul 30, 2:40�pm, Warren <ve3...@gmail.com> wrote:
> 
>> avr-gnatlink F:\cygwin\home\Warren\avr\testavr\testavr.ali -mmcu=avr5 -
> lgcc
>> -o F:\cygwin\home\Warren\avr\testavr\testavr
> 
> Just -lgcc on its own? you'd expect it to call up -lgnat & possibly -
> lgnarl. Hmm.

Huh?  It does the -lgnat on its own.  Adding it 
didn't helped either. ;-)

Warren



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

* Re: GPS 2010 for AVR
  2010-07-30 13:40   ` Warren
  2010-07-30 15:43     ` sjw
@ 2010-07-30 18:13     ` Warren
  1 sibling, 0 replies; 12+ messages in thread
From: Warren @ 2010-07-30 18:13 UTC (permalink / raw)


Warren expounded in
news:Xns9DC56260D7E70WarrensBlatherings@81.169.183.62: 

> Tero Koskinen expounded in news:4c51d42b$0$12211$7b1e8fa0@news.nbl.fi:
>> For AVR-Ada 1.1 you can use command:
>> avr-gnatmake -XMCU=atmega328p -Phello.gpr
> 
> I installed AVR-Ada on my home computer. I'm interested in using
> some of the library support for it, so I gave it a go.  But I
> ran into a problem in getting it to link:

Ok, I looked at the hello example more closely, and
after some experimentation I finally got all my ducks 
in a row.  

It now works, hoo ha!

The key turned out to be the following 3 lines in the
project file (that I had differently):

  package Builder  renames AVR.Builder;
  package Compiler renames AVR.Compiler;
  package Binder   renames AVR.Binder;

I'm not that familiar with all this gnat project file 
business, but I can see that I'll need to.. 

Warren



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

* Re: GPS 2010 for AVR
  2010-07-30 16:33       ` Warren
@ 2010-07-30 19:36         ` Simon Wright
  2010-07-30 20:56           ` Warren
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2010-07-30 19:36 UTC (permalink / raw)


Warren <ve3wwg@gmail.com> writes:

> sjw expounded in news:d00563f7-b2a4-4a8c-8d53-adcbe72d62d8
> @j9g2000yqn.googlegroups.com:
>
>> On Jul 30, 2:40 pm, Warren <ve3...@gmail.com> wrote:
>> 
>>> avr-gnatlink F:\cygwin\home\Warren\avr\testavr\testavr.ali -mmcu=avr5 -
>> lgcc
>>> -o F:\cygwin\home\Warren\avr\testavr\testavr
>> 
>> Just -lgcc on its own? you'd expect it to call up -lgnat & possibly -
>> lgnarl. Hmm.
>
> Huh?  It does the -lgnat on its own.  Adding it 
> didn't helped either. ;-)

Oh, I must have misunderstood. What happens if you call avr-gnatmake
with -v -largs -Wl,-v? (to see what's going on). 



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

* Re: GPS 2010 for AVR
  2010-07-30 19:36         ` Simon Wright
@ 2010-07-30 20:56           ` Warren
  0 siblings, 0 replies; 12+ messages in thread
From: Warren @ 2010-07-30 20:56 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

Simon Wright expounded in news:m2sk30rcc1.fsf@pushface.org:

> Warren <ve3wwg@gmail.com> writes:
> 
>> sjw expounded in news:d00563f7-b2a4-4a8c-8d53-adcbe72d62d8
>> @j9g2000yqn.googlegroups.com:
>>
>>> On Jul 30, 2:40 pm, Warren <ve3...@gmail.com> wrote:
>>> 
>>>> avr-gnatlink F:\cygwin\home\Warren\avr\testavr\testavr.ali
>>>> -mmcu=avr5 - 
>>> lgcc
>>>> -o F:\cygwin\home\Warren\avr\testavr\testavr
>>> 
>>> Just -lgcc on its own? you'd expect it to call up -lgnat & possibly
>>> - lgnarl. Hmm.
>>
>> Huh?  It does the -lgnat on its own.  Adding it 
>> didn't helped either. ;-)
> 
> Oh, I must have misunderstood. What happens if you call avr-gnatmake
> with -v -largs -Wl,-v? (to see what's going on). 

I did try the -v, but not after -largs. But the problem is now
solved now, by fixing the project file:

The key turned out to be the following 3 lines in the
project file (that I had differently):

  package Builder  renames AVR.Builder;
  package Compiler renames AVR.Compiler;
  package Binder   renames AVR.Binder;

Evidently, this sets things up a lot of things:

$ avr make
avr-gnatmake -XMCU=atmega328p -Ptestavr.gpr
avr-gcc -c --RTS=rts/avr5 \
  -gnatec=C:\WinAVR-20100110\lib\gnat\gnat.adc \
  -gdwarf-2 -gnatwp -gnatwu -gnatn -gnatp \
  -gnatVn -Os -gnatef -fverbose-asm -frename-registers \
  -mmcu=atmega328p -gnateDMCU=atmega328p \
  -fdata-sections -ffunction-sections -I- \
  -gnatA F:\home\wgay\avr\testavr\testavr.adb

The "avr" is just my wrapper script to fix the PATH 
in cygwin for the WinAVR tools.

Warren



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

end of thread, other threads:[~2010-07-30 20:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-29 19:06 GPS 2010 for AVR Warren
2010-07-29 19:19 ` Tero Koskinen
2010-07-29 19:36   ` Warren
2010-07-30 13:40   ` Warren
2010-07-30 15:43     ` sjw
2010-07-30 16:33       ` Warren
2010-07-30 19:36         ` Simon Wright
2010-07-30 20:56           ` Warren
2010-07-30 18:13     ` Warren
2010-07-29 20:08 ` Simon Wright
2010-07-30  9:12   ` sjw
2010-07-30 13:22   ` Warren

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