📄 makefile
字号:
#==============================================================================
#
# makefile
#
# LCD
#
#==============================================================================
#==============================================================================
#
# Copyright (c) 2002-2006 Innova Card.
# All Rights Reserved.
#
# This software is the confidential and proprietary information of Innova Card
# ("Confidential Information"). You shall not disclose such Confidential
# Information and shall use it only in accordance with the terms of the license
# agreement you entered into with Innova Card.
#
# Innova Card makes no representations or warranties about the suitability of
# the software, either express or implied, including but not limited to
# the implied warranties of merchantability, fitness for a particular purpose,
# or non-infrigement. Innova Card shall not be liable for any damages suffered
# by licensee as the result of using, modifying or distributing this software
# or its derivatives.
#
#==============================================================================
#
# Memory Layout
# $(LAYOUT) debug xdebug release#ifndef LAYOUT
LAYOUT = release
endif
# PLEASE DO NOT MODIFY THIS LINE
AUTHORIZED_LAYOUT = debug xdebug release
define WARN
@echo "================ WARNING! ================================"
@echo " This example should be modified to support $(LAYOUT) layout."
@echo " For xdebug:"
@echo " Either the SDRAM or external SRAM must be configured (TLB,UCI,UMC)"
@echo " before running code from those external memories (see frequency example)."
@echo " For xrelease:"
@echo " The external flash must be configured (TLB,UCI,UMC)"
@echo " before running code from this flash (see standalone example)."
@echo "=========================================================="
endef
## some usefull variables
#
ROOT = ../..
INCLUDE = $(ROOT)/includeBUILD = .
INSTALL = .
LIBRARY = $(ROOT)/libSCRIPT = $(ROOT)/scriptsTOOLS = $(ROOT)/tools
#
# Tools and Options
#
AS = sde-gcc -xassembler-with-cpp
ASFLAGS = -mtune=4ksd -mips32r2 -msmartmips -c -D_32_ -D_ASSEMBLER_ -EL
CC = sde-gcc
CFLAGS = -mtune=4ksd -mips32r2 -c -D_32_ -EL \
-mno-float -ffixed-14 -ffixed-15 -G0 -fomit-frame-pointer \
-Wimplicit -Wformat -ffreestanding -mlong-calls -gdwarf-2
LD = sde-ld
LDFLAGS = -EL -e reset_vector --allow-multiple-definition \
-T $(SCRIPT)/link/target/librom-v2.0.ld \
-T $(SCRIPT)/link/board/uek.ld \
-T $(SCRIPT)/link/boot_$(subst x,,$(LAYOUT)).ld \
-T $(SCRIPT)/link/app_$(LAYOUT).ld
GDB = sde-insight
GDBFLAGS = -x $(SCRIPT)/debug/probe/fs2oe.rc \
-x $(SCRIPT)/debug/target/mips.rc \
-x $(SCRIPT)/debug/target/usip.rc \
-x $(SCRIPT)/debug/target/hal.rc \
-x $(SCRIPT)/debug/board/uek.rc \
-x $(SCRIPT)/debug/gdb_$(LAYOUT).ini
DUMP = sde-objdump
CONV = sde-conv
SREC = $(TOOLS)/SRecord/bin/srec_cat
#
# Executable
#
stamp1 =$(shell pwd)
stamp2 =$(shell cd $(stamp1)/..; pwd)
stamp =$(subst $(stamp2)/,,$(stamp1))
PROG = $(stamp)_$(LAYOUT)
#
# Libraries
#
LIBC = $(LIBRARY)/libc/libc.a
LIBIO = $(LIBRARY)/libio/libio.a
#
# Objects
#
SRC = $(wildcard ./*.c)
OBJECTS = $(SRC:.c=.o)
BOOT = $(LIBRARY)/crt0.o
#
# Rules
#
%.o: %.S
@mkdir -p $(BUILD)
$(AS) $(ASFLAGS) $(patsubst %, -I%,$(INCLUDE)) $< \
-o $(patsubst %, $(BUILD)/%, $@)
%.o: %.s
@mkdir -p $(BUILD)
$(AS) $(ASFLAGS) $(patsubst %, -I%,$(INCLUDE)) $< \
-o $(patsubst %, $(BUILD)/%, $@)
%.o: %.c
@mkdir -p $(BUILD)
$(CC) $(CFLAGS) $(patsubst %, -I%,$(INCLUDE)) $^ \
-o $(patsubst %, $(BUILD)/%, $@)
all: $(OBJECTS) $(BOOT)
ifeq (,$(findstring $(LAYOUT),$(AUTHORIZED_LAYOUT)))
$(WARN)
else
$(LD) $(LDFLAGS) -o $(INSTALL)/$(PROG).elf \
--start-group $(patsubst %, $(BUILD)/%, $(OBJECTS)) \
$(BOOT) $(LIBIO) $(LIBC) --end-group -Map $(INSTALL)/$(PROG).map
@$(DUMP) -D -S $(INSTALL)/$(PROG).elf > $(INSTALL)/$(PROG).dasm
endif
image: all
ifeq ($(subst x,,$(LAYOUT)),release)
$(CONV) -v -o $(INSTALL)/$(PROG).s19 $(INSTALL)/$(PROG).elf
ifeq ($(LAYOUT),xrelease)
$(SREC) -Line_length 110 -o $(INSTALL)/$(PROG)-x0.s19 \
$(INSTALL)/$(PROG).s19 -Crop 0x30000000 0x30400000 \
-offset -0x30000000 --address-length=4
$(SREC) -Line_length 110 -o $(INSTALL)/$(PROG)-x1.s19 \
$(INSTALL)/$(PROG).s19 -Crop 0x40000000 0x42000000 \
-offset -0x40000000 --address-length=4
endif
$(SREC) -Line_length 110 -o $(INSTALL)/$(PROG)-i8.s19 \
$(INSTALL)/$(PROG).s19 -Crop 0x81000000 0x81040000
$(SREC) -Line_length 110 -o $(INSTALL)/$(PROG)-ia.s19 \
$(INSTALL)/$(PROG).s19 -Crop 0xa1000000 0xa1040000
$(SREC) -o $(INSTALL)/$(PROG)-i.s19 $(INSTALL)/$(PROG)-i8.s19 \
$(INSTALL)/$(PROG)-ia.s19
@rm $(INSTALL)/$(PROG)-i8.s19
@rm $(INSTALL)/$(PROG)-ia.s19
@rm $(INSTALL)/$(PROG).s19
else
@echo "================ WARNING! ================================"
@echo " No Image is available with $(LAYOUT) layout. "
@echo "=========================================================="
endif
debug:
ifeq (,$(findstring $(LAYOUT),$(AUTHORIZED_LAYOUT)))
$(WARN)
else
$(GDB) $(GDBFLAGS) $(INSTALL)/$(PROG).elf
endif
clean:
rm -f $(OBJECTS) $(INSTALL)/$(PROG).elf $(INSTALL)/$(PROG).map \
$(INSTALL)/$(PROG).dasm
# EOF #
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -