blob: d10e3142f60d6147b45088235f8471428e744ea7 [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
Dave Hylandsf14b92b2014-03-12 18:06:26 -070027// options to control how Micro Python is built
28
Damien George58ebde42014-05-21 20:32:59 +010029#define MICROPY_ALLOC_PATH_MAX (128)
Dave Hylandsf14b92b2014-03-12 18:06:26 -070030#define MICROPY_EMIT_THUMB (1)
31#define MICROPY_EMIT_INLINE_THUMB (1)
32#define MICROPY_ENABLE_GC (1)
Damien George12bab722014-04-05 20:35:48 +010033#define MICROPY_ENABLE_FINALISER (1)
Damien George58ebde42014-05-21 20:32:59 +010034#define MICROPY_HELPER_REPL (1)
Damien George73496fb2014-04-13 14:51:56 +010035#define MICROPY_ENABLE_SOURCE_LINE (1)
Damien Georgef92a0d42014-05-11 17:27:31 +010036#define MICROPY_ENABLE_FROZENSET (1)
Dave Hylandsf14b92b2014-03-12 18:06:26 -070037#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
38#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
Damien George58ebde42014-05-21 20:32:59 +010039#define MICROPY_OPT_COMPUTED_GOTO (1)
Dave Hylandsf14b92b2014-03-12 18:06:26 -070040/* Enable FatFS LFNs
41 0: Disable LFN feature.
42 1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
43 2: Enable LFN with dynamic working buffer on the STACK.
44 3: Enable LFN with dynamic working buffer on the HEAP.
45*/
Damien Georgeb92d3e12014-03-17 14:04:19 +000046#define MICROPY_ENABLE_LFN (1)
47#define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
Damien George89755ae2014-05-11 17:35:43 +010048#define MICROPY_MOD_SYS_EXIT (1)
Damien George86a03042014-04-13 19:00:56 +010049#define MICROPY_MOD_SYS_STDFILES (1)
Damien George93e51b52014-05-03 18:40:50 +010050#define MICROPY_ENABLE_MOD_CMATH (1)
Damien Georgeb92d3e12014-03-17 14:04:19 +000051
52// extra built in names to add to the global namespace
Damien George5fd2ebb2014-03-24 11:27:56 +000053extern const struct _mp_obj_fun_native_t mp_builtin_help_obj;
Damien George02fa0352014-03-22 23:53:50 +000054extern const struct _mp_obj_fun_native_t mp_builtin_input_obj;
Damien Georgeb92d3e12014-03-17 14:04:19 +000055extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
Damien George58ebde42014-05-21 20:32:59 +010056#define MICROPY_PORT_BUILTINS \
Damien George7efc5b32014-04-05 22:36:42 +010057 { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
58 { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
59 { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
Dave Hylandsf14b92b2014-03-12 18:06:26 -070060
Damien Georgecaac5422014-03-25 14:18:18 +000061// extra built in modules to add to the list of known ones
62extern const struct _mp_obj_module_t os_module;
63extern const struct _mp_obj_module_t pyb_module;
Damien George3f489842014-04-10 22:46:40 +010064extern const struct _mp_obj_module_t stm_module;
Damien Georgecaac5422014-03-25 14:18:18 +000065extern const struct _mp_obj_module_t time_module;
Damien George58ebde42014-05-21 20:32:59 +010066#define MICROPY_PORT_BUILTIN_MODULES \
Damien George7efc5b32014-04-05 22:36:42 +010067 { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
68 { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
Damien George3f489842014-04-10 22:46:40 +010069 { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
Damien George7efc5b32014-04-05 22:36:42 +010070 { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
Damien Georgecaac5422014-03-25 14:18:18 +000071
Damien George3f489842014-04-10 22:46:40 +010072// extra constants
Damien George58ebde42014-05-21 20:32:59 +010073#define MICROPY_PORT_CONSTANTS \
Damien George3f489842014-04-10 22:46:40 +010074 { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
75 { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
76
Dave Hylandsf14b92b2014-03-12 18:06:26 -070077// type definitions for the specific machine
78
79#define BYTES_PER_WORD (4)
80
Damien George5874c1c2014-05-03 13:24:21 +010081#define UINT_FMT "%u"
82#define INT_FMT "%d"
Dave Hylandsf14b92b2014-03-12 18:06:26 -070083
Damien George5874c1c2014-05-03 13:24:21 +010084typedef int machine_int_t; // must be pointer size
85typedef unsigned int machine_uint_t; // must be pointer size
Dave Hylandsf14b92b2014-03-12 18:06:26 -070086typedef void *machine_ptr_t; // must be of pointer size
87typedef const void *machine_const_ptr_t; // must be of pointer size
88
89// There is no classical C heap in bare-metal ports, only Python
90// garbage-collected heap. For completeness, emulate C heap via
91// GC heap. Note that MicroPython core never uses malloc() and friends,
92// so these defines are mostly to help extension module writers.
93#define malloc gc_alloc
94#define free gc_free
95#define realloc gc_realloc
96
Dave Hylands0a64c922014-03-14 00:51:26 -070097#define USE_DEVICE_MODE
98//#define USE_HOST_MODE
99
100// board specific definitions
101#include "mpconfigboard.h"