diff --git a/lab1/Makefile b/lab1/Makefile index 12a7431..9385d8e 100644 --- a/lab1/Makefile +++ b/lab1/Makefile @@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc # The location of the C compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler # is installed. -ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. +ARMGCC_BIN := ${shell which ${CC}} +ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true) + ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/.. +else + ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. +endif -OBJECTS = main.o system.o startup.o +OBJECTS = main.o system.o startup.o syscalls.o NAME = lab @@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \ --specs=nano.specs all: $(NAME).out + @echo "SUCCESS: Compilation completed successfully." main.o: main.c @$(CC) $(CFLAGS) -g $< -c -o $@ @@ -50,6 +56,9 @@ system.o: ../system.c startup.o: ../startup.c @$(CC) $(CFLAGS) $< -c -o $@ +syscalls.o: ../syscalls.c + @$(CC) $(CFLAGS) $< -c -o $@ + $(NAME).out: $(OBJECTS) @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out diff --git a/lab2/Makefile b/lab2/Makefile index 06c5834..1a68222 100644 --- a/lab2/Makefile +++ b/lab2/Makefile @@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc # The location of the C compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler # is installed. -ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. +ARMGCC_BIN := ${shell which ${CC}} +ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true) + ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/.. +else + ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. +endif -OBJECTS = main.o bump.o delay.o clock.o system.o startup.o +OBJECTS = main.o bump.o delay.o clock.o system.o startup.o syscalls.o NAME = lab @@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \ --specs=nano.specs all: $(NAME).out + @echo "SUCCESS: Compilation completed successfully." main.o: main.c @$(CC) $(CFLAGS) -g $< -c -o $@ @@ -59,6 +65,9 @@ system.o: ../system.c startup.o: ../startup.c @$(CC) $(CFLAGS) $< -c -o $@ +syscalls.o: ../syscalls.c + @$(CC) $(CFLAGS) $< -c -o $@ + $(NAME).out: $(OBJECTS) @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out diff --git a/lab3/Makefile b/lab3/Makefile index 8cd1e5a..7920501 100644 --- a/lab3/Makefile +++ b/lab3/Makefile @@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc # The location of the C compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler # is installed. -ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. +ARMGCC_BIN := ${shell which ${CC}} +ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true) + ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/.. +else + ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. +endif -OBJECTS = main.o bump.o delay.o clock.o reflectance.o cpu.o system.o startup.o +OBJECTS = main.o bump.o delay.o clock.o reflectance.o cpu.o system.o startup.o syscalls.o NAME = lab @@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \ --specs=nano.specs all: $(NAME).out + @echo "SUCCESS: Compilation completed successfully." main.o: main.c @$(CC) $(CFLAGS) -g $< -c -o $@ @@ -65,6 +71,9 @@ system.o: ../system.c startup.o: ../startup.c @$(CC) $(CFLAGS) $< -c -o $@ +syscalls.o: ../syscalls.c + @$(CC) $(CFLAGS) $< -c -o $@ + $(NAME).out: $(OBJECTS) @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out diff --git a/syscalls.c b/syscalls.c new file mode 100644 index 0000000..34c0d46 --- /dev/null +++ b/syscalls.c @@ -0,0 +1,17 @@ +// Minimal implementations to supress the warnings + +int _close(int file) { + return -1; +} + +int _lseek(int file, int ptr, int dir) { + return 0; +} + +int _read(int file, char *ptr, int len) { + return 0; +} + +int _write(int file, char *ptr, int len) { + return len; +}