# devkitARM Compilation BASH Script

**URL:** <https://feuniverse.us/t/devkitarm-compilation-bash-script/405>\
**Category:** Resources\
**Created:** [August 21, 2014, 2:16am UTC](https://feuniverse.us/t/devkitarm-compilation-bash-script/405 "2014-08-21T02:16:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crazycolorz5](https://feuniverse.us/user_avatar/feuniverse.us/crazycolorz5/32/3875_2.png) [@Crazycolorz5](https://feuniverse.us/u/Crazycolorz5)\
**Post date:** [August 21, 2014, 2:16am UTC](https://feuniverse.us/t/devkitarm-compilation-bash-script/405/1 "2014-08-21T02:16:12Z")

</div>

Since I’m working a lot on a Mac laptop recently (because it’s the only laptop I could mooch off for free) I spent the last good three hours researching BASH and stuff to make a script to compile my asm goodies. And I thought I’d share because I’m that kind of person. Here ya go. You’ll want to run it in Automator using [these instructions](http://superuser.com/a/239235).  
(Obviously, change the second line to where you installed devkitpro)

```
#!/bin/bash

devkit=(Where you installed devkit pro)/devkitpro/devkitARM/bin/

FileDir=$(dirname "$1")
FILE=$(basename "$1")
FileName="${FILE%.*}"

$devkit/arm-none-eabi-as -g -mcpu=arm7tdmi -mthumb-interwork "$1" -o "$FileDir/$FileName.elf"

#Print symbol table
#Use this if you want, I guess? I never used it so...
#/arm-none-eabi-readelf/ -s "%~n1.elf" "%~n1.symbols.log"

# Extract raw assembly binary (text section) from elf
$devkit/arm-none-eabi-objcopy -S "$FileDir/$FileName.elf" -O binary "$FileDir/$FileName.dmp"

rm "$FileDir/$FileName.elf"

echo "Compiled."

```

Edit: It’s really difficult to get compiler output if you run this through Automator. So either get your code right, or just use Terminal

---

<div class="post-metadata">

**Author:** ![CT075](https://feuniverse.us/user_avatar/feuniverse.us/ct075/32/1182_2.png) [@CT075](https://feuniverse.us/u/CT075)\
**Post date:** [January 3, 2015, 5:44pm UTC](https://feuniverse.us/t/devkitarm-compilation-bash-script/405/2 "2015-01-03T17:44:18Z")

</div>

may as well add that if you’re on a unix-based system, you can run assemble-arm from shell/terminal directly by running the following in the folder containing “assemble-arm.sh” (or just “assemble-arm” or whatever)

`sudo cp ./assemble-arm.sh /usr/bin/assemble-arm
sudo chmod +x /usr/bin/assemble-arm`
