Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
GCC ARM problem example
.global activate
activate:
b test
.global _start
_start:
ldr sp, =0x07FFFFFF
bl main
void activate(void);
void test(void) {
char *s = "Yay!\n";
while(*s) {
*(volatile char*)0x101f1000 = *s;
s++;
}
}
int main(void) {
char *string = "Hello, World!\n";
char *string2 = "Done!\n";
while(*string) {
*(volatile char*)0x101f1000 = *string;
string++;
}
activate();
while(*string2) {
*(volatile char*)0x101f1000 = *string2;
string2++;
}
while(1); /* We can't exit, there's nowhere to go */
return 0;
}
CC=arm-linux-gnueabi-gcc
LD=arm-linux-gnueabi-ld
CFLAGS=-ansi -pedantic -Wall -Wextra -march=armv6 -msoft-float -fPIC -mapcs-frame
LDFLAGS=-N -Ttext=0x10000
kernel.elf: bootstrap.o kernel.o activate.o
.PHONY: clean
clean:
$(RM) *.elf *.o
.SUFFIXES: .s .o .elf
.s.o:
$(CC) $(CFLAGS) -o $@ -c $^
.o.elf:
$(LD) $(LDFLAGS) -o $@ $^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.