mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-02-06 02:52:42 +08:00
[build system] more makefile cleanup for lpc stuff
- removed usb_lib target, not used anywhere - fix lpc bootloader makefile
This commit is contained in:
2
Makefile
2
Makefile
@@ -206,7 +206,7 @@ sim: sim_static
|
||||
|
||||
# stuff to build and upload the lpc bootloader ...
|
||||
include Makefile.lpctools
|
||||
lpctools: lpc21iap usb_lib
|
||||
lpctools: lpc21iap
|
||||
|
||||
commands: paparazzi
|
||||
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
|
||||
usb_lib:
|
||||
@[ -d sw/airborne/arch/lpc21/lpcusb ] && (cd sw/airborne/arch/lpc21/lpcusb; $(MAKE)) || echo "Not building usb_lib: sw/airborne/arch/lpc21/lpcusb directory missing"
|
||||
|
||||
bl:
|
||||
cd $(AIRBORNE)/arch/lpc21/test/bootloader; $(MAKE) clean; $(MAKE)
|
||||
|
||||
BOOTLOADER_DEV=/dev/ttyUSB0
|
||||
BOOTLOADER_DEV ?= /dev/ttyUSB0
|
||||
upload_bl bl.upload: bl
|
||||
lpc21isp -control $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex $(BOOTLOADER_DEV) 38400 12000
|
||||
|
||||
JTAG_INTERFACE = olimex-jtag-tiny.cfg
|
||||
JTAG_INTERFACE ?= olimex-jtag-tiny.cfg
|
||||
#JTAG_INTERFACE = olimex-arm-usb-ocd.cfg
|
||||
|
||||
upload_jtag: bl
|
||||
openocd -f interface/$(JTAG_INTERFACE) -f board/olimex_lpc_h2148.cfg -c init -c halt -c "flash write_image erase $(AIRBORNE)/arch/lpc21/test/bootloader/bl.hex" -c reset -c shutdown
|
||||
|
||||
|
||||
|
||||
lpc21iap:
|
||||
$(MAKE) -C sw/ground_segment/lpc21iap
|
||||
|
||||
@@ -32,4 +28,4 @@ ms:
|
||||
upload_ms ms.upload: ms
|
||||
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf
|
||||
|
||||
.PHONY: usb_lib bl upload_bl upload_jtag ms upload_ms lpc21iap upgrade_bl
|
||||
.PHONY: bl upload_bl upload_jtag ms upload_ms lpc21iap upgrade_bl
|
||||
|
||||
@@ -23,49 +23,7 @@
|
||||
# This is the common Makefile for finding the arm compiler and OpenOcd
|
||||
#
|
||||
|
||||
#
|
||||
# try to pick up the compiler from the path
|
||||
#
|
||||
CC = $(shell which arm-none-eabi-gcc)
|
||||
LD = $(shell which arm-none-eabi-gcc)
|
||||
AR = $(shell which arm-none-eabi-ar)
|
||||
CP = $(shell which arm-none-eabi-objcopy)
|
||||
DMP = $(shell which arm-none-eabi-objdump)
|
||||
NM = $(shell which arm-none-eabi-nm)
|
||||
SIZE = $(shell which arm-none-eabi-size)
|
||||
GDB = $(shell which arm-none-eabi-gdb)
|
||||
TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
||||
|
||||
#
|
||||
# if not found in path, try the paparazzi toolchain in /opt
|
||||
#
|
||||
ifeq ($(CC),)
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
|
||||
# Define programs and commands.
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-gcc
|
||||
AR = $(GCC_BIN_PREFIX)-ar
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
DMP = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
GDB = $(GCC_BIN_PREFIX)-gdb
|
||||
else
|
||||
# toolchain not found...
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# some general commands
|
||||
RM = rm
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-toolchain
|
||||
|
||||
#
|
||||
# some generic and informative targets
|
||||
|
||||
48
conf/Makefile.arm-toolchain
Normal file
48
conf/Makefile.arm-toolchain
Normal file
@@ -0,0 +1,48 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
|
||||
#
|
||||
# This is the common Makefile for finding the arm compiler
|
||||
#
|
||||
|
||||
#
|
||||
# try to pick up the compiler from the path
|
||||
#
|
||||
CC = $(shell which arm-none-eabi-gcc)
|
||||
LD = $(shell which arm-none-eabi-gcc)
|
||||
AR = $(shell which arm-none-eabi-ar)
|
||||
CP = $(shell which arm-none-eabi-objcopy)
|
||||
DMP = $(shell which arm-none-eabi-objdump)
|
||||
NM = $(shell which arm-none-eabi-nm)
|
||||
SIZE = $(shell which arm-none-eabi-size)
|
||||
GDB = $(shell which arm-none-eabi-gdb)
|
||||
TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
||||
|
||||
#
|
||||
# if not found in path, try the paparazzi toolchain in /opt
|
||||
#
|
||||
ifeq ($(CC),)
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
|
||||
# Define programs and commands.
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-gcc
|
||||
AR = $(GCC_BIN_PREFIX)-ar
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
DMP = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
GDB = $(GCC_BIN_PREFIX)-gdb
|
||||
else
|
||||
# toolchain not found...
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# some general commands
|
||||
RM = rm
|
||||
@@ -107,7 +107,6 @@ LDFLAGS += $(MATH_LIB)
|
||||
LDFLAGS += -lc -lgcc
|
||||
LDFLAGS += $(CPLUSPLUS_LIB)
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
# -lusbstack -Larm7/lpcusb
|
||||
|
||||
ifndef LDSCRIPT
|
||||
ifeq ($(FLASH_MODE),ISP)
|
||||
|
||||
@@ -32,7 +32,7 @@ DATE = $$(date +%Y%m%d)
|
||||
#
|
||||
# find compiler toolchain
|
||||
#
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-toolchain
|
||||
|
||||
#
|
||||
# if the new arm-none-eabi multilib compiler was not found try the old arm-elf one
|
||||
@@ -82,6 +82,6 @@ depend: $(LIBSRCS)
|
||||
$(Q)$(CC) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
|
||||
# phony targets
|
||||
.PHONY: all clean depend
|
||||
.PHONY: all clean lib dist depend
|
||||
|
||||
-include .depend
|
||||
|
||||
@@ -18,7 +18,7 @@ LINKFILE_RAM = lpc2148-ram.ld
|
||||
#
|
||||
# try to find the paparazzi multilib toolchain
|
||||
#
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-toolchain
|
||||
|
||||
TAR = tar
|
||||
|
||||
@@ -49,7 +49,7 @@ lib: $(LIBOBJS)
|
||||
app: $(APPNAME).elf
|
||||
$(Q)echo "...copying"
|
||||
$(CP) $(CPFLAGS) $(APPNAME).elf $(APPNAME).hex
|
||||
$(OD) $(ODFLAGS) $(APPNAME).elf > $(APPNAME).dmp
|
||||
$(DMP) $(ODFLAGS) $(APPNAME).elf > $(APPNAME).dmp
|
||||
# $(Q)echo "....loading"
|
||||
# ./lpc21isp -control bl.hex com4 38400 12000
|
||||
# ./lpc21isp -control -termonly bl.hex com4 115200 12000
|
||||
@@ -57,7 +57,7 @@ app: $(APPNAME).elf
|
||||
app_ram: $(APPNAME_RAM).elf
|
||||
$(Q)echo "...copying"
|
||||
$(CP) $(CPFLAGS) $(APPNAME_RAM).elf $(APPNAME_RAM).hex
|
||||
$(OD) $(ODFLAGS) $(APPNAME_RAM).elf > $(APPNAME_RAM).dmp
|
||||
$(DMP) $(ODFLAGS) $(APPNAME_RAM).elf > $(APPNAME_RAM).dmp
|
||||
|
||||
$(APPNAME).elf: $(OBJS) $(LIBNAME).a $(LINKFILE)
|
||||
$(Q)echo "..linking"
|
||||
@@ -81,3 +81,5 @@ dist: clean
|
||||
|
||||
# recompile if the Makefile changes
|
||||
$(OBJS) $(LIBOBJS): Makefile
|
||||
|
||||
.PHONY: all clean lib app app_ram arch dist
|
||||
|
||||
Reference in New Issue
Block a user