Eclipse setup - missing definitions
Eclipse setup - missing definitions
Hi Guys
Currently I have set up eclipse to compile and debug micrypython on a STM32F429DISC, and this is working great
However, in eclipse the definitions from generated headers like qstrdefs.generated.h are not recognised.
Examples: MP_QSTR_opt, MP_STATE_PORT, MP_DEFINE_CONST_FUN_OBJ_KW
This creates a lot of "noise" in the editor, even though the project compiles and runs just file using the included makefiles.
Does anyone know a way to make eclipse aware of these generated header files and include them in the scan for symbols?
cheers
Poul Flindt
Currently I have set up eclipse to compile and debug micrypython on a STM32F429DISC, and this is working great
However, in eclipse the definitions from generated headers like qstrdefs.generated.h are not recognised.
Examples: MP_QSTR_opt, MP_STATE_PORT, MP_DEFINE_CONST_FUN_OBJ_KW
This creates a lot of "noise" in the editor, even though the project compiles and runs just file using the included makefiles.
Does anyone know a way to make eclipse aware of these generated header files and include them in the scan for symbols?
cheers
Poul Flindt
Re: Eclipse setup - missing definitions
You'd need to write a script which expands the QDEF macros. You can see in py/qtr.h https://github.com/micropython/micropyt ... .h#L39-L46 the following:
The C preprocessor will take the QDEF macros from genhdr/qstrdefs.generated.h: and create something like this: Then you need to coerce eclipse to look at your generated definitions.
You could create a dummy.c file (in the stmhal directory) which contains the following: and run: and this will generate build-PYBV10/dumy.pp which is the preprocessed version. It might be enough to rename dummy.pp to dummy.h and get eclipse to use that (I've never used eclipse, so I'm not sure what's needed).
Code: Select all
enum {
#ifndef NO_QSTR
#define QDEF(id, str) id,
#include "genhdr/qstrdefs.generated.h"
#undef QDEF
#endif
MP_QSTRnumber_of, // no underscore so it can't clash with any of the above
};
Code: Select all
QDEF(MP_QSTR_NULL, (const byte*)"\x00\x00\x00" "")
QDEF(MP_QSTR_, (const byte*)"\x05\x15\x00" "")
QDEF(MP_QSTR__star_, (const byte*)"\x8f\xb5\x01" "*")
QDEF(MP_QSTR__, (const byte*)"\xfa\xb5\x01" "_")
QDEF(MP_QSTR__slash_, (const byte*)"\x8a\xb5\x01" "/")
QDEF(MP_QSTR__percent__hash_o, (const byte*)"\x6c\x1a\x03" "%#o")
QDEF(MP_QSTR__percent__hash_x, (const byte*)"\x7b\x1a\x03" "%#x")
...
Code: Select all
enum {
MP_QSTR_NULL,
MP_QSTR_,
MP_QSTR__star_,
MP_QSTR__,
MP_QSTR__slash_,
MP_QSTR__percent__hash_o,
MP_QSTR__percent__hash_x,
...
MP_QSTRnumber_of, // no underscore so it can't clash with any of the above
};
You could create a dummy.c file (in the stmhal directory) which contains the following:
Code: Select all
#include "../py/qstr.h"
Code: Select all
make build-PYBV10/qstr.pp
Re: Eclipse setup - missing definitions
Thanks Dave.
The project builds fine, and in the process creates genhdr/qstrdefs.generated.h.
I was hoping to use the this file, as it seems like double the work to build it again just for eclipse...
Ill play around a little and if I cant coerce eclipse to look in the build folder and include it without adding to the code base.
The project builds fine, and in the process creates genhdr/qstrdefs.generated.h.
I was hoping to use the this file, as it seems like double the work to build it again just for eclipse...
Ill play around a little and if I cant coerce eclipse to look in the build folder and include it without adding to the code base.
Re: Eclipse setup - missing definitions
Hi,
I am also facing similar issue. Can you please help me in resolving the issues.
I tried to build MicroPython source code on the directory "/minimal" and I commented STMicro related code in the source because I need for Just MicroPython Interpreter only. I am using Infineon's HighTec IDE to cross-build the source code. Now I am facing some issues mentioned below.
What about the .py files in "/py" directory.? provide some details.
Some header files are out-come of .py files in "/py" directory. How can I generate them.?
Are the .py files are needed to build on the source build of MicroPython or Needed to build separately.?
Please help in this regard.
Thanks and Regards,
Siva Prakash Reddy
I am also facing similar issue. Can you please help me in resolving the issues.
I tried to build MicroPython source code on the directory "/minimal" and I commented STMicro related code in the source because I need for Just MicroPython Interpreter only. I am using Infineon's HighTec IDE to cross-build the source code. Now I am facing some issues mentioned below.
What about the .py files in "/py" directory.? provide some details.
Some header files are out-come of .py files in "/py" directory. How can I generate them.?
Are the .py files are needed to build on the source build of MicroPython or Needed to build separately.?
Please help in this regard.
Thanks and Regards,
Siva Prakash Reddy
Re: Eclipse setup - missing definitions
Can you explain what you are trying to do?
The way the build system is setup, you build for a specific target - there should be no need to to comment out code.
See the README file here : https://github.com/micropython/micropyt ... ts/minimal
The minimal target port should be able to compile to run on a linux, or on a STM32 board, dependent on an option "cross=1" -> STM32.
As for your last question, I am not into the details of how much of the .py files are needed for a particulart build - but this information can be found in the build setup if you have the time.
I would strongly suggest that you do not edit any files from a clean checkout until you have a working build - it just makes the finding mistakes so much harder.
cheers
The way the build system is setup, you build for a specific target - there should be no need to to comment out code.
See the README file here : https://github.com/micropython/micropyt ... ts/minimal
The minimal target port should be able to compile to run on a linux, or on a STM32 board, dependent on an option "cross=1" -> STM32.
As for your last question, I am not into the details of how much of the .py files are needed for a particulart build - but this information can be found in the build setup if you have the time.
I would strongly suggest that you do not edit any files from a clean checkout until you have a working build - it just makes the finding mistakes so much harder.
cheers
Re: Eclipse setup - missing definitions
Thanks for the response.
I am trying to build MicroPython for Infineon's TriCore Architecture. I downloaded source code of MicroPython from git and I selected "/minimal" to cross build it for TriCore Arch. I didn't found cross-compiler tool for TriCore to build on Linux PC. So, I downloaded Infineon's HighTech IDE (Eclipse Based) and I created a Project and then added "/minimal", "/py", "/lib" directories and some files in "/utils" directory to this project. After that, I am facing "MP_QSTR_XXXX" and "genhdr/qstrdefs.generated.h" issues.
Please, mention the necessary steps to be followed to build MicroPython Interpreter. Also, mention the way I followed is correct or not.?
Please send me your Makefile for reference.
Thanks and Regards,
Siva Prakash Reddy
I am trying to build MicroPython for Infineon's TriCore Architecture. I downloaded source code of MicroPython from git and I selected "/minimal" to cross build it for TriCore Arch. I didn't found cross-compiler tool for TriCore to build on Linux PC. So, I downloaded Infineon's HighTech IDE (Eclipse Based) and I created a Project and then added "/minimal", "/py", "/lib" directories and some files in "/utils" directory to this project. After that, I am facing "MP_QSTR_XXXX" and "genhdr/qstrdefs.generated.h" issues.
Please, mention the necessary steps to be followed to build MicroPython Interpreter. Also, mention the way I followed is correct or not.?
Please send me your Makefile for reference.
Thanks and Regards,
Siva Prakash Reddy
Re: Eclipse setup - missing definitions
I'd recommend that you run the minimal build under linux using gcc (and building for arm not tricore) and do That will cause all of the commands being executed, including the ones which build the generated headers to be shown,
Code: Select all
make V=1
Re: Eclipse setup - missing definitions
Did you create an Eclipse project? You need to create makefile project from existing makefile. Point to one of the MicroPython makefiles. Then create and build target, eg BOARD=PYBV10. In your case you will also need to specify CC=TricoreCompilerName, either in the makefile or the build target. In Eclipse the build target is the command line parameters for make. Try BOARD=MyBoard CC=TricoreCompilerName.
MicroPython makefile does lots of magic with gnu utilities and Python including qstr stuff.
MicroPython makefile does lots of magic with gnu utilities and Python including qstr stuff.