All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] micropython: new package
@ 2015-09-14 10:21 Chris Packham
  2015-09-14 13:06 ` Vicente Olivert Riera
                   ` (3 more replies)
  0 siblings, 4 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-14 10:21 UTC (permalink / raw)
  To: buildroot

MicroPython - a lean and efficient Python implementation for
microcontrollers and constrained systems.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

Hi Buildroot,
    
Thought you might be interested in mircopython a minimal python 3
implementation. It's designed for micro controllers but is also well suited
to other general purpose embedded CPUs.
    
Cheers,
Chris

 package/Config.in                          |  2 ++
 package/micropython-lib/Config.in          |  7 +++++++
 package/micropython-lib/micropython-lib.mk | 12 ++++++++++++
 package/micropython/Config.in              |  8 ++++++++
 package/micropython/micropython.mk         | 22 ++++++++++++++++++++++
 5 files changed, 51 insertions(+)
 create mode 100644 package/micropython-lib/Config.in
 create mode 100644 package/micropython-lib/micropython-lib.mk
 create mode 100644 package/micropython/Config.in
 create mode 100644 package/micropython/micropython.mk

diff --git a/package/Config.in b/package/Config.in
index fc35f12..986fe16 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -509,6 +509,8 @@ menu "Lua libraries/modules"
 endmenu
 endif
 	source "package/lutok/Config.in"
+	source "package/micropython/Config.in"
+	source "package/micropython-lib/Config.in"
 	source "package/moarvm/Config.in"
 	source "package/mono/Config.in"
 if BR2_PACKAGE_MONO
diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
new file mode 100644
index 0000000..a7e017b
--- /dev/null
+++ b/package/micropython-lib/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MICROPYTHON_LIB
+	bool "micropython-lib"
+	depends on BR2_PACKAGE_MICROPYTHON
+	help
+	  Core Python libraries ported to MicroPython.
+
+	  http://micropython.org
diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
new file mode 100644
index 0000000..c0e6a2a
--- /dev/null
+++ b/package/micropython-lib/micropython-lib.mk
@@ -0,0 +1,12 @@
+################################################################################
+# micropython-lib
+################################################################################
+MICROPYTHON_LIB_VERSION = v0.5
+MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
+MICROPYTHON_LIB_LICENSE_FILES = LICENSE
+
+define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D) PREFIX=$(TARGET_DIR)/usr/lib/micropython install
+endef
+
+$(eval $(generic-package))
diff --git a/package/micropython/Config.in b/package/micropython/Config.in
new file mode 100644
index 0000000..ca60f01
--- /dev/null
+++ b/package/micropython/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_MICROPYTHON
+	bool "micropython"
+	select BR2_PACKAGE_LIBFFI
+	help
+	  MicroPython - a lean and efficient Python implementation for
+	  microcontrollers and constrained systems.
+
+	  http://micropython.org
diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
new file mode 100644
index 0000000..9b5e7d2
--- /dev/null
+++ b/package/micropython/micropython.mk
@@ -0,0 +1,22 @@
+################################################################################
+# micropython
+################################################################################
+MICROPYTHON_VERSION = v1.4.5
+MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
+MICROPYTHON_LICENSE = MIT
+MICROPYTHON_LICENSE_FILES = LICENSE
+MICROPYTHON_DEPENDENCIES = libffi
+
+ifeq ($(BR2_powerpc),y)
+MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
+endif
+
+define MICROPYTHON_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D)/unix \
+		CROSS_COMPILE=$(TARGET_CROSS) \
+		DESTDIR=$(TARGET_DIR) \
+		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
+		install
+endef
+
+$(eval $(generic-package))
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
@ 2015-09-14 13:06 ` Vicente Olivert Riera
  2015-09-14 23:14   ` Chris Packham
  2015-09-14 13:40 ` Vicente Olivert Riera
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-14 13:06 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On 09/14/2015 11:21 AM, Chris Packham wrote:
> MicroPython - a lean and efficient Python implementation for
> microcontrollers and constrained systems.

The website says:

"Micro Python is a lean and fast implementation of the Python 3
programming language that is optimised to run on a microcontroller."

So, why don't we use that comment instead? It also specifies the Python
version which is important.

More comments below. Please scroll down.

> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> 
> Hi Buildroot,
>     
> Thought you might be interested in mircopython a minimal python 3
> implementation. It's designed for micro controllers but is also well suited
> to other general purpose embedded CPUs.
>     
> Cheers,
> Chris
> 
>  package/Config.in                          |  2 ++
>  package/micropython-lib/Config.in          |  7 +++++++
>  package/micropython-lib/micropython-lib.mk | 12 ++++++++++++
>  package/micropython/Config.in              |  8 ++++++++
>  package/micropython/micropython.mk         | 22 ++++++++++++++++++++++
>  5 files changed, 51 insertions(+)
>  create mode 100644 package/micropython-lib/Config.in
>  create mode 100644 package/micropython-lib/micropython-lib.mk
>  create mode 100644 package/micropython/Config.in
>  create mode 100644 package/micropython/micropython.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index fc35f12..986fe16 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -509,6 +509,8 @@ menu "Lua libraries/modules"
>  endmenu
>  endif
>  	source "package/lutok/Config.in"
> +	source "package/micropython/Config.in"
> +	source "package/micropython-lib/Config.in"
>  	source "package/moarvm/Config.in"
>  	source "package/mono/Config.in"
>  if BR2_PACKAGE_MONO
> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
> new file mode 100644
> index 0000000..a7e017b
> --- /dev/null
> +++ b/package/micropython-lib/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_MICROPYTHON_LIB
> +	bool "micropython-lib"
> +	depends on BR2_PACKAGE_MICROPYTHON
> +	help
> +	  Core Python libraries ported to MicroPython.
> +
> +	  http://micropython.org
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..c0e6a2a
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,12 @@
> +################################################################################
> +# micropython-lib
> +################################################################################
> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> +
> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
> +	$(MAKE) -C $(@D) PREFIX=$(TARGET_DIR)/usr/lib/micropython install
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/micropython/Config.in b/package/micropython/Config.in
> new file mode 100644
> index 0000000..ca60f01
> --- /dev/null
> +++ b/package/micropython/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_MICROPYTHON
> +	bool "micropython"
> +	select BR2_PACKAGE_LIBFFI
> +	help
> +	  MicroPython - a lean and efficient Python implementation for
> +	  microcontrollers and constrained systems.

Same here, I would use the same exact command you can find in
mycropython's website.

> +
> +	  http://micropython.org
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..9b5e7d2
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +# micropython
> +################################################################################
> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = libffi
> +
> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif

A comment about why this is necessary for powerpc would be good, IMHO.

Regards,

Vincent.

> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(MAKE) -C $(@D)/unix \
> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
  2015-09-14 13:06 ` Vicente Olivert Riera
@ 2015-09-14 13:40 ` Vicente Olivert Riera
  2015-09-14 22:44   ` Chris Packham
  2015-09-14 13:58 ` Thomas Petazzoni
  2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
  3 siblings, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-14 13:40 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

more comments:

On 09/14/2015 11:21 AM, Chris Packham wrote:
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..9b5e7d2
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +# micropython
> +################################################################################
> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = libffi

micropython calls pkg-config in order to obtain the libraries and cflags
for libffi:

ifeq ($(MICROPY_PY_FFI),1)
LIBFFI_LDFLAGS_MOD := $(shell pkg-config --libs libffi)
LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi)
CFLAGS_MOD += $(LIBFFI_CFLAGS_MOD) -DMICROPY_PY_FFI=1

So please, add host-pkgconf to MICROPYTHON_DEPENDENCIES. Otherwise it
will fail to compile with an error like this one:

LINK micropython
build/modffi.o: In function `ffifunc_call':
modffi.c:(.text+0x24c): undefined reference to `ffi_call'
modffi.c:(.text+0x260): undefined reference to `ffi_call'
build/modffi.o: In function `mod_ffi_callback':
modffi.c:(.text+0x7b0): undefined reference to `ffi_closure_alloc'
... and many more

> +
> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif
> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(MAKE) -C $(@D)/unix \

Please add $(TARGET_MAKE_ENV) before $(MAKE). You need that in order to
Buildroot set the PATH variable so the pkg-config executable and the
libffi.pc file can be found.

Regards,

Vincent.

> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
  2015-09-14 13:06 ` Vicente Olivert Riera
  2015-09-14 13:40 ` Vicente Olivert Riera
@ 2015-09-14 13:58 ` Thomas Petazzoni
  2015-09-14 14:12   ` Vicente Olivert Riera
  2015-09-14 23:01   ` Chris Packham
  2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
  3 siblings, 2 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-14 13:58 UTC (permalink / raw)
  To: buildroot

Chris,

Thanks for this contribution.

On Mon, 14 Sep 2015 22:21:42 +1200, Chris Packham wrote:
> MicroPython - a lean and efficient Python implementation for
> microcontrollers and constrained systems.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> 
> Hi Buildroot,
>     
> Thought you might be interested in mircopython a minimal python 3
> implementation. It's designed for micro controllers but is also well suited
> to other general purpose embedded CPUs.

Some quick questions that come to mind:

 * What happens if we have Micropython installed next to the regular
   Python 2 or Python 3 interpreters / standard library on the same
   system? Do they conflict or not?

 * What about all the Python external modules (package/python-*/) we
   have in Buildroot? Do they work with Micropython?

> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
> new file mode 100644
> index 0000000..a7e017b
> --- /dev/null
> +++ b/package/micropython-lib/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_MICROPYTHON_LIB
> +	bool "micropython-lib"
> +	depends on BR2_PACKAGE_MICROPYTHON
> +	help
> +	  Core Python libraries ported to MicroPython.
> +
> +	  http://micropython.org
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..c0e6a2a
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,12 @@
> +################################################################################
> +# micropython-lib
> +################################################################################

Nitpick: use the standard header for all packages. You lack an empty
line before and after the package name. See all other Buildroot
packages. Ditto for the micropython package.

> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE

You should define MICROPYTHON_LIB_LICENSE as well.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 13:58 ` Thomas Petazzoni
@ 2015-09-14 14:12   ` Vicente Olivert Riera
  2015-09-14 23:03     ` Chris Packham
  2015-09-14 23:01   ` Chris Packham
  1 sibling, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-14 14:12 UTC (permalink / raw)
  To: buildroot

Dear Thomas Petazzoni,

On 09/14/2015 02:58 PM, Thomas Petazzoni wrote:
> Chris,
> 
> Thanks for this contribution.
> 
> On Mon, 14 Sep 2015 22:21:42 +1200, Chris Packham wrote:
>> MicroPython - a lean and efficient Python implementation for
>> microcontrollers and constrained systems.
>>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>> ---
>>
>> Hi Buildroot,
>>     
>> Thought you might be interested in mircopython a minimal python 3
>> implementation. It's designed for micro controllers but is also well suited
>> to other general purpose embedded CPUs.
> 
> Some quick questions that come to mind:
> 
>  * What happens if we have Micropython installed next to the regular
>    Python 2 or Python 3 interpreters / standard library on the same
>    system? Do they conflict or not?

It shouldn't conflict as micropython installs the library files under
/usr/lib/micropython/ directory. And the installed binaries are
/usr/local/bin/{pip-}micropython. Perhaps this should be changed to
install them in /usr instead of /usr/local.

Regards,

Vincent.

>  * What about all the Python external modules (package/python-*/) we
>    have in Buildroot? Do they work with Micropython?
> 
>> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
>> new file mode 100644
>> index 0000000..a7e017b
>> --- /dev/null
>> +++ b/package/micropython-lib/Config.in
>> @@ -0,0 +1,7 @@
>> +config BR2_PACKAGE_MICROPYTHON_LIB
>> +	bool "micropython-lib"
>> +	depends on BR2_PACKAGE_MICROPYTHON
>> +	help
>> +	  Core Python libraries ported to MicroPython.
>> +
>> +	  http://micropython.org
>> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
>> new file mode 100644
>> index 0000000..c0e6a2a
>> --- /dev/null
>> +++ b/package/micropython-lib/micropython-lib.mk
>> @@ -0,0 +1,12 @@
>> +################################################################################
>> +# micropython-lib
>> +################################################################################
> 
> Nitpick: use the standard header for all packages. You lack an empty
> line before and after the package name. See all other Buildroot
> packages. Ditto for the micropython package.
> 
>> +MICROPYTHON_LIB_VERSION = v0.5
>> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
>> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> 
> You should define MICROPYTHON_LIB_LICENSE as well.
> 
> Thomas
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 13:40 ` Vicente Olivert Riera
@ 2015-09-14 22:44   ` Chris Packham
  0 siblings, 0 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-14 22:44 UTC (permalink / raw)
  To: buildroot

Hi Vincent,

On Tue, Sep 15, 2015 at 1:40 AM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Chris Packham,
>
> more comments:
>
> On 09/14/2015 11:21 AM, Chris Packham wrote:
>> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
>> new file mode 100644
>> index 0000000..9b5e7d2
>> --- /dev/null
>> +++ b/package/micropython/micropython.mk
>> @@ -0,0 +1,22 @@
>> +################################################################################
>> +# micropython
>> +################################################################################
>> +MICROPYTHON_VERSION = v1.4.5
>> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
>> +MICROPYTHON_LICENSE = MIT
>> +MICROPYTHON_LICENSE_FILES = LICENSE
>> +MICROPYTHON_DEPENDENCIES = libffi
>
> micropython calls pkg-config in order to obtain the libraries and cflags
> for libffi:
>
> ifeq ($(MICROPY_PY_FFI),1)
> LIBFFI_LDFLAGS_MOD := $(shell pkg-config --libs libffi)
> LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi)
> CFLAGS_MOD += $(LIBFFI_CFLAGS_MOD) -DMICROPY_PY_FFI=1
>
> So please, add host-pkgconf to MICROPYTHON_DEPENDENCIES. Otherwise it
> will fail to compile with an error like this one:
>
> LINK micropython
> build/modffi.o: In function `ffifunc_call':
> modffi.c:(.text+0x24c): undefined reference to `ffi_call'
> modffi.c:(.text+0x260): undefined reference to `ffi_call'
> build/modffi.o: In function `mod_ffi_callback':
> modffi.c:(.text+0x7b0): undefined reference to `ffi_closure_alloc'
> ... and many more
>
>> +
>> +ifeq ($(BR2_powerpc),y)
>> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>> +endif
>> +
>> +define MICROPYTHON_INSTALL_TARGET_CMDS
>> +     $(MAKE) -C $(@D)/unix \
>
> Please add $(TARGET_MAKE_ENV) before $(MAKE). You need that in order to
> Buildroot set the PATH variable so the pkg-config executable and the
> libffi.pc file can be found.
>
> Regards,
>
> Vincent.
>
>> +             CROSS_COMPILE=$(TARGET_CROSS) \
>> +             DESTDIR=$(TARGET_DIR) \
>> +             CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
>> +             install
>> +endef
>> +
>> +$(eval $(generic-package))
>>
>

OK thanks. Will look at these comments and the ones from the other
mail. I was using qemu_x86_defconfig for testing so it probably picked
up things from my host environment.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 13:58 ` Thomas Petazzoni
  2015-09-14 14:12   ` Vicente Olivert Riera
@ 2015-09-14 23:01   ` Chris Packham
  2015-09-15  8:23     ` Thomas Petazzoni
  1 sibling, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-14 23:01 UTC (permalink / raw)
  To: buildroot

On Tue, Sep 15, 2015 at 1:58 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Chris,
>
> Thanks for this contribution.
>
> On Mon, 14 Sep 2015 22:21:42 +1200, Chris Packham wrote:
>> MicroPython - a lean and efficient Python implementation for
>> microcontrollers and constrained systems.
>>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>> ---
>>
>> Hi Buildroot,
>>
>> Thought you might be interested in mircopython a minimal python 3
>> implementation. It's designed for micro controllers but is also well suited
>> to other general purpose embedded CPUs.
>
> Some quick questions that come to mind:
>
>  * What happens if we have Micropython installed next to the regular
>    Python 2 or Python 3 interpreters / standard library on the same
>    system? Do they conflict or not?

They're installed in with different executable names and library paths
so they should co-exist happily.

>
>  * What about all the Python external modules (package/python-*/) we
>    have in Buildroot? Do they work with Micropython?

Probably depends on the module, but I assume the answer is mostly no.
Some of the "standard" libraries in micropython-lib are stubs to quote
the readme: "micropython-lib is a highly experimental community
project". Getting into buildroot is one way of helping them to move
out of "experimental" status.

>> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
>> new file mode 100644
>> index 0000000..a7e017b
>> --- /dev/null
>> +++ b/package/micropython-lib/Config.in
>> @@ -0,0 +1,7 @@
>> +config BR2_PACKAGE_MICROPYTHON_LIB
>> +     bool "micropython-lib"
>> +     depends on BR2_PACKAGE_MICROPYTHON
>> +     help
>> +       Core Python libraries ported to MicroPython.
>> +
>> +       http://micropython.org
>> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
>> new file mode 100644
>> index 0000000..c0e6a2a
>> --- /dev/null
>> +++ b/package/micropython-lib/micropython-lib.mk
>> @@ -0,0 +1,12 @@
>> +################################################################################
>> +# micropython-lib
>> +################################################################################
>
> Nitpick: use the standard header for all packages. You lack an empty
> line before and after the package name. See all other Buildroot
> packages. Ditto for the micropython package.
>

Will do.

>> +MICROPYTHON_LIB_VERSION = v0.5
>> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
>> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
>
> You should define MICROPYTHON_LIB_LICENSE as well.

That's an interesting problem. It's actually multiple licenses
(depending on the source of the library) so nothing in the "normal"[1]
list fits. I could say "various" or enumerate the ones I can identify
but it would be hard to be accurate.

>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

[1] - http://buildroot.org/downloads/manual/manual.html#legal-info-list-licenses

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 14:12   ` Vicente Olivert Riera
@ 2015-09-14 23:03     ` Chris Packham
  2015-09-15  8:24       ` Thomas Petazzoni
  2015-09-15 19:49       ` Jörg Krause
  0 siblings, 2 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-14 23:03 UTC (permalink / raw)
  To: buildroot

On Tue, Sep 15, 2015 at 2:12 AM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Thomas Petazzoni,
>
> On 09/14/2015 02:58 PM, Thomas Petazzoni wrote:
>> Chris,
>>
>> Thanks for this contribution.
>>
>> On Mon, 14 Sep 2015 22:21:42 +1200, Chris Packham wrote:
>>> MicroPython - a lean and efficient Python implementation for
>>> microcontrollers and constrained systems.
>>>
>>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>>> ---
>>>
>>> Hi Buildroot,
>>>
>>> Thought you might be interested in mircopython a minimal python 3
>>> implementation. It's designed for micro controllers but is also well suited
>>> to other general purpose embedded CPUs.
>>
>> Some quick questions that come to mind:
>>
>>  * What happens if we have Micropython installed next to the regular
>>    Python 2 or Python 3 interpreters / standard library on the same
>>    system? Do they conflict or not?
>
> It shouldn't conflict as micropython installs the library files under
> /usr/lib/micropython/ directory. And the installed binaries are
> /usr/local/bin/{pip-}micropython. Perhaps this should be changed to
> install them in /usr instead of /usr/local.

The local part seems hard-coded to me. But we could always sed it on
the way through.

>
> Regards,
>
> Vincent.
>
>>  * What about all the Python external modules (package/python-*/) we
>>    have in Buildroot? Do they work with Micropython?
>>
>>> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
>>> new file mode 100644
>>> index 0000000..a7e017b
>>> --- /dev/null
>>> +++ b/package/micropython-lib/Config.in
>>> @@ -0,0 +1,7 @@
>>> +config BR2_PACKAGE_MICROPYTHON_LIB
>>> +    bool "micropython-lib"
>>> +    depends on BR2_PACKAGE_MICROPYTHON
>>> +    help
>>> +      Core Python libraries ported to MicroPython.
>>> +
>>> +      http://micropython.org
>>> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
>>> new file mode 100644
>>> index 0000000..c0e6a2a
>>> --- /dev/null
>>> +++ b/package/micropython-lib/micropython-lib.mk
>>> @@ -0,0 +1,12 @@
>>> +################################################################################
>>> +# micropython-lib
>>> +################################################################################
>>
>> Nitpick: use the standard header for all packages. You lack an empty
>> line before and after the package name. See all other Buildroot
>> packages. Ditto for the micropython package.
>>
>>> +MICROPYTHON_LIB_VERSION = v0.5
>>> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
>>> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
>>
>> You should define MICROPYTHON_LIB_LICENSE as well.
>>
>> Thomas
>>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 13:06 ` Vicente Olivert Riera
@ 2015-09-14 23:14   ` Chris Packham
  0 siblings, 0 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-14 23:14 UTC (permalink / raw)
  To: buildroot

Hi Vincent,

On Tue, Sep 15, 2015 at 1:06 AM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> On 09/14/2015 11:21 AM, Chris Packham wrote:
<snip>
>> +ifeq ($(BR2_powerpc),y)
>> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>> +endif
>
> A comment about why this is necessary for powerpc would be good, IMHO.
>

Full explanation is here
https://github.com/micropython/micropython#the-unix-version I'll try
to include a short comment in the makefile.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
                   ` (2 preceding siblings ...)
  2015-09-14 13:58 ` Thomas Petazzoni
@ 2015-09-15  0:01 ` Chris Packham
  2015-09-15 10:14   ` Vicente Olivert Riera
  2015-09-15 21:54   ` Chris Packham
  3 siblings, 2 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-15  0:01 UTC (permalink / raw)
  To: buildroot

Micro Python is a lean and fast implementation of the Python 3
programming language that is optimised to run on a microcontroller.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

Hi Buildroot,
    
Thought you might be interested in mircopython a minimal python 3
implementation. It's designed for micro controllers but is also well suited
to other general purpose embedded CPUs.
    
Cheers,
Chris
    
Changes since v1:
- Add dependency on host-pkgconf.
- Use $(TARGET_MAKE_ENV) in make invocation for micropython
  (micropython-lib doesn't need it because it doesn't use anything setup by
  it).
- Override PREFIX to install to /usr/bin instead of /usr/local/bin
- Update/add some comments.

 package/Config.in                          |  2 ++
 package/micropython-lib/Config.in          |  7 +++++++
 package/micropython-lib/micropython-lib.mk | 15 +++++++++++++++
 package/micropython/Config.in              |  8 ++++++++
 package/micropython/micropython.mk         | 27 +++++++++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 package/micropython-lib/Config.in
 create mode 100644 package/micropython-lib/micropython-lib.mk
 create mode 100644 package/micropython/Config.in
 create mode 100644 package/micropython/micropython.mk

diff --git a/package/Config.in b/package/Config.in
index fc35f12..986fe16 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -509,6 +509,8 @@ menu "Lua libraries/modules"
 endmenu
 endif
 	source "package/lutok/Config.in"
+	source "package/micropython/Config.in"
+	source "package/micropython-lib/Config.in"
 	source "package/moarvm/Config.in"
 	source "package/mono/Config.in"
 if BR2_PACKAGE_MONO
diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
new file mode 100644
index 0000000..a7e017b
--- /dev/null
+++ b/package/micropython-lib/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MICROPYTHON_LIB
+	bool "micropython-lib"
+	depends on BR2_PACKAGE_MICROPYTHON
+	help
+	  Core Python libraries ported to MicroPython.
+
+	  http://micropython.org
diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
new file mode 100644
index 0000000..8eb3c1f
--- /dev/null
+++ b/package/micropython-lib/micropython-lib.mk
@@ -0,0 +1,15 @@
+################################################################################
+#
+# micropython-lib
+#
+################################################################################
+MICROPYTHON_LIB_VERSION = v0.5
+MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
+MICROPYTHON_LIB_LICENSE = various
+MICROPYTHON_LIB_LICENSE_FILES = LICENSE
+
+define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D) PREFIX=$(TARGET_DIR)/usr/lib/micropython install
+endef
+
+$(eval $(generic-package))
diff --git a/package/micropython/Config.in b/package/micropython/Config.in
new file mode 100644
index 0000000..ec47463
--- /dev/null
+++ b/package/micropython/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_MICROPYTHON
+	bool "micropython"
+	select BR2_PACKAGE_LIBFFI
+	help
+	  Micro Python is a lean and fast implementation of the Python 3
+	  programming language that is optimised to run on a microcontroller.
+
+	  http://micropython.org
diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
new file mode 100644
index 0000000..16dc263
--- /dev/null
+++ b/package/micropython/micropython.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# micropython
+#
+################################################################################
+MICROPYTHON_VERSION = v1.4.5
+MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
+MICROPYTHON_LICENSE = MIT
+MICROPYTHON_LICENSE_FILES = LICENSE
+MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
+
+# Use fallback implementation for exception handling on architectures that
+# don't have explicit support.
+ifeq ($(BR2_powerpc),y)
+MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
+endif
+
+define MICROPYTHON_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
+		CROSS_COMPILE=$(TARGET_CROSS) \
+		DESTDIR=$(TARGET_DIR) \
+		PREFIX=$(TARGET_DIR)/usr \
+		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
+		install
+endef
+
+$(eval $(generic-package))
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 23:01   ` Chris Packham
@ 2015-09-15  8:23     ` Thomas Petazzoni
  0 siblings, 0 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-15  8:23 UTC (permalink / raw)
  To: buildroot

Chris,

On Tue, 15 Sep 2015 11:01:08 +1200, Chris Packham wrote:

> >  * What happens if we have Micropython installed next to the regular
> >    Python 2 or Python 3 interpreters / standard library on the same
> >    system? Do they conflict or not?
> 
> They're installed in with different executable names and library paths
> so they should co-exist happily.

Good.

> >  * What about all the Python external modules (package/python-*/) we
> >    have in Buildroot? Do they work with Micropython?
> 
> Probably depends on the module, but I assume the answer is mostly no.

Ok. Anyway, the Python external modules are installed
in /usr/lib/python<version>/, so micropython will not see them. So
we're safe if someone enables both micropython, python 2 and a bunch of
python external modules: python 2 will allow to use the python external
modules, and micropython will live its own life without providing
access to the python external modules.

> Some of the "standard" libraries in micropython-lib are stubs to quote
> the readme: "micropython-lib is a highly experimental community
> project". Getting into buildroot is one way of helping them to move
> out of "experimental" status.

Sure, makes sense.

> >> +MICROPYTHON_LIB_VERSION = v0.5
> >> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> >> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> >
> > You should define MICROPYTHON_LIB_LICENSE as well.
> 
> That's an interesting problem. It's actually multiple licenses
> (depending on the source of the library) so nothing in the "normal"[1]
> list fits. I could say "various" or enumerate the ones I can identify
> but it would be hard to be accurate.

Isn't it a bit problematic for an open-source project to not have a
clear license (or list of licenses) ? It basically means that you can't
safely redistribute it.

I believe listing all the licenses is the proper course of action here.
Something like:

<foo>_LICENSE = MIT (this, that), BSD-2c (foo, bar)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 23:03     ` Chris Packham
@ 2015-09-15  8:24       ` Thomas Petazzoni
  2015-09-15 19:49       ` Jörg Krause
  1 sibling, 0 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-15  8:24 UTC (permalink / raw)
  To: buildroot

Chris,

On Tue, 15 Sep 2015 11:03:35 +1200, Chris Packham wrote:

> > It shouldn't conflict as micropython installs the library files under
> > /usr/lib/micropython/ directory. And the installed binaries are
> > /usr/local/bin/{pip-}micropython. Perhaps this should be changed to
> > install them in /usr instead of /usr/local.
> 
> The local part seems hard-coded to me. But we could always sed it on
> the way through.

It's not normal for Buildroot systems to have stuff in /usr/local.
Perhaps you could write a patch for micropython to make this
configurable and submit the patch upstream?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
@ 2015-09-15 10:14   ` Vicente Olivert Riera
  2015-09-15 10:19     ` Vicente Olivert Riera
  2015-09-15 22:03     ` Thomas Petazzoni
  2015-09-15 21:54   ` Chris Packham
  1 sibling, 2 replies; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-15 10:14 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham, Thomas Petazzoni (license comment),

On 09/15/2015 01:01 AM, Chris Packham wrote:
[snip]
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..8eb3c1f
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,15 @@
> +################################################################################
> +#
> +# micropython-lib
> +#
> +################################################################################
> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE = various

As Thomas suggested, improve that by listing the licenses. According to
the LICENSE file, everything is MIT unless the setup.py of each module
says something different, so I have done a quick check:

$ find micropython-lib-v0.5/ -type f -name "setup.py" -exec grep license
{} \; | sort -u
      license='MIT',
      license='Python',

So I think it would be enough by just having:

MICROPYTHON_LIB_LICENSE = Python (some modules), MIT (everything else)

Thomas, what do you think?

> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> +
> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
> +	$(MAKE) -C $(@D) PREFIX=$(TARGET_DIR)/usr/lib/micropython install

It will not harm to add $(TARGET_MAKE_ENV) before $(MAKE) here as well.

> +endef
> +
> +$(eval $(generic-package))

[snip]

> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..16dc263
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,27 @@
> +################################################################################
> +#
> +# micropython
> +#
> +################################################################################
> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
> +
> +# Use fallback implementation for exception handling on architectures that
> +# don't have explicit support.

This comment, are you trying to keep the lines 80 characters long? In
that case, you can put "don't" in the first line.

Regards,

Vincent.

> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif
> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		PREFIX=$(TARGET_DIR)/usr \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-15 10:14   ` Vicente Olivert Riera
@ 2015-09-15 10:19     ` Vicente Olivert Riera
  2015-09-15 21:30       ` Chris Packham
  2015-09-15 22:03     ` Thomas Petazzoni
  1 sibling, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-15 10:19 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

by the way, can you please mark your previous patch as superseded?

http://patchwork.ozlabs.org/patch/517337/

Regards,

Vincent.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: new package
  2015-09-14 23:03     ` Chris Packham
  2015-09-15  8:24       ` Thomas Petazzoni
@ 2015-09-15 19:49       ` Jörg Krause
  1 sibling, 0 replies; 38+ messages in thread
From: Jörg Krause @ 2015-09-15 19:49 UTC (permalink / raw)
  To: buildroot

On Di, 2015-09-15 at 11:03 +1200, Chris Packham wrote:
> On Tue, Sep 15, 2015 at 2:12 AM, Vicente Olivert Riera
> <Vincent.Riera@imgtec.com> wrote:
> > Dear Thomas Petazzoni,
> > 
> > It shouldn't conflict as micropython installs the library files
> > under
> > /usr/lib/micropython/ directory. And the installed binaries are
> > /usr/local/bin/{pip-}micropython. Perhaps this should be changed to
> > install them in /usr instead of /usr/local.
> 
> The local part seems hard-coded to me. But we could always sed it on
> the way through.

Adding PREFIX=$(TARGET_DIR)/usr to MICROPYTHON_INSTALL_TARGET_CMDS
works for me:

$ ls output/target/usr/bin/
micropython  pip-micropython

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-15 10:19     ` Vicente Olivert Riera
@ 2015-09-15 21:30       ` Chris Packham
  0 siblings, 0 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-15 21:30 UTC (permalink / raw)
  To: buildroot

On Tue, Sep 15, 2015 at 10:19 PM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Chris Packham,
>
> by the way, can you please mark your previous patch as superseded?
>
> http://patchwork.ozlabs.org/patch/517337/
>

Have done so now. I thought patchwork was smart enough to figure out a
v2. I even used the --in-repy-to for that reason. I might have
confused it by sending 2 v1s.

> Regards,
>
> Vincent.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
  2015-09-15 10:14   ` Vicente Olivert Riera
@ 2015-09-15 21:54   ` Chris Packham
  2015-09-15 22:49     ` [Buildroot] [PATCHv3] " Chris Packham
  1 sibling, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-15 21:54 UTC (permalink / raw)
  To: buildroot

On Tue, Sep 15, 2015 at 12:01 PM, Chris Packham <judge.packham@gmail.com> wrote:
> Micro Python is a lean and fast implementation of the Python 3
> programming language that is optimised to run on a microcontroller.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
> Hi Buildroot,
>
> Thought you might be interested in mircopython a minimal python 3
> implementation. It's designed for micro controllers but is also well suited
> to other general purpose embedded CPUs.
>
> Cheers,
> Chris
>
> Changes since v1:
> - Add dependency on host-pkgconf.
> - Use $(TARGET_MAKE_ENV) in make invocation for micropython
>   (micropython-lib doesn't need it because it doesn't use anything setup by
>   it).
> - Override PREFIX to install to /usr/bin instead of /usr/local/bin
> - Update/add some comments.
>
<snip>

I'll send a v3 mopping up the additional comments at some point.

One issue I am facing is that the build process for micropython ties
into git to generate it's version string which works when built from a
clone of the micropython git repo. But when run via buildroot it ends
up getting the version based on the buildroot git repo so the version
number displayed is 2015.10-... instead of 1.4.5. I'll do some
investigation to see if I can override the automatic logic but I was
wondering if there are any other packages with similar problems and
how they were addressed.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv2] micropython: new package
  2015-09-15 10:14   ` Vicente Olivert Riera
  2015-09-15 10:19     ` Vicente Olivert Riera
@ 2015-09-15 22:03     ` Thomas Petazzoni
  1 sibling, 0 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-15 22:03 UTC (permalink / raw)
  To: buildroot

Vicente, Chris,

On Tue, 15 Sep 2015 11:14:45 +0100, Vicente Olivert Riera wrote:

> As Thomas suggested, improve that by listing the licenses. According to
> the LICENSE file, everything is MIT unless the setup.py of each module
> says something different, so I have done a quick check:
> 
> $ find micropython-lib-v0.5/ -type f -name "setup.py" -exec grep license
> {} \; | sort -u
>       license='MIT',
>       license='Python',
> 
> So I think it would be enough by just having:
> 
> MICROPYTHON_LIB_LICENSE = Python (some modules), MIT (everything else)
> 
> Thomas, what do you think?

I haven't checked micropython source code myself, but what you propose
looks sensible, to the exception that "Python" isn't a license. The
license of Python is "Python software foundation license v2".

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv3] micropython: new package
  2015-09-15 21:54   ` Chris Packham
@ 2015-09-15 22:49     ` Chris Packham
  2015-09-16  6:25       ` Jerzy Grzegorek
  2015-09-16 21:12       ` Thomas Petazzoni
  0 siblings, 2 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-15 22:49 UTC (permalink / raw)
  To: buildroot

Micro Python is a lean and fast implementation of the Python 3
programming language that is optimised to run on a microcontroller.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Hi Buildroot,
    
Thought you might be interested in mircopython a minimal python 3
implementation. It's designed for micro controllers but is also well suited
to other general purpose embedded CPUs.
    
Cheers,
Chris
    
Changes since v1:
- Add dependency on host-pkgconf.
- Use $(TARGET_MAKE_ENV) in make invocation for micropython
  (micropython-lib doesn't need it because it doesn't use anything setup by
  it).
- Override PREFIX to install to /usr/bin instead of /usr/local/bin
- Update/add some comments.
    
Changes since v2:
- Use $(TARGET_MAKE_ENV) in micropython-lib for consistency
- Update LICENSE for micropython-lib (thanks to Vincent for the shell
  snippet that saved me having to check them manually).
- Add patch to take the version number from the package instead of from the
  buildroot git repository.

 package/Config.in                          |  2 ++
 package/micropython-lib/Config.in          |  7 +++++++
 package/micropython-lib/micropython-lib.mk | 17 +++++++++++++++++
 package/micropython/0001-fix-version.patch | 14 ++++++++++++++
 package/micropython/Config.in              |  8 ++++++++
 package/micropython/micropython.mk         | 27 +++++++++++++++++++++++++++
 6 files changed, 75 insertions(+)
 create mode 100644 package/micropython-lib/Config.in
 create mode 100644 package/micropython-lib/micropython-lib.mk
 create mode 100644 package/micropython/0001-fix-version.patch
 create mode 100644 package/micropython/Config.in
 create mode 100644 package/micropython/micropython.mk

diff --git a/package/Config.in b/package/Config.in
index fc35f12..986fe16 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -509,6 +509,8 @@ menu "Lua libraries/modules"
 endmenu
 endif
 	source "package/lutok/Config.in"
+	source "package/micropython/Config.in"
+	source "package/micropython-lib/Config.in"
 	source "package/moarvm/Config.in"
 	source "package/mono/Config.in"
 if BR2_PACKAGE_MONO
diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
new file mode 100644
index 0000000..a7e017b
--- /dev/null
+++ b/package/micropython-lib/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MICROPYTHON_LIB
+	bool "micropython-lib"
+	depends on BR2_PACKAGE_MICROPYTHON
+	help
+	  Core Python libraries ported to MicroPython.
+
+	  http://micropython.org
diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
new file mode 100644
index 0000000..4445306
--- /dev/null
+++ b/package/micropython-lib/micropython-lib.mk
@@ -0,0 +1,17 @@
+################################################################################
+#
+# micropython-lib
+#
+################################################################################
+MICROPYTHON_LIB_VERSION = v0.5
+MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
+MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
+MICROPYTHON_LIB_LICENSE_FILES = LICENSE
+
+define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		PREFIX=$(TARGET_DIR)/usr/lib/micropython \
+		install
+endef
+
+$(eval $(generic-package))
diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
new file mode 100644
index 0000000..e2cad58
--- /dev/null
+++ b/package/micropython/0001-fix-version.patch
@@ -0,0 +1,14 @@
+diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
+--- micropython-v1.4.5-old/py/makeversionhdr.py	2015-08-12 00:42:30.000000000 +1200
++++ micropython-v1.4.5/py/makeversionhdr.py	2015-09-16 10:21:06.698962836 +1200
+@@ -70,9 +70,7 @@
+ 
+ def make_version_header(filename):
+     # Get version info using git, with fallback to docs/conf.py
+-    info = get_version_info_from_git()
+-    if info is None:
+-        info = get_version_info_from_docs_conf()
++    info = get_version_info_from_docs_conf()
+ 
+     git_tag, git_hash, ver = info
+ 
diff --git a/package/micropython/Config.in b/package/micropython/Config.in
new file mode 100644
index 0000000..ec47463
--- /dev/null
+++ b/package/micropython/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_MICROPYTHON
+	bool "micropython"
+	select BR2_PACKAGE_LIBFFI
+	help
+	  Micro Python is a lean and fast implementation of the Python 3
+	  programming language that is optimised to run on a microcontroller.
+
+	  http://micropython.org
diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
new file mode 100644
index 0000000..75a517d
--- /dev/null
+++ b/package/micropython/micropython.mk
@@ -0,0 +1,27 @@
+################################################################################
+#
+# micropython
+#
+################################################################################
+MICROPYTHON_VERSION = v1.4.5
+MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
+MICROPYTHON_LICENSE = MIT
+MICROPYTHON_LICENSE_FILES = LICENSE
+MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
+
+# Use fallback implementation for exception handling on architectures that don't
+# have explicit support.
+ifeq ($(BR2_powerpc),y)
+MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
+endif
+
+define MICROPYTHON_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
+		CROSS_COMPILE=$(TARGET_CROSS) \
+		DESTDIR=$(TARGET_DIR) \
+		PREFIX=$(TARGET_DIR)/usr \
+		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
+		install
+endef
+
+$(eval $(generic-package))
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv3] micropython: new package
  2015-09-15 22:49     ` [Buildroot] [PATCHv3] " Chris Packham
@ 2015-09-16  6:25       ` Jerzy Grzegorek
  2015-09-16 21:12       ` Thomas Petazzoni
  1 sibling, 0 replies; 38+ messages in thread
From: Jerzy Grzegorek @ 2015-09-16  6:25 UTC (permalink / raw)
  To: buildroot

Hi Chris,

> Micro Python is a lean and fast implementation of the Python 3
> programming language that is optimised to run on a microcontroller.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> Hi Buildroot,
>      
> Thought you might be interested in mircopython a minimal python 3
> implementation. It's designed for micro controllers but is also well suited
> to other general purpose embedded CPUs.
>      
> Cheers,
> Chris
>      
> Changes since v1:
> - Add dependency on host-pkgconf.
> - Use $(TARGET_MAKE_ENV) in make invocation for micropython
>    (micropython-lib doesn't need it because it doesn't use anything setup by
>    it).
> - Override PREFIX to install to /usr/bin instead of /usr/local/bin
> - Update/add some comments.
>      
> Changes since v2:
> - Use $(TARGET_MAKE_ENV) in micropython-lib for consistency
> - Update LICENSE for micropython-lib (thanks to Vincent for the shell
>    snippet that saved me having to check them manually).
> - Add patch to take the version number from the package instead of from the
>    buildroot git repository.
>
>   package/Config.in                          |  2 ++
>   package/micropython-lib/Config.in          |  7 +++++++
>   package/micropython-lib/micropython-lib.mk | 17 +++++++++++++++++
>   package/micropython/0001-fix-version.patch | 14 ++++++++++++++
>   package/micropython/Config.in              |  8 ++++++++
>   package/micropython/micropython.mk         | 27 +++++++++++++++++++++++++++
>   6 files changed, 75 insertions(+)
>   create mode 100644 package/micropython-lib/Config.in
>   create mode 100644 package/micropython-lib/micropython-lib.mk
>   create mode 100644 package/micropython/0001-fix-version.patch
>   create mode 100644 package/micropython/Config.in
>   create mode 100644 package/micropython/micropython.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index fc35f12..986fe16 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -509,6 +509,8 @@ menu "Lua libraries/modules"
>   endmenu
>   endif
>   	source "package/lutok/Config.in"
> +	source "package/micropython/Config.in"
> +	source "package/micropython-lib/Config.in"
>   	source "package/moarvm/Config.in"
>   	source "package/mono/Config.in"
>   if BR2_PACKAGE_MONO
> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
> new file mode 100644
> index 0000000..a7e017b
> --- /dev/null
> +++ b/package/micropython-lib/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_MICROPYTHON_LIB
> +	bool "micropython-lib"
> +	depends on BR2_PACKAGE_MICROPYTHON
> +	help
> +	  Core Python libraries ported to MicroPython.
> +
> +	  http://micropython.org
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..4445306
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,17 @@
> +################################################################################
> +#
> +# micropython-lib
> +#
> +################################################################################

Here and...

> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> +
> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		PREFIX=$(TARGET_DIR)/usr/lib/micropython \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
> new file mode 100644
> index 0000000..e2cad58
> --- /dev/null
> +++ b/package/micropython/0001-fix-version.patch
> @@ -0,0 +1,14 @@
> +diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
> +--- micropython-v1.4.5-old/py/makeversionhdr.py	2015-08-12 00:42:30.000000000 +1200
> ++++ micropython-v1.4.5/py/makeversionhdr.py	2015-09-16 10:21:06.698962836 +1200
> +@@ -70,9 +70,7 @@
> +
> + def make_version_header(filename):
> +     # Get version info using git, with fallback to docs/conf.py
> +-    info = get_version_info_from_git()
> +-    if info is None:
> +-        info = get_version_info_from_docs_conf()
> ++    info = get_version_info_from_docs_conf()
> +
> +     git_tag, git_hash, ver = info
> +
> diff --git a/package/micropython/Config.in b/package/micropython/Config.in
> new file mode 100644
> index 0000000..ec47463
> --- /dev/null
> +++ b/package/micropython/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_MICROPYTHON
> +	bool "micropython"
> +	select BR2_PACKAGE_LIBFFI
> +	help
> +	  Micro Python is a lean and fast implementation of the Python 3
> +	  programming language that is optimised to run on a microcontroller.
> +
> +	  http://micropython.org
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..75a517d
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,27 @@
> +################################################################################
> +#
> +# micropython
> +#
> +################################################################################

here, you should add an empty line.

Regards,
Jerzy

> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
> +
> +# Use fallback implementation for exception handling on architectures that don't
> +# have explicit support.
> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif
> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		PREFIX=$(TARGET_DIR)/usr \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
> +		install
> +endef
> +
> +$(eval $(generic-package))

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv3] micropython: new package
  2015-09-15 22:49     ` [Buildroot] [PATCHv3] " Chris Packham
  2015-09-16  6:25       ` Jerzy Grzegorek
@ 2015-09-16 21:12       ` Thomas Petazzoni
  2015-09-16 23:28         ` Chris Packham
  1 sibling, 1 reply; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-16 21:12 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On Wed, 16 Sep 2015 10:49:52 +1200, Chris Packham wrote:
> Micro Python is a lean and fast implementation of the Python 3
> programming language that is optimised to run on a microcontroller.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>

It starts to look almost good, there are still a few things to adjust.
See below.

>  package/Config.in                          |  2 ++
>  package/micropython-lib/Config.in          |  7 +++++++
>  package/micropython-lib/micropython-lib.mk | 17 +++++++++++++++++
>  package/micropython/0001-fix-version.patch | 14 ++++++++++++++
>  package/micropython/Config.in              |  8 ++++++++
>  package/micropython/micropython.mk         | 27 +++++++++++++++++++++++++++
>  6 files changed, 75 insertions(+)

Could you split that up into two patches, one for micropython, and one
for micropython-libs (in that order in the patch series) ?

> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
> new file mode 100644
> index 0000000..a7e017b
> --- /dev/null
> +++ b/package/micropython-lib/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_MICROPYTHON_LIB
> +	bool "micropython-lib"
> +	depends on BR2_PACKAGE_MICROPYTHON
> +	help
> +	  Core Python libraries ported to MicroPython.
> +
> +	  http://micropython.org
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..4445306
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,17 @@
> +################################################################################
> +#
> +# micropython-lib
> +#
> +################################################################################

One empty line here, as noted by Jerzy

> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> +
> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		PREFIX=$(TARGET_DIR)/usr/lib/micropython \

Is this really the correct value for PREFIX ? I haven't checked myself,
but PREFIX=$(TARGET_DIR)/usr would look more traditional.

> +		install
> +endef
> +
> +$(eval $(generic-package))
> diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
> new file mode 100644
> index 0000000..e2cad58
> --- /dev/null
> +++ b/package/micropython/0001-fix-version.patch
> @@ -0,0 +1,14 @@

All patches need a description + Signed-off-by line. See
http://git.buildroot.net/buildroot/tree/package/python/100-optional-test-modules.patch
for example.

> +diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
> +--- micropython-v1.4.5-old/py/makeversionhdr.py	2015-08-12 00:42:30.000000000 +1200
> ++++ micropython-v1.4.5/py/makeversionhdr.py	2015-09-16 10:21:06.698962836 +1200
> +@@ -70,9 +70,7 @@
> + 
> + def make_version_header(filename):
> +     # Get version info using git, with fallback to docs/conf.py
> +-    info = get_version_info_from_git()
> +-    if info is None:
> +-        info = get_version_info_from_docs_conf()
> ++    info = get_version_info_from_docs_conf()
> + 
> +     git_tag, git_hash, ver = info
> + 
> diff --git a/package/micropython/Config.in b/package/micropython/Config.in
> new file mode 100644
> index 0000000..ec47463
> --- /dev/null
> +++ b/package/micropython/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_MICROPYTHON
> +	bool "micropython"
> +	select BR2_PACKAGE_LIBFFI

If you select libffi, then you need to replicate the dependencies of
libffi, so:

	depends on BR2_TOOLCHAIN_HAS_THREADS

> +	help
> +	  Micro Python is a lean and fast implementation of the Python 3
> +	  programming language that is optimised to run on a microcontroller.
> +
> +	  http://micropython.org

And:

comment "micropython needs a toolchain w/ thread"
	depends on !BR2_TOOLCHAIN_HAS_THREADS

> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..75a517d
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,27 @@
> +################################################################################
> +#
> +# micropython
> +#
> +################################################################################

Need an empty line here.

> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
> +
> +# Use fallback implementation for exception handling on architectures that don't
> +# have explicit support.
> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif
> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		DESTDIR=$(TARGET_DIR) \
> +		PREFIX=$(TARGET_DIR)/usr \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
> +		install
> +endef

It seems like this is going to do the build and installation in the
<pkg>_INSTALL_TARGET_CMDS, which isn't nice. I've done a quick test,
and the following seems to work:

define MICROPYTHON_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
                CROSS_COMPILE=$(TARGET_CROSS) \
                CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS)
endef

define MICROPYTHON_INSTALL_TARGET_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
                DESTDIR=$(TARGET_DIR) \
                PREFIX=$(TARGET_DIR)/usr \
                install
endef

Which is much more in line with Buildroot standards.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCHv3] micropython: new package
  2015-09-16 21:12       ` Thomas Petazzoni
@ 2015-09-16 23:28         ` Chris Packham
  2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
  0 siblings, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-16 23:28 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Thu, Sep 17, 2015 at 9:12 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Chris Packham,
>
> On Wed, 16 Sep 2015 10:49:52 +1200, Chris Packham wrote:
>> Micro Python is a lean and fast implementation of the Python 3
>> programming language that is optimised to run on a microcontroller.
>>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>
> It starts to look almost good, there are still a few things to adjust.
> See below.
>
>>  package/Config.in                          |  2 ++
>>  package/micropython-lib/Config.in          |  7 +++++++
>>  package/micropython-lib/micropython-lib.mk | 17 +++++++++++++++++
>>  package/micropython/0001-fix-version.patch | 14 ++++++++++++++
>>  package/micropython/Config.in              |  8 ++++++++
>>  package/micropython/micropython.mk         | 27 +++++++++++++++++++++++++++
>>  6 files changed, 75 insertions(+)
>
> Could you split that up into two patches, one for micropython, and one
> for micropython-libs (in that order in the patch series) ?

Will do.

>> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
>> new file mode 100644
>> index 0000000..a7e017b
>> --- /dev/null
>> +++ b/package/micropython-lib/Config.in
>> @@ -0,0 +1,7 @@
>> +config BR2_PACKAGE_MICROPYTHON_LIB
>> +     bool "micropython-lib"
>> +     depends on BR2_PACKAGE_MICROPYTHON
>> +     help
>> +       Core Python libraries ported to MicroPython.
>> +
>> +       http://micropython.org
>> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
>> new file mode 100644
>> index 0000000..4445306
>> --- /dev/null
>> +++ b/package/micropython-lib/micropython-lib.mk
>> @@ -0,0 +1,17 @@
>> +################################################################################
>> +#
>> +# micropython-lib
>> +#
>> +################################################################################
>
> One empty line here, as noted by Jerzy
>

Done.

>> +MICROPYTHON_LIB_VERSION = v0.5
>> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
>> +MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
>> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
>> +
>> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
>> +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
>> +             PREFIX=$(TARGET_DIR)/usr/lib/micropython \
>
> Is this really the correct value for PREFIX ? I haven't checked myself,
> but PREFIX=$(TARGET_DIR)/usr would look more traditional.

Yes it's correct for the way the micropython-lib Makefile[1] is written.

>
>> +             install
>> +endef
>> +
>> +$(eval $(generic-package))
>> diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
>> new file mode 100644
>> index 0000000..e2cad58
>> --- /dev/null
>> +++ b/package/micropython/0001-fix-version.patch
>> @@ -0,0 +1,14 @@
>
> All patches need a description + Signed-off-by line. See
> http://git.buildroot.net/buildroot/tree/package/python/100-optional-test-modules.patch
> for example.

Done

>> +diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
>> +--- micropython-v1.4.5-old/py/makeversionhdr.py      2015-08-12 00:42:30.000000000 +1200
>> ++++ micropython-v1.4.5/py/makeversionhdr.py  2015-09-16 10:21:06.698962836 +1200
>> +@@ -70,9 +70,7 @@
>> +
>> + def make_version_header(filename):
>> +     # Get version info using git, with fallback to docs/conf.py
>> +-    info = get_version_info_from_git()
>> +-    if info is None:
>> +-        info = get_version_info_from_docs_conf()
>> ++    info = get_version_info_from_docs_conf()
>> +
>> +     git_tag, git_hash, ver = info
>> +
>> diff --git a/package/micropython/Config.in b/package/micropython/Config.in
>> new file mode 100644
>> index 0000000..ec47463
>> --- /dev/null
>> +++ b/package/micropython/Config.in
>> @@ -0,0 +1,8 @@
>> +config BR2_PACKAGE_MICROPYTHON
>> +     bool "micropython"
>> +     select BR2_PACKAGE_LIBFFI
>
> If you select libffi, then you need to replicate the dependencies of
> libffi, so:
>
>         depends on BR2_TOOLCHAIN_HAS_THREADS
>

Done

>> +     help
>> +       Micro Python is a lean and fast implementation of the Python 3
>> +       programming language that is optimised to run on a microcontroller.
>> +
>> +       http://micropython.org
>
> And:
>
> comment "micropython needs a toolchain w/ thread"
>         depends on !BR2_TOOLCHAIN_HAS_THREADS
>

Done

>> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
>> new file mode 100644
>> index 0000000..75a517d
>> --- /dev/null
>> +++ b/package/micropython/micropython.mk
>> @@ -0,0 +1,27 @@
>> +################################################################################
>> +#
>> +# micropython
>> +#
>> +################################################################################
>
> Need an empty line here.
>

Done

>> +MICROPYTHON_VERSION = v1.4.5
>> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
>> +MICROPYTHON_LICENSE = MIT
>> +MICROPYTHON_LICENSE_FILES = LICENSE
>> +MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
>> +
>> +# Use fallback implementation for exception handling on architectures that don't
>> +# have explicit support.
>> +ifeq ($(BR2_powerpc),y)
>> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>> +endif
>> +
>> +define MICROPYTHON_INSTALL_TARGET_CMDS
>> +     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
>> +             CROSS_COMPILE=$(TARGET_CROSS) \
>> +             DESTDIR=$(TARGET_DIR) \
>> +             PREFIX=$(TARGET_DIR)/usr \
>> +             CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS) \
>> +             install
>> +endef
>
> It seems like this is going to do the build and installation in the
> <pkg>_INSTALL_TARGET_CMDS, which isn't nice. I've done a quick test,
> and the following seems to work:
>
> define MICROPYTHON_BUILD_CMDS
>         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
>                 CROSS_COMPILE=$(TARGET_CROSS) \
>                 CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS)
> endef
>
> define MICROPYTHON_INSTALL_TARGET_CMDS
>         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
>                 DESTDIR=$(TARGET_DIR) \
>                 PREFIX=$(TARGET_DIR)/usr \
>                 install
> endef
>
> Which is much more in line with Buildroot standards.
>

Done.

> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

[1] - https://github.com/micropython/micropython-lib/blob/master/Makefile#L8

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-16 23:28         ` Chris Packham
@ 2015-09-16 23:29           ` Chris Packham
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
                               ` (3 more replies)
  0 siblings, 4 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-16 23:29 UTC (permalink / raw)
  To: buildroot

Thought you might be interested in mircopython a minimal python 3
implementation. It's designed for micro controllers but is also well suited
to other general purpose embedded CPUs.

Cheers,
Chris

Changes since v1:
- Add dependency on host-pkgconf.
- Use $(TARGET_MAKE_ENV) in make invocation for micropython
  (micropython-lib doesn't need it because it doesn't use anything setup by
  it).
- Override PREFIX to install to /usr/bin instead of /usr/local/bin
- Update/add some comments.

Changes since v2:
- Use $(TARGET_MAKE_ENV) in micropython-lib for consistency
- Update LICENSE for micropython-lib (thanks to Vincent for the shell
  snippet that saved me having to check them manually).
- Add patch to take the version number from the package instead of from the
  buildroot git repository.

Changes since v3:
- Split into 2 patches
- Separate build and install steps for micropython
- Minor style fixes

Chris Packham (2):
  micropython: new package
  micropython-lib: new packages

 package/Config.in                          |  2 ++
 package/micropython-lib/Config.in          |  7 +++++++
 package/micropython-lib/micropython-lib.mk | 18 +++++++++++++++++
 package/micropython/0001-fix-version.patch | 22 ++++++++++++++++++++
 package/micropython/Config.in              | 12 +++++++++++
 package/micropython/micropython.mk         | 32 ++++++++++++++++++++++++++++++
 6 files changed, 93 insertions(+)
 create mode 100644 package/micropython-lib/Config.in
 create mode 100644 package/micropython-lib/micropython-lib.mk
 create mode 100644 package/micropython/0001-fix-version.patch
 create mode 100644 package/micropython/Config.in
 create mode 100644 package/micropython/micropython.mk

-- 
2.5.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 1/2] micropython: new package
  2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
@ 2015-09-16 23:29             ` Chris Packham
  2015-09-17  8:56               ` Vicente Olivert Riera
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 2/2] micropython-lib: new packages Chris Packham
                               ` (2 subsequent siblings)
  3 siblings, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-16 23:29 UTC (permalink / raw)
  To: buildroot

Micro Python is a lean and fast implementation of the Python 3
programming language that is optimised to run on a microcontroller.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 package/Config.in                          |  1 +
 package/micropython/0001-fix-version.patch | 22 ++++++++++++++++++++
 package/micropython/Config.in              | 12 +++++++++++
 package/micropython/micropython.mk         | 32 ++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 package/micropython/0001-fix-version.patch
 create mode 100644 package/micropython/Config.in
 create mode 100644 package/micropython/micropython.mk

diff --git a/package/Config.in b/package/Config.in
index fc35f12..94ac406 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -509,6 +509,7 @@ menu "Lua libraries/modules"
 endmenu
 endif
 	source "package/lutok/Config.in"
+	source "package/micropython/Config.in"
 	source "package/moarvm/Config.in"
 	source "package/mono/Config.in"
 if BR2_PACKAGE_MONO
diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
new file mode 100644
index 0000000..1bf2992
--- /dev/null
+++ b/package/micropython/0001-fix-version.patch
@@ -0,0 +1,22 @@
+Always use the fallback behaviour for determining the version number
+
+When built from within buildroot the micropython build process detects
+that it is inside a git repository and ends up using the buildroot
+version number instead of the correct micropython version number.
+
+Signed-off-by: Chris Packham <judge.packham@gmail.com>
+---
+diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
+--- micropython-v1.4.5-old/py/makeversionhdr.py	2015-08-12 00:42:30.000000000 +1200
++++ micropython-v1.4.5/py/makeversionhdr.py	2015-09-16 10:21:06.698962836 +1200
+@@ -70,9 +70,7 @@
+ 
+ def make_version_header(filename):
+     # Get version info using git, with fallback to docs/conf.py
+-    info = get_version_info_from_git()
+-    if info is None:
+-        info = get_version_info_from_docs_conf()
++    info = get_version_info_from_docs_conf()
+ 
+     git_tag, git_hash, ver = info
+ 
diff --git a/package/micropython/Config.in b/package/micropython/Config.in
new file mode 100644
index 0000000..3ad38d6
--- /dev/null
+++ b/package/micropython/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_MICROPYTHON
+	bool "micropython"
+	select BR2_PACKAGE_LIBFFI
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	help
+	  Micro Python is a lean and fast implementation of the Python 3
+	  programming language that is optimised to run on a microcontroller.
+
+	  http://micropython.org
+
+comment "micropython needs a toolchain w/ thread"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
new file mode 100644
index 0000000..2d7c924
--- /dev/null
+++ b/package/micropython/micropython.mk
@@ -0,0 +1,32 @@
+################################################################################
+#
+# micropython
+#
+################################################################################
+
+MICROPYTHON_VERSION = v1.4.5
+MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
+MICROPYTHON_LICENSE = MIT
+MICROPYTHON_LICENSE_FILES = LICENSE
+MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
+
+# Use fallback implementation for exception handling on architectures that don't
+# have explicit support.
+ifeq ($(BR2_powerpc),y)
+MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
+endif
+
+define MICROPYTHON_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
+		CROSS_COMPILE=$(TARGET_CROSS) \
+		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS)
+endef
+
+define MICROPYTHON_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
+		DESTDIR=$(TARGET_DIR) \
+		PREFIX=$(TARGET_DIR)/usr \
+		install
+endef
+
+$(eval $(generic-package))
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 2/2] micropython-lib: new packages
  2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
@ 2015-09-16 23:29             ` Chris Packham
  2015-09-17  8:56               ` Vicente Olivert Riera
  2015-09-17 21:48             ` [Buildroot] [PATCH v4 0/2] Micropython package Thomas Petazzoni
  2015-09-18  7:32             ` Thomas Petazzoni
  3 siblings, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-16 23:29 UTC (permalink / raw)
  To: buildroot

Core Python libraries ported to MicroPython.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 package/Config.in                          |  1 +
 package/micropython-lib/Config.in          |  7 +++++++
 package/micropython-lib/micropython-lib.mk | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 package/micropython-lib/Config.in
 create mode 100644 package/micropython-lib/micropython-lib.mk

diff --git a/package/Config.in b/package/Config.in
index 94ac406..986fe16 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -510,6 +510,7 @@ endmenu
 endif
 	source "package/lutok/Config.in"
 	source "package/micropython/Config.in"
+	source "package/micropython-lib/Config.in"
 	source "package/moarvm/Config.in"
 	source "package/mono/Config.in"
 if BR2_PACKAGE_MONO
diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
new file mode 100644
index 0000000..a7e017b
--- /dev/null
+++ b/package/micropython-lib/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MICROPYTHON_LIB
+	bool "micropython-lib"
+	depends on BR2_PACKAGE_MICROPYTHON
+	help
+	  Core Python libraries ported to MicroPython.
+
+	  http://micropython.org
diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
new file mode 100644
index 0000000..a4a6cf6
--- /dev/null
+++ b/package/micropython-lib/micropython-lib.mk
@@ -0,0 +1,18 @@
+################################################################################
+#
+# micropython-lib
+#
+################################################################################
+
+MICROPYTHON_LIB_VERSION = v0.5
+MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
+MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
+MICROPYTHON_LIB_LICENSE_FILES = LICENSE
+
+define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		PREFIX=$(TARGET_DIR)/usr/lib/micropython \
+		install
+endef
+
+$(eval $(generic-package))
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 1/2] micropython: new package
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
@ 2015-09-17  8:56               ` Vicente Olivert Riera
  2015-09-18  4:54                 ` Chris Packham
  0 siblings, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-17  8:56 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On 09/17/2015 12:29 AM, Chris Packham wrote:
> Micro Python is a lean and fast implementation of the Python 3
> programming language that is optimised to run on a microcontroller.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Tested-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Build test for MIPS architecture:

$ file output/target/usr/bin/micropython
output/target/usr/bin/micropython: ELF 32-bit MSB executable, MIPS,
MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), for
GNU/Linux 2.6.32, with unknown capability 0x41000000 = 0xf676e75, with
unknown capability 0x10000 = 0x70403, stripped

One more comment below. Please scroll down.

> ---
>  package/Config.in                          |  1 +
>  package/micropython/0001-fix-version.patch | 22 ++++++++++++++++++++
>  package/micropython/Config.in              | 12 +++++++++++
>  package/micropython/micropython.mk         | 32 ++++++++++++++++++++++++++++++
>  4 files changed, 67 insertions(+)
>  create mode 100644 package/micropython/0001-fix-version.patch
>  create mode 100644 package/micropython/Config.in
>  create mode 100644 package/micropython/micropython.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index fc35f12..94ac406 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -509,6 +509,7 @@ menu "Lua libraries/modules"
>  endmenu
>  endif
>  	source "package/lutok/Config.in"
> +	source "package/micropython/Config.in"
>  	source "package/moarvm/Config.in"
>  	source "package/mono/Config.in"
>  if BR2_PACKAGE_MONO
> diff --git a/package/micropython/0001-fix-version.patch b/package/micropython/0001-fix-version.patch
> new file mode 100644
> index 0000000..1bf2992
> --- /dev/null
> +++ b/package/micropython/0001-fix-version.patch
> @@ -0,0 +1,22 @@
> +Always use the fallback behaviour for determining the version number
> +
> +When built from within buildroot the micropython build process detects
> +that it is inside a git repository and ends up using the buildroot
> +version number instead of the correct micropython version number.
> +
> +Signed-off-by: Chris Packham <judge.packham@gmail.com>
> +---
> +diff -Naur micropython-v1.4.5-old/py/makeversionhdr.py micropython-v1.4.5/py/makeversionhdr.py
> +--- micropython-v1.4.5-old/py/makeversionhdr.py	2015-08-12 00:42:30.000000000 +1200
> ++++ micropython-v1.4.5/py/makeversionhdr.py	2015-09-16 10:21:06.698962836 +1200
> +@@ -70,9 +70,7 @@
> + 
> + def make_version_header(filename):
> +     # Get version info using git, with fallback to docs/conf.py
> +-    info = get_version_info_from_git()
> +-    if info is None:
> +-        info = get_version_info_from_docs_conf()
> ++    info = get_version_info_from_docs_conf()
> + 
> +     git_tag, git_hash, ver = info
> + 
> diff --git a/package/micropython/Config.in b/package/micropython/Config.in
> new file mode 100644
> index 0000000..3ad38d6
> --- /dev/null
> +++ b/package/micropython/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_MICROPYTHON
> +	bool "micropython"
> +	select BR2_PACKAGE_LIBFFI
> +	depends on BR2_TOOLCHAIN_HAS_THREADS
> +	help
> +	  Micro Python is a lean and fast implementation of the Python 3
> +	  programming language that is optimised to run on a microcontroller.
> +
> +	  http://micropython.org
> +
> +comment "micropython needs a toolchain w/ thread"

threads (in plural)

This is something the maintainer can amend for you, I guess, so you
don't need to send another patch.

Regards,

Vincent.

> +	depends on !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> new file mode 100644
> index 0000000..2d7c924
> --- /dev/null
> +++ b/package/micropython/micropython.mk
> @@ -0,0 +1,32 @@
> +################################################################################
> +#
> +# micropython
> +#
> +################################################################################
> +
> +MICROPYTHON_VERSION = v1.4.5
> +MICROPYTHON_SITE = $(call github,micropython,micropython,$(MICROPYTHON_VERSION))
> +MICROPYTHON_LICENSE = MIT
> +MICROPYTHON_LICENSE_FILES = LICENSE
> +MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
> +
> +# Use fallback implementation for exception handling on architectures that don't
> +# have explicit support.
> +ifeq ($(BR2_powerpc),y)
> +MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
> +endif
> +
> +define MICROPYTHON_BUILD_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
> +		CROSS_COMPILE=$(TARGET_CROSS) \
> +		CFLAGS_EXTRA=$(MICROPYTHON_CFLAGS)
> +endef
> +
> +define MICROPYTHON_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
> +		DESTDIR=$(TARGET_DIR) \
> +		PREFIX=$(TARGET_DIR)/usr \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 2/2] micropython-lib: new packages
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 2/2] micropython-lib: new packages Chris Packham
@ 2015-09-17  8:56               ` Vicente Olivert Riera
  0 siblings, 0 replies; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-17  8:56 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On 09/17/2015 12:29 AM, Chris Packham wrote:
> Core Python libraries ported to MicroPython.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Tested-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Build test for MIPS architecture:

$ find output/target/usr/lib/micropython/ | wc -l
191

There are no binary files to check if it was build for the right
architecture.

Regards,

Vincent.

> ---
>  package/Config.in                          |  1 +
>  package/micropython-lib/Config.in          |  7 +++++++
>  package/micropython-lib/micropython-lib.mk | 18 ++++++++++++++++++
>  3 files changed, 26 insertions(+)
>  create mode 100644 package/micropython-lib/Config.in
>  create mode 100644 package/micropython-lib/micropython-lib.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 94ac406..986fe16 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -510,6 +510,7 @@ endmenu
>  endif
>  	source "package/lutok/Config.in"
>  	source "package/micropython/Config.in"
> +	source "package/micropython-lib/Config.in"
>  	source "package/moarvm/Config.in"
>  	source "package/mono/Config.in"
>  if BR2_PACKAGE_MONO
> diff --git a/package/micropython-lib/Config.in b/package/micropython-lib/Config.in
> new file mode 100644
> index 0000000..a7e017b
> --- /dev/null
> +++ b/package/micropython-lib/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_MICROPYTHON_LIB
> +	bool "micropython-lib"
> +	depends on BR2_PACKAGE_MICROPYTHON
> +	help
> +	  Core Python libraries ported to MicroPython.
> +
> +	  http://micropython.org
> diff --git a/package/micropython-lib/micropython-lib.mk b/package/micropython-lib/micropython-lib.mk
> new file mode 100644
> index 0000000..a4a6cf6
> --- /dev/null
> +++ b/package/micropython-lib/micropython-lib.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# micropython-lib
> +#
> +################################################################################
> +
> +MICROPYTHON_LIB_VERSION = v0.5
> +MICROPYTHON_LIB_SITE = $(call github,micropython,micropython-lib,$(MICROPYTHON_LIB_VERSION))
> +MICROPYTHON_LIB_LICENSE = Python software foundation license v2 (some modules), MIT (everything else)
> +MICROPYTHON_LIB_LICENSE_FILES = LICENSE
> +
> +define MICROPYTHON_LIB_INSTALL_TARGET_CMDS
> +	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
> +		PREFIX=$(TARGET_DIR)/usr/lib/micropython \
> +		install
> +endef
> +
> +$(eval $(generic-package))
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
  2015-09-16 23:29             ` [Buildroot] [PATCH v4 2/2] micropython-lib: new packages Chris Packham
@ 2015-09-17 21:48             ` Thomas Petazzoni
  2015-09-18  7:32             ` Thomas Petazzoni
  3 siblings, 0 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-17 21:48 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On Thu, 17 Sep 2015 11:29:57 +1200, Chris Packham wrote:

> Chris Packham (2):
>   micropython: new package
>   micropython-lib: new packages

Both applied, thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 1/2] micropython: new package
  2015-09-17  8:56               ` Vicente Olivert Riera
@ 2015-09-18  4:54                 ` Chris Packham
  0 siblings, 0 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-18  4:54 UTC (permalink / raw)
  To: buildroot

On Thu, Sep 17, 2015 at 8:56 PM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Chris Packham,
>
> On 09/17/2015 12:29 AM, Chris Packham wrote:
<snip>
>> +
>> +comment "micropython needs a toolchain w/ thread"
>
> threads (in plural)
>
> This is something the maintainer can amend for you, I guess, so you
> don't need to send another patch.
>

D'oh I was doing that in a hurry yesterday. I see Thomas has committed
it with a fix thanks to both for noticing/fixing.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
                               ` (2 preceding siblings ...)
  2015-09-17 21:48             ` [Buildroot] [PATCH v4 0/2] Micropython package Thomas Petazzoni
@ 2015-09-18  7:32             ` Thomas Petazzoni
  2015-09-18  8:22               ` Chris Packham
  3 siblings, 1 reply; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-18  7:32 UTC (permalink / raw)
  To: buildroot

Chris,

On Thu, 17 Sep 2015 11:29:57 +1200, Chris Packham wrote:

> Chris Packham (2):
>   micropython: new package
>   micropython-lib: new packages

There are a number of build failures caused by Micropython in the
autobuilders:

 * On MIPS64
   http://autobuild.buildroot.org/results/99a/99a610c72877fef53d93e1a923bd5c71b3376618/build-end.log

 * On Xtensa
   http://autobuild.buildroot.org/results/670/670907760d6b3e7eb46b433647b392cec3bafdcd/build-end.log

 * On SH4A
   http://autobuild.buildroot.org/results/f5a/f5a2c563b8bdab9e345960a5b92d31f3f92dba00/build-end.log

See http://autobuild.buildroot.org/?reason=micropython-v1.4.5 for the
complete list of build failures.

If you could look into these, it would be helpful.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-18  7:32             ` Thomas Petazzoni
@ 2015-09-18  8:22               ` Chris Packham
  2015-09-18  9:19                 ` [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh Chris Packham
  2015-09-18  9:29                 ` [Buildroot] [PATCH v4 0/2] Micropython package Vicente Olivert Riera
  0 siblings, 2 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-18  8:22 UTC (permalink / raw)
  To: buildroot

On Fri, Sep 18, 2015 at 7:32 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Chris,
>
> On Thu, 17 Sep 2015 11:29:57 +1200, Chris Packham wrote:
>
>> Chris Packham (2):
>>   micropython: new package
>>   micropython-lib: new packages
>
> There are a number of build failures caused by Micropython in the
> autobuilders:
>
>  * On MIPS64
>    http://autobuild.buildroot.org/results/99a/99a610c72877fef53d93e1a923bd5c71b3376618/build-end.log
>
>  * On Xtensa
>    http://autobuild.buildroot.org/results/670/670907760d6b3e7eb46b433647b392cec3bafdcd/build-end.log
>
>  * On SH4A
>    http://autobuild.buildroot.org/results/f5a/f5a2c563b8bdab9e345960a5b92d31f3f92dba00/build-end.log
>
> See http://autobuild.buildroot.org/?reason=micropython-v1.4.5 for the
> complete list of build failures.
>
> If you could look into these, it would be helpful.

Xtensa and SH4A look like they need MICROPY_GCREGS_SETJMP I'll send a
patch for them shortly. The MIPS64 one looks different so might need
some investigation.

>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh
  2015-09-18  8:22               ` Chris Packham
@ 2015-09-18  9:19                 ` Chris Packham
  2015-09-19 12:00                   ` Thomas Petazzoni
  2015-09-18  9:29                 ` [Buildroot] [PATCH v4 0/2] Micropython package Vicente Olivert Riera
  1 sibling, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-18  9:19 UTC (permalink / raw)
  To: buildroot

These architectures don't have explicit exception handling support in
micropython but can use the setjmp fallback behaviour instead.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 package/micropython/micropython.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
index 2d7c924..6266882 100644
--- a/package/micropython/micropython.mk
+++ b/package/micropython/micropython.mk
@@ -12,7 +12,7 @@ MICROPYTHON_DEPENDENCIES = host-pkgconf libffi
 
 # Use fallback implementation for exception handling on architectures that don't
 # have explicit support.
-ifeq ($(BR2_powerpc),y)
+ifeq ($(BR2_powerpc)$(BR2_sh)$(BR2_xtensa),y)
 MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
 endif
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-18  8:22               ` Chris Packham
  2015-09-18  9:19                 ` [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh Chris Packham
@ 2015-09-18  9:29                 ` Vicente Olivert Riera
  2015-09-18  9:43                   ` Chris Packham
  1 sibling, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-18  9:29 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On 09/18/2015 09:22 AM, Chris Packham wrote:
> On Fri, Sep 18, 2015 at 7:32 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
>> Chris,
>>
>> On Thu, 17 Sep 2015 11:29:57 +1200, Chris Packham wrote:
>>
>>> Chris Packham (2):
>>>   micropython: new package
>>>   micropython-lib: new packages
>>
>> There are a number of build failures caused by Micropython in the
>> autobuilders:
>>
>>  * On MIPS64
>>    http://autobuild.buildroot.org/results/99a/99a610c72877fef53d93e1a923bd5c71b3376618/build-end.log
>>
>>  * On Xtensa
>>    http://autobuild.buildroot.org/results/670/670907760d6b3e7eb46b433647b392cec3bafdcd/build-end.log
>>
>>  * On SH4A
>>    http://autobuild.buildroot.org/results/f5a/f5a2c563b8bdab9e345960a5b92d31f3f92dba00/build-end.log
>>
>> See http://autobuild.buildroot.org/?reason=micropython-v1.4.5 for the
>> complete list of build failures.
>>
>> If you could look into these, it would be helpful.
> 
> Xtensa and SH4A look like they need MICROPY_GCREGS_SETJMP I'll send a
> patch for them shortly. The MIPS64 one looks different so might need
> some investigation.

as the build error says, a right shift is being performed in the
py/objint_mpz.c file, and the offending one is at line #54:

MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4

in MIPS64 n64 the MP_SSIZE_MAX is 64-bit wide and the value of
MPZ_DIG_SIZE 16, so MPZ_DIG_SIZE * 4 is 64. That shift causes a warning
because its trying to shift 64 bits of a 64-bit variable:

py/objint_mpz.c:54:5: error: right shift count >= width of type [-Werror]

MIPS32 and MIPS64 n32 are fine because MP_SSIZE_MAX is 32-bit wide and
the #if clauses in the py/objint_mpz.c protect that to happen.

Look at this test for MIPS32:

$ mips-linux-gnu-gcc -mips32r2 -EB ssize_t.c -o ssize_t
$ qemu-mips ssize_t
MP_SSIZE_MAX: 32 bits
MPZ_DIG_SIZE: 16
right-shifting 0 bits
right-shifting 16 bits

And now look at the same test for MIPS64 n64:

$ mips-linux-gnu-gcc -mips64r2 -mabi=64 -EB ssize_t.c -o ssize_t
ssize_t.c: In function 'main':
ssize_t.c:24:2: warning: right shift count >= width of type
  (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK;
  ^
$ qemu-mips64 ssize_t
MP_SSIZE_MAX: 64 bits
MPZ_DIG_SIZE: 16
right-shifting 0 bits
right-shifting 16 bits
right-shifting 32 bits
right-shifting 48 bits
right-shifting 64 bits

I don't know what's the purpose of the code in py/objint_mpz.c and I
don't know if they really want to do a 64-bit shift of a 64-bit
variable. But the thing is that since it's compiled with the -Werror
flag, that warning makes the compilation to fail.

If they really want to do such a shift, then they should remove the
-Werror. But if they don't want to do such a shift, then more #if
clauses are needed in order to prevent that to happen. Perhaps you could
talk with upstream about this.

Regards,

Vincent.

> 
>>
>> Thanks!
>>
>> Thomas
>> --
>> Thomas Petazzoni, CTO, Free Electrons
>> Embedded Linux, Kernel and Android engineering
>> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH v4 0/2] Micropython package
  2015-09-18  9:29                 ` [Buildroot] [PATCH v4 0/2] Micropython package Vicente Olivert Riera
@ 2015-09-18  9:43                   ` Chris Packham
  2015-09-18  9:51                     ` [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets Chris Packham
  0 siblings, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-18  9:43 UTC (permalink / raw)
  To: buildroot

On Fri, Sep 18, 2015 at 9:29 PM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Chris Packham,
>
> On 09/18/2015 09:22 AM, Chris Packham wrote:
>> On Fri, Sep 18, 2015 at 7:32 PM, Thomas Petazzoni
>> <thomas.petazzoni@free-electrons.com> wrote:
>>> Chris,
>>>
>>> On Thu, 17 Sep 2015 11:29:57 +1200, Chris Packham wrote:
>>>
>>>> Chris Packham (2):
>>>>   micropython: new package
>>>>   micropython-lib: new packages
>>>
>>> There are a number of build failures caused by Micropython in the
>>> autobuilders:
>>>
>>>  * On MIPS64
>>>    http://autobuild.buildroot.org/results/99a/99a610c72877fef53d93e1a923bd5c71b3376618/build-end.log
>>>
>>>  * On Xtensa
>>>    http://autobuild.buildroot.org/results/670/670907760d6b3e7eb46b433647b392cec3bafdcd/build-end.log
>>>
>>>  * On SH4A
>>>    http://autobuild.buildroot.org/results/f5a/f5a2c563b8bdab9e345960a5b92d31f3f92dba00/build-end.log
>>>
>>> See http://autobuild.buildroot.org/?reason=micropython-v1.4.5 for the
>>> complete list of build failures.
>>>
>>> If you could look into these, it would be helpful.
>>
>> Xtensa and SH4A look like they need MICROPY_GCREGS_SETJMP I'll send a
>> patch for them shortly. The MIPS64 one looks different so might need
>> some investigation.
>
> as the build error says, a right shift is being performed in the
> py/objint_mpz.c file, and the offending one is at line #54:
>
> MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4
>
> in MIPS64 n64 the MP_SSIZE_MAX is 64-bit wide and the value of
> MPZ_DIG_SIZE 16, so MPZ_DIG_SIZE * 4 is 64. That shift causes a warning
> because its trying to shift 64 bits of a 64-bit variable:
>
> py/objint_mpz.c:54:5: error: right shift count >= width of type [-Werror]
>
> MIPS32 and MIPS64 n32 are fine because MP_SSIZE_MAX is 32-bit wide and
> the #if clauses in the py/objint_mpz.c protect that to happen.
>
> Look at this test for MIPS32:
>
> $ mips-linux-gnu-gcc -mips32r2 -EB ssize_t.c -o ssize_t
> $ qemu-mips ssize_t
> MP_SSIZE_MAX: 32 bits
> MPZ_DIG_SIZE: 16
> right-shifting 0 bits
> right-shifting 16 bits
>
> And now look at the same test for MIPS64 n64:
>
> $ mips-linux-gnu-gcc -mips64r2 -mabi=64 -EB ssize_t.c -o ssize_t
> ssize_t.c: In function 'main':
> ssize_t.c:24:2: warning: right shift count >= width of type
>   (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 4) & DIG_MASK;
>   ^
> $ qemu-mips64 ssize_t
> MP_SSIZE_MAX: 64 bits
> MPZ_DIG_SIZE: 16
> right-shifting 0 bits
> right-shifting 16 bits
> right-shifting 32 bits
> right-shifting 48 bits
> right-shifting 64 bits
>
> I don't know what's the purpose of the code in py/objint_mpz.c and I
> don't know if they really want to do a 64-bit shift of a 64-bit
> variable. But the thing is that since it's compiled with the -Werror
> flag, that warning makes the compilation to fail.
>
> If they really want to do such a shift, then they should remove the
> -Werror. But if they don't want to do such a shift, then more #if
> clauses are needed in order to prevent that to happen. Perhaps you could
> talk with upstream about this.
>

I raised an issue [1]. But in the meantime I think I've found the
right setting to pass for a 64 bit target. Patch to follow.

[1] - https://github.com/micropython/micropython/issues/1465

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets
  2015-09-18  9:43                   ` Chris Packham
@ 2015-09-18  9:51                     ` Chris Packham
  2015-09-18 10:02                       ` Vicente Olivert Riera
  0 siblings, 1 reply; 38+ messages in thread
From: Chris Packham @ 2015-09-18  9:51 UTC (permalink / raw)
  To: buildroot

From the micropython source:

  This mpz module implements arbitrary precision integers.

  The storage for each digit is defined by mpz_dig_t.  The actual number
  of bits in mpz_dig_t that are used is defined by MPZ_DIG_SIZE.  The
  machine must also provide a type that is twice as wide as mpz_dig_t,
  in both signed and unsigned versions

  MPZ_DIG_SIZE can be between 4 and 8*sizeof(mpz_dig_t), but it makes
  most sense to have it as large as possible.

Micropython detects x86_64 targets and sets MPZ_DIG_SIZE appropriately
but for other 64-bit targets we need to explicitly pass
-DMPZ_DIG_SIZE=32 in CFLAGS.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 package/micropython/micropython.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
index 6266882..1ac2e8d 100644
--- a/package/micropython/micropython.mk
+++ b/package/micropython/micropython.mk
@@ -16,6 +16,10 @@ ifeq ($(BR2_powerpc)$(BR2_sh)$(BR2_xtensa),y)
 MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
 endif
 
+ifeq ($(BR2_ARCH_IS_64),y)
+MICROPYTHON_CFLAGS += -DMPZ_DIG_SIZE=32
+endif
+
 define MICROPYTHON_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
 		CROSS_COMPILE=$(TARGET_CROSS) \
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets
  2015-09-18  9:51                     ` [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets Chris Packham
@ 2015-09-18 10:02                       ` Vicente Olivert Riera
  2015-09-19  9:19                         ` Chris Packham
  0 siblings, 1 reply; 38+ messages in thread
From: Vicente Olivert Riera @ 2015-09-18 10:02 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On 09/18/2015 10:51 AM, Chris Packham wrote:
> From the micropython source:
> 
>   This mpz module implements arbitrary precision integers.
> 
>   The storage for each digit is defined by mpz_dig_t.  The actual number
>   of bits in mpz_dig_t that are used is defined by MPZ_DIG_SIZE.  The
>   machine must also provide a type that is twice as wide as mpz_dig_t,
>   in both signed and unsigned versions
> 
>   MPZ_DIG_SIZE can be between 4 and 8*sizeof(mpz_dig_t), but it makes
>   most sense to have it as large as possible.
> 
> Micropython detects x86_64 targets and sets MPZ_DIG_SIZE appropriately
> but for other 64-bit targets we need to explicitly pass
> -DMPZ_DIG_SIZE=32 in CFLAGS.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>  package/micropython/micropython.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
> index 6266882..1ac2e8d 100644
> --- a/package/micropython/micropython.mk
> +++ b/package/micropython/micropython.mk
> @@ -16,6 +16,10 @@ ifeq ($(BR2_powerpc)$(BR2_sh)$(BR2_xtensa),y)
>  MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>  endif
>  
> +ifeq ($(BR2_ARCH_IS_64),y)
> +MICROPYTHON_CFLAGS += -DMPZ_DIG_SIZE=32
> +endif
> +

you have to take into account that MIPS64 n32 is a 64-bit target as
well, but it has a MP_SSIZE_MAX of 32-bit. So, if you set MPZ_DIG_SIZE
to 32 for all 64-bit arches, then you will see the same failure for the
when building for MIPS64 n32.

I suggest you to do modify the "ifeq" like this:

# MIPS64 n32 is a 64-bit arch, but it has a 32-bit wide SSIZE_MAX which
# means we still need the default MPZ_DIG_SIZE of 16.
ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)


Regards,

Vincent.

>  define MICROPYTHON_BUILD_CMDS
>  	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/unix \
>  		CROSS_COMPILE=$(TARGET_CROSS) \
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets
  2015-09-18 10:02                       ` Vicente Olivert Riera
@ 2015-09-19  9:19                         ` Chris Packham
  0 siblings, 0 replies; 38+ messages in thread
From: Chris Packham @ 2015-09-19  9:19 UTC (permalink / raw)
  To: buildroot

Hi Vincent,

On Fri, Sep 18, 2015 at 10:02 PM, Vicente Olivert Riera
<Vincent.Riera@imgtec.com> wrote:
> Dear Chris Packham,
>
> On 09/18/2015 10:51 AM, Chris Packham wrote:
>> From the micropython source:
>>
>>   This mpz module implements arbitrary precision integers.
>>
>>   The storage for each digit is defined by mpz_dig_t.  The actual number
>>   of bits in mpz_dig_t that are used is defined by MPZ_DIG_SIZE.  The
>>   machine must also provide a type that is twice as wide as mpz_dig_t,
>>   in both signed and unsigned versions
>>
>>   MPZ_DIG_SIZE can be between 4 and 8*sizeof(mpz_dig_t), but it makes
>>   most sense to have it as large as possible.
>>
>> Micropython detects x86_64 targets and sets MPZ_DIG_SIZE appropriately
>> but for other 64-bit targets we need to explicitly pass
>> -DMPZ_DIG_SIZE=32 in CFLAGS.
>>
>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>> ---
>>  package/micropython/micropython.mk | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
>> index 6266882..1ac2e8d 100644
>> --- a/package/micropython/micropython.mk
>> +++ b/package/micropython/micropython.mk
>> @@ -16,6 +16,10 @@ ifeq ($(BR2_powerpc)$(BR2_sh)$(BR2_xtensa),y)
>>  MICROPYTHON_CFLAGS = -DMICROPY_GCREGS_SETJMP=1
>>  endif
>>
>> +ifeq ($(BR2_ARCH_IS_64),y)
>> +MICROPYTHON_CFLAGS += -DMPZ_DIG_SIZE=32
>> +endif
>> +
>
> you have to take into account that MIPS64 n32 is a 64-bit target as
> well, but it has a MP_SSIZE_MAX of 32-bit. So, if you set MPZ_DIG_SIZE
> to 32 for all 64-bit arches, then you will see the same failure for the
> when building for MIPS64 n32.
>
> I suggest you to do modify the "ifeq" like this:
>
> # MIPS64 n32 is a 64-bit arch, but it has a 32-bit wide SSIZE_MAX which
> # means we still need the default MPZ_DIG_SIZE of 16.
> ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
>

I'll take a look. The remote machine I was doing my buildroot hacking
on has gone AWOL so it may take a while for me to get it back up and
running (there was a planned server outage so I suspect it's trying to
access some non-existent mounts).

When I asked upstream there was a thought that this commit[1] might
fix the issue. So I'll try adding that as a patch first.

--
[1] - https://github.com/micropython/micropython/commit/8b4fb4fe140e9cf57fcfa258d0d2d6fe19090fc5

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh
  2015-09-18  9:19                 ` [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh Chris Packham
@ 2015-09-19 12:00                   ` Thomas Petazzoni
  0 siblings, 0 replies; 38+ messages in thread
From: Thomas Petazzoni @ 2015-09-19 12:00 UTC (permalink / raw)
  To: buildroot

Dear Chris Packham,

On Fri, 18 Sep 2015 21:19:35 +1200, Chris Packham wrote:
> These architectures don't have explicit exception handling support in
> micropython but can use the setjmp fallback behaviour instead.
> 
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>  package/micropython/micropython.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2015-09-19 12:00 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 10:21 [Buildroot] [PATCH] micropython: new package Chris Packham
2015-09-14 13:06 ` Vicente Olivert Riera
2015-09-14 23:14   ` Chris Packham
2015-09-14 13:40 ` Vicente Olivert Riera
2015-09-14 22:44   ` Chris Packham
2015-09-14 13:58 ` Thomas Petazzoni
2015-09-14 14:12   ` Vicente Olivert Riera
2015-09-14 23:03     ` Chris Packham
2015-09-15  8:24       ` Thomas Petazzoni
2015-09-15 19:49       ` Jörg Krause
2015-09-14 23:01   ` Chris Packham
2015-09-15  8:23     ` Thomas Petazzoni
2015-09-15  0:01 ` [Buildroot] [PATCHv2] " Chris Packham
2015-09-15 10:14   ` Vicente Olivert Riera
2015-09-15 10:19     ` Vicente Olivert Riera
2015-09-15 21:30       ` Chris Packham
2015-09-15 22:03     ` Thomas Petazzoni
2015-09-15 21:54   ` Chris Packham
2015-09-15 22:49     ` [Buildroot] [PATCHv3] " Chris Packham
2015-09-16  6:25       ` Jerzy Grzegorek
2015-09-16 21:12       ` Thomas Petazzoni
2015-09-16 23:28         ` Chris Packham
2015-09-16 23:29           ` [Buildroot] [PATCH v4 0/2] Micropython package Chris Packham
2015-09-16 23:29             ` [Buildroot] [PATCH v4 1/2] micropython: new package Chris Packham
2015-09-17  8:56               ` Vicente Olivert Riera
2015-09-18  4:54                 ` Chris Packham
2015-09-16 23:29             ` [Buildroot] [PATCH v4 2/2] micropython-lib: new packages Chris Packham
2015-09-17  8:56               ` Vicente Olivert Riera
2015-09-17 21:48             ` [Buildroot] [PATCH v4 0/2] Micropython package Thomas Petazzoni
2015-09-18  7:32             ` Thomas Petazzoni
2015-09-18  8:22               ` Chris Packham
2015-09-18  9:19                 ` [Buildroot] [PATCH] micropython: Set MICROPY_GCREGS_SETJMP=1 for xtensa and sh Chris Packham
2015-09-19 12:00                   ` Thomas Petazzoni
2015-09-18  9:29                 ` [Buildroot] [PATCH v4 0/2] Micropython package Vicente Olivert Riera
2015-09-18  9:43                   ` Chris Packham
2015-09-18  9:51                     ` [Buildroot] [PATCH] micropython: Set MPZ_DIG_SIZE=32 for 64 bit targets Chris Packham
2015-09-18 10:02                       ` Vicente Olivert Riera
2015-09-19  9:19                         ` Chris Packham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.