From 5eca0c61c4af99d25c506eb211e1cc5927ddd903 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Thu, 15 Apr 2021 18:42:13 +0100 Subject: [PATCH] waf: add support for --enable-stats --- Tools/ardupilotwaf/boards.py | 7 +++++++ Tools/ardupilotwaf/chibios.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 2cdefa5718..4dc87042ee 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -691,6 +691,13 @@ class chibios(Board): else: cfg.msg("Enabling malloc guard", "no") + if cfg.env.ENABLE_STATS: + cfg.msg("Enabling ChibiOS thread statistics", "yes") + env.CFLAGS += [ '-DHAL_ENABLE_THREAD_STATISTICS' ] + env.CXXFLAGS += [ '-DHAL_ENABLE_THREAD_STATISTICS' ] + else: + cfg.msg("Enabling ChibiOS thread statistics", "no") + env.LIB += ['gcc', 'm'] env.GIT_SUBMODULES += [ diff --git a/Tools/ardupilotwaf/chibios.py b/Tools/ardupilotwaf/chibios.py index a5d1036cf8..36d3dfbb55 100644 --- a/Tools/ardupilotwaf/chibios.py +++ b/Tools/ardupilotwaf/chibios.py @@ -294,6 +294,8 @@ def load_env_vars(env): env.CHIBIOS_BUILD_FLAGS += ' ENABLE_ASSERTS=yes' if env.ENABLE_MALLOC_GUARD: env.CHIBIOS_BUILD_FLAGS += ' ENABLE_MALLOC_GUARD=yes' + if env.ENABLE_STATS: + env.CHIBIOS_BUILD_FLAGS += ' ENABLE_STATS=yes' def setup_optimization(env):