Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
bda70412
Commit
bda70412
authored
May 06, 2015
by
Josef Gajdusek
Committed by
Damien George
May 06, 2015
Browse files
esp8266: Add support for frozen modules
parent
d39d96b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
esp8266/Makefile
View file @
bda70412
...
@@ -6,6 +6,9 @@ QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h
...
@@ -6,6 +6,9 @@ QSTR_DEFS = qstrdefsport.h #$(BUILD)/pins_qstr.h
# include py core make definitions
# include py core make definitions
include
../py/py.mk
include
../py/py.mk
MAKE_FROZEN
=
../tools/make-frozen.py
SCRIPTDIR
=
scripts
PORT
=
/dev/ttyACM0
PORT
=
/dev/ttyACM0
CROSS_COMPILE
=
xtensa-lx106-elf-
CROSS_COMPILE
=
xtensa-lx106-elf-
ESP_SDK
=
$(
shell
$(CC)
-print-sysroot
)
/usr
ESP_SDK
=
$(
shell
$(CC)
-print-sysroot
)
/usr
...
@@ -51,6 +54,7 @@ SRC_C = \
...
@@ -51,6 +54,7 @@ SRC_C = \
modpybpin.c
\
modpybpin.c
\
modesp.c
\
modesp.c
\
utils.c
\
utils.c
\
$(BUILD)
/frozen.c
\
STM_SRC_C
=
$(
addprefix
stmhal/,
\
STM_SRC_C
=
$(
addprefix
stmhal/,
\
printf.c
\
printf.c
\
...
@@ -77,6 +81,19 @@ OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
...
@@ -77,6 +81,19 @@ OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
all
:
$(BUILD)/firmware-combined.bin
all
:
$(BUILD)/firmware-combined.bin
SCRIPTDIR_FILE
=
$(BUILD)
/scriptdir
ifeq
($(wildcard $(SCRIPTDIR_FILE)),)
$(shell
$(MKDIR)
-p
$(BUILD))
$(shell
echo
$(SCRIPTDIR)
>
$(SCRIPTDIR_FILE))
else
ifneq
($(shell cat $(SCRIPTDIR_FILE)), $(SCRIPTDIR))
$(shell
echo
$(SCRIPTDIR)
>
$(SCRIPTDIR_FILE))
endif
$(BUILD)/frozen.c
:
$(wildcard $(SCRIPTDIR)/*) $(SCRIPTDIR_FILE)
$(ECHO)
"Generating
$@
"
$(Q)$(MAKE_FROZEN)
$(SCRIPTDIR)
>
$@
.PHONY
:
deploy
.PHONY
:
deploy
deploy
:
$(BUILD)/firmware-combined.bin
deploy
:
$(BUILD)/firmware-combined.bin
...
...
esp8266/main.c
View file @
bda70412
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "py/runtime0.h"
#include "py/runtime0.h"
#include "py/runtime.h"
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "py/stackctrl.h"
#include "py/frozenmod.h"
#include "py/gc.h"
#include "py/gc.h"
#include "pyexec.h"
#include "pyexec.h"
#include "gccollect.h"
#include "gccollect.h"
...
@@ -46,6 +47,10 @@ STATIC void mp_reset(void) {
...
@@ -46,6 +47,10 @@ STATIC void mp_reset(void) {
mp_init
();
mp_init
();
mp_obj_list_init
(
mp_sys_path
,
0
);
mp_obj_list_init
(
mp_sys_path
,
0
);
mp_obj_list_init
(
mp_sys_argv
,
0
);
mp_obj_list_init
(
mp_sys_argv
,
0
);
#if MICROPY_MODULE_FROZEN
mp_lexer_t
*
lex
=
mp_find_frozen_module
(
"main"
,
4
);
mp_parse_compile_execute
(
lex
,
MP_PARSE_FILE_INPUT
,
mp_globals_get
(),
mp_locals_get
());
#endif
}
}
void
soft_reset
(
void
)
{
void
soft_reset
(
void
)
{
...
...
esp8266/mpconfigport.h
View file @
bda70412
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_MODULE_FROZEN (1)
// type definitions for the specific machine
// type definitions for the specific machine
...
...
esp8266/scripts/main.py
0 → 100644
View file @
bda70412
# This script is run on boot
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