Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
9c9bc65e
Commit
9c9bc65e
authored
Mar 09, 2019
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpy-cross: Add "-march=<arch>" option to select native emitter.
parent
d9d92f27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
mpy-cross/main.c
mpy-cross/main.c
+23
-0
mpy-cross/mpconfigport.h
mpy-cross/mpconfigport.h
+8
-8
No files found.
mpy-cross/main.c
View file @
9c9bc65e
...
...
@@ -109,6 +109,7 @@ STATIC int usage(char **argv) {
"-msmall-int-bits=number : set the maximum bits used to encode a small-int
\n
"
"-mno-unicode : don't support unicode in compiled strings
\n
"
"-mcache-lookup-bc : cache map lookups in the bytecode
\n
"
"-march=<arch> : set architecture for native emitter; x86, x64, armv6, armv7m, xtensa
\n
"
"
\n
"
"Implementation specific options:
\n
"
,
argv
[
0
]
);
...
...
@@ -193,6 +194,13 @@ MP_NOINLINE int main_(int argc, char **argv) {
mp_dynamic_compiler
.
small_int_bits
=
31
;
mp_dynamic_compiler
.
opt_cache_map_lookup_in_bytecode
=
0
;
mp_dynamic_compiler
.
py_builtins_str_unicode
=
1
;
#if defined(__i386__)
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_X86
;
#elif defined(__x86_64__)
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_X64
;
#else
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_NONE
;
#endif
const
char
*
input_file
=
NULL
;
const
char
*
output_file
=
NULL
;
...
...
@@ -240,6 +248,21 @@ MP_NOINLINE int main_(int argc, char **argv) {
mp_dynamic_compiler
.
py_builtins_str_unicode
=
0
;
}
else
if
(
strcmp
(
argv
[
a
],
"-municode"
)
==
0
)
{
mp_dynamic_compiler
.
py_builtins_str_unicode
=
1
;
}
else
if
(
strncmp
(
argv
[
a
],
"-march="
,
sizeof
(
"-march="
)
-
1
)
==
0
)
{
const
char
*
arch
=
argv
[
a
]
+
sizeof
(
"-march="
)
-
1
;
if
(
strcmp
(
arch
,
"x86"
)
==
0
)
{
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_X86
;
}
else
if
(
strcmp
(
arch
,
"x64"
)
==
0
)
{
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_X64
;
}
else
if
(
strcmp
(
arch
,
"armv6"
)
==
0
)
{
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_ARMV6
;
}
else
if
(
strcmp
(
arch
,
"armv7m"
)
==
0
)
{
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_ARMV7M
;
}
else
if
(
strcmp
(
arch
,
"xtensa"
)
==
0
)
{
mp_dynamic_compiler
.
native_arch
=
MP_NATIVE_ARCH_XTENSA
;
}
else
{
return
usage
(
argv
);
}
}
else
{
return
usage
(
argv
);
}
...
...
mpy-cross/mpconfigport.h
View file @
9c9bc65e
...
...
@@ -31,14 +31,14 @@
#define MICROPY_PERSISTENT_CODE_SAVE (1)
#define MICROPY_EMIT_X64 (1)
#define MICROPY_EMIT_X86 (
0
)
#define MICROPY_EMIT_THUMB (
0
)
#define MICROPY_EMIT_INLINE_THUMB (
0
)
#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (
0
)
#define MICROPY_EMIT_INLINE_THUMB_FLOAT (
0
)
#define MICROPY_EMIT_ARM (
0
)
#define MICROPY_EMIT_XTENSA (
0
)
#define MICROPY_EMIT_INLINE_XTENSA (
0
)
#define MICROPY_EMIT_X86 (
1
)
#define MICROPY_EMIT_THUMB (
1
)
#define MICROPY_EMIT_INLINE_THUMB (
1
)
#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (
1
)
#define MICROPY_EMIT_INLINE_THUMB_FLOAT (
1
)
#define MICROPY_EMIT_ARM (
1
)
#define MICROPY_EMIT_XTENSA (
1
)
#define MICROPY_EMIT_INLINE_XTENSA (
1
)
#define MICROPY_DYNAMIC_COMPILER (1)
#define MICROPY_COMP_CONST_FOLDING (1)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment