Files
u-boot-tk1-som/include
Masahiro Yamada 8be60f06c2 linux/kconfig.h: add CPP macros useful for per-image config options
The previous commit introduced a useful macro used in makefiles,
in order to reference to different variables (CONFIG_... or
CONFIG_SPL_...) depending on the build context.

Per-image config option control is a PITA in C sources, too.
Here are some macros useful in C/CPP expressions.

CONFIG_IS_ENABLED(FOO) can be used as a shorthand for

  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \
   (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))

For example, it is useful to describe C code as follows,

  #if CONFIG_IS_ENABLED(OF_CONTROL)
      (device tree code)
  #else
      (board file code)
  #endif

The ifdef conditional above is switched by CONFIG_OF_CONTROL during
the U-Boot proper building (CONFIG_SPL_BUILD is not defined), and by
CONFIG_SPL_OF_CONTROL during SPL building (CONFIG_SPL_BUILD is
defined).

The macro can be used in C context as well, so you can also write the
equivalent code as follows:

  if (CONFIG_IS_ENABLED(OF_CONTROL)) {
      (device tree code)
  } else {
      (board file code)
  }

Another useful macro is CONFIG_VALUE().
CONFIG_VALUE(FOO) is expanded into CONFIG_FOO if CONFIG_SPL_BUILD is
undefined, and into CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined.

You can write as follows:

  text_base = CONFIG_VALUE(TEXT_BASE);

instead of:

  #ifdef CONFIG_SPL_BUILD
      text_base = CONFIG_SPL_TEXT_BASE;
  #else
      text_base = CONFIG_TEXT_BASE;
  #endif

This commit also adds slight hacking on fixdep so that it can
output a correct list of fixed dependencies.

If the fixdep finds CONFIG_IS_ENABLED(FOO) in a source file,
we want
    $(wildcard include/config/foo.h)
in the U-boot proper building context, while we want
    $(wildcard include/config/spl/foo.h)
in the SPL build context.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-08-18 13:46:00 -04:00
..
2014-07-30 08:48:03 -04:00
2015-05-05 20:58:20 -06:00
2015-06-10 19:26:54 -06:00
2015-07-21 17:39:29 -06:00
2015-07-27 15:53:48 -07:00
2015-08-05 21:06:16 -06:00
2014-06-21 10:06:58 -06:00
2015-04-10 14:23:23 +02:00
2015-07-21 17:39:25 -06:00
2015-08-05 08:42:41 -06:00
2015-08-05 08:44:07 -06:00
2015-05-28 08:18:24 -04:00
2014-12-05 08:06:15 -08:00
2015-01-21 10:25:02 +01:00
2015-04-23 16:46:50 -07:00
2015-07-22 08:57:54 +02:00
2014-11-19 08:48:42 +01:00
2014-12-11 13:18:43 -07:00
2014-10-25 15:27:37 -04:00
2014-06-20 11:54:29 -06:00
2015-04-23 09:05:53 -06:00
2015-07-21 17:39:25 -06:00
2015-01-06 10:10:04 +02:00
2015-06-04 03:34:47 -06:00
2015-08-05 08:42:41 -06:00
2015-01-05 12:08:55 -05:00
2015-04-20 17:57:13 -05:00
2015-07-21 17:39:27 -06:00
2015-07-21 17:39:28 -06:00
2014-11-24 12:00:00 +01:00
2015-07-01 21:15:03 +05:30
2015-03-05 20:50:29 -05:00
2015-07-26 12:11:33 +02:00
2015-01-21 10:25:53 +01:00