0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LLVM-ET-Arm-19.1.5-Darwin-universalをMacBookで使う

Posted at

LLVM Embedded Toolchain for ArmをMacbook Pro (Apple M3 Pro)にインストールしたメモ。

インストール

ここからリリース版をダウンロードする。
https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases

ダウンロードしたファイル
LLVM-ET-Arm-19.1.5-Darwin-universal.dmg

ダブルクリックすると、以下のようなウィンドウが出来るので、Applicationsフォルダにコピーする。

image.png

ターミナルを開く

PATHを通して、バージョンを確認する。

$ export PATH=/Applications/LLVM-ET-Arm-19.1.5-Darwin-universal/bin:$PATH
$ clang --version
clang version 19.1.5
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /Applications/LLVM-ET-Arm-19.1.5-Darwin-universal/bin

QEMUをインストールする

$ brew install qemu

サンプルプログラムのビルドと実行

サンプルプログラム(baremetal-semihosting)をビルドする

$ cd /Applications/LLVM-ET-Arm-19.1.5-Darwin-universal/samples/src/baremetal-semihosting
$ make
../../../bin/clang --target=armv6m-none-eabi -march=armv6m -mfpu=none -mfloat-abi=soft -lcrt0-semihost -lsemihost -g -T ../../ldscripts/microbit.ld -o hello.elf hello.c

ファイルを確認する。

$ file hello.elf
hello.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped

プログラムを実行する

$ make run
qemu-system-arm -M microbit -semihosting -nographic -device loader,file=hello.hex
Hello World!

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?