Import precompiled code into wipy 2.0

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
Arkaik
Posts: 4
Joined: Tue May 02, 2017 9:15 am

Import precompiled code into wipy 2.0

Post by Arkaik » Tue May 02, 2017 3:16 pm

Hi everyone,

I'm currently trying to import precompiled code but it always fails.
I followed this topics but the repository seems to have changed a bit and I think the procedure isn't good anymore.
viewtopic.php?f=11&t=2326
viewtopic.php?f=3&t=2334&p=13322&hilit= ... led#p13322

What I did is first to clone the micropython-esp32 repository at https://github.com/micropython/micropython-esp32 to my computer.
Then I built mpy-cross and precompile my module.

As the line #define MICROPY_PERSISTENT_CODE_LOAD (1) already exists in micropython/cc3200/mpconfigport.h and py/emitglue.c doesn't contains 400 lines anymore (looks like it changed a lot) I suppose I don't need to rebuild the firmware anymore. Am I right?

Whatever when I try to load my precompiled module from flash it's never found by python.

I would like to know what I am dooing wrong. I have to admit that I feel a little lost with all the repos and different boards that exist.

So should I rebuild the firmware and flash it to my board or it's not necessary?
Am I using the good repository when I compile with mpy-cross?

I also tried to compile with the -mcache-lookup-bc option but I obtain the same result, is there more option I'm missing?

I will certainly have other questions as I'm a pure noob in micropython but I think I begin to understand how it works.

I hope someone will help me because I'm stuck with it for quite a long time ^^.

Thank you in advance and sorry if my english is not perfect ;)

User avatar
Roberthh
Posts: 2438
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Import precompiled code into wipy 2.0

Post by Roberthh » Wed May 03, 2017 6:00 am

So you are trying to use the esp32 build of micropython.org on your wipy 2.0? That should work. By mistake, I did that for a Lopy, and it worked too, even if that was not the intention. The opposite works too, including execution of pre-compiled files.

The esp32 port of micropython.org has the support for pre-compiled files already built-in, and I tried that it works.

You have to use mpy-cross from the same tree ans the esp32 code, since the mpy-cross versions differ.

You can also put your Python scripts into esp/modules and build the firmware, creating frozen bytecode. I have done that and it works.

Arkaik
Posts: 4
Joined: Tue May 02, 2017 9:15 am

Re: Import precompiled code into wipy 2.0

Post by Arkaik » Wed May 03, 2017 9:50 am

Hi, thank you for the quick answer.

I tried both solutions without success.

As you said the support of pre-compiled files is already built-in, I tried with the latest firmware (Flashed with the update script given by pycom.io).
After flashing the latest firmware I pre-compiled my module with the mpy-cross tool from esp32 branch to a .mpy file and I upload it to the board into the flash/ folder with ftp.
When I tried to import it from repl, the module is not found.

I can succesfully build the firmware, I built it from the git micropython-esp32 branch as precised in doc.
I flashed it with success after erasing flash but when I boot the board, there was no wipy-wlan-xxxx wifi access point so I can't use it.

Did I miss something?
I included nothing to the firmware for the test purpose and I don't know why I can't see the wifi AP.
I precise that after flashing the custom firmware, the led was not blinking with blue color as it does when using the updater.

User avatar
Roberthh
Posts: 2438
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Import precompiled code into wipy 2.0

Post by Roberthh » Wed May 03, 2017 10:06 am

Which Repository are you using?

a) https://github.com/micropython/micropyt ... sp32/esp32
b) https://github.com/pycom/pycom-micropyt ... ster/esp32
c) https://github.com/pycom/pycom-micropyt ... ster/esp32

In a) precomiled code is supported both for frozen bytecode and .mpy files
in b) frozen bytecode is upported, and procmpiled .mpy files can be added by inserting
#define MICROPY_PERSISTENT_CODE_LOAD (1)
into mpconfigport.h
in c) no support for frozen bytecode or precompiled files. This is an obsolete branch.

In any case, you have to use mpy-cross from that branch.

For b) and c), this is the wrong forum. You might get also and mybe better support at https://forum.pycom.io/

Arkaik
Posts: 4
Joined: Tue May 02, 2017 9:15 am

Re: Import precompiled code into wipy 2.0

Post by Arkaik » Wed May 03, 2017 12:24 pm

I'm using the first repository a) https://github.com/micropython/micropyt ... sp32/esp32

After building and flashing the firmware, I still have no wifi AP.

I precise that I just clone the esp-idf repository but I didn't build any project.

When I boot the board after flashing, the led was enabled with green soft light. After reboot again, no led enabled.
If I boot in bootloader mode G23+GND the led is enabled with high green light.

Does this green light meems something?
If I understood well, the led is supposed to blink blue every 4 sec.

User avatar
Roberthh
Posts: 2438
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Import precompiled code into wipy 2.0

Post by Roberthh » Wed May 03, 2017 8:48 pm

There is a note in readme that if you use that port on wipy, you have to switch the antenna. Look here at the end of the file https://github.com/micropython/micropyt ... /README.md

The LED is only blinking with the pycom.io firmware, choice b) or c).

Post Reply