adding a modliblib... module

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
roland_vs
Posts: 68
Joined: Tue Dec 08, 2015 8:28 pm
Location: Netherlands
Contact:

adding a modliblib... module

Post by roland_vs » Wed Dec 06, 2017 12:42 pm

Dear,

I have added a "modunalib.c" to the "/extmod" directory and added all necessary additions to
- ports/stm32/mpconfigport.h
- py/objmodule.c

and of course to the
- /extmod/modunalib.c

I use a #define MICROPYTHON_PY_UNALIB similar to the other modules to switch in/out the use of the library and skipping generating code when not in use.
Somehow when compiling the modunalib.c does not get compiled automagically...
Only by forcing it by adding it to the Makefile at the point where the modonewire.c is included, it will compile.

I'm wondering if that is ok, or shouldn't the making process pick up the added file? And if so, where to look to make it happen??

Regards,

Roland

SpotlightKid
Posts: 277
Joined: Wed Apr 08, 2015 5:19 am

Re: adding a modliblib... module

Post by SpotlightKid » Wed Dec 06, 2017 1:22 pm

roland_vs wrote:
Wed Dec 06, 2017 12:42 pm
Somehow when compiling the modunalib.c does not get compiled automagically...
Only by forcing it by adding it to the Makefile at the point where the modonewire.c is included, it will compile.
AFAIK that's the normal way to do it. You add your module's source to the Makefile of the chosen port to the SRC_MOD (or in this case the EXTMOD_SRC_C ?) variable.

User avatar
roland_vs
Posts: 68
Joined: Tue Dec 08, 2015 8:28 pm
Location: Netherlands
Contact:

Re: adding a modliblib... module

Post by roland_vs » Wed Dec 06, 2017 2:29 pm

But... what I don't understand is why similar modules like uhashlib etc. appear automatically... and my unalib does not...?

SpotlightKid
Posts: 277
Joined: Wed Apr 08, 2015 5:19 am

Re: adding a modliblib... module

Post by SpotlightKid » Wed Dec 06, 2017 3:18 pm

The object file (moduhashlib.o) is listed in ./py/py.mk.

User avatar
roland_vs
Posts: 68
Joined: Tue Dec 08, 2015 8:28 pm
Location: Netherlands
Contact:

Re: adding a modliblib... module

Post by roland_vs » Thu Dec 07, 2017 8:42 pm

@SpotlightKid Thanks!

Post Reply