Commit 3d8256b2 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

Use #ifdef for IMAGE_BL* instead of #if



One nasty part of ATF is some of boolean macros are always defined
as 1 or 0, and the rest of them are only defined under certain
conditions.

For the former group, "#if FOO" or "#if !FOO" must be used because
"#ifdef FOO" is always true.  (Options passed by $(call add_define,)
are the cases.)

For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because
checking the value of an undefined macro is strange.

Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like
follows:

  $(eval IMAGE := IMAGE_BL$(call uppercase,$(3)))

  $(OBJ): $(2)
          @echo "  CC      $$<"
          $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@

This means, IMAGE_BL* is defined when building the corresponding
image, but *undefined* for the other images.

So, IMAGE_BL* belongs to the latter group where we should use #ifdef
or #ifndef.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent f38d93fd
......@@ -82,7 +82,7 @@ void plat_rockchip_gic_driver_init(void)
* can use GIC system registers to manage interrupts and does
* not need GIC interface base addresses to be configured.
*/
#if IMAGE_BL31
#ifdef IMAGE_BL31
gicv3_driver_init(&rockchip_gic_data);
#endif
}
......
......@@ -50,13 +50,13 @@
/* Size of cacheable stacks */
#if DEBUG_XLAT_TABLE
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL1
#elif defined(IMAGE_BL1)
#define PLATFORM_STACK_SIZE 0x440
#elif IMAGE_BL2
#elif defined(IMAGE_BL2)
#define PLATFORM_STACK_SIZE 0x400
#elif IMAGE_BL31
#elif defined(IMAGE_BL31)
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL32
#elif defined(IMAGE_BL32)
#define PLATFORM_STACK_SIZE 0x440
#endif
......
......@@ -50,13 +50,13 @@
/* Size of cacheable stacks */
#if DEBUG_XLAT_TABLE
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL1
#elif defined(IMAGE_BL1)
#define PLATFORM_STACK_SIZE 0x440
#elif IMAGE_BL2
#elif defined(IMAGE_BL2)
#define PLATFORM_STACK_SIZE 0x400
#elif IMAGE_BL31
#elif defined(IMAGE_BL31)
#define PLATFORM_STACK_SIZE 0x800
#elif IMAGE_BL32
#elif defined(IMAGE_BL32)
#define PLATFORM_STACK_SIZE 0x440
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment