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
50e8e28f
Commit
50e8e28f
authored
Nov 05, 2016
by
Paul Sokolovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zephyr/Makefile: Add minimal port.
parent
f59465d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
1 deletion
+116
-1
zephyr/Makefile
zephyr/Makefile
+4
-1
zephyr/README.md
zephyr/README.md
+19
-0
zephyr/main.c
zephyr/main.c
+2
-0
zephyr/mpconfigport_minimal.h
zephyr/mpconfigport_minimal.h
+91
-0
No files found.
zephyr/Makefile
View file @
50e8e28f
...
...
@@ -54,7 +54,7 @@ SRC_QSTR += $(SRC_C)
OBJ
=
$(PY_O)
$(
addprefix
$(BUILD)
/,
$(SRC_C:.c=.o)
)
CFLAGS
=
$(KBUILD_CFLAGS)
$(NOSTDINC_FLAGS)
$(ZEPHYRINCLUDE)
\
-std
=
gnu99
-DNDEBUG
-DMICROPY_HEAP_SIZE
=
$(MICROPY_HEAP_SIZE)
$(INC)
-std
=
gnu99
-DNDEBUG
-DMICROPY_HEAP_SIZE
=
$(MICROPY_HEAP_SIZE)
$(
CFLAGS_EXTRA)
$(
INC)
include
../py/mkrules.mk
...
...
@@ -83,6 +83,9 @@ $(Z_SYSGEN_H):
rm
-f
$(LIBMICROPYTHON)
-
$(MAKE)
-f
Makefile.zephyr
BOARD
=
$(BOARD)
CONF_FILE
=
$(CONF_FILE)
minimal
:
$(MAKE)
BOARD
=
$(BOARD)
CFLAGS_EXTRA
=
'-DMP_CONFIGFILE="<mpconfigport_minimal.h>"'
FROZEN_DIR
=
# Clean Zephyr things too
clean
:
z_clean
...
...
zephyr/README.md
View file @
50e8e28f
...
...
@@ -74,3 +74,22 @@ starts from 0). You will need to adjust it for another board (using board's
reference materials). To execute the above sample, copy it to clipboard, in
MicroPython REPL enter "paste mode" using Ctrl+E, paste clipboard, press
Ctrl+D to finish paste mode and start execution.
Minimal build
-------------
MicroPython is committed to maintain minimal binary size for Zephyr port
below 128KB, as long as Zephyr project is committed to maintain stable
minimal size of their kernel (which they appear to be). Note that at such
size, there is no support for any Zephyr features beyond REPL over UART,
and only very minimal set of builtin Python modules. Thus, this build
is more suitable for code size control and quick demonstrations even on
smaller systems. It's also suitable for careful enabling of features one
by one to achieve needed functionality and code size. This is in contrast
to the "default" build, which may get more and more features enabled by
default over time.
To make a minimal build:
make BOARD=<board> minimal
zephyr/main.c
View file @
50e8e28f
...
...
@@ -72,7 +72,9 @@ int real_main(void) {
#endif
mp_init
();
MP_STATE_PORT
(
mp_kbd_exception
)
=
mp_obj_new_exception
(
&
mp_type_KeyboardInterrupt
);
#if MICROPY_MODULE_FROZEN
pyexec_frozen_module
(
"main.py"
);
#endif
#if MICROPY_REPL_EVENT_DRIVEN
pyexec_event_repl_init
();
for
(;;)
{
...
...
zephyr/mpconfigport_minimal.h
0 → 100644
View file @
50e8e28f
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Linaro Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <alloca.h>
// Include Zephyr's autoconf.h, which should be made first by Zephyr makefiles
#include "autoconf.h"
// Usually passed from Makefile
#ifndef MICROPY_HEAP_SIZE
#define MICROPY_HEAP_SIZE (16 * 1024)
#endif
#define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_ATTRTUPLE (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FILTER (0)
#define MICROPY_PY_BUILTINS_MIN_MAX (0)
#define MICROPY_PY_BUILTINS_PROPERTY (0)
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_SLICE (0)
#define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_SYS_MODULES (0)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_PY_BUILTINS_COMPLEX (0)
// Saving extra crumbs to make sure binary fits in 128K
#define MICROPY_COMP_CONST_FOLDING (0)
#define MICROPY_COMP_CONST (0)
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (0)
#ifdef CONFIG_BOARD
#define MICROPY_HW_BOARD_NAME "zephyr-" CONFIG_BOARD
#else
#define MICROPY_HW_BOARD_NAME "zephyr-generic"
#endif
#ifdef CONFIG_SOC
#define MICROPY_HW_MCU_NAME CONFIG_SOC
#else
#define MICROPY_HW_MCU_NAME "unknown-cpu"
#endif
typedef
int
mp_int_t
;
// must be pointer size
typedef
unsigned
mp_uint_t
;
// must be pointer size
typedef
void
*
machine_ptr_t
;
// must be of pointer size
typedef
const
void
*
machine_const_ptr_t
;
// must be of pointer size
typedef
long
mp_off_t
;
#define BYTES_PER_WORD (sizeof(mp_int_t))
#define MP_STATE_PORT MP_STATE_VM
#define MICROPY_PORT_ROOT_POINTERS \
mp_obj_t mp_kbd_exception; \
const char *readline_hist[8];
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