9
0
Fork 0

Micro Python: Add logic to automatically download the Micro Python tarball at download

This commit is contained in:
Gregory Nutt 2015-01-11 10:49:20 -06:00
parent 00b64ed8bb
commit 999c029f44
6 changed files with 67 additions and 24 deletions

View File

@ -3,8 +3,8 @@
# see misc/tools/kconfig-language.txt.
#
source "$APPSDIR/interpreters/ficl/Kconfig"
source "$APPSDIR/interpreters/bas/Kconfig"
source "$APPSDIR/interpreters/ficl/Kconfig"
config INTERPRETERS_PCODE
bool "Pascal p-code interpreter"
@ -17,3 +17,5 @@ config INTERPRETERS_PCODE
if INTERPRETERS_PCODE
endif
source "$APPSDIR/interpreters/micropython/Kconfig"

View File

@ -19,18 +19,30 @@ micropython
https://micropython.org/
NOTE that Micro Python is not included in this directory. Before building
this example, you must first download Micro Python from:
NOTE that Micro Python is not included in this directory. Be default,
it will be downloaded at build time from the github . You can avoid
this download by pre-installing Micro Python. Before building, just
download Micro Python from:
https://micropython.org/download/
https://github.com/micropython/micropython/releases
Or clone from the GIT repository:
Or clone from the GIT repository at:
https://github.com/micropython/
https://github.com/micropython/micropython
This port was contributed by Dave Marples using Micro Python circu
The Micro Python code should reside in directory should be
apps/interpreters/micropython/micropython-$(CONFIG_INTERPRETERS_MICROPYTHON_VERSION)
This port was contributed by Dave Marples using Micro Python circa
1.3.8. It may not be compatible with other versions.
NOTE: Right now, Micro Python will not build on Windows with a Windows
native toolchain due to usage of POSIX paths in the Micro Python build
system. It should build correctly on Linux or under Cygwin with the
NuttX buildroot tools.
pcode
-----

View File

@ -11,6 +11,14 @@ config INTERPRETERS_MICROPYTHON
if INTERPRETERS_MICROPYTHON
config INTERPRETERS_MICROPYTHON_URL
string "URL where Micro Python can be downloaded"
default "https://github.com/micropython/micropython/archive"
config INTERPRETERS_MICROPYTHON_VERSION
string "Version number"
default "1.3.8"
config INTERPRETERS_MICROPYTHON_APPNAME
string "Executable name"
default "micropython"
@ -26,9 +34,9 @@ config INTERPRETERS_MICROPYTHON_PRIORITY
default 100
depends on NSH_BUILTIN_APPS
CONFIG_INTERPRETERS_MICROPYTHON_PROGNAME
config INTERPRETERS_MICROPYTHON_PROGNAME
string "Program name"
default "micropython"
depends on BUILD_KERNEL
endif # INTERPRETERS_MICROPYTHON
endif # INTERPRETERS_MICROPYTHON

View File

@ -34,13 +34,24 @@
#
###########################################################################
TOP ?= ../../../../micropython
TOPDIR ?= ../../../nuttx
APPDIR ?= ../../../apps
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
MICROPYTHON_DIR = $(TOP)/py
WD := ${shell pwd | sed -e 's/ /\\ /g'}
include $(MICROPYTHON_DIR)/mkenv.mk
CONFIG_INTERPRETERS_MICROPYTHON_URL ?= "https://github.com/micropython/micropython/archive"
CONFIG_INTERPRETERS_MICROPYTHON_VERSION ?= "1.3.8"
MICROPYTHON_VERSION = $(patsubst "%",%,$(strip $(CONFIG_INTERPRETERS_MICROPYTHON_VERSION)))
MICROPYTHON_TARBALL = v$(MICROPYTHON_VERSION).tar.gz
WGET ?= wget
MICROPYTHON_UNPACKNAME = micropython-$(MICROPYTHON_VERSION)
UNPACK ?= tar -zxf
MICROPYTHON_PATH = $(WD)/$(MICROPYTHON_UNPACKNAME)/py
-include $(MICROPYTHON_PATH)/mkenv.mk
# qstr definitions (must come before including py.mk)
@ -48,17 +59,13 @@ QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(MICROPYTHON_DIR)/py.mk
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
-include $(MICROPYTHON_PATH)/py.mk
# c99 is needed for micropython
CFLAGS+=-std=c99 -Wno-shadow -Wno-strict-prototypes
INC = -I. -I$(TOP) -I$(PY_SRC) -I$(BUILD)
INC = -I. -I$(WD) -I$(PY_SRC) -I$(BUILD)
CFLAGS +=$(INC)
@ -105,12 +112,21 @@ ROOTDEPPATH = --dep-path .
all: .built
.built: $(OBJ)
$(MICROPYTHON_TARBALL):
@echo "Downloading: $(MICROPYTHON_TARBALL)"
$(Q) $(WGET) $(CONFIG_INTERPRETERS_MICROPYTHON_URL)/$(MICROPYTHON_TARBALL)
$(MICROPYTHON_UNPACKNAME): $(MICROPYTHON_TARBALL)
@echo "Unpacking: $(MICROPYTHON_TARBALL) -> $(MICROPYTHON_UNPACKNAME)"
$(Q) $(UNPACK) $(MICROPYTHON_TARBALL)
@touch $(MICROPYTHON_UNPACKNAME)
.built: $(MICROPYTHON_UNPACKNAME) $(OBJ)
$(call ARCHIVE, $(BIN), $(OBJ))
@touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJ) $(MAINOBJ)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(MICROPYTHON_UNPACKNAME) $(OBJ) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
@ -124,7 +140,7 @@ ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),micropython_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
context: $(MICROPYTHON_UNPACKNAME) $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
@ -135,9 +151,14 @@ endif
depend: .depend
clean:
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
$(call DELDIR, $(MICROPYTHON_UNPACKNAME))
$(call DELFILE, .downloaded)
$(call DELFILE, .$(MICROPYTHON_TARBALL))
include $(MICROPYTHON_DIR)/mkrules.mk
-include $(MICROPYTHON_PATH)/mkrules.mk
-include Make.dep

View File

@ -42,7 +42,7 @@
#include "cfgdefine.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -44,7 +44,7 @@
#include "cfgparser.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************