---
title: "Embedded Tutorial (1): Kompilieren auf PC für Arm"
description: "Wer Code für Embedded Systeme entwickelt, wird früher oder später mit folgender Herausforderung konfrontiert: Man muss auf seinem x86-PC Code für das Embedded Device kompilieren, welches auf Arm läuft."
image: https://blog.phytec.de/hubfs/Blog%20Featured%20Images/Embedded%20Tutorial%20-1.jpg
---

[Skip to content](https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm#main-content)

[![PHYTEC Logo](https://blog.phytec.de/hubfs/logo-PHYTEC-1.svg "PHYTEC Logo")](https://blog.phytec.de/)

![](data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iNTEycHgiIGhlaWdodD0iNTEycHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIzMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiB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JuZXcgMCAwIDI0IDI0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNMTcuMjUsMTcuMjVMNi43NSw2Ljc1Ii8+DQo8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTE3LjI1LDYuNzVsLTEwLjUsMTAuNSIvPg0KPC9zdmc+DQo=)

- [Zur PHYTEC Startseite](https://www.phytec.de/startseite/)
- [Kontakt](https://blog.phytec.de/kontakt)

![](https://blog.phytec.de/hubfs/raw_assets/public/Phytec%20-%20Blog%20Theme/images/icon-suche-w.svg)

[Zurück zu allen Artikeln](https://blog.phytec.de)

- [Wissen](https://blog.phytec.de/tag/wissen)
- [Applikationen](https://blog.phytec.de/tag/applikationen)
- [Software](https://blog.phytec.de/tag/software)

# Embedded Tutorial (1): Kompilieren auf PC für Arm

![Christian Waidner](https://blog.phytec.de/hubfs/Mitarbeiter-Fotos/Christian-Waidner.png)

Von [Christian Waidner](https://blog.phytec.de/author/christian-waidner)

14 Dezember 2022

[![Share on linkedin](https://blog.phytec.de/hubfs/Pyhtec%20Theme/images/linkedin-color.svg)](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=linkedin) [![Share on twitter](https://blog.phytec.de/hubfs/Pyhtec%20Theme/images/twitter-color.svg)](https://twitter.com/intent/tweet?original_referer=https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=twitter&url=https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=twitter&source=tweetbutton&text=) [![Share on facebook](https://blog.phytec.de/hubfs/Pyhtec%20Theme/images/facebook-color.svg)](http://www.facebook.com/share.php?u=https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=facebook) [![Share on email](https://blog.phytec.de/hubfs/Pyhtec%20Theme/images/email-color.svg)](mailto:?subject=Check%20out%20https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=email%20&body=Check%20out%20https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm&utm_medium=social&utm_source=email)

Wer Code für Embedded Systeme entwickelt, wird früher oder später mit folgender Herausforderung konfrontiert: Man muss auf seinem x86-PC Code für das Embedded Device kompilieren, welches auf Arm läuft. Da beide Systeme nicht kompatibel sind, kann x86-kompilierter Code nicht auf Arm ausgeführt werden und umgekehrt. Daher benötigt man ein Cross-Compiling Setup.

![Embedded Tutorial (1): Kompilieren auf PC für Arm](https://blog.phytec.de/hs-fs/hubfs/Blog%20Featured%20Images/Embedded%20Tutorial%20-1.jpg?width=1920&height=1080&name=Embedded%20Tutorial%20-1.jpg)

Wir möchten Ihnen eine Crosscompiling-Möglichkeit vorstellen, die auch bei Phytec eingesetzt wird: Die Verwendung eines Crosscompilers in einem Docker Container. Zu diesem Zweck realisieren wir in diesem Tutorial ein simples „Hello World“ Programm in C, das auf einem Armv7 System ausgeführt werden soll (zum Beispiel einem phyCORE Modul von Phytec oder auch einem Raspberry Pi).

## How-To: Cross-Kompilieren auf PC für Arm

Schritt 1: Docker installieren

Die Installationsdateien für Docker finden Sie direkt auf der Docker Webseite: [https://www.docker.com/get-started](https://www.docker.com/get-started)

Ich verwende Docker für Windows, das Tutorial kann aber natürlich auch mit Linux oder Mac verwendet werden.

Schritt 2: Die bash-shell öffnen

Wer, wie ich, mit Windows arbeitet, muss erst einen Bash-Layer installieren, zum Beispiel [https://www.cygwin.com/](https://www.cygwin.com/)

Schritt 3: Dockcross installieren

Nun wird die richtige Variante von Dockcross für das jeweilige Embedded Device gewählt. Hierfür muss das Betriebssystem des Zielgeräts bekannt sein, sowie auch die Art des Prozessors. In meinem Setup laufen beide Zielgeräte mit Linux. Die Prozessorarchitektur kann in der Kommandozeile mit dem Befehl „uname“ angezeigt werden: Mein phyCORE-i.MX 8M Mini läuft mit aarch64 (eine arm8-Variante) und mein Zero Pi 2W mit armv7l . Da Arm8 abwärtskompatibel ist, wähle ich nun also für die Dockcross-Installation das Image dockcross/linux-armv7.

Um Dockcross zu verwenden, muss ein Hilfsscript ausgeführt werden. Nach dem Download von Dockcross kann dieses Skript automatisch erstellt werden. Es muss mit chmod als ausführbarer Code markiert werden.

*docker run --rm dockcross/linux-armv7 > ./dockcross*  
*chmod +x ./dockcross*

## Hardware- und Software-Schulungen & Trainings

[**Mehr erfahren**](https://cta-eu1.hubspot.com/web-interactives/public/v1/track/click?encryptedPayload=AVxigLKe5Mb9ZIPaKNKeKRuvR6K5cTtMaOB53kjAE6Wo25CEQMhwLZv4J4foWhvEIRmGh37ZYzgyhlYAPQhg30NpoaJujXkLufZZt2k5%2BEud5TmGlmvCIPbEfdkNMeJgqpgAHHFuxYP5pJJXQbQX8rqKtzy%2Bw%2FcDrmRNwsv7KHgS8sWNtUHf%2FrzHn0hVDyqu9nTcZGgedIcm2nqWgQ%3D%3D&portalId=26743233)

**Schritt 4: „Hello World“ Programm erstellen**

Für mein Tutorial schreibe ich ein einfaches Programm, dass ich als hello.c abspeichere:

![cprogrammtutorialdockcross-1024x93](https://blog.phytec.de/hs-fs/hubfs/cprogrammtutorialdockcross-1024x93.png?width=1024&height=93&name=cprogrammtutorialdockcross-1024x93.png)

**Schritt 5: Cross-Kompilieren**

Das Cross-Kompilieren kann mit folgendem Befehl gestartet werden:

*./dockcross bash -c '$CC -static hello.c -o hello\_arm'*

Und das war es dann auch schon: hello\_arm ist als „static binary“ für arm kompiliert. Das kann auch nochmal überprüft werden:

![hello arm als static binary für arm kompiliert](https://blog.phytec.de/hs-fs/hubfs/image2022-1-17_14-43-41.png?width=722&height=71&name=image2022-1-17_14-43-41.png)

**Schritt 6: Code ausführen**

Via SCP kann nun das Image auf das Embedded Device kopiert werden:

*scp hello\_arm polis:/tmp*

Zum Schluss ist der Code auf dem Embedded Device ausführbar:

![sshtutorialdockcross](https://blog.phytec.de/hs-fs/hubfs/sshtutorialdockcross.png?width=772&height=123&name=sshtutorialdockcross.png)

 

 Linux, Yocto, u.v.m

## Software + Hardware Schulungen und Trainings

[**Mehr erfahren**](https://cta-eu1.hubspot.com/web-interactives/public/v1/track/click?encryptedPayload=AVxigLKe5Mb9ZIPaKNKeKRuvR6K5cTtMaOB53kjAE6Wo25CEQMhwLZv4J4foWhvEIRmGh37ZYzgyhlYAPQhg30NpoaJujXkLufZZt2k5%2BEud5TmGlmvCIPbEfdkNMeJgqpgAHHFuxYP5pJJXQbQX8rqKtzy%2Bw%2FcDrmRNwsv7KHgS8sWNtUHf%2FrzHn0hVDyqu9nTcZGgedIcm2nqWgQ%3D%3D&portalId=26743233)

![Christian Waidner](https://blog.phytec.de/hubfs/Mitarbeiter-Fotos/Christian-Waidner.png)

 Von [Christian Waidner](https://blog.phytec.de/author/christian-waidner)

Hallo, mein Name ist Christian Waidner und ich bin Business Process Manager in der PHYTEC. Da ich schon vor meiner Anstellung bei PHYTEC gerne geblogged habe, freue ich mich, Teil der PHYTEC Blog Redaktion zu sein.

## Verwandt

<https://blog.phytec.de/kuehlung-embedded-prozessoren?hsLang=de>

[Wissen](https://blog.phytec.de/tag/wissen) / 3min

### [Warum Kühlung für Embedded Prozessoren wichtig ist und was Sie dabei beachten sollten](https://blog.phytec.de/kuehlung-embedded-prozessoren?hsLang=de)

[Mehr erfahren](https://blog.phytec.de/kuehlung-embedded-prozessoren?hsLang=de)

<https://blog.phytec.de/phytec-stellt-demosystem-fuer-kontaktlose-temperaturmessung-vor?hsLang=de>

[Wissen](https://blog.phytec.de/tag/wissen), [Applikationen](https://blog.phytec.de/tag/applikationen) / 1min

### [PHYTEC präsentiert Demo für kontaktlose Temperaturmessung](https://blog.phytec.de/phytec-stellt-demosystem-fuer-kontaktlose-temperaturmessung-vor?hsLang=de)

[Mehr erfahren](https://blog.phytec.de/phytec-stellt-demosystem-fuer-kontaktlose-temperaturmessung-vor?hsLang=de)

<https://blog.phytec.de/mehrwert-evaluieren-embedded-system-lieferant?hsLang=de>

[Wissen](https://blog.phytec.de/tag/wissen) / 2min

### [Innovation, Technologie & Mehrwert: einfach „einbetten“ mit dem passenden Embedded System Lieferanten](https://blog.phytec.de/mehrwert-evaluieren-embedded-system-lieferant?hsLang=de)

[Mehr erfahren](https://blog.phytec.de/mehrwert-evaluieren-embedded-system-lieferant?hsLang=de)

## Vom i.MX 6 zum i.MX 8

Mit dem PHYTEC Migration Guide auf der Überholspur in die nächste Produktgeneration

[**Jetzt herunterladen**](https://cta-eu1.hubspot.com/web-interactives/public/v1/track/click?encryptedPayload=AVxigLKjbQ%2B20mbfOnKt5ErOFJ8zk7WUEff4u8XOeQzoufxHOYJFFRUDdO3%2F1OHp1QlUo%2F%2B1Y0ZPyYUBv%2B2S1kbgA0WQ0kp4S8UMik2W1SyG%2FQ%2BZ0oOIrcEIT04bhZqNMJZibzBLLRQlTAC6INCHL0QuPDbcUYoJUpa1AxufNGAHeSRlSJFYEt9%2Fw4o%3D&portalId=26743233)

 

[![logo-phytec-blog-weiß](https://blog.phytec.de/hubfs/logo-phytec-blog-wei%C3%9F.svg "logo-phytec-blog-weiß")](https://insights.phytec.de/news?hsLang=de)

- [Kontakt](https://blog.phytec.de/kontakt)
- [Impressum](https://www.phytec.de/impressum/)
- [Cookie-Richtlinien](https://www.phytec.de/cookie-richtlinie/)
- [Datenschutz](https://www.phytec.de/datenschutzerklaerung/)

<https://www.facebook.com/PHYTEC.Mainz> <https://twitter.com/phytec_gmbh> <https://www.linkedin.com/company/phytec-messtechnik-gmbh> <https://www.instagram.com/phytec_germany/> <https://www.youtube.com/user/PhytecMainz>

© 2026 PHYTEC Messtechnik GmbH | Barcelona-Allee 1 | 55129 Mainz | contact@phytec.de

 

### PHYTEC Newsletter abonnieren

© 2026 PHYTEC Messtechnik GmbH | Barcelona-Allee 1 | 55129 Mainz | contact@phytec.de

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Christian Waidner",
    "url" : "https://blog.phytec.de/author/christian-waidner"
  },
  "dateModified" : "2024-02-16T07:56:01.488Z",
  "datePublished" : "2022-12-14T07:41:00.000Z",
  "headline" : "Embedded Tutorial (1): Kompilieren auf PC für Arm",
  "image" : [ "https://blog.phytec.de/hubfs/Blog%20Featured%20Images/Embedded%20Tutorial%20-1.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.phytec.de/embedded-tutorial-1-kompilieren-auf-pc-fuer-arm",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.phytec.de/hubfs/logo-PHYTEC-1.svg"
    },
    "name" : "Phytec Messtechnik GmbH"
  }
}
```