Add base code
This commit is contained in:
44
Makefile
Normal file
44
Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
CC = arm-none-eabi-gcc
|
||||
AS = arm-none-eabi-as
|
||||
LD = arm-none-eabi-ld
|
||||
CPU = -mcpu=cortex-m4
|
||||
THUMB = -mthumb
|
||||
|
||||
LDFLAGS = -T linker.ld
|
||||
CFLAGS = $(CPU) $(THUMB)
|
||||
|
||||
QEMU = qemu-system-arm
|
||||
BOARD = netduino2
|
||||
|
||||
# Output file
|
||||
TARGET = main.elf
|
||||
# Source files
|
||||
SRCS = os/main.c os/process.c os/scheduler.c os/alloc.c tasks/library.c tasks/tasks.c
|
||||
# Object files
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
debug: CFLAGS += -g
|
||||
debug: all
|
||||
|
||||
run: debug
|
||||
$(QEMU) -M $(BOARD) -nographic -kernel $(TARGET)
|
||||
|
||||
gdb: debug
|
||||
$(QEMU) -M $(BOARD) -nographic -kernel $(TARGET) -s -S
|
||||
|
||||
# Default target to build the ELF file
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) startup.o
|
||||
$(LD) $(LDFLAGS) startup.o $(OBJS) -o $(TARGET)
|
||||
|
||||
startup.o: startup.s
|
||||
$(AS) $(CPU) -g startup.s -o startup.o
|
||||
|
||||
# Rule to compile source files into object files
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.elf *.o *.i
|
||||
rm -f os/*.o tasks/*.o
|
||||
Reference in New Issue
Block a user