Ojassy / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Pull request: Use Arduino tools (avr-gcc, avr-g++, avr-gdb, etc.) on Linux like on OS X and Windows #674

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I noticed that when building ardupilot-mega, there are some differences in what 
AVR tools (compiler, linker, etc.) are used depending on which platform you're 
on:

Under OS X and Windows, it uses the tools that are packaged with the Ardunio 
software.  In Linux, it looks for separately installed avr-gcc, avr-g++, 
avr-gdb etc.

Since even in Linux you need to have Arduino installed, and since the other 
platforms use the Arduino versions of the tools, is there any reason to do 
something different in Linux?  It seems that doing the same thing in Linux that 
ardupilot-mega does on other platforms would mean one less step is required 
before building the software--you no longer have to install avr-gcc, etc.  And 
removing unnecessary steps in build processes is usually good.

I have a patch that does this at 
http://code.google.com/r/jjwiseman-ardupilot-mega-fork/ in the 
use_arduino_tools_on_linux branch.

Original issue reported on code.google.com by jjwiseman@gmail.com on 28 Jun 2012 at 5:29

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/ardupilot-mega/wiki/BuildingWithMake claims that you 
can use the ARDUINO environment variable "Overrides the automatic detection of 
the Arduino install location and forces the build system to consider this path 
the root of the Arduino installation".

My patch fixes this, so that you can set ARDUINO on linux.

Original comment by jjwiseman@gmail.com on 22 Oct 2012 at 4:46

GoogleCodeExporter commented 8 years ago
BTW, this is the complete patch:

--- a/libraries/AP_Common/Arduino.mk
+++ b/libraries/AP_Common/Arduino.mk
@@ -194,8 +194,8 @@ ifeq ($(SYSTYPE),Darwin)
   AWK          =   awk
 endif
 ifeq ($(SYSTYPE),Linux)
-  # expect that tools are on the path
-  TOOLPATH     :=  $(subst :, ,$(PATH))
+  # use the tools that come with Arduino
+  TOOLPATH     :=  $(ARDUINO)/hardware/tools/avr/bin
 endif
 ifeq ($(findstring CYGWIN, $(SYSTYPE)),CYGWIN) 
   TOOLPATH     :=  $(ARDUINO)/hardware/tools/avr/bin
@@ -216,7 +216,7 @@ AVRDUDE     :=  $(call FIND_TOOL,avrdude)
 AVARICE        :=  $(call FIND_TOOL,avarice)
 OBJCOPY            :=  $(call FIND_TOOL,avr-objcopy)
 ifeq ($(CXX),)
-$(error ERROR: cannot find the compiler tools anywhere on the path $(TOOLPATH))
+$(error ERROR: cannot find the Arduino compiler tools, please set 
ARDUINO=<path to arduino installation>)
 endif

 # Find awk

Original comment by jjwiseman@gmail.com on 22 Oct 2012 at 4:48