-
Notifications
You must be signed in to change notification settings - Fork 15
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
simplefunction module doesn't work on esp32 #3
Comments
The point of the user modules is that you can separate your code from the rest of micropython. So, you shouldn't put anything into /ports/esp32. Instead, you should have your files at the same level as the micropython directory. This is discussed in https://micropython-usermod.readthedocs.io/en/latest/usermods_03.html. You also need to pass the make arguments with the location of your user module directory, e.g.,
However, you still have to modify the mpconfigport.h file for your port, as you already pointed out. |
ok, now I created a separated directory |
I have just realised that I gave contradictory instructions in my first reply. That was a generic make command, and would most certainly not work. (The make flag I have just checked the following steps on the unix port, and they work: So, if you clone the whole repository, you should have a library structure like this:
Assuming that you have
at the end of
Alternatively, if you don't want to edit the header file, you can run make with
Now, you should see following compiler messages:
and
With this, all examples in usermod will be compiled, but only simplefunction will be included, since we set the flag for that particular module only. If you want to include another module, you simply add the corresponding flag to your header file, mpconfigport.h, or add another CFLAGS_EXTRA. You can find out, which flag you need by looking at the very end of the C source file. The last line is always something like
where the last argument of the MP_REGISTER_MODULE macro is the flag that you have to define in the header file, or add to the CFLAGS_EXTRA, if you want to include that module. At this point, you should be able to run micropython and import the simplefunction module. (I haven't yet set up the ESP32 environment, and I can only check this on the unix and STM32 ports, but there it works, and I don't think that this is a port-specific problem.) I hope this helps, and again, sorry for the confusion. |
@v923z I got it and I firstly decidided to run it Then, I tried on esp32 port and got the following result: Do you know what this might be? |
Can you compile micropython without any extra modules? (Leave out usermod altogether!) Can you post your entire make output? (You can simply copy the console output, and format everything as code.) And I would like to refer to your first comment: it seemed that the code was compiled, but simplefunction was linked. Is that correct? (If you go back to that state, can you see As for your last question, could you, please, run |
and after I performed only
and I got the following output:
Once more, thank you |
Not at all. But it would actually be much better, if we could somehow solve the problem.
Exactly. If I do this, my compilation also fails with the same error. You really have to run
I think this should be the solution. |
Look, I think we're almost there. I decided to review the But on esp32 port it still gave me an error, look this snippet from the very end of the output: |
I find this strange. I thought that
Actually, ESP32 is a strange beast: on that platform, micropython runs as a subprocess, and is not implemented natively: https://docs.micropython.org/en/latest/esp32/general.html . For this reason, hardware-related functions might or might not work in the same way as with, e.g., STM32. I have to admit, I haven't tested the code on ESP32, and since I am a bit tied down with It could also be that the |
No, you were write, I returned the names and ran a make clean and had no problems on unix port, sorry for the confusion. This is now really solved with:
I decided to create a another directory
What I had as a result:
The first one because of the already mentioned The later three ones are kind of similar, I decided to register them here, but I am satisfied, I believe the ones I got to compile and use are enough for me to continue. Thank you very much! |
OK, I would then keep this issue open, so that I don't forget about it. Thanks for taking the time for reporting! Incidentally, |
I was following the docs and I was trying to build the simplefunction example to the esp32. So I placed the
simplefunction.c
in the working directory (in my case/ports/esp32
), added the#define MODULE_SIMPLEFUNCTION_ENABLED (1)
to thempconfigport.h
and run the makefile on the terminal only using make, because as the code is in the same directory I don't need to specify a path and the others constants such as board and compiler are defined on makefile.So It built with no error, when I gave a make deploy and tried to import the module on my esp32 I got the following message:
ImportError: no module named 'simplefunction'
.So, I think there's something missing... Can someone help me figure out?
One more information: while the make is running it prints a message
"QSTR not updated "
, in somehow I think it has something to do with it.@v923z
The text was updated successfully, but these errors were encountered: