The result of our work is this window on the device: ')
Note: Scratchbox is used as an IDE, as this is a Fremantle SDK. QtQreator can be used, but as such there is no support for Fremantle and will not be. Why? Yes, because it does support a new, cross-platform SDK - MADDE, which I have already mentioned (and I will mention in the end).
Well, if you are under the cut, it means that you decided to read my article.
1. Installing the SDK and running HelloWorld in the emulator.
All the videos here are not very good quality, you can watch them on YouTube in HD format, just double click on the video.
Let's start from the beginning, let's assume at this point that you either did not read the previous article , or decided not to go thorny a little long way to install the SDK. But if you followed the first path, then as a result prize you would get a comfortable environment for developing in your native OS (of course, my personal opinion). But if you are lazy for any reason, the option described by me does not suit you, I suggest another, easier and simpler one.
If you already have Fremantle SDK, you can skip this step and go directly to the second step.
optional 7ip archiver, if you do not have it (take any).
VirtualBox or quemu or VMWare. In my example, I use VirtualBox.
and continue to act according to the video, everything seems to be there clearly:
Notes: install guest OS add-ons directly from VirtualBox itself, and not those included in the SDK itself (link to them on the desktop). They do not need to be downloaded anywhere, they already come with VirtualBox itself and the distribution kit is connected as a virtual disk image.
As you can see, installing, configuring and launching the application takes less than 10 minutes, unlike the method I described earlier. Everything is very simple
2. Installing Qt 4.6.2, and creating and running a Qt application in the emulator.
From this point on, it does not matter if you use the installation method proposed from the previous article or from point 1. Everything is relevant for both installation cases.
here the sequence is:
First, we remove the Qt 4.5 installed in the SDK.
fakeroot apt-get remove libqtv4 *
and then install the official Qt 4.6.2 for Maemo5:
fakeroot apt-get install libqt4-maemo5-dev
Moreover, it is necessary to do this for both ARMEL and x86 targets. The x86 target is needed to run and debug in the emulator, and the ARMEL target is to run and debug on the device (cross-compilation). You can switch between targets in the scratchbox using the menu:
sb-menu
Now attention !!!! A network in scratchbox may not work (there may be network errors when running the command to install packages). This is due to minor problems in the scratchbox. They are easy to eliminate. To do this outside of scratchbox, you need to copy for each target and for the scratchbox itself, the file resolv.conf, which you received via DHCP or formed during the configuration of a static network (directly or indirectly through utilities):
In this case, apt-get will work through this proxy.
Also, before installing packages, Qt will not be superfluous to update packages for each target in scratchbox (in general, all commands starting with “fakeroot” are executed only inside the scratchbox, and sudo is outside it):
fakeroot apt-get update
After that, we create a Qt project - “Qt Hello World” and select all targets for ARMEL and X86 as assembly configurations (after all, we plan to debug both in the emulator and on the device).
3. Setting up and running the application in the local emulator and on the device via the network (via WiFi in my case).
This is not enough to build a Qt project, the fact is that the ESBox does not know about the existence of the official Qt, which is installed in / opt / qt4-maemo5 as opposed to the unofficial one that integrates into the system (it is distributed in different directories, qmake suppose is in / usr / local / bin, include is in / usrt / include / qt4, etc.). In principle, the behavior of the Qt informal package is standard, but in this case it is difficult to deal with several versions, which is probably why Qt-Schnick decided not to scatter the package throughout the system. This can be corrected by two methods, when creating a project, you can simply change all the paths to Include and qmake, but you can make it easier, or rather make symbolic links: for qmake (attention I have a typo in the comments on the video, there is a need to write “bin” instead of “dev”, alas, I can’t fix it for technical reasons):
ln -s / opt / qt4-maemo5 / bin / qmake / usr / local / bin
check that qmake is available without specifying the path:
qmake
there should be a hint for qmake, and the Qt version is shown at the beginning, it should be 4.6.2
for include:
ln -s / opt / qt4-maemo5 / include / usr / local / qt4
This is needed for ESBox.
You need to do this operation for each scratchbox build target (ARMEL and X86), so that you don’t find that in the terminal you are debugging with one version of Qt, and on the device with another :-). You remember that to switch a target to scratchbox you need to use the “sb-menu” utility.
Then we build our application for the emulator (X86-develop) and create a debugging configuration (local). We start, agree to the invitation to start the emulator. You will see that the program stopped at the entry point to the "main" function and earned HelloWorld. Everything works well. Hooray!!!
Now we will start debugging on the device. At first I decided to demonstrate debugging over the network. All you need to do is install a gdb server on the device (for debugging) and an ssh server (and the client doesn’t hurt either). Open SSH client and server can be installed using this meta package: maemo.org/downloads/product/Maemo5/openssh . It is located in the repository.maemo.org/extras repository . How to install a new repository, you can peep in my article. You can also go to the link to the application and click the “Install” button directly on the device.
You can install gdb from the maemo repositories right on the device, it is located in the repositories
Just add these lines to the /etc/apt/sources.list file on the device (or through the standard package manager), for this you need to be the superuser, to enter this mode, enter the command on the device:
sudo gainroot
and then enter:
apt-get update apt-get install gdb
All this can be done via ssh, it is not necessary to write it all with your hands on the keyboard :-).
The second way is to manually download the gdb package and install it using dpkg (I did just that). Go and download to the device via this link package . And save to your device. Therefore, in the console (again, you can use ssh) go there and enter:
In the ESBox settings, create a device and set the IP N900 as the “Host Name”. Create a launch configuration on a remote host (in our case, this is the N900) set the delivery method of the SSH application. There are two options - SBRSH and SSH. SBRSH is when the device is mounted the folder with the application in its file system and starts from this place. Plus: everything happens faster. Minus: the device should see your computer (for the virtual system should be in Bridge mode and not NAT, or switch ports) and on the SDK host should be an SSH server. SSH - the project is copied via SCP to the N900 and started from there. Plus: the virtual machine can be in Bridge mode. Minus: a little slower. I chose the second option, but you can choose it yourself, the settings there are not very different (although in the video I first created SBRSH, but then changed it to SSH). As a “Remote Connection”, a remote connection, select a previously configured device and launch it for debugging.
At startup, they will be asked to enter a password for the user user. (Password "maemo"). It is better to click the “Save password” checkbox, otherwise it will ask the password many times, annoying :-)
And the Vaaaalayayayaya, started and stopped at a breakpoint, and the same application appeared on the device screen as on the emulator (take my word for it, but better check with yourself :-)).
4. Setting up and running the application on the device via USB connection.
Lack of debugging over the network: slow. But the USB connection will come to the rescue. In fact, this is also debugging over the network, since a network interface is created via USB, through which the application is debugged. But as he is, in fact, "point-to-point", then due to this, it happens faster.
Preparation: it is necessary to put the pc-connectivity package on the device, it is already on the virtual machine. It is located in the Extras repository. A very powerful tool inherited from previous versions of Maemo. In short: it allows you to create connection profiles, for each profile you can separately configure connections via USB, Wifi and Bluetooth. Yes, you can debug on bluetooth, but I have not tried. Wifi debugging creates an access point with a DHCP server. Full documentation can be found here . But do not be intimidated by a very large amount of documentation. In our case, it is not necessary to read it :-).
It is necessary to start from the status bar (the menu that appears if you click on the area where the watch is :-)) pc-connectivity and set the “USB” checkbox, click the “Apply” button and connect the device via USB to the computer (the screenshot did not work , sfotkal on another phone). After that, we will have a new “usb” network interface. By default, everything is already configured and you can use a pre-installed USB device with a network address of 192.168.2.15 as an ESBox device, the virtual table will receive the address of 192.168.2.14. But if you already have this address space, you will have to change it to something else. PC-connectivity settings can be found in the standard settings menu of the N900.
After that, we check the connection - we go to the device via SSH. Well, all that's left is to create a debugging configuration for this connection and run it directly on the device.
Conclusion
As you can see, everything is very simple. Start writing for Maemo5, with the device or not, is not difficult. But personally, I don’t like that I can’t use Qt-creator. Of course, you can even edit the code on shared folders between the virtual machine and the host, and then you can run it all by hand either in the emulator or on the device and already debug in Gdb with your hands, or use ESBox. But I'm already very used to Qt-Creator. But there is a solution - MADDE. This is a completely different SDK and there is no official support yet (located in the Developer Preview) and in Qt-Creator there is no support for MADDE (in the official release), but all this promises to release Qt 4.7. But nevertheless, you can use all of this right now (using the main branch from the git repository or using the latest "snapshots"), and on any OS without using virtual machines. The Qt-Creator in Gitorious in the master branch already works quite well with MADDE. Now in MADDE there are two basic things missing - an emulator and package updates. If you have a device on which you want to debug and are ready to install the necessary packages by hand, then MADDE will suit you. In the next article for developers, I will describe the process of setting up and working with MADDE.
All the pleasant codding :-) PS: as always, I invite you to visit my blog , there is information in English (albeit belatedly). You can find English version on my blog erudenko.com PS: I apologize for the 6 emoticons in the article, I understand that the site is serious, but I am very cheerful people and I can not resist :-) (oh again, smiley :-), oh again .....)