blob: 41bc6a3937d428c360d312873b39ff875d8e4822 [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)
Paul Sokolovsky0ef015b2014-05-07 02:23:46 +030042#define MICROPY_STREAMS_NON_BLOCK (1)
Damien George5b65f0c2014-04-17 23:24:13 +010043#define MICROPY_USE_COMPUTED_GOTO (1)
Paul Sokolovsky4165cd12014-04-13 07:00:37 +030044#define MICROPY_MOD_SYS_STDFILES (1)
Damien Georgedbdfee12014-04-17 17:11:03 +010045#define MICROPY_ENABLE_MOD_CMATH (1)
Paul Sokolovsky1f85d622014-05-01 01:35:38 +030046// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
47// names in exception messages (may require more RAM).
48#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
Damienc025ebb2013-10-12 14:30:21 +010049
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030050extern const struct _mp_obj_module_t mp_module_time;
Paul Sokolovskye1e42492014-04-17 20:34:04 +030051extern const struct _mp_obj_module_t mp_module_socket;
Paul Sokolovsky4abaa1b2014-04-18 00:00:15 +030052extern const struct _mp_obj_module_t mp_module_ffi;
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030053#define MICROPY_EXTRA_BUILTIN_MODULES \
Paul Sokolovsky4abaa1b2014-04-18 00:00:15 +030054 { MP_OBJ_NEW_QSTR(MP_QSTR_ffi), (mp_obj_t)&mp_module_ffi }, \
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030055 { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_time }, \
Paul Sokolovskye1e42492014-04-17 20:34:04 +030056 { MP_OBJ_NEW_QSTR(MP_QSTR_microsocket), (mp_obj_t)&mp_module_socket }, \
Paul Sokolovskyeb2fc972014-04-17 18:28:38 +030057
Damienc025ebb2013-10-12 14:30:21 +010058// type definitions for the specific machine
59
Paul Sokolovskye85c3892013-12-30 03:38:32 +020060#ifdef __LP64__
61typedef long machine_int_t; // must be pointer size
62typedef unsigned long machine_uint_t; // must be pointer size
Paul Sokolovskye85c3892013-12-30 03:38:32 +020063#else
64// These are definitions for machines where sizeof(int) == sizeof(void*),
65// regardless for actual size.
66typedef int machine_int_t; // must be pointer size
67typedef unsigned int machine_uint_t; // must be pointer size
Paul Sokolovskye85c3892013-12-30 03:38:32 +020068#endif
Damiend276f632013-10-22 16:05:47 +010069
Paul Sokolovskye85c3892013-12-30 03:38:32 +020070#define BYTES_PER_WORD sizeof(machine_int_t)
71
Damienc025ebb2013-10-12 14:30:21 +010072typedef void *machine_ptr_t; // must be of pointer size
Damiend99b0522013-12-21 18:17:45 +000073typedef const void *machine_const_ptr_t; // must be of pointer size
Paul Sokolovsky910843e2014-02-14 12:02:34 +020074
Paul Sokolovsky910843e2014-02-14 12:02:34 +020075extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
76#define MICROPY_EXTRA_BUILTINS \
Damien George7efc5b32014-04-05 22:36:42 +010077 { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },