Page 1 of 1

A concrete QSTR example

Posted: Fri Aug 02, 2019 8:11 pm
by manseekingknowledge
QSTR is mentioned a lot in this forum, but other than a short blurb about it under the "Storing strings in flash" section here there doesn't seem to be any concrete examples. I imported my main module and ran the command micropython.qstr_info(1) and the only thing it returned was the name of the module I imported. I guess I was expecting to see... more.

A few questions:

1.) My main module imports a lot of other modules, does micropython.qstr_info(1) run recursively, or do I need to import every single module that ever gets imported before I run micropython.qstr_info(1)?

2.) Will micropython.qstr_info(1) only ever return module names, or will it return actual strings that are in my code?

3.) Does adding QSTRs to qstrdefsport.h work if my modules are already frozen?

Re: A concrete QSTR example

Posted: Fri Aug 02, 2019 10:03 pm
by jimmo
If your modules are already frozen, then your strings have already been QSRT-ified.

Re: A concrete QSTR example

Posted: Sat Aug 03, 2019 2:59 am
by manseekingknowledge
jimmo wrote:
Fri Aug 02, 2019 10:03 pm
If your modules are already frozen, then your strings have already been QSRT-ified.
Good to know.