QT for Arduino development - Mega boards
-
With a bit more investigation, I figured out how to compile and upload to the Mega 2560, at least in a terminal window. It was necessary to change, not only the board tag, but also the programmer type from 'arduino' to 'wiring'. My Makefile for the Mega 2560 now looks like this:
ARDUINO_DIR = /usr/share/arduino ARDMK_DIR = /usr/share/arduino AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr TARGET = main ARDUINO_LIBS = BOARD_TAG = mega2560 MONITOR_PORT = /dev/ttyACM0 #MCU = atmega1250 #F_CPU = 16000000 # Avrdude code #ARDUINO_PORT = /dev/ttyACM0 AVRDUDE_ARD_PROGRAMMER = wiring AVRDUDE_ARD_BAUDRATE = 115200 include /usr/share/arduino/Arduino.mk
This is sufficient to be able to compile and upload with:
$ make upload
However, there is still the problem of getting the Mega board recognized in QT. I can set up an alternative Makefile (e.g. Makefile.mega2560) with the required parameters, and then create a new Run profile in QT Creator. here I can add a new Deploy task with a make parameter of -f Makefile.mega2560. However the IDE does not recognize the Mega hardware. For example, while Serial0 is recognized, Serial1 is not so any code that mega specific hardware will not compile because the compiler does not recognize the objects or definitions. I will investigate this further and report back if I figure it out.
BTW, I figured out how to drag the top of the compose window upwards with the up/down arrow in the black circle. Didn't notice it at first.
-
Hi @qcontinuum,
your link in the first post is broken, so its hard to know what you are doing.
Can you fix that, please?
Regards
-
Not sure how it got condensed like that, but I have updated it. Should be OK now.
-
Hi @qcontinuum,
Thanks. From the updated link I see, that a Generic Project is used.
In that case, the project definitions have to be done yourself, Creator does not know (and doesn't care) what's inside the
Makefile
or passed to themake
commandline.So I think you need some other includes, or provide a `#define' for the mega2560.
Can you show us the relevant definitions for Serial0 and Serial1?
Regards
-
@aha_1980 , I have come to the same conclusion as you outline here. If I want to compile for anything other than a Uno board, I have to run make directly in terminal. I can live with that but I was hoping that there was a better way. My investigation of Eclipse was rather underwhelming, but I found QT very useful, at least as an editor and error checker (particularly for classes) and to do proof on concept testing.
Serial0 and Serial1 are part of the Arduino framework. I only have to include <Arduino.h> in my project. However, compiling in QT will only recognize Serial0. I did some investigating along the lines you suggest and discovered that the Ardiono IDE does some pre-processing behind the scenes, although I didn't find and details. Looking through various Arduino library files, there are some symbols defined (e.g. #define ARDUINO_AVR_MEGA) but they seem to be "read-only", i.e. to determine rather than to set which board I am using. If I use them then the compiler complains about a duplicate definition or ignores it. In the Makefile, the board is set with:
BOARD_TAG = mega
However, as you say, QT does not see that. The identification of an appropriate define might be a question for the Arduino forum. Its is difficult to know where to draw the line between Arduino stuff and C++ sometimes so I hope I haven't gone too much OT.
-
Hi @qcontinuum said in QT for Arduino development - Mega boards:
#define ARDUINO_AVR_MEGA
You can put such defines in the <project>.defines file, it will be prepended to all project files.
Changing the Makefile to use for build should be possible too: Press Ctrl+5 and you are in the projects setup page. You can specify the make command here, and you should even be able to create several build configurations (I've not tested that, but I think it works).
After all, it should be enough fun to code for these micros.
Regards
If you, however, need to change them regularly, that may be a bit tedious...
-
Sorry, I tried Ctrl-F5, but it does absolutely nothing.
-
@qcontinuum I said
Ctrl+5
which switches to Projects mode; not Ctrl+F5 ;) -
Yes, so you did. Sorry my mistake. Its just the same as clicking Projects on the left hand side which is were I went anyway. Thanks.
-
Hi all guys and thanks for the support.
The next link no longer works.
The following page is missing the main images where you can see how QT is configured in the projects section.
https://readwrite.com/qtcreator-arduino-development/
It would seem as if the world does not want people to use QT to develop applications for arduino :D :D
Could you help me out here? I have completely followed the procedure contained in https://readwrite.com/qtcreator-arduino-development/ but without pictures showing me how to configure the projects section, I don't know how to move forward.
Thank you very much see you soon and happy holidays. Bye Bye
-
Hi @velvettiere
you had luck, the web archive has snapshots of the pictures :)
The screens in Creator look a bit different now, but you should get the idea of what to modify.
Good luck!
-
-
@aha_1980 said in QT for Arduino development - Mega boards:
Hi @velvettiere
you had luck, the web archive has snapshots of the pictures :)
The screens in Creator look a bit different now, but you should get the idea of what to modify.
Good luck!
Thankyou very much for your support.
I found another image, the first, that it's necessary to follow the entire guide.
Another site in the web archive.
http://web.archive.org/web/20221126085301/https://blog.jayway.com/2011/09/22/using-qtcreator-for-arduino-development/?unapproved=549656&moderation-hash=33455ce227a44aef31f2f7535e519077#comment-549656I will try to follow the entire process and will be here with some upgrade in time.
Thank you a lot. Bye Bye.