-
Notifications
You must be signed in to change notification settings - Fork 447
Q: advice on using MegaCore with Arduino-Makefile? #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
from a quick look you'd probably have to make a 1.0.x style boards.txt, we don't support |
thanks for the quick response! In their boards.txt file, we already added:
and that seemed to at least parse the file correctly when Right now we install all these packages via
I'm guessing we need to put the MegaCore files somewhere and then update Makefile vars like Sorry for the long message, and thanks for a great project! |
I'm realizing that one point of confusion for us is that we are using the
|
yes, the arduino-core dpkg will install the 1.0.5 libraries, cores, avrdude etc. but not the ide, and not 1.6.5 which the megacore says t requires (seems odd to require 1.6 for non-arm) i'll have a go in a mo this works for me with 1.0.5 from debian (same as ubuntu package) and arduino-mk 1.5 dpkg: Makefile:
Directory structure inside ~/sketchbook/hardware/:
i've not tried uploading of course, but Blink works fine, i tried wire.h and it seems to be using the system one, not the one within the core, so you might need to set ARDUINO_LIB_PATH or USER_LIB_PATH |
i had to tweak Arduino.mk to allow the user to overload ARDUINO_LIB_PATH: diff --git a/Arduino.mk b/Arduino.mk
index b522e64..66830a1 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -472,8 +472,12 @@ ifndef AVR_TOOLS_PATH
AVR_TOOLS_PATH = $(AVR_TOOLS_DIR)/bin
endif
-ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
-$(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
+ifndef ARDUINO_LIB_PATH
+ ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries
+ $(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
+else
+ $(call show_config_variable,ARDUINO_LIB_PATH,[USER])
+endif
# 1.5.x platform dependent libs path
ifndef ARDUINO_PLATFORM_LIB_PATH you could just use USER_LIB_PATH instead, but then all of your libraries would have to be inside the megacore which is not very portable. the problem with overriding ARDUINO_LIB_PATH this way is that you will only find the libraries inside the core (and the user ones) not the original arduino ones. |
Very informative, thanks a lot! We'll be working on it again tomorrow and will look at your advice carefully then. Additionally, it looks like we're on an older version of |
1.5-2 is in 15.10 onwards: https://launchpad.net/ubuntu/+source/arduino-mk or you could check out the git version. |
i might give this a try, i've got a mega1284 and 644 although i found the mighty-1284p and sanguino cores very straightforward, what's new in this one? p.s. there's even an ubuntu package for the mighty-1284p core |
Basically we've got a lot of code and a toolchain (described above) that works great on the ATmega328. Now we have an application that needs a lot more I/O (30 digital and 8 analog), and we went looking for a chip with more pins that could run the same code... The alternative we're considering is a bunch of I2C port expanders or something like that. We're not too familiar with the AVR/Arduino ecosystem so the pointers are appreciated! (Note - if it's relevant, we're not using the bootloaders...) |
if you literally don't want to change your existing code and toolchain from 328p to 1284p, i'd say forget the megacore and just:
and be done with it (on a newish version of ubuntu/debian). the 1284 core installs into /usr/share/arduino/hardware/ so no need to do anything with libraries etc; just a simple Makefile: BOARD_TAG = mighty_opt
ALTERNATE_CORE_PATH = /usr/share/arduino/hardware/mighty-1284p
include /usr/share/arduino/Arduino.mk |
Looks promising, but still looks like it leaves us 6 digital pins short factoring in 8 analog ... though maybe we can cut back :) I'm thinking you're probably right that 1284 with a port expander or two may be the smartest bet to ensure things go smoothly. Thanks for the advice |
ah i didn't realise the atmega128 was a specific chip, though it meant 128* (as in 1284p) anyway if you use IDE 1.6.9 i can get megacore to use its own libraries (e.g. Wire.h) without messing with ARDUINO_LIB_PATH or editing Arduino.mk using: Makefile: ARDUINO_DIR = /path/to/arduino-1.6.9
BOARD_TAG = 128
ALTERNATE_CORE = megacore
F_CPU = 16000000L
ARDUINO_PLATFORM_LIB_PATH = $(HOME)/arduino16/hardware/megacore/avr/libraries/
include /path/to/Arduino.mk arduino16 sketchbook - note avr subdirectory:
|
Hey - just wanted to follow-up and share our experience: With your help we were able to build and program the atmega64 (not 128 as I previously indicated). Unfortunately, we continued to encounter issues with running code from the MegaCore libraries - in particular a simple Thanks again for your help! |
that's a shame. megacore did seem a bit of a hack. i'd say try mighty-1284p or i guess the regular 328p with a couple of mcp23017 port expanders. p.s. i built some new debian/fedora (should work on ubuntu) packages here so you don't need to update your ubuntu, just use dpkg to install it. |
It's all good - worth a try! We've decided to use port expanders with the 328 because the 1284 would require an expander anyway for the I/O we need. thanks for the heads-up on the packages - still loving this project |
Hi -
We've been working on using https://github.com/MCUdude/MegaCore with Makefile for a while now, and have the chip programming and running with low-level AVR code, but cannot get the Arduino libraries (e.g. Wire) to work.
Any advice on the "correct" way to use the MegaCore package above? E.g. where to put the new files and what Makefile variables to set?
We're on Ubuntu.
much thanks!
The text was updated successfully, but these errors were encountered: