C Programm startet nicht

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
sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

C Programm startet nicht

Beitrag von sunnyheaven » 20 Jan 2021, 12:02

Hallo,

ich versuche verzweifelt, ein C Programm auf dem TXT zum Laufen zu bringen.
Die Anleitung von vleeuwen kenne ich, die FW ist auch die Richtige.

Ich kopiere einfach das im GitHub vorhandene, bereits kompilierte HelloWorld Beispiel auf den TXT. Das Programm läuft aber nicht an. Muss ich da mit SLI noch was machen? Ist mir in der Anleitung von vleeuwen nicht klar geworden. Sorry...

Gruß
Jan

Benutzeravatar
PHabermehl
Beiträge: 2429
Registriert: 20 Dez 2014, 22:59
Wohnort: Bad Hersfeld

Re: C Programm startet nicht

Beitrag von PHabermehl » 20 Jan 2021, 12:34

Hallo Jan,

ich wage jetzt mal einen Schuss in Blaue...

Ist das Programm als "Ausführbar" markiert?

Stichwort Linux und chmod...

Gruß
Peter
https://www.MINTronics.de -- der ftDuino & TX-Pi Shop!

viele Grüße
Peter

sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

Re: C Programm startet nicht

Beitrag von sunnyheaven » 20 Jan 2021, 13:16

Hi Peter,

ich hab das HelloWorld Programm (ohne Endung) einfach aus dem GitHub rüberkopiert.
Muss ich da noch was machen?

Gruß
Jan

Benutzeravatar
PHabermehl
Beiträge: 2429
Registriert: 20 Dez 2014, 22:59
Wohnort: Bad Hersfeld

Re: C Programm startet nicht

Beitrag von PHabermehl » 20 Jan 2021, 18:26

Hallo Jan,

ja, da muss man etwas machen. Daher hatte ich das Stichwort chmod gegeben und gedacht, dass Du diesen Fehler entweder sofort ausschließen kannst oder dass Du den Begriff einfach mal bei google eingibst. Linux ist gut dokumentiert, da findet man immer 'was.

Unter Linux muss eine Datei als ausführbar gekennzeichnet sein. Das heißt, Du müsstest die Datei im Terminal mit Admin-Rechten entsprechend als ausführbar kennzeichnen per "chmod a+x <dateiname>", wobei dann durch das "a" auch alle Benutzer die Datei ausführen dürfen. Wenn das nicht gewünscht ist, naja, chmod kennt verschiedene Parameter.

Gruß
Peter
https://www.MINTronics.de -- der ftDuino & TX-Pi Shop!

viele Grüße
Peter

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: C Programm startet nicht

Beitrag von vleeuwen » 21 Jan 2021, 00:18

Upload with the Fischertechnik Web interface.
Hochladen mit der Fischertechnik Webschnittstelle.
https://github.com/fischertechnik/txt_d ... eTxtWeb.md
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

Re: C Programm startet nicht

Beitrag von sunnyheaven » 21 Jan 2021, 18:25

Hi,

I followed exactly the instructions of vleeuwen. Load and autoload ist activated, button is green, but programm doesn't start. :shock:
Any hints for a bloody newbie?

Bye,
Jan

sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

Re: C Programm startet nicht

Beitrag von sunnyheaven » 21 Jan 2021, 19:19

Hi,

silly me, sorry. :oops:
The TxtDemo06_O1_Blink and the TxtDemo07_Sound works fine!
The TxtDemo00_HelloWorld makes a cout... But how can I visualize the text of "Hello World"?

Sorry, for the questions of a bloody newbie....

Bye
Jan

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: C Programm startet nicht

Beitrag von vleeuwen » 21 Jan 2021, 19:46

This is basic C/C++ and LINUX/UNIX stuff.

The C++ streams the text to the standard cout or cerr or clog device (C++11).
See: https://www.cplusplus.com/reference/iostream/cout/, https://www.cplusplus.com/reference/iostream/cerr/

On the TXT is this the screen.
But there is no real screen.
To get access to the screen you will need a remote terminal connection (Putty ) and the "screen f".
See: https://linux.die.net/man/1/screen

Be aware, there could more more that one different screens and with the screen command you can also switch between the different screens.

You will need this to be able to follow the progression of your C/C++ program.
Putty has an option the write the screen text also to a file on your remote development.

Cout does not write to the TXT-display. The TXT-display is fully under control of the RoboPro runtime. There is no API available to write something from a C/C++ program to the display.

Good luck and have fun with learning some basics of LINUX and C++.
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: C Programm startet nicht

Beitrag von MasterOfGizmo » 22 Jan 2021, 13:51

vleeuwen hat geschrieben:
21 Jan 2021, 19:46
This is basic C/C++ and LINUX/UNIX stuff.
This is indeed true. But most of the rest you wrote is more or less wrong or at least inaccurate.

Unix'oid operating systems and OS that try to behave like them (e.g. Windows) use three streams to send data into an application or to receive data from it. These three streams are the standard input stream (stdin), the standard output stream (stdout) and the standard error stream (stderr). Stdin is often connected to the keyboard and stdout and stderr are often connected to some text display. be it a local one or e.g. the remote one of a distant PC. This way you can type in commands and you can see the results on screen incl possible errors.

Most programming languages provide interfaces to these streams. In C++ these are iostrem::cin, cout and cerr, in e.g. python they are sys.stdin, sys.stdout etc ....

Anyway, these three streams are handled by the operating system. It's up to the operating system to decide where these streams come from (keyboard, usb com port, ...) and where they go (screen, usb com port, ...). So if you see the text output of your program depends on the configuration of varioius system tools and system configs on your device.

So in the end it's the question how fischertechnik configured the TXT to deal with the io streams of running programs. If they decided that they should not go onto the TXTs screen, then your "Hello World" won't show up.

"Screen" in this context is just the name of a software tool used to multiplex those streams. You can basically "rewire" these streams in order to e.g. be able to redirect the output of different programs to one USB port and to switch between them. But this has nothing to do with physical screens. It's just one of many standard tools to redirect and process streams.

As for the physical screen of the TXT: There's of course an API to draw onto the screen. That's what the TXTs own GUI uses and you could use it from your application as well. You could e.g. write to the framebuffer device (/dev/fb0) directly or via some library like SDL. BTW: That's exactly the way you could make screenshots in the TXT by reading from /dev/fb0.

You might actually run into permission issues when trying to access the screen at the same time as the TXTs main user interface But that's a different story and has nothing to do with the "screen" tool not with the streams an application uses to output its "Hello World".
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: C Programm startet nicht

Beitrag von vleeuwen » 22 Jan 2021, 16:16

@ MasterOfGizmo
Not all what you are writing is possible from the point of view of the ROBOPro user account.
I have limit my suggestion to the normal TXT user acccount "ROBOPro" possibilities and following the advise of fischertechnik.
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

Re: C Programm startet nicht

Beitrag von sunnyheaven » 22 Jan 2021, 17:32

@vleeuwen an MasterOfGizmo
I only understand a minimum of your discussion :lol:

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: C Programm startet nicht

Beitrag von MasterOfGizmo » 22 Jan 2021, 18:26

Da hast Du auch nicht viel verpasst. Die Antwort hatte mit Deiner Frage leider wenig zu tun und war inhaltlich auch nicht korrekt.
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

Benutzeravatar
MasterOfGizmo
Beiträge: 2720
Registriert: 30 Nov 2014, 07:44

Re: C Programm startet nicht

Beitrag von MasterOfGizmo » 22 Jan 2021, 18:27

vleeuwen hat geschrieben:
22 Jan 2021, 16:16
I have limit my suggestion to the normal TXT user acccount "ROBOPro" possibilities and following the advise of fischertechnik.
Your answer was unfortunately mostly wrong.
Arduino für fischertechnik: ftDuino http://ftduino.de, ftDuino32 http://ftduino.de/32

sunnyheaven
Beiträge: 31
Registriert: 04 Jan 2021, 05:32

Re: C Programm startet nicht

Beitrag von sunnyheaven » 23 Jan 2021, 08:38

Hallo,

bin fast am Ziel.

Wenn ich das Hello World Programm von putty aus starte, kommt der Datenstrom auch in Putty an, soweit so gut.
Wenn ich das Programm aber über den grünen Button vom TXT au starte, läuft das Programm zwar, aber in Putty kommt kein Datenstrom an (Verbindung hab ich vorher natürlich aufgebaut).
Hab auch viel, wie von vleeuwen empfohlen, mit screen und den unzähligen Parametern rumgespielt aber ich schaffs nicht, dass der Datenstrom in putty ankommt. Ich sehe z.B. mit screen -ls auch den Screen vom TXT als attached, das geht schon, aber eben keinen Stream.

Hat jemand noch Tipps? :?

Gruß
Jan

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: C Programm startet nicht

Beitrag von vleeuwen » 23 Jan 2021, 10:29

Thanks for the feedback sunnyheaven.
I will run my tests later this weekend. it is so months ago that I run this program.

Danke für das Feedback sunnyheaven.
Ich werde meine Tests später an diesem Wochenende durchführen. Es ist so Monate her, dass ich dieses Programm starte.
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

vleeuwen
Beiträge: 1557
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: C Programm startet nicht

Beitrag von vleeuwen » 24 Jan 2021, 20:33

@ sunnyheaven

I tested the fischertechnik Github example: Hello World for you..
compiling, upload with the fischertechnik Web interface and execute it with file|load and the round green button.
It is working fine.

I have send you the details in a p.m.

Kind regards,
Carel
software enigineer/teacher/advisor
Google translate
http://tescaweb.nl/Carel/?p=713

Antworten