__XS1_L__ __XS1B__ __XS2A__ architecture defines? Topic is solved

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
aclassifier
Respected Member
Posts: 309
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

__XS1_L__ __XS1B__ __XS2A__ architecture defines?

Postby aclassifier » Mon Feb 05, 2018 7:09 pm

I have come across these in the XMOS code:

__XS1_L__
__XS1B__
__XS2A__

Are there more, and where do I find them defined?

From [1] I assume:
  • __XS1B__
    • XS1 G-Series
    • XS1 A-Series
    • XS1 U-Series
    • XS1 XA-series
  • __XS1_L__
    • XS1 L-Series
  • __XS2A_
    • xCORE-200
  • __???__ (or maybe not needed since they aren't programmeable as such(?))
    • xCORE-AUDIO family
    • xCORE-VOICE family

I need it because I am trying to port a library from the Arduino (ardiohead [2]), and if I am lucky the code may be just #ifdef'ed version of it. But to be honest I doubt it, since I would need other file names and also will absolutely use XMOS libraries when they're there. But it's worth a try.

[1] http://www.teigfam.net/oyvind/home/technology/098-my-xmos-notes/#xmos_series_of_processors (no ads, no money, no gifts, only fun and expenses)
[2] http://www.teigfam.net/oyvind/home/technology/164-my-aquariums-data-radioed-through-the-shelf/#porting_to_xmos_xc (--||--)
View Solution
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Postby robertxmos » Tue Feb 06, 2018 10:50 am

(It's easier to ask the compilers directly, rather than through the xcc driver using -X option!)

The xC compiler's inbuilt defines may be displayed using (the -march option is optional, defaulting to xs1b):

Code: Select all

xcc1llvm -dM  -E /dev/null -march=xs2a


The C complier's likewise with:

Code: Select all

xcc2clang -dM -E -x c /dev/null -march=xs2a


and the C++ complier's with:

Code: Select all

xcc2clang -dM -E -x c++ /dev/null -march=xs2a


robet
User avatar
aclassifier
Respected Member
Posts: 309
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

Postby aclassifier » Tue Feb 06, 2018 11:22 am

Thanks! But I can't find a window in the xTIMEcomposer to write this to, and if I do it in Terminal (Mac) I get this:

Code: Select all

OM11-kontor-2016:XMOS_xTIMEcomposer_Community_14.3.2 teig$ /Applications/XMOS_xTIMEcomposer_Community_14.3.2/SetEnv.command
bash-3.2$ xcc1llvm -dM  -E /dev/null -march=xs2a
bash: xcc1llvm: command not found


Even if I go to /Applications/XMOS_xTIMEcomposer_Community_14.3.2/libexec where xcc1llvm is I get

Code: Select all

bash-3.2$ ls
xcc1llvm         xllc            xpca            xpp
xcc2clang         xmos_check_module_version   xpcaobj
bash-3.2$ xcc1llvm -dM  -E /dev/null -march=xs2a
bash: xcc1llvm: command not found


Will the resulting list also list what matches what?
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Postby robertxmos » Tue Feb 06, 2018 11:39 am

Not sure why they wont run for you.
From the directory where they live try:

Code: Select all

./xcc1llvm

also

Code: Select all

ls -al

to see what the file permissions are.
User avatar
aclassifier
Respected Member
Posts: 309
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

Postby aclassifier » Tue Feb 06, 2018 11:56 am

That picked them up:

Code: Select all

bash-3.2$ ./xcc1llvm
Usage: xcc1llvm [options] <file>

OPTIONS:
  --help                    Display available options
  --version                 Display the version of the compiler
  -analysis <file>          Optimize using the whole program analysis
  -dD                       Print macro definitions in -E mode in addition to normal output
  -dM                       Print macro definitions in -E mode only
  -D<macro>[=<val>]         Define a <macro> with <val> as its value.  If just <macro> is given, <val> is taken to be 1
  -emit-llvm                Output LLVM IR instead of assembly
  -emit-llvm-bc             Output LLVM bitcode instead of assembly
  -E                        Only run the preprocessor
          (-f<option> may be disabled using -fno-<option>)
  -falways-inline           Always inline functions declared with the inline specifier
  -fglobalresource-directives
                            Emit .globalresource directives [enabled]
  -fimplicit-overlay        Treat every function as an overlay root
  -finline-functions        Inline simple functions into their callers
  -foverlay                 Place functions marked with the overlay attribute in overlays
  -fresource-checks         Trap at run-time when resource allocation fails
  -fshow-used-clocks        Show clock usage
  -fsubword-select          Allow selecting on sub-word streaming channel inputs [enabled]
  -fsyntax-only             Check for syntax errors, then stop
  -ftrap-info               Output trap information [enabled]
  -funroll-loops            Perform automatic loop unrolling
  -fverbose-asm             Add extra commentary to assembler output
  -fxta-info                Generate timing information [enabled]
  -fverify                  Verify llvm-IR
  -g[<opt>]                 Generate debug information in DWARF format
  -isystem <directory>      Add directory to SYSTEM include search path
  -I <directory>            Add directory to include search path
  -march=[xs1b|xs2a]        Set the target architecture of compilation [xs1b]
  -mcmodel=[default|small|large]
                            Set the code model [default]
  -m[no-]dual-issue         Disable/enable dual-issue instruction scheduling
  -mllvm <option>           Pass <option> to the LLVM backend
  -mtimer-abi=[swtimers|hwtimers]
                            Set the swtimers/hwtimer abi
  -MD                       Generate make dependencies and compile
  -MF <file>                Write dependency output to the given file
  -MMD                      Like -MD but ignore system header files
  -MP                       Generate phony targets for headers
  -MT <target>              Set target of rule in dependency output
  -o <file>                 Place output into <file>
  -O<number>                Set optimization level to <number>
  -Os                       Optimize for space rather than speed
  -pre-compilation-analysis Output analysis information about file
  -P                        Disable linemarker output in -E mode
  -taskgraph                Output taskgraph information about file
  -trigraphs                Process trigraph sequences
  -U<macro>                 Undefine <macro>
  -version                  Display the version of the compiler
  -w                        Suppress warnings
          (-W<option> may be disabled using -Wno-<option>)
  -Wall                     Turn on all warnings (see -Wuseful)
  -Wbidirectional-buffered-port
                            Warn about the use of bidirectional buffered ports [enabled]
  -Wcast-align              Warn when a reinterpret cast moves to a larger alignment [enabled]
  -Wchar-subscripts         Warn about subscripts whose type is "char"
  -Wcomment                 Warn about suspicious comment symbols
  -Wconversion              Warn when a negative integer constant is implicitly converted to an unsigned type
  -Wdiv-by-zero             Warn about compile-time integer division by zero [enabled]
  -Werror                   Treat all warnings as errors
  -Werror=<option>          Treat -W<option> as an error
  -Wextra                   Print extra (possibly unwanted) warnings
  -Wfloat-equal             Warn if floating point values are used in equality comparisons
  -Wimplicit                Warn about implicit declarations
  -Wimplicit-int            Warn when a declaration does not specify a type
  -Wlarger-than-<number>    Warn if an object is larger than <number> bytes
  -Wmain                    Warn about suspicious declarations of "main"
  -Wmissing-braces          Warn about initializers which are not fully bracketed
  -Wpadded                  Warn when padding is required to align structure members
  -Wparentheses             Warn if parentheses are omitted in certain contexts
  -Wptr-conv                Warn when implicit pointer casts [enabled]
  -Wredundant-decls         Warn about multiple declarations of the same object
  -Wreinterpret-alignment   Warn when a reinterpret cast moves to a larger alignment
  -Wreturn-type             Warn about a non-void function not returning a value
  -Wshadow                  Warn when one local variable shadows another
  -Wsign-compare            Warn about signed-unsigned comparisons
  -Wswitch-default          Warn about enumerated switches missing a "default:" statement
  -Wswitch-fallthrough      Warn when a switch case does not end with a break [enabled]
  -Wsystem-headers          Do not suppress warnings from system headers
  -Wundef                   Warn when undefined macros in conditionals
  -Wunknown-pragmas         Warn when an unknown pragma is encountered
  -Wunused                  Enable all -Wunused- warnings
  -Wunused-function         Warn when a function is unused
  -Wunused-parameter        Warn when a function parameter is unused
  -Wunused-variable         Warn when a variable is unused
  -Wunusual-code            Warn about unusual code
  -Wuseful                  Turn on useful warnings
  @<file>                   Inserts the contents of <file> into the argument list at this postion

For bug reporting instructions, please see:
http://www.xmos.com/support

Then this:

Code: Select all

bash-3.2$ ls -al
total 138096
drwxr-xr-x@  9 teig  admin       306 Sep 30 18:49 .
drwxr-xr-x@ 22 teig  admin       748 Oct 29 11:42 ..
-rwxr-xr-x@  1 teig  admin  26957984 Sep 30 18:49 xcc1llvm
-rwxr-xr-x@  1 teig  admin  33655136 Sep 30 18:49 xcc2clang
-rwxr-xr-x@  1 teig  admin   9440168 Sep 30 18:49 xllc
-rwxr-xr-x@  1 teig  admin     36832 Sep 30 18:49 xmos_check_module_version
-rwxr-xr-x@  1 teig  admin    249464 Sep 30 18:49 xpca
-rwxr-xr-x@  1 teig  admin    209988 Sep 30 18:49 xpcaobj
-rwxr-xr-x@  1 teig  admin    143660 Sep 30 18:49 xpp
bash-3.2$

And them finally I got (with ./xcc1llvm to run it):

Code: Select all

bash-3.2$ ./xcc1llvm -dM  -E /dev/null -march=xs2a
#define _ILP32 1
#define __ATOMIC_ACQUIRE 2
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_CONSUME 1
#define __ATOMIC_RELAXED 0
#define __ATOMIC_RELEASE 3
#define __ATOMIC_SEQ_CST 5
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __CHAR16_TYPE__ unsigned short
#define __CHAR32_TYPE__ unsigned int
#define __CHAR_BIT__ 8
#define __CHAR_UNSIGNED__ 1
#define __CONSTANT_CFSTRINGS__ 1
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __DBL_DIG__ 15
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define __DBL_HAS_DENORM__ 1
#define __DBL_HAS_INFINITY__ 1
#define __DBL_HAS_QUIET_NAN__ 1
#define __DBL_MANT_DIG__ 53
#define __DBL_MAX_10_EXP__ 308
#define __DBL_MAX_EXP__ 1024
#define __DBL_MAX__ 1.7976931348623157e+308
#define __DBL_MIN_10_EXP__ (-307)
#define __DBL_MIN_EXP__ (-1021)
#define __DBL_MIN__ 2.2250738585072014e-308
#define __DECIMAL_DIG__ 17
#define __FINITE_MATH_ONLY__ 0
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __FLT_DIG__ 6
#define __FLT_EPSILON__ 1.19209290e-7F
#define __FLT_EVAL_METHOD__ 0
#define __FLT_HAS_DENORM__ 1
#define __FLT_HAS_INFINITY__ 1
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MANT_DIG__ 24
#define __FLT_MAX_10_EXP__ 38
#define __FLT_MAX_EXP__ 128
#define __FLT_MAX__ 3.40282347e+38F
#define __FLT_MIN_10_EXP__ (-37)
#define __FLT_MIN_EXP__ (-125)
#define __FLT_MIN__ 1.17549435e-38F
#define __FLT_RADIX__ 2
#define __ILP32__ 1
#define __INT16_C_SUFFIX__
#define __INT16_FMTd__ "hd"
#define __INT16_FMTi__ "hi"
#define __INT16_TYPE__ short
#define __INT32_C_SUFFIX__
#define __INT32_FMTd__ "d"
#define __INT32_FMTi__ "i"
#define __INT32_TYPE__ int
#define __INT64_C_SUFFIX__ LL
#define __INT64_FMTd__ "lld"
#define __INT64_FMTi__ "lli"
#define __INT64_TYPE__ long long int
#define __INT8_C_SUFFIX__
#define __INT8_FMTd__ "hhd"
#define __INT8_FMTi__ "hhi"
#define __INT8_TYPE__ signed char
#define __INTMAX_C_SUFFIX__ LL
#define __INTMAX_FMTd__ "lld"
#define __INTMAX_FMTi__ "lli"
#define __INTMAX_MAX__ 9223372036854775807LL
#define __INTMAX_TYPE__ long long int
#define __INTMAX_WIDTH__ 64
#define __INTPTR_FMTd__ "d"
#define __INTPTR_FMTi__ "i"
#define __INTPTR_TYPE__ int
#define __INTPTR_WIDTH__ 32
#define __INT_MAX__ 2147483647
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
#define __LDBL_DIG__ 15
#define __LDBL_EPSILON__ 2.2204460492503131e-16L
#define __LDBL_HAS_DENORM__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __LDBL_HAS_QUIET_NAN__ 1
#define __LDBL_MANT_DIG__ 53
#define __LDBL_MAX_10_EXP__ 308
#define __LDBL_MAX_EXP__ 1024
#define __LDBL_MAX__ 1.7976931348623157e+308L
#define __LDBL_MIN_10_EXP__ (-307)
#define __LDBL_MIN_EXP__ (-1021)
#define __LDBL_MIN__ 2.2250738585072014e-308L
#define __LITTLE_ENDIAN__ 1
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __LONG_MAX__ 2147483647L
#define __ORDER_BIG_ENDIAN__ 4321
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __ORDER_PDP_ENDIAN__ 3412
#define __POINTER_WIDTH__ 32
#define __PRAGMA_REDEFINE_EXTNAME 1
#define __PTRDIFF_FMTd__ "d"
#define __PTRDIFF_FMTi__ "i"
#define __PTRDIFF_TYPE__ int
#define __PTRDIFF_WIDTH__ 32
#define __SCHAR_MAX__ 127
#define __SHRT_MAX__ 32767
#define __SIG_ATOMIC_MAX__ 2147483647
#define __SIG_ATOMIC_WIDTH__ 32
#define __SIZEOF_DOUBLE__ 8
#define __SIZEOF_FLOAT__ 4
#define __SIZEOF_INT__ 4
#define __SIZEOF_LONG_DOUBLE__ 8
#define __SIZEOF_LONG_LONG__ 8
#define __SIZEOF_LONG__ 4
#define __SIZEOF_POINTER__ 4
#define __SIZEOF_PTRDIFF_T__ 4
#define __SIZEOF_SHORT__ 2
#define __SIZEOF_SIZE_T__ 4
#define __SIZEOF_WCHAR_T__ 1
#define __SIZEOF_WINT_T__ 4
#define __SIZE_FMTX__ "X"
#define __SIZE_FMTo__ "o"
#define __SIZE_FMTu__ "u"
#define __SIZE_FMTx__ "x"
#define __SIZE_MAX__ 4294967295U
#define __SIZE_TYPE__ unsigned int
#define __SIZE_WIDTH__ 32
#define __STDC_HOSTED__ 1
#define __STDC_UTF_16__ 1
#define __STDC_UTF_32__ 1
#define __UINTMAX_C_SUFFIX__ ULL
#define __UINTMAX_FMTX__ "llX"
#define __UINTMAX_FMTo__ "llo"
#define __UINTMAX_FMTu__ "llu"
#define __UINTMAX_FMTx__ "llx"
#define __UINTMAX_TYPE__ long long unsigned int
#define __USER_LABEL_PREFIX__ _
#define __VERSION__ "4.2.1 Compatible XMOS-25550-Sep-30-2017 Clang 3.6.0 "
#define __WCHAR_MAX__ 255
#define __WCHAR_TYPE__ unsigned char
#define __WCHAR_UNSIGNED__ 1
#define __WCHAR_WIDTH__ 8
#define __WINT_TYPE__ unsigned int
#define __WINT_UNSIGNED__ 1
#define __WINT_WIDTH__ 32
#define __XC__ 1
#define __XS2A__ 1
#define __llvm__ 1
#define __xcore__ 1

I tried several -march:

Code: Select all

-march=xs2a shows __XS2A__
-march=xs1b shows __XS1B__
bash-3.2$ ./xcc1llvm -dM  -E /dev/null -march=xs1_l
error: xcc1llvm: Unknown target architecture `xs1_l'
bash-3.2$ ./xcc1llvm -dM  -E /dev/null -march=xs1
error: xcc1llvm: Unknown target architecture `xs1l'

So what are the possible -march parameters? And which architectures do they match?
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Postby robertxmos » Tue Feb 06, 2018 12:02 pm

xcc --help
...
-march=[xs1b|xs2a] Set the target architecture of compilation
...
User avatar
aclassifier
Respected Member
Posts: 309
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

Postby aclassifier » Tue Feb 06, 2018 12:09 pm

Ok, two options?

I guess xs1a must have been, then? Obsoleted?

But I did find __XS1_L__ in some code as well..

Is my initial assumed list correct then? I'd assume no..

Is the xTIMEcomposer scheme to read the connected processor's type and then that sets up the TARGET in Makefile? But I can edit the TARGET myself. Again, what are the options? (Not that I need all, maybe it's a secret, but I got kind of curious when I did find those ..3?)
robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Postby robertxmos » Tue Feb 06, 2018 1:17 pm

xs1a is indeed obsolete.
Libraries may still have xs1a supporting code in them, but it will be ignored.

The 'TARGET = ' in the Makefile is the value sent to 'xcc --target='

The 'xcc --target=' flag will set up the right header file for you (look in the .build directory)
It will also set the -march flag for you when compilers are called.
The compiler internally will set the defines you saw above as these are the ones it uses.

If you want other defines for use in your code, you add them yourself.

Who is online

Users browsing this forum: aclassifier and 24 guests