-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
extmod/mod_network: Define network hostname globally for all nic boards. #9086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
extmod/modnetwork.c: extmod/modnetwork.h: Added hostname variable and get/set functions. If the NIC board uses LWIP library, the hostame is publish through mDNS. Make mod_network_nic_type_t definition globally used by all NIC boards. drivers/cyw43/cyw43.h drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c extmod/network_cyw43.c extmod/network_cyw43.h: Remove previous hostname definition to use the global one. Use mod_network_nic_type_t object for nic board access. extmod/network_wiznet5k.c: Use mod_network_nic_type_t object. ports/stm32/eth.c: ports/stm32/eth.h: ports/stm32/mpconfigport.h: ports/stm32/network_lan.c: ports/mimxrt/eth.c: ports/mimxrt/eth.h: ports/mimxrt/mpconfigport.h: ports/mimxrt/network_lan.c: Move struct eth definition to eth.h to be able to use mod_network_nic_type_t object for the nic board access. ports/rp2/mpconfigport.h: Use mod_network_nic_type_t object.
extmod/modnetwork.c: Add #if LWIP_NETIF_HOSTNAME to check if netif struct has a hostname member.
Following the usual style of instantiation and init().
So that SDRAM can be used as the heap on ARDUINO_PORTENTA_H7, for example. Fixes issue #9087.
If mboot is built with support for packing (signing/encryption) it needs up to 32KiB. So for simplicity increase the mboot region to 32KiB unconditionally for WB55 boards (custom WB55 board configurations can still provide their own linker scripts to override this).
Rather than having the autobuild know about the particular variants, have the mpconfigboard.mk describe them and make autobuild discover them automatically. Adds a "query-variants" target to stm32/Makefile to allow the set of possible variants to be queried. Removes pybv3 from the autobuild as this isn't use by the downloads page. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Not safe to use mp_hal_delay_ms before boot if threading is enabled, because threading will not have been initialised, and MICROPY_EVENT_POLL_HOOK assumes threading is initialised. HAL_Delay doesn't call MICROPY_EVENT_POLL_HOOK, but is still power-efficient like mp_hal_delay_ms (unlike mp_hal_delay_us). Fixes #7816. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
It has been about 8 years since support for this chip was added. Reasons to remove it are: - It is no longer easy to obtain this part. - There are now many other options for WiFi. - It's not a good use of developer time to maintain it. Signed-off-by: Damien George <damien@micropython.org>
It's no longer used by any port. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Also document support for 'cp :a :b'. Signed-off-by: Damien George <damien@micropython.org>
Updated some of the CPython feature differences: - Updated status of some features. - Added CSS to fix table widths to 100% and word wrap. - Specified explicit table column ratios to improve layout appearance. - Added missing references to anchors. - Better consistency with use of formatting and case.
Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
* `init()` can be called multiple times to reconfigure UART. * After `deinit()` it is impossible to call `init()` again. Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
These can't be nested, so apply styling separately. Signed-off-by: Laurens Valk <laurens@pybricks.com>
Signed-off-by: Laurens Valk <laurens@pybricks.com>
The existing non-Docker instructions are basically impossible to follow because the esp-open-sdk does not compile. Update these instructions to use the exact toolchain that our CI uses. Also split the Docker from non-Docker instructions, to avoid confusion about which commands need to be prefixed. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Previously the desired output type was specified. Now make the type part of the function name. Because this function is used in a few places this saves code size due to smaller call-site. This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c (which is almost the only place where the output type isn't a compile-time constant). This saves ~140 bytes on PYBV11. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Now that we have `mp_obj_new_str_type_from_vstr` (private helper used by objstr.c) split from the public API (`mp_obj_new_str_from_vstr`), we can enforce a unicode check at the public API without incurring a performance cost on the various objstr.c methods (which are already working on known unicode-safe strings). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The new `mp_obj_new_str_from_utf8_vstr` can be used when you know you already have a unicode-safe string. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
All uses of this are either tiny strings or not-known-to-be-safe. Update comments for mp_obj_new_str_copy and mp_obj_new_str_of_type. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There don't seem to be many changes going from v2.1.2 to v2.1.3 of lwIP. Mostly they are: - IPv6 fixes and improvements - changes to apps and other code that MicroPython doesn't use - comments and tests - minor bug fixes In particular there doesn't look to be any change to the API of any function used by MicroPython. Network multi tests pass on PYBD_SF2 and PYBD_SF6. PYBD_SF2, PYBD_SF6 and PICO_W have unchanged iperf3 performance. Similar results for networking on the mimxrt port. Signed-off-by: Damien George <damien@micropython.org>
Having two separate manifests is confusing. It's simpler to have the daily builds use the same configuration as the stable, release builds. Signed-off-by: Damien George <damien@micropython.org>
The check for make_new (i.e. used to determine something's type) is now more complicated due to the slot access. This commit changes the inlining of a few frequently-used helpers to overall improve code size and performance.
The intent is to allow us to make breaking changes to the native ABI (e.g. changes to dynruntime.h) without needing the bytecode version to increment. With this commit the two bits previously used for the feature flags (but now unused as of .mpy version 6) encode a sub-version. A bytecode-only .mpy file can be loaded as long as MPY_VERSION matches, but a native .mpy (i.e. one with an arch set) must also match MPY_SUB_VERSION. This allows 3 additional updates to the native ABI per bytecode revision. The sub-version is set to 1 because the previous commits that changed the layout of mp_obj_type_t have changed the native ABI. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
This matches class `__dict__`, and is similarly gated on MICROPY_CPYTHON_COMPAT. Unlike class though, because modules's globals are actually dict instances, the result is a mutable dictionary. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Useful when more detail is needed for an OSError associated with a file. Signed-off-by: Damien George <damien@micropython.org>
This improves error messages in mpy-cross: - When loading a .py file that doesn't exist (or can't be opened) it now includes the filename in the OSError. - When saving a .mpy file that can't be opened it now raises an exception (prior, it would silently fail), and includes the filename in the OSError. Signed-off-by: Damien George <damien@micropython.org>
Prevent handle leaks when file objects aren't closed explicitly and fix some MICROPY_CPYTHON_COMPAT issues: this wasn't properly adhered to because #ifdef was used so it was always on, and closing files multiple times should be avoided unconditionally.
frozentest.mpy was previously duplicated in ports/minimal and ports/powerpc. This needs to be re-generated on every .mpy version increase, so might as well just have a single copy of it. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This uses the frozentest.mpy that is also used by ports/minimal. Also fixes two bugs that these new tests picked up: - File extension matching in manifestfile.py. - Handling of freeze_mpy results in makemanifest. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Allows running from a different directory, etc. This work was funded by Planet Innovation.
extmod/modnetwork.c: extmod/modnetwork.h: Added hostname variable and get/set functions. If the NIC board uses LWIP library, the hostame is publish through mDNS. Make mod_network_nic_type_t definition globally used by all NIC boards. drivers/cyw43/cyw43.h drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c extmod/network_cyw43.c extmod/network_cyw43.h: Remove previous hostname definition to use the global one. Use mod_network_nic_type_t object for nic board access. extmod/network_wiznet5k.c: Use mod_network_nic_type_t object. ports/stm32/eth.c: ports/stm32/eth.h: ports/stm32/mpconfigport.h: ports/stm32/network_lan.c: ports/mimxrt/eth.c: ports/mimxrt/eth.h: ports/mimxrt/mpconfigport.h: ports/mimxrt/network_lan.c: Move struct eth definition to eth.h to be able to use mod_network_nic_type_t object for the nic board access. ports/rp2/mpconfigport.h: Use mod_network_nic_type_t object.
extmod/modnetwork.c: Add #if LWIP_NETIF_HOSTNAME to check if netif struct has a hostname member.
This PR looks like a git fault. |
This git stuff is really a pain... All this to resolve the conflicts introduced by the new |
Commit message formatting error is not mine (don't know what to do...):
|
How did you attempt to update? With |
@robert-hh |
extmod/modnetwork.c: extmod/modnetwork.h: Added hostname variable and get/set functions. If the NIC board uses LWIP library, the hostame is publish through mDNS. Make mod_network_nic_type_t definition globally used by all NIC boards. drivers/cyw43/cyw43.h drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c extmod/network_cyw43.c extmod/network_cyw43.h: Remove previous hostname definition to use the global one. Use mod_network_nic_type_t object for nic board access. extmod/network_wiznet5k.c: Use mod_network_nic_type_t object. ports/stm32/eth.c: ports/stm32/eth.h: ports/stm32/mpconfigport.h: ports/stm32/network_lan.c: ports/mimxrt/eth.c: ports/mimxrt/eth.h: ports/mimxrt/mpconfigport.h: ports/mimxrt/network_lan.c: Move struct eth definition to eth.h to be able to use mod_network_nic_type_t object for the nic board access. ports/rp2/mpconfigport.h: Use mod_network_nic_type_t object.
extmod/modnetwork.c: Add #if LWIP_NETIF_HOSTNAME to check if netif struct has a hostname member.
extmod/modnetwork.c: extmod/modnetwork.h: Added hostname variable and get/set functions. If the NIC board uses LWIP library, the hostame is publish through mDNS. Make mod_network_nic_type_t definition globally used by all NIC boards. drivers/cyw43/cyw43.h drivers/cyw43/cyw43_ctrl.c drivers/cyw43/cyw43_lwip.c extmod/network_cyw43.c extmod/network_cyw43.h: Remove previous hostname definition to use the global one. Use mod_network_nic_type_t object for nic board access. extmod/network_wiznet5k.c: Use mod_network_nic_type_t object. ports/stm32/eth.c: ports/stm32/eth.h: ports/stm32/mpconfigport.h: ports/stm32/network_lan.c: ports/mimxrt/eth.c: ports/mimxrt/eth.h: ports/mimxrt/mpconfigport.h: ports/mimxrt/network_lan.c: Move struct eth definition to eth.h to be able to use mod_network_nic_type_t object for the nic board access. ports/rp2/mpconfigport.h: Use mod_network_nic_type_t object.
@omogenot You cannot do it like that. There are 137 commits and 520 changed files in this PR, which aims to change a single feature. So something went fundamentally wrong, and you have to start over. The structures I use are: Example of a rebased branch. Note the line with the
|
This PR proposes to globally move hostname definition to the
network
module, so that it will be defined for all nic boards by using thenetwork.hostname()
method. The default host name is set tomp-host
and the hostname length is controlled by theMICROPY_PY_HOSTNAME_LENGTH
constant which is defaulted to 32 if not defined.Note: This PR would replace some of the modifications done specifically for the cyw43 board only (PR #8918), but keeps the ioctl functions up and running using this global hostname definition.
If the nic board uses the LWIP library, we take advantage of the integrated
mDNS
server (if theLWIP_MDNS_RESPONDER
constant is defined) to declare hostname for that nic board.From now on, on the network, you can perform a ping
my-host.local
to get a response from your micropython board.I could not test these modifications for all nic boards, I have only WIZNET5K boards available.