Running C++ programs on the TXT

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
winijenh
Beiträge: 29
Registriert: 31 Okt 2010, 21:45

Running C++ programs on the TXT

Beitrag von winijenh » 22 Jun 2015, 10:53

I've been able to succesfully (cross)compile and run a C++ program directly on the TXT.

In the documentation for the TXT-C-Programming-Expert kit that fischertechnik put online 2 weeks ago, it is suggested that you can access the 'transfer area' information via a local TXT TCP socket, and that seems to work.

These steps are not completely trivial, so I hope ft comes up with something simpler soon, but I managed to do this without knowing anything about socket APIs on linux and ARM toolchains.

At a high level, I got the Eclipse C++ IDE on linux, and an Eclipse plugin that uses the toolchain that the buildroot/Linux sources uses. In that way you can build a TXT solution without having to configure a toolchain yourself. Then of course you need to make some changes to the 'common' C++ sources that ft provides, to deal with the sockets on linux rather than Windows.

Slightly more detailed steps:
- Running an ubuntu linux VM on a Mac
- Get the TXT Linux sources from the ft website.
- Configure buildroot to create an eclipse config file that will tell eclipse what toolchain to use for the TXT:
  • Configure buildroot using the command '$make menuconfig' on the folder ft-TXT downloaded from the ft web site
    Go to the toolchain menu
    Select the option 'Register toolchain within Eclipse Buildroot plug-in
- Run buildroot using $make command. This will make buildroot get the toolchain you need. It will also build an entire linux system for the TXT, but you don't need that. Not sure if there is a way to prevent buildroot from doing all that unneccesary work and just get the toolchain. It takes a while. Go build something with ft in the mean time.
- Get eclipse. I used the lunar version.
- Get the eclipse buildroot plugin. This step and the above 3 steps are described here: https://github.com/mbats/eclipse-buildr ... plugin-%3F
- Start a new C++ project in eclipse. The Buildroot-ARM toolchain should show up as a Toolchain option. I started with the MotorOnOff example provided by ft. Copy the Main.ccp and the files in the Common directory to your project.
- Try to build and find everything you need to fix. Mostly related to sockets, although that was relatively easy with a bit of googling (error codes, closesocket, a few header files). Also need to the change the TXT IP address from 192.168.7.2 to localhost in Main.ccp. I can provide copies of the modified sources on request.
- Once the build is successful, copy the result to the TXT, folder ROBOProFIles, using scp.
- Now you can run it, either from the TXT screen or using ssh. In the latter case you can get console output.

Couple of notes:
- Haven't used the camera and the JpegDecode sources yet. They gave lots of build errors. Need to look into that.
- The TXT timers seem to be messed up. MotorOnOff uses the 10ms timer to run for 10s, but it seems to run ~10 times too fast.

Regards,
Willem Evert.

hvn
Beiträge: 266
Registriert: 20 Feb 2011, 11:15

Re: Running C++ programs on the TXT

Beitrag von hvn » 25 Jun 2015, 10:24

Hi winijenh,

Thank you for this information. Could you please provide me with the modified sources ? I'm trying to port to Linux as well.

hvn

Antworten