Page 2 of 2

Re: Wipy no float and math!

Posted: Mon Aug 29, 2016 12:02 pm
by jgmdavies
Re. the Pycom site, it's lurking at:

Is there any prospect of a 'WiPy Plus', with significantly more available memory? If not, I think many folk would like some sort of float support for the current WiPy. I've posted my first attempt at a float package, in the form of one .py file, but it's incomplete and also of course doesn't help the compiler handle float constants for inputting expressions 'naturally'.

An optional MicroPython/WiPy build with float support would be nice, but given that some people would also want some 'math', and the lingering memory issue, there's a danger of a maintenance and test overhead in supporting multiple alternative builds.


Re: Wipy no float and math!

Posted: Mon Aug 29, 2016 7:00 pm
by Roberthh
There just was another thread on this topic:
In that thread, Danicampora definitely said, that there will be no built-in float support on WipY.
Interestingly, @jgmdavies provided a python module for performing basic float operations. Maybe that's sufficient for your needs.

Re: Wipy no float and math!

Posted: Fri Sep 02, 2016 8:50 pm
by zencuke
I am currently using various ESP6288 boards so my feelings about Wipi is probably not relevant. However I've done a lot of DSP type real time embedded work (I mean many many years of it) and wanted to add one point. Fixed point math works but floating point is at least an order of magnitude easier to implement and debug if the application has any mathematical complexity at all. Sure you don't 'need' it but you don't need a high level language either. Writing in assembler allows you to create much tighter and faster code. I did a lot of that, got pretty good at it and am glad I don't have to any more. Same with fixed point arithmetic.

I agree that you should avoid floating point where you can but fixed point can be expensive to develop. As for the concept that real apps don't need floating point...


Re: Wipy no float and math!

Posted: Wed Mar 25, 2020 12:13 pm
by sekil
Hi all.

I'm compile mycropython for cc3200 and floating support + math.

Binary size = 194888
Ram free after loading fw -

Code: Select all

MicroPython v1.12 on 2020-03-25; LaunchPad with CC3200
Login as: micro
Login succeeded!
Type "help()" for more information.

>>> r = 234/1223
>>> print (r)
>>> import gc
>>> gc.mem_free()
I'm cant see any problem to compile mycropython with float/math support and why floating/math supporting disabled??? - Give user change float or no..

Link for mk files to build with floating support - ... sp=sharing

Re: Wipy no float and math!

Posted: Wed Mar 25, 2020 4:57 pm
by dhylands
I think that issue with the CC3200 is that it doesn't have your typical RAM/FLASH layout and all of the firmware gets loaded into RAM to be run.

So when you increase the size of the firmware by adding floating point support then you decrease the size of the heap by same amount as the firmware increased. If you really need floating point support and can live with the reduced heap, then that might be a favorable tradeoff, but it isn't necessarily favorable for everyone.

Re: Wipy no float and math!

Posted: Thu Mar 26, 2020 6:19 am
by sekil
i'm only say that is possible to make fw with working floating and math.. And no need reinvent crutches for floating values.. And no official info about how compile floating support on this board - only "due to ram limitation... bla bla" - but this working and with 45kb ram - and we need change cflags, ldflags and python configs..

Re: Wipy no float and math!

Posted: Thu Apr 02, 2020 3:11 pm
by sekil
If ldflags dont have this flags : -mcpu=cortex-m4 -mtune=cortex-m4 - board freezes when using float numbers - why this flags not there?

Re: Wipy no float and math!

Posted: Fri Apr 03, 2020 12:55 am
by jimmo
I suspect this was just an oversight as it worked without them and previously floating point wasn't enabled. (TBH I didn't know -mtune/-mcpu were needed as linker flags -- If you have any details about what the linker does with these flags I'd be curious to know!).

To elaborate on dhyland's answer -- remember that this chip doesn't have hardware floating point (so enabling floating point is very expensive from a code size perspective) and RAM is precious (as mentioned, this chip requires code to run from RAM). So it's a pragmatic tradeoff -- most MicroPython users would rather have more heap available than have floating point enabled.

Re: Wipy no float and math!

Posted: Fri Apr 03, 2020 11:21 am
by sekil
I'm think this cpu (cortexm4) support hard floats..
And if enable floating - fw increased with 5k - im dont think this is bigger - i'm have 45k free ram..
And with this flags code decreased with 1 or 2kb..
Im dont know what this flags did.. :)

Re: Wipy no float and math!

Posted: Sat Apr 04, 2020 11:06 am
by jimmo
sekil wrote:
Fri Apr 03, 2020 11:21 am
I'm think this cpu (cortexm4) support hard floats..
It doesn't. It's an M4, not M4F.

Relevant quote from the ref manual:
"The ARM Cortex-M4 application processor corein the CC3200 does not include the floating point unit and memory protection unit (FPUand MPU)."