Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT for Arduino development - Mega boards

QT for Arduino development - Mega boards

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 6.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qcontinuum
    wrote on last edited by Qcontinuum
    #1

    I was looking for something better than the Arduino IDE and I came across a post that described how to use QT Creator for Arduino development:

    https://blog.jayway.com/2011/09/22/using-qtcreator-for-arduino-development/?unapproved=549656&moderation-hash=33455ce227a44aef31f2f7535e519077#comment-549656

    Having given this a try I found that since the post is quite old, some adjustments were required. I am using QT4 from the Ubuntu repository on Linux Mint 19.2 with Cinnamon. The combination works very well for the UNO, but I can't get it to work with the MEGA2560? From the Arduino point of view, all one needs to do is change the Makefile to reflect the change of board (i.e. change BOARD_TAG from uno to mega). However, when I try to deploy the application to the Mega, the IDE sits forever with the Run options greyed out. When I close the application, a message pops up to tell me that there is a deployment in progress and asks me whether I want to cancel it so I choose 'yes' and QT Creator closes. Choosing 'No' repeats the cycle.

    I had to change the Makefile as follows (in accordance with the instructions in Arduino.mk):

    ARDUINO_DIR = /usr/share/arduino
    ARDMK_DIR = /usr/share/arduino
    # Set to YOUR avrtools path
    AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr
         
    TARGET = main
    ARDUINO_LIBS =
    BOARD_TAG = uno
    MONITOR_PORT = /dev/ttyACM0
    
    # Avrdude code
    #ARDUINO_PORT = /dev/ttyACM0
    AVRDUDE_ARD_PROGRAMMER = arduino
    AVRDUDE_ARD_BAUDRATE = 115200
         
    include /usr/share/arduino/Arduino.mk
    

    I also had to change 'raw_update' to just 'update'. Has anyone had success deploying from QT to the Mega 2560 board?

    I was going to have a look at Eclipse, but am still having problems getting that up and running. The version in the Ubuntu repository is really old, even older than QT Creator 4.5.2 I think!

    BTW, is there any way of expanding the tiny compose window?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qcontinuum
      wrote on last edited by Qcontinuum
      #2

      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.

      aha_1980A 1 Reply Last reply
      0
      • Q Qcontinuum

        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.

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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

        Qt has to stay free or it will die.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          Qcontinuum
          wrote on last edited by
          #4

          Not sure how it got condensed like that, but I have updated it. Should be OK now.

          aha_1980A 1 Reply Last reply
          0
          • Q Qcontinuum

            Not sure how it got condensed like that, but I have updated it. Should be OK now.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            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 the make 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

            Qt has to stay free or it will die.

            Q 1 Reply Last reply
            0
            • aha_1980A aha_1980

              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 the make 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

              Q Offline
              Q Offline
              Qcontinuum
              wrote on last edited by Qcontinuum
              #6

              @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.

              aha_1980A 1 Reply Last reply
              0
              • Q Qcontinuum

                @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.

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                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...

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  Qcontinuum
                  wrote on last edited by
                  #8

                  Sorry, I tried Ctrl-F5, but it does absolutely nothing.

                  aha_1980A 1 Reply Last reply
                  0
                  • Q Qcontinuum

                    Sorry, I tried Ctrl-F5, but it does absolutely nothing.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @qcontinuum I said Ctrl+5 which switches to Projects mode; not Ctrl+F5 ;)

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    0
                    • Q Offline
                      Q Offline
                      Qcontinuum
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        velvettiere
                        wrote on last edited by
                        #11

                        Hi all guys and thanks for the support.

                        The next link no longer works.

                        https://blog.jayway.com/2011/09/22/using-qtcreator-for-arduino-development/?unapproved=549656&moderation-hash=33455ce227a44aef31f2f7535e519077#comment-549656

                        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

                        aha_1980A 1 Reply Last reply
                        0
                        • V velvettiere

                          Hi all guys and thanks for the support.

                          The next link no longer works.

                          https://blog.jayway.com/2011/09/22/using-qtcreator-for-arduino-development/?unapproved=549656&moderation-hash=33455ce227a44aef31f2f7535e519077#comment-549656

                          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

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Hi @velvettiere

                          you had luck, the web archive has snapshots of the pictures :)

                          http://web.archive.org/web/20121116161618/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-1.jpg

                          http://web.archive.org/web/20121116152537/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-2.jpg

                          http://web.archive.org/web/20121116152647/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-3.jpg

                          The screens in Creator look a bit different now, but you should get the idea of what to modify.

                          Good luck!

                          Qt has to stay free or it will die.

                          V 1 Reply Last reply
                          1
                          • aha_1980A aha_1980 referenced this topic on
                          • aha_1980A aha_1980

                            Hi @velvettiere

                            you had luck, the web archive has snapshots of the pictures :)

                            http://web.archive.org/web/20121116161618/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-1.jpg

                            http://web.archive.org/web/20121116152537/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-2.jpg

                            http://web.archive.org/web/20121116152647/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-3.jpg

                            The screens in Creator look a bit different now, but you should get the idea of what to modify.

                            Good luck!

                            V Offline
                            V Offline
                            velvettiere
                            wrote on last edited by velvettiere
                            #13

                            @aha_1980 said in QT for Arduino development - Mega boards:

                            Hi @velvettiere

                            you had luck, the web archive has snapshots of the pictures :)

                            http://web.archive.org/web/20121116161618/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-1.jpg

                            http://web.archive.org/web/20121116152537/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-2.jpg

                            http://web.archive.org/web/20121116152647/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600-3.jpg

                            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.

                            http://web.archive.org/web/20121116161922/http://www.meegoexperts.com/wp-content/uploads/2011/09/Import-Projec-Qt-Creator-MeeGo-MeeGoExperts-600.jpg

                            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-549656

                            I will try to follow the entire process and will be here with some upgrade in time.

                            Thank you a lot. Bye Bye.

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved