Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

#/target
/tmp
/temp
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name = "trivic"
path = "src/main.rs"

[dependencies]
indoc = "2.0"


[dev-dependencies]
Expand Down
13 changes: 13 additions & 0 deletions main.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.syntax unified
.thumb

.section .text
.global _start
.type _start, %function

_start:
mov r0, #69
mov r7, #1
svc #0

.size _start, .-_start
13 changes: 13 additions & 0 deletions playground/main.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.syntax unified
.thumb

.section .text
.global _start
.type _start, %function

_start:
mov r0, #67
mov r7, #1
svc #0

.size _start, .-_start
19 changes: 19 additions & 0 deletions playground/run_asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

ASM_FILE="${1:-main.asm}"

if [ ! -f "$ASM_FILE" ]; then
echo "Error: File '$ASM_FILE' does not exist" >&2
exit 1
fi

BASE_NAME="${ASM_FILE%.asm}"

arm-none-eabi-as -mthumb -o "${BASE_NAME}.o" "$ASM_FILE"

arm-none-eabi-ld -o "$BASE_NAME" "${BASE_NAME}.o"

qemu-arm ./"$BASE_NAME"
echo $?

rm "${BASE_NAME}.o" "$BASE_NAME"
3 changes: 3 additions & 0 deletions playground/test.trv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
func main() -> Integer {
return 420;
}
12 changes: 12 additions & 0 deletions run_asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# make assemble
arm-none-eabi-as -mthumb -o main.o main.asm

# link
arm-none-eabi-ld -o main main.o

# run
qemu-arm ./main
echo $?

rm main.o main
Loading