Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:04 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM+ brain loss

Author Message
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 06:19am 14 Jun 2016
Copy link to clipboard 
Print this post

I've come across a massive bug in MM+. Probably the same affects MM2 as well.
When program and data are large enough, MMBasic wipes out all the variables in a very nasty way. Sometimes some isolated values still remain, but the behaviour becomes unpredictable.
Interestingly if I declare a large array of void data at the very beginning of my program, this seems to be solving it until my own data becomes greater than the size of that void array. Then the problem returns. Very strange...
This happens even after operations like XMODEM RECEIVE or even after loading from MMEdit. In a situation like this CPU RESTART doesn't help - it restarts, but when the program is ran the vars are still all 0. Only way to deal with it is a power cycle. I tried with three different type of boards, so I can be absolutely sure this bug is not hardware-related.

http://rittle.org

--------------
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 11:17am 14 Jun 2016
Copy link to clipboard 
Print this post

Well, all that I can say is that I have done a lot of testing around that sort of scenario and nothing remotely similar to your claim has shown up.

Can you demonstrate the issue with a program that others can run?

Geoff


Geoff Graham - http://geoffg.net
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 05:35am 15 Jun 2016
Copy link to clipboard 
Print this post

Unfortunately it is not possible for me to publish the code due to ip reasons. But after further investigation I think that heavy usage of GUI commands is the reason and somewhere the memory gets screwed up.
I have this first line in my code right now
DIM STRING nothing(250)
With it brain loss after run happens almost never. Without it - almost every time
After a power cycle, it works fine until a re-run

http://rittle.org

--------------
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9589
Posted: 03:51pm 15 Jun 2016
Copy link to clipboard 
Print this post

Wow, that's odd.

Watching this thread with interest.

I've done a fair bit of GUI back when the MM+ was new, and although I did manage to create some odd behaviours, it was in the way I was dealing with the GUI controls, and Geoff has subsequently altered that such that I can delete active controls and it won't corrupt things like that anymore.(but really, I was to blame for doing it wrong).

In my case, I was just getting weird things like parts of GUI controls popping up I never asked for etc. From memory, all my variables remained intact.

I know you say your code is IP and you can't post it, but can you post:

- How many lines is it?
- How much memory is used?

How much flash and RAM are in use when the code is working correctly, and then how much flash and RAM are in use when you run into the fault condition would be useful for comparison.

This would allow us to determine if the variables really are being erased, or are they just being zero-filled.

Anyone else using GUI stuff having any issues at all like kiiid?
Smoke makes things work. When the smoke gets out, it stops!
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 07:38pm 15 Jun 2016
Copy link to clipboard 
Print this post

The program is currently 2028 lines. It is for a very specific system, so I can't publish. Doesn't use very much RAM. Without thee nothing() array, from memory I think it is about 40%.
I will collect more details and will post soon.

http://rittle.org

--------------
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 07:32am 27 Jun 2016
Copy link to clipboard 
Print this post

Now after a very long investigation of the problem, I can confirm that GUI DELETE ALL is the reason. On some occasions it unpredictably wipes out parts of the variables and arrays. After a look in the MM+ code, I think in the file GUI.c line 381, which currently is "}", should be "} else". But that is in Geoff's hands. I only report that this problem is confirmed.

http://rittle.org

--------------
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 03:40am 29 Jun 2016
Copy link to clipboard 
Print this post

Thanks Kon, you have nailed the bug and even provided the fix! Wonderful.

This bug only surfaces on the MM+ when a lot of GUI controls are created then deleted, then more created and deleted again with different reference numbers. Rather than make a whole new version for this fix I have just updated the MM+ V5.2 hex file on my website - so if you need to have this bug fixed you should re download V5.2 (remember to clear your browser's cache first).

The source, which can be obtained from mmbasic.com, has also been updated.

Geoff
Geoff Graham - http://geoffg.net
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025