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

View File

@ -19,18 +19,30 @@ micropython
https://micropython.org/ https://micropython.org/
NOTE that Micro Python is not included in this directory. Before building NOTE that Micro Python is not included in this directory. Be default,
this example, you must first download Micro Python from: 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://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/
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. 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 pcode
----- -----

View File

@ -11,6 +11,14 @@ config INTERPRETERS_MICROPYTHON
if 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 config INTERPRETERS_MICROPYTHON_APPNAME
string "Executable name" string "Executable name"
default "micropython" default "micropython"
@ -26,9 +34,9 @@ config INTERPRETERS_MICROPYTHON_PRIORITY
default 100 default 100
depends on NSH_BUILTIN_APPS depends on NSH_BUILTIN_APPS
CONFIG_INTERPRETERS_MICROPYTHON_PROGNAME config INTERPRETERS_MICROPYTHON_PROGNAME
string "Program name" string "Program name"
default "micropython" default "micropython"
depends on BUILD_KERNEL depends on BUILD_KERNEL
endif # INTERPRETERS_MICROPYTHON endif # INTERPRETERS_MICROPYTHON

View File

@ -34,13 +34,24 @@
# #
########################################################################### ###########################################################################
TOP ?= ../../../../micropython -include $(TOPDIR)/.config
TOPDIR ?= ../../../nuttx -include $(TOPDIR)/Make.defs
APPDIR ?= ../../../apps 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) # qstr definitions (must come before including py.mk)
@ -48,17 +59,13 @@ QSTR_DEFS = qstrdefsport.h
# include py core make definitions # include py core make definitions
include $(MICROPYTHON_DIR)/py.mk -include $(MICROPYTHON_PATH)/py.mk
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# c99 is needed for micropython # c99 is needed for micropython
CFLAGS+=-std=c99 -Wno-shadow -Wno-strict-prototypes 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) CFLAGS +=$(INC)
@ -105,12 +112,21 @@ ROOTDEPPATH = --dep-path .
all: .built 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)) $(call ARCHIVE, $(BIN), $(OBJ))
@touch .built @touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y) ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJ) $(MAINOBJ) $(BIN_DIR)$(DELIM)$(PROGNAME): $(MICROPYTHON_UNPACKNAME) $(OBJ) $(MAINOBJ)
@echo "LD: $(PROGNAME)" @echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS) $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(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 $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),micropython_main) $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),micropython_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat context: $(MICROPYTHON_UNPACKNAME) $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else else
context: context:
endif endif
@ -135,9 +151,14 @@ endif
depend: .depend depend: .depend
clean:
distclean: clean distclean: clean
$(call DELFILE, Make.dep) $(call DELFILE, Make.dep)
$(call DELFILE, .depend) $(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 -include Make.dep

View File

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

View File

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