arm: Add a test with mixed ARM and Thumb code

This commit is contained in:
Tristan Ravitch 2018-08-20 22:28:04 -07:00
parent f7b87224a4
commit c718b41dc6
2 changed files with 29 additions and 6 deletions

View File

@ -1,19 +1,22 @@
A32CC=arm-none-eabi-gcc
T32CC=arm-none-eabi-gcc -march=armv7-m
A32CC=arm-linux-gnueabi-gcc
# arm-none-eabi-gcc
T32CC=arm-linux-gnueabi-gcc -mthumb
# -march=armv7-m
# arm-none-eabi-gcc -march=armv7-m
all: $(patsubst %.c,%-a32.exe,$(wildcard *.c)) $(patsubst %.c,%-t32.exe,$(wildcard *.c))
%-a32.exe: %.s
%-a32.exe: %-a32.s
$(A32CC) -fno-stack-protector -nostdlib $< -o $@
%-t32.exe: %.s
%-t32.exe: %-t32.s
$(T32CC) -fno-stack-protector -nostdlib $< -o $@
%-a32.s: %.c
$(CC) -fno-stack-protector -S -c $< -o $@
$(A32CC) -fno-stack-protector -S -c $< -o $@
%-t32.s: %.c
$(CC) -march=thumb -fno-stack-protector -S -c $< -o $@
$(T32CC) -fno-stack-protector -S -c $< -o $@
.PRECIOUS: %.s

View File

@ -0,0 +1,20 @@
#include "util.h"
void thumbFunc(int x, int*res) __attribute__((target("thumb")));
void thumbFunc(int x, int* res) {
if(x > 0) {
x = x + 10;
}
*res = x;
}
void driver(int x, int* res) {
thumbFunc(x + 1, res);
}
void _start() {
int i;
driver((int)&driver, &i);
EXIT();
}