From bb4ad00146ee5c0793440aec2bfd3f269ab6ce5b Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Tue, 6 Aug 2019 00:22:50 +0200 Subject: [PATCH] build: Add an option for debug-output Signed-off-by: Rahix <rahix@rahix.de> --- Documentation/how-to-build.rst | 13 +++++++++++++ bootstrap.sh | 2 +- meson.build | 7 +++++++ meson_options.txt | 7 +++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 meson_options.txt diff --git a/Documentation/how-to-build.rst b/Documentation/how-to-build.rst index 13c2f186..6f55d360 100644 --- a/Documentation/how-to-build.rst +++ b/Documentation/how-to-build.rst @@ -58,6 +58,19 @@ can build with *ninja*. .. note:: + If you intend to work on the firmware, you might want to enable debug output + in the firmware version you build. You can do this by calling ``meson`` + with additional arguments. To do so, add you meson arguments to the + bootstrap call like this: + + .. code-block:: shell-session + + ./bootstrap.sh -Ddebug_prints=true + + (``debug_prints`` is an option provided by our firmware) + +.. warning:: + Our build-system contains a few workarounds around short-comings in meson. These workarounds might break on some setups which we did not yet test. If this is the case for you, please open an issue in our `issue tracker`_! diff --git a/bootstrap.sh b/bootstrap.sh index 1363d4eb..e9de7e97 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -5,7 +5,7 @@ cd "$(dirname "$0")" test -d build/ && rm -r build/ git submodule update --init ./lib/micropython -meson --cross-file card10-cross.ini build/ +meson --cross-file card10-cross.ini build/ "$@" set +x diff --git a/meson.build b/meson.build index e58eb189..4851b175 100644 --- a/meson.build +++ b/meson.build @@ -21,6 +21,13 @@ add_global_arguments( language: 'c', ) +if get_option('debug_prints') + add_global_arguments( + ['-DLOG_ENABLE_DEBUG=1'], + language: 'c', + ) +endif + add_global_link_arguments( '-Wl,--gc-sections', '-lm', diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..e0a79c54 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,7 @@ +option( + 'debug_prints', + type: 'boolean', + value: false, + + description: 'Whether to print debug messages on the serial console' +) -- GitLab