For pico port ntptime not standard?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

For pico port ntptime not standard?

Post by Jibun no kage » Sun Aug 21, 2022 3:59 pm

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?

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

Re: For pico port ntptime not standard?

Post by Roberthh » Sun Aug 21, 2022 4:40 pm

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

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: For pico port ntptime not standard?

Post by Jibun no kage » Sun Aug 21, 2022 6:45 pm

Yeah, that makes sense, since pico has not native wifi.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: For pico port ntptime not standard?

Post by Jibun no kage » 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?

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

Re: For pico port ntptime not standard?

Post by Roberthh » Sun Aug 21, 2022 7:05 pm

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.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: For pico port ntptime not standard?

Post by jimmo » Mon Aug 22, 2022 1:33 am

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.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: For pico port ntptime not standard?

Post by Jibun no kage » Mon Aug 22, 2022 4:46 pm

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.

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

Re: For pico port ntptime not standard?

Post by Roberthh » Mon Aug 22, 2022 7:13 pm

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.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: For pico port ntptime not standard?

Post by jimmo » Mon Aug 22, 2022 11:56 pm

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)

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: For pico port ntptime not standard?

Post by Jibun no kage » Tue Aug 23, 2022 3:55 am

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?

Post Reply