Wiki » Historique » Version 26
  Patrice Nadeau, 2014-07-24 21:22 
  
| 1 | 2 | Patrice Nadeau | %{font-size:18pt}Utilisation d'un BeagleBone Black% | 
|---|---|---|---|
| 2 | |||
| 3 | 23 | 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 | 25 | Patrice Nadeau | h1. Introduction  | 
| 12 | |||
| 13 | Le BBB est un ordinateur complet avec licence libre utilisant GN/Linux comme système d'exploitation.  | 
||
| 14 | Toutes les spécifications sont disponibles sur le site http://beagleboard.org/.  | 
||
| 15 | 1 | Patrice Nadeau | |
| 16 | Ceci en fait un outil de développement idéal.  | 
||
| 17 | 26 | Patrice Nadeau | |
| 18 | Ce document explique comment utiliser un poste sous openSUSE pour faire du développement avec la langage C.  | 
||
| 19 | |||
| 20 | J'ai choisi cette méthode pour les raisons suivantes  | 
||
| 21 | * La programmation des µc AVR d'Atmel se fait de cette manière  | 
||
| 22 | * Je connais déjà le C  | 
||
| 23 | * Linux est écrit en C  | 
||
| 24 | 25 | Patrice Nadeau | |
| 25 | 1 | Patrice Nadeau | h1. Matériel requis  | 
| 26 | |||
| 27 | * BeagleBone Black (Digikey #"BB-BBLK-000-REVC-ND":http://www.digikey.ca/product-detail/en/BB-BBLK-000/BB-BBLK-000-REVC-ND/4842211)  | 
||
| 28 | |||
| 29 | 18 | Patrice Nadeau | h2. Mode « slave »  | 
| 30 | 1 | Patrice Nadeau | |
| 31 | 18 | Patrice Nadeau | * Câble USB A - Mini-B (fournis avec le BBB)  | 
| 32 | |||
| 33 | h2. Mode « stand-alone »  | 
||
| 34 | |||
| 35 | Dans ce mode le BBB se comporte comme un ordinateur complet.  | 
||
| 36 | |||
| 37 | 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)  | 
| 38 | * Câble Ethernet  | 
||
| 39 | > Facultatif  | 
||
| 40 | > * Concentrateur USB  | 
||
| 41 | 1 | Patrice Nadeau | > * Clavier/souris  | 
| 42 | > * Adaptateur vidéo  | 
||
| 43 | |||
| 44 | 18 | Patrice Nadeau | h1. Branchement  | 
| 45 | 1 | Patrice Nadeau | |
| 46 | 18 | Patrice Nadeau | Peux importe la méthode, le BBB seras disponible a l'adresse *192.168.7.2* avec l'utilisateur *root*.  | 
| 47 | 3 | Patrice Nadeau | |
| 48 | 18 | Patrice Nadeau | h2. Mode « slave »  | 
| 49 | |||
| 50 | 24 | Patrice Nadeau | Brancher le BBB à l'ordinateur en utilisant le port Micro-B.  | 
| 51 | 12 | Patrice Nadeau | Un nouveau média apparaitra ainsi qu'une nouvelle carte réseau.  | 
| 52 | 15 | Patrice Nadeau | |
| 53 | > Optionnellement  | 
||
| 54 | 19 | Patrice Nadeau | > A partir du nouveau media, copier localement le fichier *boot/Drivers/Linux/FTDI/mkudevrule.sh*.  | 
| 55 | > A partir d'une session terminal, exécuter le script  | 
||
| 56 | 12 | Patrice Nadeau | ><pre><code class="bash">  | 
| 57 | 13 | Patrice Nadeau | chmod +x mkudevrule.sh  | 
| 58 | 1 | Patrice Nadeau | sudo ./mkudevrule.sh  | 
| 59 | </code></pre>  | 
||
| 60 | |||
| 61 | 18 | Patrice Nadeau | h2. Mode « master »  | 
| 62 | |||
| 63 | Au minimum, brancher les câbles d'alimentation Ethernet.  | 
||
| 64 | Un clavier, souris et écran peuvent aussi être branchés.  | 
||
| 65 | |||
| 66 | h1. Logiciel requis  | 
||
| 67 | |||
| 68 | h2. Développement local  | 
||
| 69 | |||
| 70 | 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.  | 
||
| 71 | |||
| 72 | 3 | Patrice Nadeau | h2. Développement à partir d'un autre poste  | 
| 73 | |||
| 74 | 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.  | 
| 75 | 3 | Patrice Nadeau | |
| 76 | 20 | Patrice Nadeau | Télécharger les fichier suivants  | 
| 77 | * Compilateur (gcc)  | 
||
| 78 | ** http://software.opensuse.org/package/cross-arm-linux-gnueabi-binutils  | 
||
| 79 | ** http://software.opensuse.org/package/cross-arm-linux-gnueabi-gcc  | 
||
| 80 | * Librairies  | 
||
| 81 | ** http://software.opensuse.org/package/cross-arm-linux-gnueabi-kernel-headers  | 
||
| 82 | ** http://software.opensuse.org/package/cross-arm-linux-gnueabi-glibc  | 
||
| 83 | ** http://software.opensuse.org/package/cross-arm-linux-gnueabi-libffi  | 
||
| 84 | 4 | Patrice Nadeau | |
| 85 | 20 | Patrice Nadeau | En tant que *root* :  | 
| 86 | 6 | Patrice Nadeau | <pre><code class="bash">  | 
| 87 | 20 | Patrice Nadeau | # Installer les packages  | 
| 88 | rpm -Uhv cross-arm-linux-gnueabi*.rpm  | 
||
| 89 | # Créer le lien vers les exécutable  | 
||
| 90 | 5 | Patrice Nadeau | ln -s /opt/cross/bin /usr/local/arm  | 
| 91 | 10 | Patrice Nadeau | </code></pre>  | 
| 92 | 1 | Patrice Nadeau | |
| 93 | 20 | Patrice Nadeau | Créer le fichier */etc/profile.d/arm.sh*  | 
| 94 | 7 | Patrice Nadeau | <pre><code class="bash">  | 
| 95 | 5 | Patrice Nadeau | #!/bin/bash  | 
| 96 | 1 | Patrice Nadeau | # Export path for ARM tollchain  | 
| 97 | 7 | Patrice Nadeau | export PATH=/usr/local/arm:${PATH} | 
| 98 | export MANPATH=/opt/cross/share/man:${MANPATH} | 
||
| 99 | 11 | Patrice Nadeau | </code></pre>  | 
| 100 | |||
| 101 | h1. Utilisation  | 
||
| 102 | 1 | Patrice Nadeau | |
| 103 | 7 | Patrice Nadeau | En tant qu'utilisateur, se relogguer OU dans la session _courante_  | 
| 104 | 1 | Patrice Nadeau | <pre><code class="bash">  | 
| 105 | source /etc/profile.d/arm.sh  | 
||
| 106 | </code></pre>  | 
||
| 107 | 18 | Patrice Nadeau | |
| 108 | 11 | Patrice Nadeau | h2. Création du code  | 
| 109 | 10 | Patrice Nadeau | |
| 110 | Créer un fichier *test.c*  | 
||
| 111 | <pre><code class="c">  | 
||
| 112 | #include <stdio.h>  | 
||
| 113 | void (main)(void)  | 
||
| 114 | { | 
||
| 115 |     printf("Allo la terre !\n"); | 
||
| 116 | int x;  | 
||
| 117 | 1 | Patrice Nadeau | }  | 
| 118 | </code></pre>  | 
||
| 119 | 11 | Patrice Nadeau | |
| 120 | h2. Compilation  | 
||
| 121 | 10 | Patrice Nadeau | |
| 122 | Compiler avec  | 
||
| 123 | 1 | Patrice Nadeau | <pre><code class="bash">  | 
| 124 | arm-linux-gnueabi-gcc test.c -o test  | 
||
| 125 | 11 | Patrice Nadeau | </code></pre>  | 
| 126 | |||
| 127 | 22 | Patrice Nadeau | h2. Téléchargement  | 
| 128 | 16 | Patrice Nadeau | |
| 129 | 21 | Patrice Nadeau | Copier l’exécutable dans le BBB  | 
| 130 | 16 | Patrice Nadeau | |
| 131 | <pre><code class="bash">  | 
||
| 132 | scp test root@192.168.7.2:  | 
||
| 133 | </code></pre>  | 
||
| 134 | |||
| 135 | 21 | Patrice Nadeau | Ouvrir une session dans et exécuter le programme directement dans le BBB  | 
| 136 | 16 | Patrice Nadeau | |
| 137 | <pre><code class="bash">  | 
||
| 138 | ssh root@192.168.7.2  | 
||
| 139 | ./test  | 
||
| 140 | 1 | Patrice Nadeau | </code></pre>  |