I am using Ubuntu 22.04 to do some bare metal programming. I have 3 files to compile and link to create a .elf file name app.elf (im using Makefile to do this). However I encountered the error below:
$ make all
/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=gnu11 -Wall -O0 -c -o main.o main.c
/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=gnu11 -Wall -O0 -c -o startup.o startup.c
/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=gnu11 -Wall -O0 -c -o gpio.o gpio.c
/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -nostdlib -T stm32_ls.ld -Wl,-Map=app.map -o app.elf main.o startup.o gpio.o
/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: error: .: read: Is a directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: app.elf] Error 1
This is my Makefile script:
CC=/opt/gcc-arm-none-eabi/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc
MACH=cortex-m3
CFLAGS=-mcpu=$(MACH) -mthumb -std=gnu11 -Wall -O0
LDFLAGS=-nostdlib -T stm32_ls.ld -Wl,-Map=app.map
all: app.elf
app.elf: main.o startup.o gpio.o
$(CC) $(LDFLAGS) -o $@ $^
main.o: main.c
$(CC) $(CFLAGS) -c -o $@ $^
startup.o: startup.c
$(CC) $(CFLAGS) -c -o $@ $^
gpio.o: gpio.c
$(CC) $(CFLAGS) -c -o $@ $^
clean:
rm -f *.o *.elf *.map
I've tried reinstalling the toolchain as well as making sure that all file permissions are in executable state.
I think this error is more on the linux side instead of the toolchain but I may be wrong because I'm still a beginner in both fields.
If anyone know how to solve this please do reply. Thank you !