blob: b15fa63043d46401bd7cac27232add5caa49512f [file] [log] [blame]
Damien George04b91472014-05-03 23:27:38 +01001/*
2 * This file is part of the Micro Python project, http://micropython.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2013, 2014 Damien P. George
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
Damienc025ebb2013-10-12 14:30:21 +010027// options to control how Micro Python is built
28
Damiend2755ec2013-10-16 23:58:48 +010029#define MICROPY_EMIT_X64 (1)
Damien3ef4abb2013-10-12 16:53:13 +010030#define MICROPY_EMIT_THUMB (0)
31#define MICROPY_EMIT_INLINE_THUMB (0)
Paul Sokolovsky78e8e302014-04-02 20:57:19 +030032#define MICROPY_ENABLE_GC (1)
Damien George12bab722014-04-05 20:35:48 +010033#define MICROPY_ENABLE_FINALISER (1)
Damien George136f6752014-01-07 14:54:15 +000034#define MICROPY_MEM_STATS (1)
Damien Georgecbd2f742014-01-19 11:48:48 +000035#define MICROPY_DEBUG_PRINTERS (1)
Damien George136f6752014-01-07 14:54:15 +000036#define MICROPY_ENABLE_REPL_HELPERS (1)
Damien Georged3ebe482014-01-07 15:20:33 +000037#define MICROPY_ENABLE_LEXER_UNIX (1)
Damien George62ad1892014-01-29 21:51:51 +000038#define MICROPY_ENABLE_SOURCE_LINE (1)
Damien George0c36da02014-03-08 15:24:39 +000039#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
Damien George438c88d2014-02-22 19:25:23 +000040#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
Damien George354d15a2014-02-06 21:11:19 +000041#define MICROPY_PATH_MAX (PATH_MAX)
Damien George5b65f0c2014-04-17 23:24:13 +010042#define MICROPY_USE_COMPUTED_GOTO (1)
Paul Sokolovsky4165cd12014-04-13 07:00:37 +030043#define MICROPY_MOD_SYS_STDFILES (1)
Damien Georgedbdfee12014-04-17 17:11:03 +010044#define MICROPY_ENABLE_MOD_CMATH (1)
Paul Sokolovsky1f85d622014-05-01 01:35:38 +030045// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
46// names in exception messages (may require more RAM).
47#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
Damienc025ebb2013-10-12 14:30:21 +010048
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030049extern const struct _mp_obj_module_t mp_module_time;
Paul Sokolovskye1e42492014-04-17 20:34:04 +030050extern const struct _mp_obj_module_t mp_module_socket;
Paul Sokolovsky4abaa1b2014-04-18 00:00:15 +030051extern const struct _mp_obj_module_t mp_module_ffi;
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030052#define MICROPY_EXTRA_BUILTIN_MODULES \
Paul Sokolovsky4abaa1b2014-04-18 00:00:15 +030053 { MP_OBJ_NEW_QSTR(MP_QSTR_ffi), (mp_obj_t)&mp_module_ffi }, \
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030054 { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_time }, \
Paul Sokolovskye1e42492014-04-17 20:34:04 +030055 { MP_OBJ_NEW_QSTR(MP_QSTR_microsocket), (mp_obj_t)&mp_module_socket }, \
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030056
Damienc025ebb2013-10-12 14:30:21 +010057// type definitions for the specific machine
58
Paul Sokolovskye85c3892013-12-30 03:38:32 +020059#ifdef __LP64__
60typedef long machine_int_t; // must be pointer size
61typedef unsigned long machine_uint_t; // must be pointer size
Paul Sokolovskye85c3892013-12-30 03:38:32 +020062#else
63// These are definitions for machines where sizeof(int) == sizeof(void*),
64// regardless for actual size.
65typedef int machine_int_t; // must be pointer size
66typedef unsigned int machine_uint_t; // must be pointer size
Paul Sokolovskye85c3892013-12-30 03:38:32 +020067#endif
Damiend276f632013-10-22 16:05:47 +010068
Paul Sokolovskye85c3892013-12-30 03:38:32 +020069#define BYTES_PER_WORD sizeof(machine_int_t)
70
Damienc025ebb2013-10-12 14:30:21 +010071typedef void *machine_ptr_t; // must be of pointer size
Damiend99b0522013-12-21 18:17:45 +000072typedef const void *machine_const_ptr_t; // must be of pointer size
Paul Sokolovsky910843e2014-02-14 12:02:34 +020073
Paul Sokolovsky910843e2014-02-14 12:02:34 +020074extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
75#define MICROPY_EXTRA_BUILTINS \
Damien George7efc5b32014-04-05 22:36:42 +010076 { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },