tranformation MP_QSTR__slash_lib into /lib

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

tranformation MP_QSTR__slash_lib into /lib

Post by Roberthh » Sat Jan 26, 2019 7:18 am

Which setting/step in creating binaries causes during the translation of e.g. MP_QSTR__slash_lib into /lib the mapping of "_slash_" into "/"? I assume it is a singe setting/flag, but searching did not reveal the right place.

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: tranformation MP_QSTR__slash_lib into /lib

Post by stijn » Sat Jan 26, 2019 9:00 am

makeqstrdata.py processes the compiler-generated files and has

Code: Select all

codepoint2name[ord('/')] = 'slash'

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

Re: transformation MP_QSTR__slash_lib into /lib

Post by Roberthh » Thu Jun 18, 2020 6:49 am

I still have this problem, that a term MP_QSTR__slash_lib is NOT converted into "/lib", but into "_slash_lib". If I look into qstrdefs.generated.h, I find it there, opposed to other ports. Up to the point of the file qstrdefs.preprocessed.h it looks fine, but the last transformation does not happen for this specific file.

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: tranformation MP_QSTR__slash_lib into /lib

Post by stijn » Thu Jun 18, 2020 7:38 pm

Is there a way to reproduce this? I.e. what port and/or custom build are you using?

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

Re: tranformation MP_QSTR__slash_lib into /lib

Post by Roberthh » Thu Jun 18, 2020 8:00 pm

That's the w600 port I am working on: https://github.com/robert-hh/micropytho ... ports/w60x
You can compile that with the standard setting: make V=s, but it requires a SDK for proper linking and compiling. A copy is here:
https://github.com/robert-hh/WM_SDK_W60X
But even without proper compiling, linking and loading it to a board, you can seen the wrong result int build/genhdr/qstrdefs.generated.h, because that's an early step.
The confusing thing is, that this seems to be the only failing QSTR, and that is for initializing sys.path
Obviously I can bypass the error by directly setting the path list with string constants. But it strange, and I must have had a similar problem in Jan 2019. I just don't remember what was the conclusion back then. It was definitely not with that port.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: tranformation MP_QSTR__slash_lib into /lib

Post by dhylands » Thu Jun 18, 2020 9:06 pm

It looks like you need to add a line:

Code: Select all

Q(/lib)
to your qstrdefsport.h file.

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

Re: tranformation MP_QSTR__slash_lib into /lib

Post by Roberthh » Fri Jun 19, 2020 5:56 am

Thanks. That did the trick.

Post Reply