Compile lv_micropython (v8) for Windows

Description

To be able to do rapid prototyping I would like to compile the lv_micropython repository for Windows.
I’m running into many issues during this process. Also Edgeline, seems to contain a LVGL 7 version of Micropython binary.

What MCU/Processor/Board and compiler are you using?

Windows

What do you want to achieve?

I want to have a Micropython with LVGL V8 binary to do prototyping.

What have you tried so far?

I have tried compiling on Windows (mingw) and Linux, both without success.

After resolving the requirements with regards to external libraries (i.e. SDL2), I get loads of compilation errors, which differ between Linux and Windows.

The first obvious error seems to be in the mpconfigport.h for the windows port.
lv_micropython/mpconfigport.h at master · lvgl/lv_micropython (github.com)

There is this line, which has an unknown variable/define:

//use large block for GC to increase speed of allocate, but consume more memory
#define MICROPY_BYTES_PER_GC_BLOCK (64 * BYTES_PER_WORD)

BYTES_PER_WORD is unknow/undefined.

Has anyone managed to compile LVGL v8 + Micropython?

As far as I know, the Windows port in lv_micropython is not configured to work with LVGL; it’s just inherited from upstream. In general I believe @amirgon recommends using the Unix port in a VM or WSL for development.

I am not sure exactly where Edgeline gets its Micropython binary from; I suspect it’s a closed-source fork with additional features for Edgeline integration.

Another note: I believe the use of v7 in Edgeline was just for stability during development, and the official release will be using v8.

1 Like

The unix port is the supported one.
But at least once, a year ago, someone tried and succeeded building and running lv_micropython on Window with mingw:

This was long ago and we don’t have any CI to test it, so I won’t be surprised if it’s broken now.
Everyone are simply developing on Linux these days (or a Linux VM).

Another interesting option is to use GitPod.
It is pre-configured with the Linux port and you can do almost everything there (build, run, interact with the LVGL GUI, use VSCode to edit the files, commit, push etc.) Everything is online so you only need a web browser!

1 Like

Thanks for the pointers guys. The Windows port is broken, I can confirm.
The unix port seems like the easiest solution here, that will be absolutely fine.
GitPod, looks pretty neat as well.

We have started a discussion regarding the Windows port issues - if anyone is interested in participating/contributing:

I know this is quite old but I found it when I had the same issue. I added

#ifndef BYTES_PER_WORD
#define BYTES_PER_WORD 4
#endif

to mpconfig.h and it did compile and run. I tried

import lvgl as lv

and that didn’t.
Here’s the build log from VS2022:

Rebuild started...
1>------ Rebuild All started: Project: micropython, Configuration: Release x64 ------
1>EXEC : warning : in the working copy of '.vs/ProjectSettings.json', CRLF will be replaced by LF the next time Git touches it
1>GEN C:\Users\cjones\lv_micropython\ports\windows\build-standard\genhdr\mpversion.h.tmp
1>7>
1>10>
1>6>
1>2>
1>objgetitemiter.c
1>1>
1>runtime_utils.c
1>objboundmeth.c
1>modure.c
1>compile.c
1>argcheck.c
1>10>
1>7>
1>6>
1>objint.c
1>scheduler.c
1>1>
1>objcell.c
1>2>
1>12>
1>12>
1>asmarm.c
1>emitbc.c
1>moduselect.c
1>7>
1>10>
1>objint_longlong.c
1>6>
1>scope.c
1>12>
1>1>
1>objclosure.c
1>modutimeq.c
1>asmbase.c
1>2>
1>emitcommon.c
1>7>
1>10>
1>objint_mpz.c
1>6>
1>sequence.c
1>objcomplex.c
1>1>
1>12>
1>2>
1>moduzlib.c
1>asmthumb.c
1>emitglue.c
1>7>
1>10>
1>showbc.c
1>objlist.c
1>6>
1>objdeque.c
1>1>
1>12>
1>asmx64.c
1>2>
1>utime_mphal.c
1>emitinlinethumb.c
1>7>
1>10>
1>objmap.c
1>smallint.c
1>6>
1>objdict.c
1>1>
1>12>
1>asmx86.c
1>2>
1>virtpin.c
1>emitinlinextensa.c
1>10>
1>7>
1>stackctrl.c
1>objmodule.c
1>6>
1>1>
1>objenumerate.c
1>asmxtensa.c
1>12>
1>vfs.c
1>10>
1>2>
1>7>
1>emitnarm.c
1>stream.c
1>objnamedtuple.c
1>6>
1>1>
1>objexcept.c
1>bc.c
1>12>
1>vfs_posix.c
1>2>
1>10>
1>emitnative.c
1>7>
1>unicode.c
1>objnone.c
1>1>
1>6>
1>binary.c
1>objfilter.c
1>12>
1>10>
1>vfs_posix_file.c
1>2>
1>vm.c
1>7>
1>emitnthumb.c
1>objobject.c
1>6>
1>1>
1>objfloat.c
1>builtinevex.c
1>12>
1>2>
1>vfs_reader.c
1>10>
1>emitnx64.c
1>7>
1>vstr.c
1>objpolyiter.c
1>1>
1>6>
1>builtinhelp.c
1>objfun.c
1>12>
1>2>
1>readline.c
1>emitnx86.c
1>10>
1>7>
1>warning.c
1>objproperty.c
1>1>
1>6>
1>builtinimport.c
1>objgenerator.c
1>2>
1>12>
1>emitnxtensa.c
1>gchelper_generic.c
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>9>
1>pairheap.c
1>parse.c
1>parsenum.c
1>parsenumbase.c
1>persistentcode.c
1>profile.c
1>pystack.c
1>qstr.c
1>reader.c
1>repl.c
1>ringbuf.c
1>runtime.c
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>3>
1>emitnxtensawin.c
1>formatfloat.c
1>frozenmod.c
1>gc.c
1>lexer.c
1>malloc.c
1>map.c
1>modarray.c
1>modbuiltins.c
1>modcmath.c
1>modcollections.c
1>modgc.c
1>machine_mem.c
1>machine_pinbase.c
1>machine_pulse.c
1>machine_signal.c
1>moduasyncio.c
1>modubinascii.c
1>moductypes.c
1>moduhashlib.c
1>moduheapq.c
1>modujson.c
1>moduos.c
1>modurandom.c
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>11>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>4>
1>modio.c
1>modmath.c
1>modmicropython.c
1>modstruct.c
1>modsys.c
1>modthread.c
1>moduerrno.c
1>mpprint.c
1>mpstate.c
1>mpz.c
1>nativeglue.c
1>nlr.c
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>8>
1>objrange.c
1>objreversed.c
1>objset.c
1>objsingleton.c
1>objslice.c
1>objstr.c
1>objstringio.c
1>objstrunicode.c
1>objtuple.c
1>objtype.c
1>objzip.c
1>opmethods.c
1>nlraarch64.c
1>nlrmips.c
1>nlrpowerpc.c
1>nlrsetjmp.c
1>nlrthumb.c
1>nlrx64.c
1>nlrx86.c
1>nlrxtensa.c
1>obj.c
1>objarray.c
1>objattrtuple.c
1>objbool.c
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>5>
1>10>
1>fmode.c
1>10>
1>init.c
1>10>
1>realpath.c
1>10>
1>windows_mphal.c
1>10>
1>dirent.c
1>10>
1>gettimeofday.c
1>10>
1>gccollect.c
1>10>
1>input.c
1>10>
1>main.c
1>10>
1>modtime.c
1>10>
1>modmachine.c
1>QSTR updated
1>Module registrations updated
1>Root pointer registrations updated
1>Compressed data updated
1>qstrdefs.h
1>qstrdefsport.h
1>argcheck.c
1>asmarm.c
1>asmbase.c
1>asmthumb.c
1>asmx64.c
1>asmx86.c
1>asmxtensa.c
1>bc.c
1>binary.c
1>builtinevex.c
1>builtinhelp.c
1>builtinimport.c
1>compile.c
1>emitbc.c
1>emitcommon.c
1>emitglue.c
1>emitinlinethumb.c
1>emitinlinextensa.c
1>emitnarm.c
1>emitnative.c
1>emitnthumb.c
1>emitnx64.c
1>emitnx86.c
1>emitnxtensa.c
1>emitnxtensawin.c
1>formatfloat.c
1>frozenmod.c
1>gc.c
1>malloc.c
1>lexer.c
1>map.c
1>modarray.c
1>modbuiltins.c
1>modcmath.c
1>modcollections.c
1>modgc.c
1>modio.c
1>modmath.c
1>modmicropython.c
1>modstruct.c
1>modsys.c
1>modthread.c
1>moduerrno.c
1>mpprint.c
1>mpstate.c
1>mpz.c
1>nativeglue.c
1>nlr.c
1>nlraarch64.c
1>nlrmips.c
1>nlrpowerpc.c
1>nlrsetjmp.c
1>nlrthumb.c
1>nlrx64.c
1>nlrx86.c
1>nlrxtensa.c
1>obj.c
1>objarray.c
1>objattrtuple.c
1>objbool.c
1>objboundmeth.c
1>objcell.c
1>objclosure.c
1>objcomplex.c
1>objdeque.c
1>objdict.c
1>objenumerate.c
1>objexcept.c
1>objfilter.c
1>objfloat.c
1>objfun.c
1>objgenerator.c
1>objgetitemiter.c
1>objint.c
1>objint_longlong.c
1>objint_mpz.c
1>objlist.c
1>objmap.c
1>objmodule.c
1>objnamedtuple.c
1>objnone.c
1>objobject.c
1>objpolyiter.c
1>objproperty.c
1>objrange.c
1>objreversed.c
1>objset.c
1>objsingleton.c
1>objslice.c
1>objstr.c
1>objstringio.c
1>objstrunicode.c
1>objtuple.c
1>objtype.c
1>objzip.c
1>opmethods.c
1>pairheap.c
1>parse.c
1>parsenum.c
1>parsenumbase.c
1>persistentcode.c
1>profile.c
1>pystack.c
1>qstr.c
1>reader.c
1>repl.c
1>ringbuf.c
1>runtime.c
1>runtime_utils.c
1>scheduler.c
1>scope.c
1>sequence.c
1>showbc.c
1>smallint.c
1>stackctrl.c
1>stream.c
1>unicode.c
1>vm.c
1>vstr.c
1>warning.c
1>machine_mem.c
1>machine_pinbase.c
1>machine_pulse.c
1>machine_signal.c
1>moduasyncio.c
1>modubinascii.c
1>moductypes.c
1>moduhashlib.c
1>moduheapq.c
1>modujson.c
1>moduos.c
1>modurandom.c
1>modure.c
1>moduselect.c
1>modutimeq.c
1>moduzlib.c
1>utime_mphal.c
1>virtpin.c
1>vfs.c
1>vfs_posix.c
1>vfs_posix_file.c
1>vfs_reader.c
1>readline.c
1>gchelper_generic.c
1>fmode.c
1>init.c
1>realpath.c
1>windows_mphal.c
1>dirent.c
1>gettimeofday.c
1>gccollect.c
1>input.c
1>main.c
1>modtime.c
1>modmachine.c
1>micropython.vcxproj -> C:\Users\cjones\lv_micropython\ports\windows\build-standard\Releasex64\micropython.exe
1>Done building project "micropython.vcxproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild started at 8:25 PM and took 16.541 seconds ==========

It looks like a lot of work has been done to advance desktop simulation. So, it’s pretty likely I was using some old instructions to get to where I was above.