Porting into TriCore Environment

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
SUBBU3881
Posts: 17
Joined: Mon Dec 04, 2017 10:46 am

Re: Porting into TriCore Environment

Post by SUBBU3881 » Thu Feb 15, 2018 6:14 am

Already MICROPY_PY_BUILTINS_PROPERTY is set to 1. The following lines are from "../py/mpconfig.h"

// Whether to support property object
#ifndef MICROPY_PY_BUILTINS_PROPERTY
#define MICROPY_PY_BUILTINS_PROPERTY (1)
#endif
stijn wrote:
Wed Feb 14, 2018 10:34 am
When reporting errors it is helpful to post the complete error message. As well as other interesting information, like which command you used to generate the file.

If it only gives that error for certain MP_QSTR_xxx definitions and not all of them, it means the generation didn't use all needed files/options. MP_QSTR_doc is in objproperty.c, but it is compiled conditionally with #if MICROPY_PY_BUILTINS_PROPERTY. So, likely during your qstr generation MICROPY_PY_BUILTINS_PROPERTY was 0 when the preprocessor ran hence it's not in qstrdefs.generated.h.

SUBBU3881
Posts: 17
Joined: Mon Dec 04, 2017 10:46 am

Re: Porting into TriCore Environment

Post by SUBBU3881 » Thu Feb 15, 2018 6:33 am

Everything I am doing in Windows 10 only. I am not using Linux PC to run any commands. Makefiles are generated automatically for the project.
The following is the error..

Multiple markers at this line
- Symbol 'MP_QSTR_' could not be resolved
- each undeclared identifier is reported only once for each function it
appears in
- 'MP_QSTR_' undeclared (first use in this function)
MPY_Building_Error.jpg
Errors with MP_QSTR_XXXX
MPY_Building_Error.jpg (253.8 KiB) Viewed 4714 times

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

Re: Porting into TriCore Environment

Post by dhylands » Thu Feb 15, 2018 6:45 am

When building minimal, I find that MP_QSTR_ is found near the beginning of the build/genhdr/qstrdefs.generated.h file which looks like this:

Code: Select all

// This file was automatically generated by makeqstrdata.py
  
QDEF(MP_QSTR_NULL, (const byte*)"\x00\x00" "")
QDEF(MP_QSTR_, (const byte*)"\x05\x00" "")
QDEF(MP_QSTR___add__, (const byte*)"\xc4\x07" "__add__")
QDEF(MP_QSTR___bool__, (const byte*)"\x2b\x08" "__bool__")

SUBBU3881
Posts: 17
Joined: Mon Dec 04, 2017 10:46 am

Re: Porting into TriCore Environment

Post by SUBBU3881 » Thu Feb 15, 2018 6:52 am

Please, can you give some clarification here, because I am not able sorting out this problem. I ran .py scripts seperately and added them to my project, but still they are not working.
dhylands wrote:
Thu Feb 15, 2018 6:45 am
When building minimal, I find that MP_QSTR_ is found near the beginning of the build/genhdr/qstrdefs.generated.h file which looks like this:

Code: Select all

// This file was automatically generated by makeqstrdata.py
  
QDEF(MP_QSTR_NULL, (const byte*)"\x00\x00" "")
QDEF(MP_QSTR_, (const byte*)"\x05\x00" "")
QDEF(MP_QSTR___add__, (const byte*)"\xc4\x07" "__add__")
QDEF(MP_QSTR___bool__, (const byte*)"\x2b\x08" "__bool__")

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

Re: Porting into TriCore Environment

Post by stijn » Thu Feb 15, 2018 10:00 am

Consider this:

Code: Select all

//minimal/mpconfigport.h
#define MICROPY_PY_BUILTINS_PROPERTY (0)

//mpconfig.h
#include "mpconfigport.h"
//...
#ifndef MICROPY_PY_BUILTINS_PROPERTY
#define MICROPY_PY_BUILTINS_PROPERTY (1)
#endif
which is what happens for example for the minimal port. Now MICROPY_PY_BUILTINS_PROPERTY is 0, not 1. Just to show that you cannot just look at a single place for figuring out what the value is.

Moreover it's not because your dev environment shows MICROPY_PY_BUILTINS_PROPERTY is 1 when building the project, that it is also 1 when preprocessing during qstr generation. In fact I am pretty sure that exactly is the problem, it's 0 when generating qstrs.
We really can't help you if you do not show exactly what command you are using to generate the header, sorry.

SUBBU3881
Posts: 17
Joined: Mon Dec 04, 2017 10:46 am

Re: Porting into TriCore Environment

Post by SUBBU3881 » Thu Feb 15, 2018 12:10 pm

stijn wrote:
Thu Feb 15, 2018 10:00 am
We really can't help you if you do not show exactly what command you are using to generate the header, sorry.
I am not getting "command" from your words. I am using it in Windows 10 and I added MicroPython src code to a new project. I included genhdr/qstrdefs.generated.h file to project before starting building.

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

Re: Porting into TriCore Environment

Post by stijn » Thu Feb 15, 2018 1:23 pm

The question is how did you create qstrdefs.generated.h? You say you ran .py scripts seperately. Which scripts, what arguments, etc?

SUBBU3881
Posts: 17
Joined: Mon Dec 04, 2017 10:46 am

Re: Porting into TriCore Environment

Post by SUBBU3881 » Fri Feb 16, 2018 5:28 am

The HighTec IDE don't support Python Scripts Building, So I ran them seperately in Linux PC and added those to my project settings.
can you please give examples to run those scripts.?

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

Re: Porting into TriCore Environment

Post by dhylands » Fri Feb 16, 2018 6:20 am

The best way to get examples of how to run the scripts is to due a minimal build on the linux system with make V=1. This is what I see whemn I do that:

Code: Select all

mkdir -p build/genhdr
python ../../py/makeversionhdr.py build/genhdr/mpversion.h
Generating build/genhdr/mpversion.h
GEN build/genhdr/qstr.i.last
arm-none-eabi-gcc -E -DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB -DN_ARM -DN_XTENSA -Ibuild/tmp -I. -I../.. -Ibuild -Wall -Werror -std=c99 -nostdlib -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion  -Os -DNDEBUG -fdata-sections -ffunction-sections ../../py/mpstate.c ../../py/malloc.c ../../py/gc.c ../../py/pystack.c ../../py/qstr.c ../../py/vstr.c ../../py/mpprint.c ../../py/unicode.c ../../py/mpz.c ../../py/reader.c ../../py/lexer.c ../../py/parse.c ../../py/scope.c ../../py/compile.c ../../py/emitcommon.c ../../py/emitbc.c ../../py/asmbase.c ../../py/asmx64.c ../../py/asmx86.c ../../py/asmthumb.c ../../py/emitinlinethumb.c ../../py/asmarm.c ../../py/asmxtensa.c ../../py/emitinlinextensa.c ../../py/formatfloat.c ../../py/parsenumbase.c ../../py/parsenum.c ../../py/emitglue.c ../../py/persistentcode.c ../../py/runtime.c ../../py/runtime_utils.c ../../py/scheduler.c ../../py/nativeglue.c ../../py/stackctrl.c ../../py/argcheck.c ../../py/warning.c ../../py/map.c ../../py/obj.c ../../py/objarray.c ../../py/objattrtuple.c ../../py/objbool.c ../../py/objboundmeth.c ../../py/objcell.c ../../py/objclosure.c ../../py/objcomplex.c ../../py/objdict.c ../../py/objenumerate.c ../../py/objexcept.c ../../py/objfilter.c ../../py/objfloat.c ../../py/objfun.c ../../py/objgenerator.c ../../py/objgetitemiter.c ../../py/objint.c ../../py/objint_longlong.c ../../py/objint_mpz.c ../../py/objlist.c ../../py/objmap.c ../../py/objmodule.c ../../py/objobject.c ../../py/objpolyiter.c ../../py/objproperty.c ../../py/objnone.c ../../py/objnamedtuple.c ../../py/objrange.c ../../py/objreversed.c ../../py/objset.c ../../py/objsingleton.c ../../py/objslice.c ../../py/objstr.c ../../py/objstrunicode.c ../../py/objstringio.c ../../py/objtuple.c ../../py/objtype.c ../../py/objzip.c ../../py/opmethods.c ../../py/sequence.c ../../py/stream.c ../../py/binary.c ../../py/builtinimport.c ../../py/builtinevex.c ../../py/builtinhelp.c ../../py/modarray.c ../../py/modbuiltins.c ../../py/modcollections.c ../../py/modgc.c ../../py/modio.c ../../py/modmath.c ../../py/modcmath.c ../../py/modmicropython.c ../../py/modstruct.c ../../py/modsys.c ../../py/moduerrno.c ../../py/modthread.c ../../py/vm.c ../../py/bc.c ../../py/showbc.c ../../py/repl.c ../../py/smallint.c ../../py/frozenmod.c ../../py/../extmod/moductypes.c ../../py/../extmod/modujson.c ../../py/../extmod/modure.c ../../py/../extmod/moduzlib.c ../../py/../extmod/moduheapq.c ../../py/../extmod/modutimeq.c ../../py/../extmod/moduhashlib.c ../../py/../extmod/modubinascii.c ../../py/../extmod/virtpin.c ../../py/../extmod/machine_mem.c ../../py/../extmod/machine_pinbase.c ../../py/../extmod/machine_signal.c ../../py/../extmod/machine_pulse.c ../../py/../extmod/machine_i2c.c ../../py/../extmod/machine_spi.c ../../py/../extmod/modussl_axtls.c ../../py/../extmod/modussl_mbedtls.c ../../py/../extmod/modurandom.c ../../py/../extmod/moduselect.c ../../py/../extmod/modwebsocket.c ../../py/../extmod/modwebrepl.c ../../py/../extmod/modframebuf.c ../../py/../extmod/vfs.c ../../py/../extmod/vfs_reader.c ../../py/../extmod/vfs_fat.c ../../py/../extmod/vfs_fat_diskio.c ../../py/../extmod/vfs_fat_file.c ../../py/../extmod/vfs_fat_misc.c ../../py/../extmod/utime_mphal.c ../../py/../extmod/uos_dupterm.c ../../py/../lib/embed/abort_.c ../../py/../lib/utils/printf.c ../../py/emitnative.c >build/genhdr/qstr.i.last;
GEN build/genhdr/qstr.split
python ../../py/makeqstrdefs.py split build/genhdr/qstr.i.last build/genhdr/qstr build/genhdr/qstrdefs.collected.h
touch build/genhdr/qstr.split
GEN build/genhdr/qstrdefs.collected.h
python ../../py/makeqstrdefs.py cat build/genhdr/qstr.i.last build/genhdr/qstr build/genhdr/qstrdefs.collected.h
QSTR updated
GEN build/genhdr/qstrdefs.generated.h
cat ../../py/qstrdefs.h qstrdefsport.h build/genhdr/qstrdefs.collected.h | sed 's/^Q(.*)/"&"/' | arm-none-eabi-gcc -E -I. -I../.. -Ibuild -Wall -Werror -std=c99 -nostdlib -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion  -Os -DNDEBUG -fdata-sections -ffunction-sections - | sed 's/^"\(Q(.*)\)"/\1/' > build/genhdr/qstrdefs.preprocessed.h
python ../../py/makeqstrdata.py build/genhdr/qstrdefs.preprocessed.h > build/genhdr/qstrdefs.generated.h

Post Reply