diff --git a/Documentation/how-to-build.rst b/Documentation/how-to-build.rst index 13c2f1868c021be83cef8ac4b3ab9fbcb7004688..6f55d36068445530d478ad4c57d86baa3b9df3f7 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 1363d4ebe413a252ba8e7e540405a63458320c0a..e9de7e9748ad859d65363d6b94aa421662503480 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 e58eb189d3fcc084bad0acc72c8e030a97771d5a..4851b17596d54583608ef9cedcb890a367d89ed3 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 0000000000000000000000000000000000000000..e0a79c540133acc94716e895ed5e8697cfe2847b --- /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' +)