mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
6cf27208f3
* chibios: update submodule to stable_21.11.x and sync HAL config Switch the ChibiOS submodule to the upstream stable_21.11.x branch, update the submodule URL, and adjust the Paparazzi ChibiOS config files to match the newer HAL layout. This commit is intentionally limited to the submodule/config update and is known to leave Paparazzi in a non-building state until the follow-up RTOS monitor compatibility fix lands. * rtos_mon: fix ChibiOS 21.11 build break and sample CPU load by interval Update the RTOS monitor to use the current ChibiOS kernel statistics API, fix the thread bookkeeping regressions introduced by the submodule update, and compute CPU/thread load from deltas between monitoring samples instead of lifetime cumulative counters. This restores compilation of rtos_mon_arch.c with the updated ChibiOS tree and makes the reported CPU load reliable over the reporting window. * chibios: enable BDMA for H7 ADC3 Configure ADC3 on STM32H7 to use the BDMA path expected by the updated ChibiOS ADCv4 driver, and provide the companion DMA/BDMA stream definitions used by the new configuration checks. This fixes H7 builds that fail with STM32_ADC_ADC3_DMA_STREAM being referenced while ADC3 is intended to run on BDMA. * rtos_mon: use the ChibiOS 21.11 core memory API Adjust rtos_mon_arch.c to the current chCoreGetStatusX() API, which now returns the amount of free core memory directly instead of filling a memory_area_t structure. This fixes the remaining build break in the RTOS monitor with the updated ChibiOS tree. * tawaki: enable BDMA for H7 ADC3 Mirror the H7 ADC3 configuration fix in the Tawaki board mcuconf so the updated ChibiOS ADCv4 driver takes the ADC3 BDMA path expected on STM32H7. * shell: fix ChibiOS 21.11 core memory query API * matek: enable BDMA for H7 ADC3 * chibios: include newlib syscall bindings * can: use ChibiOS 21.11 FDCAN defaults and API * chibios: restore submodule URL to paparazzi fork
378 lines
10 KiB
Makefile
378 lines
10 KiB
Makefile
#
|
|
# Copyright (C) 2012-2016 The Paparazzi Team
|
|
#
|
|
# This file is part of paparazzi.
|
|
#
|
|
# paparazzi is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
# any later version.
|
|
#
|
|
# paparazzi is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with paparazzi; see the file COPYING. If not, write to
|
|
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
# Boston, MA 02111-1307, USA.
|
|
#
|
|
|
|
#
|
|
# This is the common Makefile for target using chibios
|
|
#
|
|
# chibios directory
|
|
CHIBIOS = $(PAPARAZZI_SRC)/sw/ext/chibios
|
|
|
|
# directory with board defines for chibios platforms (board specific)
|
|
BOARD_COMMON ?=
|
|
BOARD_DIR ?= $(BOARD)/chibios
|
|
CHIBIOS_BOARD_COMMON_DIR = $(PAPARAZZI_SRC)/sw/airborne/boards/$(BOARD_COMMON)
|
|
CHIBIOS_BOARD_DIR = $(PAPARAZZI_SRC)/sw/airborne/boards/$(BOARD_DIR)
|
|
|
|
# chibos linker scripts directory
|
|
# to keep backwards compatibility with Luftboot (Lia/Lisa M)
|
|
# and possibly other bootloaders (like PX4 bootloader)
|
|
# we need to keep a separate linker script with a memory offset
|
|
# because it is not possible to pass it dynamicaly to the linker
|
|
# hence we have two destinations for linker scripts
|
|
CHIBIOS_BOOTLOADER_SCRIPT =
|
|
# check if we used 1 to define presence of luftboot
|
|
ifeq ($(HAS_LUFTBOOT),1)
|
|
CHIBIOS_BOOTLOADER_SCRIPT = 1
|
|
endif
|
|
# check if we used TRUE to define presence of luftboot
|
|
ifeq ($(HAS_LUFTBOOT),TRUE)
|
|
CHIBIOS_BOOTLOADER_SCRIPT = 1
|
|
endif
|
|
|
|
ifdef CHIBIOS_BOOTLOADER_SCRIPT
|
|
# we use the modified linker script
|
|
CHIBIOS_LINKER_DIR ?= $(PAPARAZZI_SRC)/sw/airborne/arch/chibios/
|
|
else
|
|
# we use the original linker script
|
|
CHIBIOS_LINKER_DIR ?= $(STARTUPLD)
|
|
endif
|
|
|
|
# Launch with "make Q=''" to get full command display
|
|
Q=@
|
|
|
|
# Debugging options
|
|
RTOS_DEBUG ?= 0
|
|
|
|
ifeq (,$(findstring $(RTOS_DEBUG),0 FALSE))
|
|
$(info ChibiOS Debug mode is ON)
|
|
$(TARGET).CFLAGS += \
|
|
-DCH_DBG_STATISTICS=TRUE \
|
|
-DCH_DBG_SYSTEM_STATE_CHECK=TRUE \
|
|
-DCH_DBG_ENABLE_CHECKS=TRUE \
|
|
-DCH_DBG_ENABLE_ASSERTS=TRUE \
|
|
-DCH_DBG_ENABLE_TRACE=TRUE \
|
|
-DCH_DBG_ENABLE_STACK_CHECK=TRUE \
|
|
-DCH_DBG_FILL_THREADS=TRUE \
|
|
-DCH_DBG_STATISTICS=TRUE
|
|
else
|
|
$(TARGET).CFLAGS += -DCH_DBG_STATISTICS=TRUE -DCH_DBG_FILL_THREADS=TRUE
|
|
endif
|
|
|
|
#
|
|
# Add syscalls and c++ new/delete operators
|
|
#
|
|
$(TARGET).srcs += c++.cpp pprz_syscalls.c
|
|
$(TARGET).CXXFLAGS += -fno-sized-deallocation
|
|
$(TARGET).CXXFLAGS += $(CXXSTANDARD)
|
|
|
|
#
|
|
# General rules
|
|
#
|
|
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
|
|
$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o)
|
|
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
|
|
|
|
|
|
##############################################################################
|
|
# Build global options
|
|
# NOTE: Can be overridden externally.
|
|
#
|
|
|
|
# Paparazzi options here.
|
|
ifeq ($(PPRZ_DEFINITION),)
|
|
PPRZ_DEFINITION = -DUSE_CHIBIOS_RTOS -DUSE_ADC_WATCHDOG -DPPRZLINK_UNALIGNED_ACCESS=1
|
|
endif
|
|
|
|
# Compiler options here.
|
|
ifeq ($(USE_OPT),)
|
|
# ChibiOS already define OPT
|
|
ifeq (,$(findstring $(RTOS_DEBUG),0 FALSE))
|
|
CH_OPT ?= 0 -g -ggdb3 -fno-inline
|
|
else
|
|
CH_OPT ?= 2
|
|
endif
|
|
USE_OPT = -O$(CH_OPT) \
|
|
-falign-functions=16 -fomit-frame-pointer \
|
|
-W -Wall \
|
|
$(PPRZ_DEFINITION)
|
|
endif
|
|
|
|
# C specific options here (added to USE_OPT).
|
|
ifeq ($(USE_COPT),)
|
|
USE_COPT = -std=gnu99
|
|
endif
|
|
|
|
# C++ specific options here (added to USE_OPT).
|
|
ifeq ($(USE_CPPOPT),)
|
|
USE_CPPOPT = -fno-rtti
|
|
endif
|
|
|
|
# Enable this if you want the linker to remove unused code and data
|
|
ifeq ($(USE_LINK_GC),)
|
|
USE_LINK_GC = yes
|
|
endif
|
|
|
|
# Linker extra options here.
|
|
ifeq ($(USE_LDOPT),)
|
|
USE_LDOPT =
|
|
endif
|
|
|
|
# Enable this if you want link time optimizations (LTO)
|
|
ifeq ($(USE_LTO),)
|
|
USE_LTO = no
|
|
else
|
|
# Force LTO to 'no' if in debug mode
|
|
ifeq (,$(findstring $(RTOS_DEBUG),0 FALSE))
|
|
USE_LTO = no
|
|
endif
|
|
endif
|
|
|
|
# If enabled, this option allows to compile the application in THUMB mode.
|
|
ifeq ($(USE_THUMB),)
|
|
USE_THUMB = yes
|
|
endif
|
|
|
|
# Enable this if you want to see the full log while compiling.
|
|
ifeq ($(USE_VERBOSE_COMPILE),)
|
|
ifeq ($(Q),@)
|
|
USE_VERBOSE_COMPILE = no
|
|
else
|
|
USE_VERBOSE_COMPILE = yes
|
|
endif
|
|
endif
|
|
|
|
# If enabled, this option makes the build process faster by not compiling
|
|
# modules not used in the current configuration.
|
|
ifeq ($(USE_SMART_BUILD),)
|
|
USE_SMART_BUILD = no
|
|
endif
|
|
|
|
#
|
|
# Build global options
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
# Architecture or project specific options
|
|
#
|
|
|
|
# Stack size to be allocated to the Cortex-M process stack. This stack is
|
|
# the stack used by the main() thread.
|
|
ifeq ($(USE_PROCESS_STACKSIZE),)
|
|
USE_PROCESS_STACKSIZE = 0x2000
|
|
endif
|
|
|
|
# Stack size to the allocated to the Cortex-M main/exceptions stack. This
|
|
# stack is used for processing interrupts and exceptions.
|
|
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
|
|
USE_EXCEPTIONS_STACKSIZE = 0x400
|
|
endif
|
|
|
|
# Enables the use of FPU on Cortex-M4 / M7 (no, softfp, hard).
|
|
ifeq ($(USE_FPU),)
|
|
USE_FPU = hard
|
|
endif
|
|
|
|
#
|
|
# Architecture or project specific options
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
# Project, sources and paths
|
|
#
|
|
|
|
# Project name defined in board makefile
|
|
|
|
# Imported source files and paths
|
|
# Licensing files.
|
|
include $(CHIBIOS)/os/license/license.mk
|
|
# Startup files.
|
|
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/$(CHIBIOS_BOARD_STARTUP)
|
|
# HAL-OSAL files (optional).
|
|
include $(CHIBIOS)/os/hal/hal.mk
|
|
include $(CHIBIOS)/os/hal/ports/STM32/$(CHIBIOS_BOARD_PLATFORM)
|
|
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
|
|
# RTOS files (optional).
|
|
include $(CHIBIOS)/os/rt/rt.mk
|
|
include $(CHIBIOS)/os/common/ports/ARMv7-M/compilers/GCC/mk/port.mk
|
|
# Other files (optional).
|
|
#
|
|
ifeq ($(USE_FATFS), TRUE)
|
|
include $(PAPARAZZI_HOME)/conf/chibios/fatfs.mk
|
|
endif
|
|
include $(CHIBIOS)/os/various/newlib_bindings/newlib.mk
|
|
|
|
# Define linker script file here
|
|
LDSCRIPT= $(CHIBIOS_LINKER_DIR)/$(CHIBIOS_BOARD_LINKER)
|
|
|
|
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
|
# setting.
|
|
CSRC = $(ALLCSRC) \
|
|
$(PAPARAZZI_SRC)/sw/airborne/arch/chibios/board.c
|
|
|
|
ECSRC = $(filter %.c, $($(TARGET).srcs))
|
|
ECPPSRC = $(filter %.cpp, $($(TARGET).srcs))
|
|
|
|
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
|
# setting.
|
|
CPPSRC =
|
|
|
|
# C sources to be compiled in ARM mode regardless of the global setting.
|
|
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
|
# option that results in lower performance and larger code size.
|
|
ACSRC =
|
|
|
|
# C++ sources to be compiled in ARM mode regardless of the global setting.
|
|
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
|
# option that results in lower performance and larger code size.
|
|
ACPPSRC =
|
|
|
|
# C sources to be compiled in THUMB mode regardless of the global setting.
|
|
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
|
# option that results in lower performance and larger code size.
|
|
TCSRC =
|
|
|
|
# C sources to be compiled in THUMB mode regardless of the global setting.
|
|
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
|
# option that results in lower performance and larger code size.
|
|
TCPPSRC =
|
|
|
|
# List ASM source files here
|
|
ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
|
|
|
|
INCDIR = $(CONFDIR) $(ALLINC) $(CHIBIOS_BOARD_DIR) $(CHIBIOS_BOARD_COMMON_DIR)
|
|
|
|
# Output directory and files
|
|
BUILDDIR := $(AIRCRAFT_BUILD_DIR)/$(TARGET)
|
|
|
|
#
|
|
# Project, sources and paths
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
# Compiler settings
|
|
#
|
|
MCU ?= cortex-m4
|
|
|
|
TRGT = arm-none-eabi-
|
|
CC = $(TRGT)gcc
|
|
CPPC = $(TRGT)g++
|
|
# Enable loading with g++ only if you need C++ runtime support.
|
|
# NOTE: You can use C++ even without C++ support if you are careful. C++
|
|
# runtime support makes code size explode.
|
|
ifeq ($(ECPPSRC),)
|
|
LD = $(TRGT)gcc
|
|
else
|
|
LD = $(TRGT)g++
|
|
endif
|
|
CP = $(TRGT)objcopy
|
|
AS = $(TRGT)gcc -x assembler-with-cpp
|
|
AR = $(TRGT)ar
|
|
OD = $(TRGT)objdump
|
|
SZ = $(TRGT)size
|
|
HEX = $(CP) -O ihex
|
|
BIN = $(CP) -O binary
|
|
|
|
# ARM-specific options here
|
|
AOPT =
|
|
|
|
# THUMB-specific options here
|
|
TOPT = -mthumb -DTHUMB
|
|
|
|
# Define C warning options here
|
|
CWARN = -Wall -Wextra -Wstrict-prototypes
|
|
|
|
# Define C++ warning options here
|
|
CPPWARN = -Wall -Wextra
|
|
|
|
#
|
|
# Compiler settings
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
# Start of user section
|
|
#
|
|
|
|
# List all user C define here, like -D_DEBUG=1
|
|
UDEFS = $($(TARGET).CFLAGS) $(USER_CFLAGS) $(BOARD_CFLAGS)
|
|
|
|
# List all extra user CPP define here
|
|
UPDEFS = $($(TARGET).CXXFLAGS)
|
|
|
|
# Define ASM defines here
|
|
UADEFS = $($(TARGET).CFLAGS) $(USER_CFLAGS) $(BOARD_CFLAGS)
|
|
|
|
# List all user directories here
|
|
# remove -I before include dir because ChibiOS is adding them again
|
|
UINCDIR = $(CHIBIOS)/os/license $(patsubst -I%,%,$(INCLUDES))
|
|
|
|
# List the user directory to look for the libraries here
|
|
ULIBDIR = $(RUST_DIRS)
|
|
|
|
# List all user libraries here
|
|
ULIBS = -lm $(BOARD_LDFLAGS) $(RUST_LIBS)
|
|
|
|
#
|
|
# End of user defines
|
|
##############################################################################
|
|
|
|
#
|
|
# Include upload rules
|
|
##############################################################################
|
|
# default: assume the luftboot bootloader is used
|
|
# if luftboot is not used define NO_LUFTBOOT to a value != 0
|
|
# this is necessary for Makefile.stm32-upload
|
|
ifdef NO_LUFTBOOT
|
|
ASSUMING_LUFTBOOT = "no"
|
|
else
|
|
ASSUMING_LUFTBOOT = "yes"
|
|
endif
|
|
|
|
|
|
# Settings for GDB
|
|
GDB = $(shell which arm-none-eabi-gdb)
|
|
ifeq ($(GDB),)
|
|
GDB = $(shell which gdb-multiarch)
|
|
endif
|
|
|
|
|
|
# Settings for OOCD
|
|
$(TARGET).OOCD_INTERFACE=ftdi/flossjtag
|
|
OOCD_INTERFACE=ftdi/flossjtag
|
|
OOCD = $(shell which openocd)
|
|
|
|
ifndef $(TARGET).OOCD_BOARD
|
|
OOCD_BOARD = lisa-m
|
|
else
|
|
OOCD_BOARD = $($(TARGET).OOCD_BOARD)
|
|
endif
|
|
|
|
###############################################################################
|
|
|
|
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
|
|
#include $(RULESPATH)/rules.mk
|
|
|
|
EXTRA_RULES_INCLUDE_PATH = $(PAPARAZZI_HOME)/conf/chibios/chibios_extra_rules.mk
|
|
include $(PAPARAZZI_HOME)/conf/chibios/chibios_rules.mk
|
|
|
|
###############################################################################
|
|
# Upload makefile
|
|
include $(PAPARAZZI_HOME)/conf/Makefile.stm32-upload
|