Page 1 of 2

For pico port ntptime not standard?

Posted: Sun Aug 21, 2022 3:59 pm
by Jibun no kage
For pico port ntptime not standard? This because pico until recently did not have wifi via PicoW. Is there now an expectation that ntptime should be included in the base MP for pico?

I can't seem to find micropython-ntptime or any variant of it via the Thonny package management?

Re: For pico port ntptime not standard?

Posted: Sun Aug 21, 2022 4:40 pm
by Roberthh
ntptime.py is located in micropython/extmod, which is an unusual place. It should move to micropython-lib, now that the latter moved into the standard set of submodules. ntptime.py is included at some ports to the set of frozen bytecode.

edit: looking through the build system, it is included for Pico_W, esp8266, esp32

Re: For pico port ntptime not standard?

Posted: Sun Aug 21, 2022 6:45 pm
by Jibun no kage
Yeah, that makes sense, since pico has not native wifi.

Re: For pico port ntptime not standard?

Posted: Sun Aug 21, 2022 6:47 pm
by Jibun no kage
If a package is installed in the lib tree, does that not imply it is frozen or such?

Re: For pico port ntptime not standard?

Posted: Sun Aug 21, 2022 7:05 pm
by Roberthh
If a package is installed in the lib tree, does that not imply it is frozen or such?
No. It just is pulled with "make submodules" or "git submodule update --init".

To have it frozen, it must be mentioned in the manifest.py files applying to that specific board. Then it will be included while building the firmware.

Re: For pico port ntptime not standard?

Posted: Mon Aug 22, 2022 1:33 am
by jimmo
Jibun no kage wrote:
Sun Aug 21, 2022 6:47 pm
If a package is installed in the lib tree, does that not imply it is frozen or such?
Yes, exactly as Robert said.

We cannot possibly include every single library from lib in the firmware.

Re: For pico port ntptime not standard?

Posted: Mon Aug 22, 2022 4:46 pm
by Jibun no kage
Yup, not suggesting any change... if I implied such, that was not intended. I am just developing my understanding how change can or should be done if done. I am still looking, learning how the extmod under mpy-cross relates to the port specific manifest list works for each board definition.

For example discussion only here, if I wanted to remove 'onewire' support, that is under the extmod 'scope'. Whereas if I want to remove 'spi' support, that is under the ports/* scope for rp2, and I should be looking at the boards configuration files.

Where or what all depends on the actual device hardware, and if the given component is abstracted or specific to the given device. Initially I was expecting a master manifest file, but as I am looking at things it is more modular than that. :)

I do have one question, the documentation notes that any thing in the 'modules' directory for a given port is included in the final image, does this mean that said 'modules' content are frozen as well, I want to say yes, but I have not looked at the actual logic as yet. And based on what Robert said above, to ensure it is frozen, I need to explicitly configure for that.

Clearly adding stuff is much easier than removing.

Re: For pico port ntptime not standard?

Posted: Mon Aug 22, 2022 7:13 pm
by Roberthh
Most of the C-Coded modules are controlled by the port's mpconfigport.h, the global py/mpconfig.h and eventually a board's mpconfigboard.h. py/mpyconfig.h has the defaults, which are use if not configured otherwise. py/mpconfig.h includes mpconfigport.hm, which in turn may include mpyconfigboard.h or more.
The Python frozen modules are defined in the various manifest.py files, where the entry point is defined by the FROZEN_MANIFEST variable of Makefile. That one can be overridden when calling make.

Re: For pico port ntptime not standard?

Posted: Mon Aug 22, 2022 11:56 pm
by jimmo
Jibun no kage wrote:
Mon Aug 22, 2022 4:46 pm
Whereas if I want to remove 'spi' support, that is under the ports/* scope for rp2, and I should be looking at the boards configuration files.
Yes, exactly. ports/rp2/mpconfigport.h

Code: Select all

#define MICROPY_PY_MACHINE_SPI                  (1)

Re: For pico port ntptime not standard?

Posted: Tue Aug 23, 2022 3:55 am
by Jibun no kage
So 1 for include, 0 for exclude, right? Excluding frozen stuff seems straight forward if there is a manifest file.

But to exclude drivers, example I found that NeoPixel has a manifest file, but onewire for example does not. So not sure how to exclude drivers I don't need. For my ESP01 MQTT/UART image, I don't need sensor drivers or display drivers. But I have not as yet figured out exactly how to remove select drivers right.

Or how to remove core modules, say for example, webrepl. Do just change the MICRO_SOURCE_EXTMOD set, exclude the C source file modwebrepl.c but do I not also need to remove the generation of the object file and/or even the configuration that attempts linking?