Noob needing compile help

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
BackWoodsBrewer
Posts: 6
Joined: Mon Dec 20, 2010 11:33 pm

Noob needing compile help

Post by BackWoodsBrewer » Mon Dec 20, 2010 11:41 pm

Hi all, I've been learning about AVR's and having a lot of fun with them, however I am very new to C++ and having a time getting any of the example projects to build. I've edited the Makefile as recommended (I think). When using AVR Studio 4 I just cannot get it to build. Here's what I've been trying:

1) set project to use external makefile
2) adding external paths, headers, libraries, kitchen sinks to the project properties option
3) searching google and staring at screen hoping it will help some (no avail)

If anyone could help me get setup to do a successful build I'd die a very happy man :D

Thanks for your time!

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Noob needing compile help

Post by maxi » Tue Dec 21, 2010 12:31 am

BackWoodsBrewer wrote:I just cannot get it to build.


What error messages did you get?

BackWoodsBrewer
Posts: 6
Joined: Mon Dec 20, 2010 11:33 pm

Re: Noob needing compile help

Post by BackWoodsBrewer » Tue Dec 21, 2010 3:43 am

maxi wrote:
BackWoodsBrewer wrote:I just cannot get it to build.


What error messages did you get?


Well, all sorts just depending on how I setup the project, so first thing I need to know is how to create a new project "correctly".

When I use the project wizard, it will create a new directory with the name of the project. So if I try to make it in the "hid-mouse\firmware" directory I'll have something like hid-mouse\firmware\myproject". The makefile looks like it goes up three directories then copies the usbdrv folder to the working directory. I have tried making sure my project folder is three levels deep from the vusb folder or changing the makefile to go up four folders in such a case. I can copy the contents of the usbdrv folder to the project directory and it will compile, just not build.

I know this probably sounds like an idiotic question, but like I said I have very little experience with C/C++ but am learning.

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Noob needing compile help

Post by maxi » Tue Dec 21, 2010 9:22 pm

Sounds like you are not adding the necessary paths to include directories. Go into configuration options and add the path to usbdrv along with ./ & ../(the current directory and parent). If you're still stuck then why not take a look at the avr-cdc project as it comes with avr studio project files included.

Alan Chatham
Rank 1
Rank 1
Posts: 28
Joined: Wed Sep 30, 2009 3:36 am
Location: Osaka, Japan
Contact:

Re: Noob needing compile help

Post by Alan Chatham » Thu Dec 23, 2010 8:14 pm

Yeahhhh.... It's a path issue. The other way is to move all the usb-related files into the usbdrv file, then look at the main file and adjust the #include "file.h"'s to #include "usbdrv/file.h". Yeah, it's a huge pain to figure out if you've not worked with this stuff before...

BackWoodsBrewer
Posts: 6
Joined: Mon Dec 20, 2010 11:33 pm

Re: Noob needing compile help

Post by BackWoodsBrewer » Sat Dec 25, 2010 10:33 pm

Thank you for the cdc example project. It builds fine so I know the problem isn't my toolchain. I have tried different setups but I am mainly getting an error about main.elf not found. I hate to bother anyone, but if someone has the time, could you post an AVR Studio 4 project file with a working HID Mouse example so I can see what I am missing?

Thank you all so very much and MERRY CHRISTMAS!

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Noob needing compile help

Post by maxi » Sat Dec 25, 2010 11:39 pm

You do know that you can simply open MSYS, cd to the firmware directory and type 'make hex'? This is how the projects' makefiles were intended to work.
readme wrote:Please note that the first "make hex" copies the driver from the top level into the firmware directory. If you use a different build system than our Makefile, you must copy the driver by hand.

Also, to use an external makefile with avr-studio the following criteria must be met
avr-studio wrote:1. Target name must equal project name.
2. Clean/rebuild support requires "clean" target.
3. Makefile and target must exist in the same folder

In short, if you want to use avr-studio then you're probably best not using the external makefile (as is) and just select a target device and F_CPU under config options.

If you are still truly stuck then I guess I could make a .aps for you, though it would not be using the existing makefile so you'll have to specify a target etc and ofcourse tell me where I can post it. Much better if you could get this working yourself, teach a man to fish an' all that ;)

Merry Xmas!

BackWoodsBrewer
Posts: 6
Joined: Mon Dec 20, 2010 11:33 pm

Re: Noob needing compile help

Post by BackWoodsBrewer » Sun Dec 26, 2010 1:41 am

THANK YOU!!!

I thought I was forced to modify/use the Makefile that came in the example. After some more trial/error I got it to build! :D

At first it was telling me "No rule to make main.o from main.c or something, so I tried exporting Makefile and then set the project to use it and it worked!

I greatly appreciate your "teach a man to fish" attitude as that is how I prefer to learn, just that I was having an impossible time with this. Thank you so very much for your time and patience with me. Merry Christmas! :D

Post Reply