Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Building a custom GUI for QML-Tool Microchip SAM-BA v3

Building a custom GUI for QML-Tool Microchip SAM-BA v3

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlsam-baatmelembedded
4 Posts 2 Posters 1.8k 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.
  • A Offline
    A Offline
    adahl
    wrote on last edited by
    #1

    I have difficulties using an external QML project and I hope someone could give some hints. Let me describe.

    There's a free software tool implemented with Qt5/QML to connect to embedded hardware, especially certain ARM SoCs manufactured by Atmel/Microchip. The tool is called SAM-BA. You can get the source code on GitHub and binary archives from MicroChip.

    That tool is for command line only and you can extend it with your own QML scripts. What I want to create is a new Desktop GUI tool interfacing SAM-BA for connecting to the SoC and do the things SAM-BA can do like initializing hardware, reading and writing from flash memories on target and so on. Basically I want to use the QML API of that tool in my own GUI, which should do more, e.g. talking to a database.

    I'm open for any toolkit that can do the job, but I thought instead of calling SAM-BA as a cli tool and parsing the output it would be better to use the QML API and write my GUI with Qt and/or QML, whatever fits best, I have no strong preferences. However I'm struggling to actually use that QML API. This is what I tried so far:

    Note: my host PC runs with Debian GNU/Linux version 9 (stretch), which comes with Qt 5.7 and for building SAM-BA I built Qt 5.9.3 by myself, which resides somewhere below /usr/local now.

    First thing I tried was writing a standalone QML file my-gui.qml like this:

    import QtQuick 2.3
    import SAMBA 3.2
    import SAMBA.Connection.Serial 3.2
    
    Rectangle {
        id: simpleButton
        color: "grey"
        width: 150; height: 75
    
        Text {
            id: buttonLabel
            anchors.centerIn: parent
            text: "button label"
        }
    
        SerialConnection {
            /*
            onConnectionOpened: print("Connection opened")
            onConnectionFailed: print("Connection failed: " + message)
            onConnectionClosed: print("Connection closed")
            */
        }
    }
    

    Running this with SAM-BA like described in their docs leads to a segfault, but I think this is out of scope here:

    ./sam-ba -x /path/to/my-gui.qml
    

    What works instead is going to my folder and calling the my-gui.qml file with qml or qmlscene like this:

    qml -I ~/release/sam-ba_v3.3/qml my-gui.qml
    

    But, as far as I understood qml and qmlscene are dev tools and I would need a Qt development environment, which is no option for later deployment. So I made a new Qt Quick Application project in Qt Creator and try to use SAM-BA from there and this is where I got stuck. 😕

    I added the full path to the qml subfolder of my sam-ba release directory (which is similar to the extracted tarball of the distributed binary files mentioned above) to QML_IMPORT_PATH in my .pro file like I did when calling qmlscene, which lets QT Creator find all that stuff in the editor. Build also is successful, but I get the following errors at runtime:

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:6 module "SAMBA.Connection.Serial" is not installed
    qrc:/main.qml:5 module "SAMBA" is not installed
    qrc:/main.qml:6 module "SAMBA.Connection.Serial" is not installed
    qrc:/main.qml:5 module "SAMBA" is not installed
    

    What works instead is calling that main.qml with qmlscene from outside the project, but I guess that's not the way to go. Did I miss some includes? Or what is necessary to interface that external QML project from my application?

    Any hints appreciated, I will give more information on anything which might be missing to properly describe the problem. Note: I also posted this problem at the at91 forum here: Problems with QML and SAM-BA v3 for a custom GUI. But I talked to a friend of mine yesterday who said it could be better to cross post it here again, because of the audience with more Qt experience. 😇

    1 Reply Last reply
    0
    • A Offline
      A Offline
      adahl
      wrote on last edited by
      #2

      I searched the forum a little more and I tried different things and now I got my example running in Qt Creator. All I had to do was setting the environment variable QML2_IMPORT_PATH …

      Screenshot_20191017_131805.png

      I mark this as solved for now. I expect problems with deployment later, but this would be another topic. Thanks for reading.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        adahl
        wrote on last edited by adahl
        #3

        So, today was the day and I tried building this project in Qt Creator on Windows. Downloaded and installed Qt 5.9.x LTS, successfully built SAM-BA with that environment and verified I could use that SAM-BA standalone to connect to a target board.

        Then I set up my custom GUI project like described above. Build successful, no warnings in Qt Creator. However when I tried to run it I get a complaint the file samba_conn_serial.dll could not be loaded, although the error message showed the complete path to that file and it was actually at that place. At first sight this seems very strange to me. Is this a platform specific problem on loading a QML plugin coming with an additional library? On Linux I did not need to explicitly link any SAM-BA libraries (.so), is that necessary on Windows? I'll give you the exact error message tomorrow, already shutdown that virtual machine.

        aha_1980A 1 Reply Last reply
        0
        • A adahl

          So, today was the day and I tried building this project in Qt Creator on Windows. Downloaded and installed Qt 5.9.x LTS, successfully built SAM-BA with that environment and verified I could use that SAM-BA standalone to connect to a target board.

          Then I set up my custom GUI project like described above. Build successful, no warnings in Qt Creator. However when I tried to run it I get a complaint the file samba_conn_serial.dll could not be loaded, although the error message showed the complete path to that file and it was actually at that place. At first sight this seems very strange to me. Is this a platform specific problem on loading a QML plugin coming with an additional library? On Linux I did not need to explicitly link any SAM-BA libraries (.so), is that necessary on Windows? I'll give you the exact error message tomorrow, already shutdown that virtual machine.

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

          @adahl

          However when I tried to run it I get a complaint the file samba_conn_serial.dll could not be loaded, although the error message showed the complete path to that file and it was actually at that place. At first sight this seems very strange to me.

          Such errors could mean, that the DLL has own dependencies that are not satisfied. Dependency Walker is the tool of choice to debug that.

          Regardd

          Qt has to stay free or it will die.

          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