platform -> board

This commit is contained in:
px4dev 2013-02-20 21:25:04 -08:00
parent abe48bd714
commit 50739c1843
7 changed files with 40 additions and 35 deletions

View File

@ -14,12 +14,22 @@ include $(PX4_BASE)/makefiles/setup.mk
CONFIGS ?= px4fmu_default px4io_default
#
# Platforms (boards) that we build NuttX export kits for.
# Boards that we build NuttX export kits for.
#
PLATFORMS = px4fmu px4io
BOARDS = px4fmu px4io
#
# If the user has listed a config as a target, strip it out and override CONFIGS
# Debugging
#
MQUIET = --no-print-directory
#MQUIET = --print-directory
################################################################################
# No user-serviceable parts below
################################################################################
#
# If the user has listed a config as a target, strip it out and override CONFIGS.
#
EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS))
ifneq ($(EXPLICIT_CONFIGS),)
@ -34,12 +44,6 @@ endif
STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)/$(config).px4)
FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)/$(config).build/firmware.px4)
#
# Debugging
#
MQUIET = --no-print-directory
#MQUIET = --print-directory
all: $(STAGED_FIRMWARES)
#
@ -76,18 +80,18 @@ $(FIRMWARES): $(BUILD_DIR)/%.build/firmware.px4:
#
# XXX PX4IO configuration name is bad - NuttX configs should probably all be "px4"
#
NUTTX_ARCHIVES = $(foreach platform,$(PLATFORMS),$(ARCHIVE_DIR)/$(platform).export)
NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)/$(board).export)
.PHONY: archives
archives: $(NUTTX_ARCHIVES)
$(ARCHIVE_DIR)/%.export: platform = $(notdir $(basename $@))
$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(platform),px4io),io,nsh)
$(ARCHIVE_DIR)/%.export: board = $(notdir $(basename $@))
$(ARCHIVE_DIR)/%.export: configuration = $(if $(filter $(board),px4io),io,nsh)
$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)/%.export: $(NUTTX_SRC) $(NUTTX_APPS)
@echo %% Configuring NuttX for $(platform)
@echo %% Configuring NuttX for $(board)
$(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export)
$(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean
$(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(platform)/$(configuration))
@echo %% Exporting NuttX for $(platform)
$(Q) (cd $(NUTTX_SRC)/tools && ./configure.sh $(board)/$(configuration))
@echo %% Exporting NuttX for $(board)
$(Q) make -C $(NUTTX_SRC) -r $(MQUIET) export
$(Q) mkdir -p $(dir $@)
$(Q) $(COPY) $(NUTTX_SRC)/nuttx-export.zip $@

View File

@ -7,4 +7,4 @@
#
CONFIG_ARCH = CORTEXM4F
include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk
include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk

View File

@ -7,4 +7,4 @@
#
CONFIG_ARCH = CORTEXM3
include $(PX4_MK_INCLUDE)/toolchain_gnu-arm-eabi.mk
include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk

View File

@ -6,4 +6,4 @@ CONFIG = px4fmu_default
SRCS = $(PX4_BASE)/platforms/empty.c
ROMFS_ROOT = $(PX4_BASE)/ROMFS/$(CONFIG)
include $(PX4_BASE)/makefiles/firmware.mk
include $(PX4_MK_DIR)/firmware.mk

View File

@ -5,4 +5,4 @@
CONFIG = px4io_default
SRCS = $(PX4_BASE)/platforms/empty.c
include $(PX4_BASE)/makefiles/firmware.mk
include $(PX4_MK_DIR)/firmware.mk

View File

@ -6,8 +6,8 @@
#
# Requires:
#
# PLATFORM
# Must be set to a platform name known to the PX4 distribution (as
# BOARD
# Must be set to a board name known to the PX4 distribution (as
# we need a corresponding NuttX export archive to link with).
#
# Optional:
@ -41,16 +41,16 @@
# If PX4_BASE wasn't set previously, work out what it should be
# and set it here now.
#
export PX4_MK_INCLUDE ?= $(dir $(lastword $(MAKEFILE_LIST)))
export MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST)))
ifeq ($(PX4_BASE),)
export PX4_BASE := $(abspath $(PX4_MK_INCLUDE)/..)
export PX4_BASE := $(abspath $(MK_DIR)/..)
$(info %% set PX4_BASE to $(PX4_BASE))
endif
#
# Get path and tool config
#
include $(PX4_MK_INCLUDE)/setup.mk
include $(MK_DIR)/setup.mk
#
# If WORK_DIR is not set, create a 'build' directory next to the
@ -63,18 +63,18 @@ endif
$(info %% WORK_DIR $(WORK_DIR))
#
# Sanity-check the PLATFORM variable and then get the platform config.
# If PLATFORM is not set, but CONFIG is, use that.
# Sanity-check the BOARD variable and then get the board config.
# If BOARD is not set, but CONFIG is, use that.
#
# The platform config in turn will fetch the toolchain configuration.
# The board config in turn will fetch the toolchain configuration.
#
ifeq ($(PLATFORM),)
ifeq ($(BOARD),)
ifeq ($(CONFIG),)
$(error At least one of the PLATFORM or CONFIG variables must be set before including firmware.mk)
$(error At least one of the BOARD or CONFIG variables must be set before including firmware.mk)
endif
PLATFORM := $(firstword $(subst _, ,$(CONFIG)))
BOARD := $(firstword $(subst _, ,$(CONFIG)))
endif
include $(PX4_MK_INCLUDE)/platform_$(PLATFORM).mk
include $(PX4_MK_DIR)/board_$(BOARD).mk
#
# Things that, if they change, might affect everything
@ -86,11 +86,11 @@ GLOBAL_DEPS += $(MAKEFILE_LIST)
################################################################################
#
# Check that the NuttX archive for the selected platform is available.
# Check that the NuttX archive for the selected board is available.
#
NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(PLATFORM).export)
NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)/$(BOARD).export)
ifeq ($(NUTTX_ARCHIVE),)
$(error The NuttX export archive for $(PLATFORM) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE))
$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE))
endif
#
@ -244,7 +244,7 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)/%.S.o: %.S $(GLOBAL_DEPS)
$(PRODUCT_BUNDLE): $(PRODUCT_BIN)
@echo %% Generating $@
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(PLATFORM).prototype \
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \
--git_identity $(PX4_BASE) \
--image $< > $@

View File

@ -7,6 +7,7 @@
#
export PX4_APP_SRC = $(PX4_BASE)/src/apps
export PX4_LIB_SRC = $(PX4_BASE)/src/libs
export PX4_MK_DIR = $(PX4_BASE)/makefiles
export NUTTX_SRC = $(PX4_BASE)/nuttx
export NUTTX_APP_SRC = $(PX4_BASE)/apps
export MAVLINK_SRC = $(PX4_BASE)/mavlink