Stripped down version of microbuilder.eu lpc1343codebase
I hope I didn't break anything too hard.
This commit is contained in:
commit
0c23bf065d
69 changed files with 15504 additions and 0 deletions
108
Makefile
Normal file
108
Makefile
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
##########################################################################
|
||||
# User configuration and firmware specific object files
|
||||
##########################################################################
|
||||
|
||||
# The target, flash and ram of the LPC1xxx microprocessor.
|
||||
# Use for the target the value: LPC11xx, LPC13xx or LPC17xx
|
||||
TARGET = LPC13xx
|
||||
FLASH = 32K
|
||||
SRAM = 8K
|
||||
|
||||
# For USB HID support the LPC134x reserves 384 bytes from the sram,
|
||||
# if you don't want to use the USB features, just use 0 here.
|
||||
SRAM_USB = 384
|
||||
|
||||
VPATH =
|
||||
OBJS = main.o
|
||||
|
||||
##########################################################################
|
||||
# Project-specific files
|
||||
##########################################################################
|
||||
|
||||
VPATH +=
|
||||
OBJS +=
|
||||
LIBS += core/libcore.a lcd/libfont.a
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler prefix and location
|
||||
##########################################################################
|
||||
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
AS = $(CROSS_COMPILE)gcc
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
LD = $(CROSS_COMPILE)gcc
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||
OUTFILE = firmware
|
||||
LPCRC = tools/lpcrc
|
||||
|
||||
##########################################################################
|
||||
# GNU GCC compiler flags
|
||||
##########################################################################
|
||||
ROOT_PATH = .
|
||||
INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core
|
||||
|
||||
##########################################################################
|
||||
# Startup files
|
||||
##########################################################################
|
||||
|
||||
LD_PATH = lpc1xxx
|
||||
LD_SCRIPT = $(LD_PATH)/linkscript.ld
|
||||
LD_TEMP = $(LD_PATH)/memory.ld
|
||||
|
||||
ifeq (LPC11xx,$(TARGET))
|
||||
CORTEX_TYPE=m0
|
||||
else
|
||||
CORTEX_TYPE=m3
|
||||
endif
|
||||
|
||||
CPU_TYPE = cortex-$(CORTEX_TYPE)
|
||||
VPATH += lpc1xxx
|
||||
OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o
|
||||
|
||||
##########################################################################
|
||||
# Compiler settings, parameters and flags
|
||||
##########################################################################
|
||||
|
||||
CFLAGS = -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -fno-builtin
|
||||
LDFLAGS = -nostartfiles -mthumb -mcpu=$(CPU_TYPE) -Wl,--gc-sections
|
||||
LDLIBS = -lm
|
||||
LDLIBS += -Lcore -lcore
|
||||
LDLIBS += -Llcd -lfont
|
||||
OCFLAGS = --strip-unneeded
|
||||
|
||||
all: firmware
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
core/libcore.a: core/projectconfig.h
|
||||
cd core && $(MAKE)
|
||||
|
||||
lcd/libfont.a:
|
||||
cd lcd && $(MAKE)
|
||||
|
||||
tools/lpcrc:
|
||||
cd tools && $(MAKE)
|
||||
|
||||
firmware: $(OBJS) $(SYS_OBJS) $(LIBS) $(LPCRC)
|
||||
-@echo "MEMORY" > $(LD_TEMP)
|
||||
-@echo "{" >> $(LD_TEMP)
|
||||
-@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP)
|
||||
-@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)" >> $(LD_TEMP)
|
||||
-@echo "}" >> $(LD_TEMP)
|
||||
-@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP)
|
||||
$(LD) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)
|
||||
-@echo ""
|
||||
$(SIZE) $(OUTFILE).elf
|
||||
-@echo ""
|
||||
$(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin
|
||||
-@echo ""
|
||||
$(LPCRC) $(OUTFILE).bin
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
|
||||
@cd core && $(MAKE) clean
|
||||
@cd tools && $(MAKE) clean
|
||||
@cd lcd && $(MAKE) clean
|
||||
Loading…
Add table
Add a link
Reference in a new issue