T398: Source cleanup for tool chain integration
This is a code cleanup to improve portability.
Specific issues addressed:
- Added type casts to (void *) here and there
- Changed non-standard \e escapes to \033
- Added cmake function to handle preinclude
- Changed a few Image$$ references to make use of the REGION_DECLARE
macro
- Reordered code slightly to avoid the need for a "void *rangeptr"
variable
- Changed compile time check typedef "err_msg" to avoid declaring
zero sized array, which is not standards compliant. It will now
either be -1 (error) or 1 (ok), not -1 and 0
- Reordered the *nfsptr_t typedef to make the cmse_nonsecure_call
standards compliant
- Added null tests to both secure and non_secure suites to avoid
defining zero length array. Also use this to find end of list
- Only define __stdout for ARMCLANG builds and conditionalize ns printf
output for ARMCLANG/GCC/IAR
- Cleaned up some enum type mismatches
- Changed non standard EINVAL error return to -1. The value was only
checked against 0 anyway
- Added type cast for conversion from float to int
Have tested with IAR, which starts and runs the idle thread. Changes
related to this is not included in this commit.
Author: Thomas Tornblom <thomas.tornblom@iar.com>
Signed-off-by: Thomas Tornblom <thomas.tornblom@iar.com>
Note: Sign off authority needs to adhere to the [DCO](./dco.txt)
rules.
Change-Id: I3e5229c0777623b128474af0311020ccacc1b797
diff --git a/bl2/ext/mcuboot/include/bl2_util.h b/bl2/ext/mcuboot/include/bl2_util.h
index 8315681..ea8df98 100644
--- a/bl2/ext/mcuboot/include/bl2_util.h
+++ b/bl2/ext/mcuboot/include/bl2_util.h
@@ -19,9 +19,17 @@
/* Evaluates to 0 if array is an array; compile error if not array (e.g.
* pointer)
*/
+#if defined(NO_TYPEOF)
+ /* __typeof__ is a non-standard gcc extension, not universally available.
+ * As this is just compile time data type test, assume things are ok for
+ * tool chains missing this feature.
+ */
+#define IS_ARRAY(array) 0
+#else
#define IS_ARRAY(array) \
ZERO_OR_COMPILE_ERROR(!__builtin_types_compatible_p(__typeof__(array), \
__typeof__(&(array)[0])))
+#endif
#define ARRAY_SIZE(array) \
((unsigned long) (IS_ARRAY(array) + \