The way we have decided to handle support is to write C++ drivers for our boards, then write micropython User C Module bindings for them, so the same underling code is shared. We then bundle these bindings in our own fork of Micropython, specifically for the Pico. Whether this approach proves viable long-term remains to be seen, but it was the best option at the time.
Anyway, the reason I'm posting is because whilst writing these bindings I've encountered multiple occasions where I get errors about the QSTR names I provide for functions and keywords. Here's an example:
Also had it for these (just the ones I remember):
Code: Select all
/home/users/pico/micropython/ports/rp2/build/frozen_content.c:219:5: error: redeclaration of enumerator 'MP_QSTR_port' 219 | MP_QSTR_port, | ^~~~~~~~~~~~ In file included from /home/user/pico/micropython/py/obj.h:33, from /home/user/pico/micropython/py/objint.h:30, from /home/user/pico/micropython/ports/rp2/build/frozen_content.c:15: /home/user/pico/micropython/ports/rp2/build/genhdr/qstrdefs.generated.h:820:6: note: previous definition of 'MP_QSTR_port' was here 820 | QDEF(MP_QSTR_port, (const byte*)"\x5c\x04" "port")
I logically understand why these errors occur, because the name is already defined in frozen_content.c, so requires me to choose a different name (such as server_start). Unfortunately the list is quite exhaustive, meaning I will keep running into this issue, not to mention there's only so far these names can deviate from the originals before they loose meaning to the customer.
Code: Select all
pin pins x y wrap loop host port connect start_server
I was therefore wondering, when I encounter such situations, is there a way for me to reference the existing QSTR so I can use the name instead of providing a new name? Accessing mp_qstr_frozen_const_pool in some way perhaps?
Thanks in advance