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