Wiki » Historique » Version 18
Patrice Nadeau, 2014-07-24 21:00
| 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 | > Copier localement le fichier */boot/Drivers/Linux/FTDI/mkudevrule.sh*. |
||
| 41 | > A partir d'une session terminal |
||
| 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 | Compilateur (gcc) |
||
| 64 | * http://software.opensuse.org/package/cross-arm-linux-gnueabi-binutils |
||
| 65 | * http://software.opensuse.org/package/cross-arm-linux-gnueabi-gcc |
||
| 66 | |||
| 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 | Le compilateur est installé dans */opt/cross/bin/* |
||
| 73 | * arm-linix-gnueabi-gcc |
||
| 74 | 5 | Patrice Nadeau | * ... |
| 75 | 6 | Patrice Nadeau | |
| 76 | 5 | Patrice Nadeau | Créer le lien vers l’exécutable : |
| 77 | <pre><code class="bash"> |
||
| 78 | ln -s /opt/cross/bin /usr/local/arm |
||
| 79 | </code></pre> |
||
| 80 | 10 | Patrice Nadeau | |
| 81 | 1 | Patrice Nadeau | Crer le fichier */etc/profile.d/arm.sh* |
| 82 | 7 | Patrice Nadeau | <pre><code class="bash"> |
| 83 | #!/bin/bash |
||
| 84 | 5 | Patrice Nadeau | # Export path for ARM tollchain |
| 85 | 1 | Patrice Nadeau | export PATH=/usr/local/arm:${PATH} |
| 86 | 7 | Patrice Nadeau | export MANPATH=/opt/cross/share/man:${MANPATH} |
| 87 | </code></pre> |
||
| 88 | 11 | Patrice Nadeau | |
| 89 | h1. Utilisation |
||
| 90 | |||
| 91 | 1 | Patrice Nadeau | En tant qu'utilisateur, se relogguer OU dans la session _courante_ |
| 92 | 7 | Patrice Nadeau | <pre><code class="bash"> |
| 93 | 1 | Patrice Nadeau | source /etc/profile.d/arm.sh |
| 94 | </code></pre> |
||
| 95 | |||
| 96 | 18 | Patrice Nadeau | h2. Création du code |
| 97 | 11 | Patrice Nadeau | |
| 98 | 10 | Patrice Nadeau | Créer un fichier *test.c* |
| 99 | <pre><code class="c"> |
||
| 100 | #include <stdio.h> |
||
| 101 | void (main)(void) |
||
| 102 | { |
||
| 103 | printf("Allo la terre !\n"); |
||
| 104 | int x; |
||
| 105 | } |
||
| 106 | 1 | Patrice Nadeau | </code></pre> |
| 107 | |||
| 108 | 11 | Patrice Nadeau | h2. Compilation |
| 109 | |||
| 110 | 10 | Patrice Nadeau | Compiler avec |
| 111 | <pre><code class="bash"> |
||
| 112 | 1 | Patrice Nadeau | arm-linux-gnueabi-gcc test.c -o test |
| 113 | </code></pre> |
||
| 114 | 11 | Patrice Nadeau | |
| 115 | h2. Téléchargement dans le BeagleBone |
||
| 116 | 16 | Patrice Nadeau | |
| 117 | Copier l’exécutable dans le BeagleBone Black |
||
| 118 | |||
| 119 | <pre><code class="bash"> |
||
| 120 | scp test root@192.168.7.2: |
||
| 121 | </code></pre> |
||
| 122 | |||
| 123 | Ouvrir une session dans et exécuter le programme directement dans le BeagleBone |
||
| 124 | |||
| 125 | <pre><code class="bash"> |
||
| 126 | ssh root@192.168.7.2 |
||
| 127 | ./test |
||
| 128 | </code></pre> |