Projet

Général

Profil

Environnement de travail à distance » Historique » Version 28

Patrice Nadeau, 2020-07-05 09:47

1 15 Patrice Nadeau
# Environnement de travail à distance
2 1 Patrice Nadeau
3 2 Patrice Nadeau
{{TOC}}
4
5
----
6
7 15 Patrice Nadeau
## Matériel requis
8 1 Patrice Nadeau
9 27 Patrice Nadeau
* BeagleBone Black ([Digikey](http://www.digikey.ca/product-detail/en/BB-BBLK-000/BB-BBLK-000-REVC-ND/4842211))
10 1 Patrice Nadeau
11 26 Patrice Nadeau
### Mode « USB »
12 1 Patrice Nadeau
13
* Câble USB A - Mini-B (fournis avec le BBB)
14
15 16 Patrice Nadeau
### Mode « stand-alone »
16 1 Patrice Nadeau
17
Dans ce mode le BBB se comporte comme un ordinateur complet.
18
19 28 Patrice Nadeau
Requiert : 
20
* Bloc d’alimentation 5 V, 1 A, 2.1 mm, centre positif ([DigiKey](http://www.digikey.ca/product-search/en?vendor=0&keywords=T1139-P5P-ND))
21 1 Patrice Nadeau
* Câble Ethernet
22 28 Patrice Nadeau
23
    > Facultatif
24
    > - Concentrateur USB
25
    > - Clavier/souris
26
    > - Adaptateur vidéo
27 1 Patrice Nadeau
28 16 Patrice Nadeau
## Branchement 
29 1 Patrice Nadeau
30
Peux importe la méthode, le BBB seras disponible à l'adresse *192.168.7.2* avec l'utilisateur *root*.
31 14 Patrice Nadeau
> Il n'y a pas de mot de passe
32 1 Patrice Nadeau
33 26 Patrice Nadeau
### Mode « USB »
34 1 Patrice Nadeau
35
Brancher le BBB à l'ordinateur en utilisant le port Micro-B.
36 25 Patrice Nadeau
Un nouveau média apparaîtra ainsi qu'une nouvelle carte réseau.
37 1 Patrice Nadeau
38
> Optionnellement
39
> A partir du nouveau media, copier localement le fichier *boot/Drivers/Linux/FTDI/mkudevrule.sh*.
40
> A partir d'une session terminal, exécuter le script
41 17 Patrice Nadeau
```bash
42 1 Patrice Nadeau
chmod +x mkudevrule.sh
43
sudo ./mkudevrule.sh
44 17 Patrice Nadeau
```
45 1 Patrice Nadeau
46 16 Patrice Nadeau
### Mode « stand-alone »
47 1 Patrice Nadeau
48 7 Patrice Nadeau
Au minimum, brancher les câbles d'alimentation et Ethernet.
49 1 Patrice Nadeau
Un clavier, souris et écran peuvent aussi être branchés.
50
51 16 Patrice Nadeau
## Logiciel requis
52 1 Patrice Nadeau
53 16 Patrice Nadeau
### Développement local
54 1 Patrice Nadeau
55
Comme la compilation seras longue sur un processeur de cette vitesse et les outils dépendant de la version installé sur le BBB, je ne documenterai pas cette section.
56
57 16 Patrice Nadeau
### Développement à partir d'un autre poste
58 1 Patrice Nadeau
59
Comme pour les AVR d'ATMEL, l’écriture du code source et sa compilation peut être faite à partir d'un autre poste.
60
61 16 Patrice Nadeau
#### Poste GNU/Linux
62 9 Patrice Nadeau
63 16 Patrice Nadeau
J'utilise ici une station de travail sous openSUSE Leap 15.2.
64 8 Patrice Nadeau
65 23 Patrice Nadeau
Télécharger les fichier suivants:
66 1 Patrice Nadeau
* Compilateur (gcc) 
67 24 Patrice Nadeau
  * <http://software.opensuse.org/package/cross-arm-linux-gnueabi-binutils>
68 23 Patrice Nadeau
  * <http://software.opensuse.org/package/cross-arm-linux-gnueabi-gcc>
69 1 Patrice Nadeau
* Librairies
70 23 Patrice Nadeau
  * <http://software.opensuse.org/package/cross-arm-linux-gnueabi-kernel-headers>
71
  * http://software.opensuse.org/package/cross-arm-linux-gnueabi-glibc>
72
  * <http://software.opensuse.org/package/cross-arm-linux-gnueabi-libffi>
73 1 Patrice Nadeau
74 18 Patrice Nadeau
<https://github.com/VegetableAvenger/BBBIOlib>
75 1 Patrice Nadeau
76
En tant que *root* :
77 20 Patrice Nadeau
```bash
78 1 Patrice Nadeau
# Installer les packages
79
rpm -Uhv cross-arm-linux-gnueabi*.rpm
80
# Créer le lien vers les exécutable
81
ln -s /opt/cross/bin /usr/local/arm
82 20 Patrice Nadeau
```
83 1 Patrice Nadeau
84
Créer le fichier */etc/profile.d/arm.sh*
85 20 Patrice Nadeau
```bash
86 1 Patrice Nadeau
#!/bin/bash
87
# Export path for ARM tollchain
88
export PATH=/usr/local/arm:${PATH}
89
export MANPATH=/opt/cross/share/man:${MANPATH}
90 20 Patrice Nadeau
```
91 1 Patrice Nadeau
92 16 Patrice Nadeau
### Utilisation
93 1 Patrice Nadeau
94 16 Patrice Nadeau
#### GNU/Linux
95 10 Patrice Nadeau
96
En tant qu'utilisateur, se relogguer OU dans la session _courante_, exécuter
97 19 Patrice Nadeau
```bash
98 1 Patrice Nadeau
source /etc/profile.d/arm.sh
99
```
100
101 16 Patrice Nadeau
## Création du code
102 1 Patrice Nadeau
103
Créer un fichier *test.c*
104 20 Patrice Nadeau
```c
105 1 Patrice Nadeau
#include <stdio.h>
106
void (main)(void)
107
{
108
    printf("Allo la terre !\n");
109
    int x;
110
}
111 20 Patrice Nadeau
```
112 1 Patrice Nadeau
113 16 Patrice Nadeau
### Compilation 
114 1 Patrice Nadeau
115
Compiler avec 
116 20 Patrice Nadeau
```bash
117 1 Patrice Nadeau
arm-linux-gnueabi-gcc test.c -o test
118 20 Patrice Nadeau
```
119 1 Patrice Nadeau
120 16 Patrice Nadeau
### Téléchargement
121 1 Patrice Nadeau
122
Copier l’exécutable dans le BBB
123
124 20 Patrice Nadeau
```bash
125 1 Patrice Nadeau
scp test root@192.168.7.2:
126 20 Patrice Nadeau
```
127 1 Patrice Nadeau
128 11 Patrice Nadeau
Ouvrir une session et exécuter le programme directement dans sur le BBB
129 1 Patrice Nadeau
130 20 Patrice Nadeau
```bash
131 1 Patrice Nadeau
ssh root@192.168.7.2
132
./test
133 20 Patrice Nadeau
```