Search found 153 matches

by v923z
Mon Mar 23, 2020 9:42 am
Forum: Development of MicroPython
Topic: linking with `round` for the pyboard
Replies: 5
Views: 1561

Re: linking with `round` for the pyboard

jimmo wrote:
Fri Mar 20, 2020 8:50 am
But yes, if you did need to set a linker flag from your C module makefile, then if that's not currently possible then it would be worth sending a PR to make it possible. I will take a look later.
OK, I'll update the makefiles, and send a PR.
by v923z
Fri Mar 20, 2020 8:16 am
Forum: Development of MicroPython
Topic: linking with `round` for the pyboard
Replies: 5
Views: 1561

Re: linking with `round` for the pyboard

I have tried to add the linker flag in the Makefile, but that doesn't help at all. Can you explain what you mean by that... I added -lm to the linker flags. you should just need to add roundf.c to SRC_LIBM. (It seems to work for me). That solved it, thanks! However, I haven't yet found a way of app...
by v923z
Thu Mar 19, 2020 10:46 am
Forum: Development of MicroPython
Topic: linking with `round` for the pyboard
Replies: 5
Views: 1561

linking with `round` for the pyboard

Hi all, I have attempted to add the around function to ulab , and to that end, I call math's round as MICROPY_FLOAT_C_FUN(round) https://github.com/v923z/micropython-ulab/blob/master/code/vectorise.c#L156 . This works on the unix port, but I can't compile for the pyboard, and get a linker error LINK...
by v923z
Sun Feb 16, 2020 3:11 pm
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

Talking about https://github.com/stinos/micropython-wrap/blob/master/classwrapper.h#L372 bascially. With 'we' I meant 'me and colleagues' but actually I wrote all of it so on second thought: yes would be less confusing to just say 'I' :D Sorry, I wasn't nit-picking, I was simply curious. This wrapp...
by v923z
Sat Feb 15, 2020 7:24 pm
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

That overrides the locals dictionary, so nothing defined in the locals will be available as a class method. Yup, forgot we use a custom attr function which does all of that, i.e. first lookup locals dict then property getters etc Just curious: who is "we"? You did exactly what Jim's suggested earli...
by v923z
Sat Feb 15, 2020 6:55 pm
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

OK, so you are, in principle, willing to accept changes to the micropython core. Just to be clear -- this is just my suggestion as someone who spends a moderate amount of time spelunking in the core (but without any actual authority or ability to accept changes). For future reference: without losin...
by v923z
Sat Feb 15, 2020 4:08 pm
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

OK, so you are, in principle, willing to accept changes to the micropython core. Just to be clear -- this is just my suggestion as someone who spends a moderate amount of time spelunking in the core (but without any actual authority or ability to accept changes). Don't worry, I didn't take your ear...
by v923z
Sat Feb 15, 2020 12:15 pm
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

My recommendation would be that if you need ulab to support an API based on properties, then write a facade in Python that implements it, and only provide the very core low-level perf-critical stuff in a simple low-level API in C. This is definitely a possible workaround, though, that would mean th...
by v923z
Sat Feb 15, 2020 11:25 am
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

Thanks for the prompt reply! Unfortunately, that doesn't cut it. I should have posted my code at the very beginning, so we could've saved an extra round. Sorry for that. FWIW, CircuitPython is a very heavy user of properties (including for builtin types) so it's worth looking at how they do it. Wel...
by v923z
Sat Feb 15, 2020 9:10 am
Forum: Development of MicroPython
Topic: implementing properties in user modules
Replies: 17
Views: 1688

Re: implementing properties in user modules

You do not need anything at all from objproperty.c, if you want a.x to get a value you can implement that in attr for instance (there might be more suitable ways, depends on specific use case). Pseudcode: static void attr(mp_obj_t self_in, qstr attr, mp_obj_t* dest) { if(dest[ 0 ] == MP_OBJ_NULL) {...