LIB: Add backtrace library

Add a backtrace library which initially exposes two public functions.
Primary usage is to dump a backtrace to the terminal via the
tfm_dump_backtrace function. This uses the printf function under the
hood.

Note that this library makes use of the GCC library function
_Unwind_Backtrace and therefore requires the building of source files
with -funwind-tables. This adds the unwind tables to the binary and
therefore results in significant increase in the code size. This GCC
argument is added when linking the backtrace library, and therefore this
library should only be linked when in use (possibly in the future for
debug builds).

The library also provides a function which allows a user to collect the
backtrace data (the function the return addresses to a provided array).

Note that this library is only built when the CONFIG_TFM_BACKTRACE_ON_CORE_PANIC
configuration is enabled.

Change-Id: If89effc053d5608fea5ce38e9b315d21ef8c6ed2
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
5 files changed