sudar / Arduino-Makefile

Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile
GNU Lesser General Public License v2.1
2.02k stars 449 forks source link

ard-parse-boards does not locate/understand 3rd-party hardware directories. #47

Closed jaysonlarose closed 7 years ago

jaysonlarose commented 11 years ago

As per http://arduino.cc/en/Guide/Environment#thirdpartyhardware , you are able to supplement the existing board libraries, core libraries, bootloaders, and programmer definitions without having to modify the originals by putting your additions in a new subdirectory in hardware/.

In other words, if your ARDUINO_DIR is /usr/share/arduino and you want to add a new board, the proper way to go about doing so is to create a new directory under /usr/share/arduino/hardware (I don't think the name matters, as long as it's not "arduino"), and put the relevant additions in there, following the same convention as the preexisting /usr/share/arduino/hardware/arduino directory. Thus your add-on file structure would start to look like this:

/usr/share/arduino/hardware/myboard/boards.txt (containing JUST the new board definition(s)!)
/usr/share/arduino/hardware/myboard/bootloaders/MyBoardRev1/Makefile
/usr/share/arduino/hardware/myboard/bootloaders/MyBoardRev1/r1bootloader.c
/usr/share/arduino/hardware/myboard/bootloaders/MyBoardRev1/r1bootloader.hex
/usr/share/arduino/hardware/myboard/cores/MyBoardRev1/Arduino.h

(etc, etc)

ard-parse-boards doesn't seem to follow this hunt behavior, since it is passed the full pathname to just the arduino subdir's boards.txt file. Instead, it should be provided with the base ARDUINO_DIR, so it can then check each subdirectory in ARDUINO_DIR/hardware/ for a boards.txt file, and use the information in each of these to compile the full boards list.

I also presume that every other component of Arduino-Makefile which may need to use data in ARDUINO_DIR/hardware will need to be modified to follow this behavior as well, making this a Pretty Big Modification to make. But... it's what the Arduino IDE does.

sudar commented 11 years ago

I also presume that every other component of Arduino-Makefile which may need to use data in ARDUINO_DIR/hardware will need to be modified to follow this behavior as well, making this a Pretty Big Modification to make.

Yeah, it involves some effort since the path is used in multiple places.

I will do it as part of #45 where I have to add support for Arduino 1.5.

Meanwhile, do you want to take a quick stab at it? :)

jaysonlarose commented 11 years ago

You know, I was gonna give it a go, but come to find out, the board variant I was dealing with...

A) Was not written with this third party hardware dealybob in mind, and

B) Was not even current with Arduino 1.0 land.

I'm still very much in the "discovery phase" as far as this whole Arduino thing goes... and I just got finished figuring out how to...

A) Find a similar package using a different die package of the same type of processor, which was at least up to date with the Arduino 1.0 way of doing things.

B) Write a new pins_arduino.h, because the QFNwhatever version of the ATMega 644p is very different in terms of the pinout than the DIP version.

C) Use an AVR as an ISP to upload a new bootloader to these boards (as the one it shipped with flat-out refused to accept any code).

D) Having gotten it working in the Ardunio IDE, do it all over again in the third-party hardware-friendly format.

E) Clean up my arduino dir back to the pre-modified version (I have other machines to install these packages on, and find that I tend to tear out less of my hair doing so when I keep stuff installed by install programs and the like as unmodified as possible)

F) Build a new monolithic arduino dir to point Arduino-Makefile at, symlinking everything that doesn't need to be modified to add the new board variants

G) Get bitten in the ass by some new, unrelated bug involving the Arduino guys using SIGNAL instead of ISR to deal with the UARTS.

H) Research G), find patch files, have them not apply cleanly, manually make the necessary changes after figuring out what-all the patch is SUPPOSED to do, and FINALLY declare victory.

NONE of this being stuff I've done before. So I think I'm done touching code for the night :)

I'm just happy to see that you responded, and it's somewhere in the grand scheme of things. I love how much you got working with one makefile and a couple of perl scripts! I can't stand the Arduino IDE (something to do with it not being VIM, and also having a nasty habit of crashing with unsaved changes). I tried using ino, and it blew up when I tried to compile the ethernet shield example sketch. It all even works on ARM, and I often use it to compile and upload Arduino sketches using a BeagleBone (I think I might get some sort of perverse kick out of compiling embedded software on another embedded platform).

Anyways, I'm going to go try and forget that computers exist for a little while after getting all that stuff done... peace!

sudar commented 11 years ago

the board variant I was dealing with...

Which board are you using?

something to do with it not being VIM

If you are using Vim (like me) then checkout these other projects of mine as well :)

I tried using ino, and it blew up when I tried to compile the ethernet shield example sketch.

What happened?

mgcrea commented 10 years ago

I'm encountering this issue while trying to build for a teensy. Related issues/projects:

$ cd /Applications/Arduino.app/Contents/Resources/Java/hardware; find teensy
teensy
teensy/boards.txt
teensy/cores
teensy/cores/teensy
teensy/cores/teensy/Arduino.h
[...]
sej7278 commented 10 years ago

@mgcrea - if you're talking about the arm teensy 3.x then you're out of luck until we get arduino 1.5 support sorted. you could try my test branch, but i don't believe even the arduino ide supports the teensy3 so its probably up to pjrc to make it work.

if you're talking about the avr teensy 2.0 then its kind of a leonardo, like the sparkfun pro micro, i use the following in my local Makefile:

MONITOR_PORT      = /dev/ttyACM0
BOARD_TAG         = promicro16
ALTERNATE_CORE    = promicro
BOOTLOADER_PARENT = /home/simon/arduino/hardware/promicro/bootloaders
BOOTLOADER_PATH   = caterina
BOOTLOADER_FILE   = Caterina-promicro16.hex
BOARDS_TXT        = /home/simon/arduino/hardware/promicro/boards.txt

include /usr/share/arduino/Arduino.mk

ard-parse-boards isn't even part of arduino-mk anymore.

mgcrea commented 9 years ago

Does the teensy 3.1 supposed to work now? Just tried with Arduino 1.6 with latest Teensyduino and it does not work.

sej7278 commented 9 years ago

does teensy work with the 1.6 ide? last i heard paul-s only started working on it this month and its not finished.

teensy 3.1 works with 1.0.6 and most AVR devices seem to work with 1.6 except those with custom cores like attiny. realistically if you don't have an ARM board, don't use 1.6

sej7278 commented 9 years ago

this shows the board and sub (cpu) for every board with a sub (which isn't every board):

$(shell for board in `cat $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_]+.name' | awk -F. {'print $1'} | sort -uf` ; do grep -E $board'.menu.cpu.[a-zA-Z0-9_]+=' $(BOARDS_TXT) | sed 's/.menu.cpu./:/;s/=/:/' ; done | column -s: -t)

atmegang   atmega168       ATmega168
atmegang   atmega8         ATmega8
bt         atmega328       ATmega328
bt         atmega168       ATmega168
diecimila  atmega328       ATmega328
diecimila  atmega168       ATmega168
lilypad    atmega328       ATmega328
lilypad    atmega168       ATmega168
mega       atmega2560      ATmega2560 (Mega 2560)
mega       atmega1280      ATmega1280
mini       atmega328       ATmega328
mini       atmega168       ATmega168
nano       atmega328       ATmega328
nano       atmega168       ATmega168
pro        16MHzatmega328  ATmega328 (5V, 16 MHz)
pro        8MHzatmega328   ATmega328 (3.3V, 8 MHz)
pro        16MHzatmega168  ATmega168 (5V, 16 MHz)
pro        8MHzatmega168   ATmega168 (3.3V, 8 MHz)

need to somehow merge it with "make show_boards"