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