Search found 594 matches

by stijn
Mon Apr 19, 2021 7:08 pm
Forum: General Discussion and Questions
Topic: Help needed for beginner - memory alloc and classes
Replies: 7
Views: 87

Re: Help needed for beginner - memory alloc and classes

ikkeT wrote:
Mon Apr 19, 2021 6:41 pm
Or should such import be in __init__ function of the class?
Yes, or in any other function. I honestly don't know what the effect is of putting it at class level, just that it doesn't import the names into an available scope..
by stijn
Mon Apr 19, 2021 6:33 pm
Forum: General Discussion and Questions
Topic: Help needed for beginner - memory alloc and classes
Replies: 7
Views: 87

Re: Help needed for beginner - memory alloc and classes

ikkeT wrote:
Mon Apr 19, 2021 6:15 pm
Is it so that one can't do the import from within the class?
No that's not a problem (assuming you mean 'in a function in a class' or so, not sure what importing at class level does but if it's wrong it'll be a syntax error, it won't just silently mess up)
by stijn
Mon Apr 19, 2021 6:29 pm
Forum: General Discussion and Questions
Topic: Valgrind Results
Replies: 5
Views: 191

Re: Valgrind Results

Sorry forgot about this thread. The output now doesn't have file/line numbers in the stacktraces anymore so it's impossible to see what the errors are about. Compile again in debug mode (make DEBUG=1). Debug mode will also fix the reported memory leak: for some reason the release builds of the unix ...
by stijn
Mon Apr 19, 2021 6:06 pm
Forum: General Discussion and Questions
Topic: Share variable between C and Micropython
Replies: 1
Views: 39

Re: Share variable between C and Micropython

Bit hard to answer without more concrete information; essentially in C every MicroPython variable is going to be of type mp_obj_t. But how to best get to them depends on what/how you want to use this. I.e. are you implementing a custom type in C which getts exposed via a module? Then look at example...
by stijn
Mon Apr 19, 2021 6:01 pm
Forum: General Discussion and Questions
Topic: Help needed for beginner - memory alloc and classes
Replies: 7
Views: 87

Re: Help needed for beginner - memory alloc and classes

Have you tried running it without the display part and just printing to the console or a text file? Could very well be the fonts etc just hit the memory limit of your device. Underscores aren't going to change much as far as memory usage go. What you can do to figure out which component uses most me...
by stijn
Mon Apr 19, 2021 6:00 am
Forum: General Discussion and Questions
Topic: Why mp_type_framebuf is declared as STATIC?
Replies: 2
Views: 65

Re: Why mp_type_framebuf is declared as STATIC?

By default anything which isn't part of the public API, i.e. doesn't get exposed and remains local to a source file, is declared static. This is cleaner, plus as fas as I'm aware it allows certain optimizations both with respect to performance and code size. You're not the first one with this questi...
by stijn
Wed Apr 07, 2021 7:58 am
Forum: General Discussion and Questions
Topic: Accessing /dev/ttyUSB0 from the micropython unix port
Replies: 5
Views: 180

Re: Accessing /dev/ttyUSB0 from the micropython unix port

I can access the bridge (from debian linux) via the usual device file /dev/ttyUSB0. Have you tried standard open("/dev/ttyUSB0") in MicroPython? If it's a driver where you can set baud rate etc on the diriver, that might just work, if you're lucky. Otherwise you'd be looking at porting the relevant...
by stijn
Wed Apr 07, 2021 6:09 am
Forum: General Discussion and Questions
Topic: Valgrind Results
Replies: 5
Views: 191

Re: Valgrind Results

Pretty sure you can just run valgrind on a 'normal' micropython build from the unix port? Assuming that reproduces the issue.
by stijn
Wed Apr 07, 2021 6:06 am
Forum: Programs, Libraries and Tools
Topic: [Solved] import stat failure
Replies: 6
Views: 296

Re: [Solved] import stat failure

Seems to follow standard Python import rules, so I don't think MicroPython should warn about it; it's just going to import the first one it sees and not even look further. It can be annoying though, and many many hours have been wasted on this (not just Python: it started with include files in C alr...
by stijn
Tue Apr 06, 2021 7:24 pm
Forum: General Discussion and Questions
Topic: Valgrind Results
Replies: 5
Views: 191

Re: Valgrind Results

Has been a while I used valgrind, but isn't the output you show a callstack? Which would mean there is actually only one warning, in gc_mark_subtree? And the line number of that one isn't shown (and it's perhaps also not the original implementation because it's from myTest.so and not from gc.c where...