Detect ARM architectures better.
Also improved report, and added partial detection for endianness. This has only been tested on ARMv7l/gcc so far.
This commit is contained in:
parent
a7b321feb3
commit
9aa245caca
3 changed files with 131 additions and 5 deletions
|
@ -10,7 +10,11 @@ int main() {
|
|||
typedef dk::Tyler<2> Tiler;
|
||||
typedef std::unique_ptr<std::ifstream> ifstreamptr;
|
||||
|
||||
std::cout << "Welcome to " << APP_NAME << ' ' << DK_DEVICE_STRING << " version for " << DK_OS_STRING << ' ' << DK_ARCH_STRING << ' ' << DK_BIT_STRING << '\n';
|
||||
std::cout << "Welcome to " << APP_NAME << ' ' << DK_DEVICE_STRING << " version for " << DK_OS_STRING << ' ' << DK_ARCH_STRING << ' ' << DK_BIT_STRING;
|
||||
#if defined(DK_ARM)
|
||||
std::cout << ' ' << DK_ARM_FAMILY_STRING << ' ' << DK_ARM_ARCH_STRING;
|
||||
#endif
|
||||
std::cout << '\n';
|
||||
|
||||
Tiler tiler(Tiler::coords(10, 6), Tiler::coords(64));
|
||||
|
||||
|
|
|
@ -1,6 +1,24 @@
|
|||
#ifndef id054C8BCA27C84EAA825922EC0A4F3317
|
||||
#define id054C8BCA27C84EAA825922EC0A4F3317
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# include <endian.h>
|
||||
#else
|
||||
# error "Please add endianness detection for your compiler"
|
||||
#endif
|
||||
|
||||
#define DK_ARM_ARCH_6 0
|
||||
#define DK_ARM_ARCH_6J 1
|
||||
#define DK_ARM_ARCH_6K 2
|
||||
#define DK_ARM_ARCH_6Z 3
|
||||
#define DK_ARM_ARCH_6ZK 4
|
||||
#define DK_ARM_ARCH_6T2 5
|
||||
#define DK_ARM_ARCH_7 6
|
||||
#define DK_ARM_ARCH_7A 7
|
||||
#define DK_ARM_ARCH_7R 8
|
||||
#define DK_ARM_ARCH_7M 9
|
||||
#define DK_ARM_ARCH_7S 10
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
# define DK_POSIX
|
||||
# define DK_ANDROID
|
||||
|
@ -29,10 +47,34 @@
|
|||
# define DK_X86_64
|
||||
# define DK_64_BIT
|
||||
#elif defined(__arm__)
|
||||
# if defined(__ARMEL__) && __ARMEL__ == 1
|
||||
# define DK_ARM_EL
|
||||
# else
|
||||
# define DK_ARM_HF
|
||||
# endif
|
||||
|
||||
# if defined(__ARM_ARCH_6__)
|
||||
# define DK_ARM_VERSION 6
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6
|
||||
# elif defined(__ARM_ARCH_6J__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6J
|
||||
# elif defined(__ARM_ARCH_6K__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6K
|
||||
# elif defined(__ARM_ARCH_6Z__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6Z
|
||||
# elif defined(__ARM_ARCH_6ZK__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6ZK
|
||||
# elif defined(__ARM_ARCH_6T2__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6T2
|
||||
# elif defined(__ARM_ARCH_7__)
|
||||
# define DK_ARM_VERSION 7
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_7
|
||||
# elif defined(__ARM_ARCH_7A__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_7A
|
||||
# elif defined(__ARM_ARCH_7R__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_7R
|
||||
# elif defined(__ARM_ARCH_7M__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_7M
|
||||
# elif defined(__ARM_ARCH_7S__)
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_7S
|
||||
# else
|
||||
# error "Unknown ARM version"
|
||||
# endif
|
||||
|
@ -42,7 +84,11 @@
|
|||
# if _M_ARM != 6 && _M_ARM != 7
|
||||
# error "Unknown ARM version"
|
||||
# endif
|
||||
# define DK_ARM_VERSION _M_ARM
|
||||
# if _M_ARM == 6
|
||||
# define DK_ARM_ARCH DK_ARM_ARCH_6
|
||||
# elif _M_ARM == 7
|
||||
# define DK_ARM_ARC DK_ARM_ARCH_7
|
||||
# endif
|
||||
# define DK_32_BIT
|
||||
# define DK_ARM
|
||||
#elif defined(__TARGET_ARCH_ARM)
|
||||
|
@ -68,4 +114,39 @@
|
|||
# error "Unknown architecture"
|
||||
#endif
|
||||
|
||||
#if defined(DK_ARM_ARCH)
|
||||
# if DK_ARM_ARCH == DK_ARM_ARCH_6 || DK_ARM_ARCH == DK_ARM_ARCH_6J || \
|
||||
DK_ARM_ARCH == DK_ARM_ARCH_6K || DK_ARM_ARCH == DK_ARM_ARCH_6Z || \
|
||||
DK_ARM_ARCH == DK_ARM_ARCH_6ZK || DK_ARM_ARCH == DK_ARM_ARCH_6T2
|
||||
# define DK_ARM_VERSION 6
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7 || DK_ARM_ARCH == DK_ARM_ARCH_7A || \
|
||||
DK_ARM_ARCH == DK_ARM_ARCH_7R || DK_ARM_ARCH == DK_ARM_ARCH_7M || \
|
||||
DK_ARM_ARCH == DK_ARM_ARCH_7S
|
||||
# define DK_ARM_VERSION 7
|
||||
# else
|
||||
# error "Unknown ARM version"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# if defined(__ARM_PCS_VFP)
|
||||
# define DK_ARM_HARDFLOAT
|
||||
# elif defined(__ARM_PCS)
|
||||
# define DK_ARM_SOFTFLOAT
|
||||
# else
|
||||
# error "Unkown floating point mode"
|
||||
# endif
|
||||
# else
|
||||
# error "Unknown compiler"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__ARMEB__) || \
|
||||
(defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
|
||||
# define DK_BIG_ENDIAN
|
||||
#elif defined(__ARMEL__) || \
|
||||
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# define DK_LITTLE_ENDIAN
|
||||
#else
|
||||
# error "Unknown endianness"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,9 +14,18 @@
|
|||
|
||||
#if defined(DK_ARM)
|
||||
# if defined(DK_32_BIT)
|
||||
# define DK_ARCH_STRING "ARMv" STRINGIZE(DK_ARM_VERSION)
|
||||
# if defined(DK_LITTLE_ENDIAN)
|
||||
# define DK_ARCH_STRING "ARMv" STRINGIZE(DK_ARM_VERSION) " (v" \
|
||||
STRINGIZE(DK_ARM_VERSION) "l)"
|
||||
# elif defined(DK_BIG_ENDIAN)
|
||||
# define DK_ARCH_STRING "ARMv" STRINGIZE(DK_ARM_VERSION) " (v" \
|
||||
STRINGIZE(DK_ARM_VERSION) "b)"
|
||||
# else
|
||||
# error "Unkonwn endianness"
|
||||
# endif
|
||||
# else
|
||||
# define DK_ARCH_STRING "ARM"
|
||||
# error "Never tested, please make sure this branch is correct"
|
||||
# endif
|
||||
#elif defined(DK_X86)
|
||||
# define DK_ARCH_STRING "x86"
|
||||
|
@ -44,4 +53,36 @@
|
|||
# error "No device type defined"
|
||||
#endif
|
||||
|
||||
#if defined(DK_ARM_ARCH)
|
||||
# if DK_ARM_ARCH == DK_ARM_ARCH_6 || DK_ARM_ARCH == DK_ARM_ARCH_6J
|
||||
# define DK_ARM_FAMILY_STRING "ARM11"
|
||||
# define DK_ARM_ARCH_STRING "ARMv6"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_6Z
|
||||
# define DK_ARM_FAMILY_STRING "ARM11"
|
||||
# define DK_ARM_ARCH_STRING "ARMv6Z"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_6K
|
||||
# define DK_ARM_FAMILY_STRING "ARM11"
|
||||
# define DK_ARM_ARCH_STRING "ARMv6K"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_6ZK
|
||||
# error "Missing data - please fill in"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_6T2
|
||||
# define DK_ARM_FAMILY_STRING "ARM11"
|
||||
# define DK_ARM_ARCH_STRING "ARMv6T2"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7
|
||||
# error "Missing data - please fill in"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7M
|
||||
# define DK_ARM_FAMILY_STRING "Cortex-M"
|
||||
# define DK_ARM_ARCH_STRING "ARMv7-M"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7R
|
||||
# define DK_ARM_FAMILY_STRING "Cortex-R"
|
||||
# define DK_ARM_ARCH_STRING "ARMv7-R"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7A
|
||||
# define DK_ARM_FAMILY_STRING "Cortex-A"
|
||||
# define DK_ARM_ARCH_STRING "ARMv7-A"
|
||||
# elif DK_ARM_ARCH == DK_ARM_ARCH_7S
|
||||
# define DK_ARM_FAMILY_STRING "Apple-A6"
|
||||
# define DK_ARM_ARCH_STRING "ARMv7-A"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue