1 ARM dev tools per Debian (Sid) - ITA¶
- Author
Andrea Manni
- Copyright
GFDL
- Version
0.1
Questi appunti sono ad uso privato.
Indice degli argomenti
Generato il 2023-02-13 con: http://docutils.sourceforge.net/rst.html
1.1 Debian arch¶
- Modify sources.list to have::
deb http://ftp.debian.org/debian/ sid main non-free contrib
As often mirrors don’t have Debian armhf port availabe. You need to pull the ftp archive.
Add the right architecture: for ARM we use:
dpkg --add-architecture armhf
apt-get update
dpkg --print-architecture # That's what your host is using
dpkg --print-foreign-architectures # That's your target enviroments
Now install the cross compiler, Sid should have a pretty well updated version. You may wanna take a snapshot / backup of the system now:
lvcreate -s -L5g -n sid_bak /dev/main/sid
apt-get install crossbuild-essential-armhf
The cross compiler is meant to build code for a Linux system, something like a embedded RaspberryPy running Debian and not a Cortex ARM processor for any microcontroller.
1.2 Test the build chain¶
Take whathever c++ example file:
#include <iostream> // a PREPROCESSOR directive
using namespace std; // make definitions visible
int main() // function header
{ // start of function body
cout << "This is ARM code."; // message
cout << endl; // start a new line
cout << "You won't regret it!" << endl; // more output
return 0; // terminate main()
} // end of function body
- And compile it::
arm-linux-gnueabihf-g++ hello.cpp file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=0ecbdddcde90341984c81cddc027d9cb127503c9, not stripped
Questo dovrebbe girare su una OrangePC / RPi:
OrangePI:/tmp:$ dpkg --print-architecture
armhf
Ma possiamo testare il binario su x86 (AMD64) con Qemu:
apt-get install qemu-user-static
apt-get install libicu-dev:armhf
Libraries should go to: /usr/lib/arm-linux-gnueabihf/
.
1.3 Boards¶
MSP432 Launchpad is ARM 32Bit Cortex M4F
Nucleo NUCLEO-L476RG has a CPU STM32L476RG: Ultra-low-power with FPU ARM Cortex-M4 MCU 80 MHz with 1 Mbyte Flash: https://developer.mbed.org/platforms/ST-Nucleo-L476RG/
OrangePC: armhf , ARMv7 Processor rev 5 (v7l)
Cortex M4 is ARMv7E-M
1.4 Eclipse¶
Download last version of eclipse CDT: https://eclipse.org/cdt/downloads.php
Create a new project “hello world” like:
* Cross compiler Prefix: arm-linux-gnueabihf-
* CC Path: /usr/bin
It should compile, Project properties -> Tool Chain -> should say Cross CC
.
1.5 Debug su remoto embedded¶
Questa procedura e’ per i sistemi embedded come RPi / OrangePi in cui e’ disponibile un sistema operativo Gnu/Linux su cui possiamo installare un GDB server e copiare i file oggetto via SSH o simile.
Install from the main archive “General purpouse tools” -> Remote System Explorer User Actions” . Con questo si puo’ stabilire una connessione (SSH - FTP) a un host embedded come RPi.
1.5.1 GDB server sulla macchina target¶
apt-get install gdbserver
1.5.2 Debug client sull’host¶
Installare il client muliarch e precisare dentro il Workspace di Eclipse che trattasi di ARM:
apt-get install gdb-multiarch
vim ~/workspace/arm/.gdbinit
set architecture arm
1.6 uC ARM plugin per Eclipse¶
Aggiungere http://gnuarmeclipse.sourceforge.net/updates
ai repo del software per Eclipse, installare ``
Scaricare STLink-master: https://github.com/texane/stlink.git
per compilare serve: apt-get install autoconf
- ::
cd stlink/ apt-get install autoconf
./autogen.sh
./configure apt-get install libusb-1.0-0-dev # dipendenze secondo bisogno make sudo make install
1.8 Gnu-ebi¶
Gnu-ebi are needed for system with no FPU like most of the old cortex uC.