Différences entre versions de « Galileo-Terminal »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « {{Galileo-NAV}} {{Galileo-TRAILER}} »)
 
Ligne 1 : Ligne 1 :
 
{{Galileo-NAV}}
 
{{Galileo-NAV}}
 +
 +
== Using the Terminal ==
 +
 +
What makes the Galileo truly unique is the fact that it has Linux running under the hood. You can interact with the Linux OS through the terminal, executing simple commands through a command-line interface. In comparison to uploading Arduino sketches, interacting with the Linux command line is a much more advanced skill, but this is as good a place as any to start learning.
 +
 +
There are two different ways to connect to the Linux terminal: over the 3.5mm stereo jack RS-232 port or over USB. The former requires a special cable (or two), and the latter requires you to upload a special Arduino sketch. We’ll cover both on this page, there are pros and cons to each approach.
 +
 +
Both of these methods require that you have a terminal emulator installed on your computer.
 +
 +
== Terminal RS-232 ==
 +
 +
This method is safer, and easier, but it does require that you have some '''extra cables'''. The terminal interface on the Galileo is a '''3.5mm stereo jack''', like what you might plug headphones into. The three contacts on this connector break out ground, RX and TX. A specialized '''3.5mm to DB9 RS-232 cable''' can help move the interface to a more common connector, and (assuming your computer doesn’t have an archaic serial port) you may need a RS-232 to USB cable on top of that to interface the board with your computer.
 +
 +
Once the board is connected to your computer, open up a serial terminal program (like [https://learn.sparkfun.com/tutorials/terminal-basics/tera-term-windows Tera Term] for Windows or [https://learn.sparkfun.com/tutorials/terminal-basics/coolterm-windows-mac-linux Cool Term] for Mac). Set the serial port number, and change the baud rate to '''115200 bps'''.
 +
 +
Check out the section below if you’re not sure what to do with Linux.
 +
 +
Custom Arduino Sketch
 +
 +
If you don’t have the weird 3.5mm RS-232 interface cables, never fear! You can upload an Arduino sketch to access the Linux terminal.
 +
 +
One warning here: this sketch does mess with some of the basic workings of the Galileo. You won’t be able to upload another Arduino sketch unless you reset the board or run the few lines at the end of this section.
 +
 +
Copy the code below into your Arduino IDE. Then upload just as you did the Blink sketch. This is a slightly modified version of the code found in [https://communities.intel.com/docs/DOC-22226 Intel’s example code samples].
 +
 +
<nowiki>void setup()
 +
{
 +
  system("cp /etc/inittab /etc/inittab.bak");  // Back up inittab
 +
  // Replace all "S:2345" with "S0:2345"'s (switching serial ports):
 +
  system("sed -i 's/S:2345/S0:2345/g' /etc/inittab");
 +
  // Replace all "ttyS1" with "ttyGS0"'s (switching serial ports):
 +
  system("sed -i 's/ttyS1/ttyGS0/g' /etc/inittab");
 +
  // Replace all "grst" with "#grst"'s to comment that line out:
 +
  system("sed -i 's/grst/#grst/g' /etc/inittab");
 +
  // Replace all "clld" with "#clld"'s to comment that line out:
 +
  system("sed -i 's/clld/#clld/g' /etc/inittab");
 +
  system("kill -SIGHUP 1");
 +
}
 +
void loop()
 +
{
 +
 +
}</nowiki>
 +
 +
Once that’s uploaded, you’ll need to open up a separate serial terminal program (not the Serial Monitor). Set the serial port to the same as your Galileo, and set the baud rate to 115200. See the below section for help using Linux.
 +
 +
Once you’re done using this version of the serial terminal, send this trio of commands to revert back to “Arduino mode”:
 +
 +
<nowiki>rm /sketch/sketch.elf
 +
cp /etc/inittab.bak /etc/inittab
 +
kill -SIGHUP 1
 +
</nowiki>
 +
 +
Those will remove your terminal “Arduino sketch”, revert back to the old '''init''' procedure, and reboot the '''init''' process. Your Galileo will revert back to the way it was, and you can upload an Arduino sketch once again.
 +
 +
== Utiliser le Terminal Linux ==
 +
When you first open your Linux terminal, press enter. You’ll the be prompted to log in, use the user name root (no password, by default). Welcome to the shell!
 +
 +
[[Fichier:Galileo-Terminal-00.jpg]]
 +
 +
From here, the you can perform a variety of basic Linux commands. You can list directory contents with '''ls'''. Navigate directories with '''cd'''. Make directories with '''mkdir''' or create files with '''touch'''. There are, of course, more advanced Linux utilities to discover as well.
 +
 +
[[Fichier:Galileo-Terminal-01.jpg]]
 +
 +
There are a wide range of Linux commands made available to the Galileo.
  
 
{{Galileo-TRAILER}}
 
{{Galileo-TRAILER}}

Version du 12 avril 2014 à 14:46


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Using the Terminal

What makes the Galileo truly unique is the fact that it has Linux running under the hood. You can interact with the Linux OS through the terminal, executing simple commands through a command-line interface. In comparison to uploading Arduino sketches, interacting with the Linux command line is a much more advanced skill, but this is as good a place as any to start learning.

There are two different ways to connect to the Linux terminal: over the 3.5mm stereo jack RS-232 port or over USB. The former requires a special cable (or two), and the latter requires you to upload a special Arduino sketch. We’ll cover both on this page, there are pros and cons to each approach.

Both of these methods require that you have a terminal emulator installed on your computer.

Terminal RS-232

This method is safer, and easier, but it does require that you have some extra cables. The terminal interface on the Galileo is a 3.5mm stereo jack, like what you might plug headphones into. The three contacts on this connector break out ground, RX and TX. A specialized 3.5mm to DB9 RS-232 cable can help move the interface to a more common connector, and (assuming your computer doesn’t have an archaic serial port) you may need a RS-232 to USB cable on top of that to interface the board with your computer.

Once the board is connected to your computer, open up a serial terminal program (like Tera Term for Windows or Cool Term for Mac). Set the serial port number, and change the baud rate to 115200 bps.

Check out the section below if you’re not sure what to do with Linux.

Custom Arduino Sketch

If you don’t have the weird 3.5mm RS-232 interface cables, never fear! You can upload an Arduino sketch to access the Linux terminal.

One warning here: this sketch does mess with some of the basic workings of the Galileo. You won’t be able to upload another Arduino sketch unless you reset the board or run the few lines at the end of this section.

Copy the code below into your Arduino IDE. Then upload just as you did the Blink sketch. This is a slightly modified version of the code found in Intel’s example code samples.

void setup() 
{
  system("cp /etc/inittab /etc/inittab.bak");  // Back up inittab
  // Replace all "S:2345" with "S0:2345"'s (switching serial ports):
  system("sed -i 's/S:2345/S0:2345/g' /etc/inittab");
  // Replace all "ttyS1" with "ttyGS0"'s (switching serial ports):
  system("sed -i 's/ttyS1/ttyGS0/g' /etc/inittab");
  // Replace all "grst" with "#grst"'s to comment that line out:
  system("sed -i 's/grst/#grst/g' /etc/inittab");
  // Replace all "clld" with "#clld"'s to comment that line out:
  system("sed -i 's/clld/#clld/g' /etc/inittab");
  system("kill -SIGHUP 1");
}
void loop() 
{

}

Once that’s uploaded, you’ll need to open up a separate serial terminal program (not the Serial Monitor). Set the serial port to the same as your Galileo, and set the baud rate to 115200. See the below section for help using Linux.

Once you’re done using this version of the serial terminal, send this trio of commands to revert back to “Arduino mode”:

rm /sketch/sketch.elf
cp /etc/inittab.bak /etc/inittab
kill -SIGHUP 1

Those will remove your terminal “Arduino sketch”, revert back to the old init procedure, and reboot the init process. Your Galileo will revert back to the way it was, and you can upload an Arduino sketch once again.

Utiliser le Terminal Linux

When you first open your Linux terminal, press enter. You’ll the be prompted to log in, use the user name root (no password, by default). Welcome to the shell!

Galileo-Terminal-00.jpg

From here, the you can perform a variety of basic Linux commands. You can list directory contents with ls. Navigate directories with cd. Make directories with mkdir or create files with touch. There are, of course, more advanced Linux utilities to discover as well.

Galileo-Terminal-01.jpg

There are a wide range of Linux commands made available to the Galileo.


Source: Intel Galileo, crédit: Arduino.cc, licence Creative Common Attribution ShareAlike. Diverses documentations publiées par Intel(R), Crédit Intel(R)

Traduit et augmenté par Meurisse D pour MCHobby.be

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.