Wipy no float and math!

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
jgmdavies
Posts: 57
Joined: Tue Aug 09, 2016 2:39 pm

Re: Wipy no float and math!

Post by jgmdavies » Mon Aug 29, 2016 12:02 pm

Re. the Pycom site, it's lurking at: https://www.pycom.io/solutions/py-boards/wipy/

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.

Jim

User avatar
Roberthh
Posts: 2017
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Wipy no float and math!

Post by Roberthh » Mon Aug 29, 2016 7:00 pm

There just was another thread on this topic: http://forum.micropython.org/viewtopic.php?f=11&t=1014
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.

zencuke
Posts: 1
Joined: Fri Sep 02, 2016 5:46 pm

Re: Wipy no float and math!

Post by zencuke » Fri Sep 02, 2016 8:50 pm

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...

Later!

sekil
Posts: 7
Joined: Wed Mar 25, 2020 12:04 pm

Re: Wipy no float and math!

Post by sekil » Wed Mar 25, 2020 12:13 pm

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
Password:
Login succeeded!
Type "help()" for more information.

>>> r = 234/1223
>>> print (r)
0.1913328
>>> import gc
>>> gc.mem_free()
42592
>>>
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 -
https://drive.google.com/file/d/1r2jbjc ... sp=sharing

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

Re: Wipy no float and math!

Post by dhylands » Wed Mar 25, 2020 4:57 pm

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.

sekil
Posts: 7
Joined: Wed Mar 25, 2020 12:04 pm

Re: Wipy no float and math!

Post by sekil » Thu Mar 26, 2020 6:19 am

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..

sekil
Posts: 7
Joined: Wed Mar 25, 2020 12:04 pm

Re: Wipy no float and math!

Post by sekil » Thu Apr 02, 2020 3:11 pm

If ldflags dont have this flags : -mcpu=cortex-m4 -mtune=cortex-m4 - board freezes when using float numbers - why this flags not there?

User avatar
jimmo
Posts: 1688
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Wipy no float and math!

Post by jimmo » Fri Apr 03, 2020 12:55 am

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.

sekil
Posts: 7
Joined: Wed Mar 25, 2020 12:04 pm

Re: Wipy no float and math!

Post by sekil » Fri Apr 03, 2020 11:21 am

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.. :)

User avatar
jimmo
Posts: 1688
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Wipy no float and math!

Post by jimmo » Sat Apr 04, 2020 11:06 am

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)."

Post Reply