Skip to content

Commit

Permalink
NuttX generate Make.defs per config from PX4 cmake (#8573)
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar authored Jan 6, 2018
1 parent f86d4b1 commit 1f63d85
Show file tree
Hide file tree
Showing 66 changed files with 40 additions and 5,408 deletions.
21 changes: 7 additions & 14 deletions platforms/nuttx/NuttX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ file(GLOB_RECURSE copy_apps_files
LIST_DIRECTORIES false
${CMAKE_CURRENT_SOURCE_DIR}/apps/*)

set(NUTTX_DIR ${CMAKE_CURRENT_BINARY_DIR}/nuttx)
set(NUTTX_CONFIG_DIR ${PX4_SOURCE_DIR}/platforms/nuttx/nuttx-configs)
configure_file(${NUTTX_CONFIG_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs)

# copy nuttx to build directory
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/nuttx)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
Expand All @@ -49,9 +53,6 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

set(NUTTX_DIR ${CMAKE_CURRENT_BINARY_DIR}/nuttx)
set(NUTTX_CONFIG_DIR ${PX4_SOURCE_DIR}/platforms/nuttx/nuttx-configs)

# copy apps to build directory
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/apps)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
Expand All @@ -68,22 +69,14 @@ set(APPS_DIR ${CMAKE_CURRENT_BINARY_DIR}/apps)
file(GLOB_RECURSE board_config_files ${NUTTX_CONFIG_DIR}/${BOARD})
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_CONFIG_DIR}/${BOARD})
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${NUTTX_DIR}/configs)
add_custom_command(OUTPUT
${NUTTX_DIR}/PX4_Config.mk
${NUTTX_DIR}/PX4_Warnings.mk
${NUTTX_DIR}/.config
${NUTTX_DIR}/Make.defs
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Config.mk ${NUTTX_DIR}/PX4_Config.mk
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/PX4_Warnings.mk ${NUTTX_DIR}/PX4_Warnings.mk
add_custom_command(
OUTPUT ${NUTTX_DIR}/.config
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig ${NUTTX_DIR}/.config
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs ${NUTTX_DIR}/Make.defs
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
COMMAND ${CMAKE_COMMAND} -E make_directory ${NUTTX_DIR}/configs/${BOARD}/src
COMMAND cd ${CMAKE_SOURCE_DIR} && ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST}
DEPENDS
${NUTTX_CONFIG_DIR}/PX4_Config.mk
${NUTTX_CONFIG_DIR}/PX4_Warnings.mk
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/defconfig
${NUTTX_CONFIG_DIR}/${BOARD}/${nuttx_config_type}/Make.defs
${board_config_files}
${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############################################################################
# configs/px4fmu-v2_upstream/src/Makefile
# nuttx-configs/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <[email protected]>
Expand Down Expand Up @@ -33,51 +33,39 @@
#
############################################################################

-include $(TOPDIR)/Make.defs
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk

CFLAGS += -I$(TOPDIR)/sched
CC = ${C_COMPILER}
CXX = ${CXX_COMPILER}
CPP = ${C_COMPILER} -E
LD = ${LD}
AR = ${CMAKE_AR} rcs
NM = ${CMAKE_NM}
OBJCOPY = ${CMAKE_OBJCOPY}
OBJDUMP = ${CMAKE_OBJDUMP}

ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CFLAGS = -Os -g2 -I${PX4_SOURCE_DIR}/src/include ${CMAKE_C_FLAGS} -I. -isystem $(TOPDIR)/include \
-Wno-bad-function-cast \
-Wno-cpp \
-Wno-float-equal \
-Wno-implicit-fallthrough \
-Wno-implicit-function-declaration \
-Wno-maybe-uninitialized \
-Wno-missing-declarations \
-Wno-missing-field-initializers \
-Wno-missing-prototypes \
-Wno-nested-externs \
-Wno-nonnull-compare \
-Wno-old-style-declaration \
-Wno-sign-compare \
-Wno-type-limits

CSRCS = empty.c
COBJS = $(CSRCS:.c=$(OBJEXT))
CXXFLAGS = -Os -g2 -I${PX4_SOURCE_DIR}/src/include ${CMAKE_CXX_FLAGS} -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx \
-fcheck-new \
-fno-builtin \
-Wno-double-promotion \
-Wno-maybe-uninitialized \
-Wno-missing-declarations

SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)

ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
endif

all: libboard$(LIBEXT)

$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)

$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)

libboard$(LIBEXT): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))

.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@

depend: .depend

clean:
$(call DELFILE, libboard$(LIBEXT))
$(call CLEAN)

distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)

-include Make.dep
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
45 changes: 0 additions & 45 deletions platforms/nuttx/nuttx-configs/PX4_Config.mk

This file was deleted.

74 changes: 0 additions & 74 deletions platforms/nuttx/nuttx-configs/PX4_Warnings.mk

This file was deleted.

Loading

0 comments on commit 1f63d85

Please sign in to comment.