-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun_example.py
More file actions
26 lines (18 loc) · 898 Bytes
/
run_example.py
File metadata and controls
26 lines (18 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python3
import os
import sys
import shutil
# build ARMORY
if not os.path.exists("build/"):
if os.system("meson -Db_lto=true --buildtype=release build") != 0: sys.exit(1)
if os.system("meson compile -C build/") != 0: sys.exit(1)
# dir for tmp data
os.makedirs("example/tmp_data/", exist_ok=True)
# build the ARM binary
if os.system("arm-none-eabi-gcc -Wall -Wpedantic -std=c11 -ffreestanding -nostdlib -mthumb -march=armv7-m -O3 -Wl,-Texample/linker.ld -Wl,-Map,example/tmp_data/binary.map example/example.c -o example/tmp_data/binary.elf") != 0: sys.exit(1)
# create disassembly for looking up armory results later
if os.system("arm-none-eabi-objdump example/tmp_data/binary.elf -d > disassembled.txt") != 0: sys.exit(1)
# start fault simulation
if os.system("cd example && python3 start_emulation.py") != 0: sys.exit(1)
# cleanup tmp data
shutil.rmtree("example/tmp_data/")