![]() |
Forum Index : Microcontroller and PC projects : weird loss of program issue
![]() ![]() |
|||||
Author | Message | ||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
No I haven't but will try it now. I have CPU 48, option explicit and option autorun on as my first three lines. Stay tuned.... |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Well HELLS BELLS!!! Remmed out the first three lines... cpu 48 option explicit option autorun on Can't get it to fail. And boy did I try. So I put those lines back in and making it fail was no problem. So I am guessing I can go back to 4.7b23 for now as long as I don't put the option autorun on in the program and just type it in the command line in the beginning before I hit run. Is there any reason I should be shy about doing this and letting it out in the wild? I would still like to know why this won't fail in 4.5E, I guess just out of curiosity. I'm going to extensively test this and report back, but so far, this (4.7 without option autorun on) is working very well. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
I think I've found a bug in the code that checks whether to update flash when an OPTION is set even though it is set to the same as before. I've reported this to Geoff. If I'm correct this means that flash is written whenever the processor powers up, not just when first programmed - hence the problems and the difference to 4.5 |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
That is very interesting news matherp. Can you tell if taking out the option autorun on (or any option) in the program will work ok, if we just put those items in using the command line? |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Ah, so it was what i expected. Great that the bug is found! Microblocks. Build with logic. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
If I'm right then it should do |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Oh well spotted by Peter. It was only two missing characters (*p++ vs *p) but I had looked at that code so many times and still did not see it. So that people can test this right away below is V4.7 B24 (for the MX170 only). 2015-09-08_025424_Micromite_V4.7B24.zip The only difference is the fix found by Peter. I have just got over the chaos from my trip away so in the near future you can expect more betas addressing the long list of missing features and bug fixes. Geoff Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
it is nice when i bug is finally nailed down! i once spent nearly a year at a company chasing a bug, in the end the solution was to swap round two lines of code - no one could figure out why it fixed the bug, but it did. might i offer a suggestion? this is only partly developed (ie, half-baked), so will need a little tinkering before it is fully workable: 1. make all options specified in a program listing volatile. 2. make all options typed at the command prompt persistent, but have them prompt with the message "also save this option to flash (y/n)?". if the user types 'n' the option is still set in ram, but not saved to flash. 3. add the following command to the language: OPTION SAVE that saves all options to flash if there is any difference between ram and flash versions. if there are no differences, then the command does nothing. within a basic program, this command should be placed after setting all options if it is desired to save them in flash. 4. add the variable: MM.CHOPT that returns true if there is a difference between ram and flash versions of any options. this is so that the programmer can elect to print out a message that should only be displayed on first-run if everything is working correctly, and indeed can double as a 'first-run' detector in the basic program. normally it would appear thus: if MM.CHOPT then print "options have changed and are being saved"
OPTION SAVE 5. expand the MEMORY command so that it also prints out the current setting of all options, both the ram and flash versions side-by-side. 6. the one exception to the above rules will be the command to set up a colour LCD - where a reboot is needed for the changes to take effect. if in basic code, this one command should (only if it changes the setting stored in flash), store the updated (single) setting directly to flash then cause an immediate reboot. if the command would cause no change in flash, then the command should do nothing and no reboot should occur. does this sound like it may work? cheers, rob :-) |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
It does. But first I need to make all the other fixes/changes in the list. My plan is to then re-examine the whole OPTION thing to see if it can be done in a better way. I like the idea of OPTION SAVE as that puts control in the hands of the user. I am not sure about the interpreter prompting with "also save this option to flash (y/n)?". Generally BASIC (or Microsoft BASIC) does not ask questions, it just executes the command or produces an error message if it cannot. Anyway, this is subject for the future. Geoff Geoff Graham - http://geoffg.net |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
Just out of interest, for me it was only the OPTION AUTORUN ON line that caused the program to be 'wipable'. Don't the other two lines talk to flash; if so, why can't I get it to 'wipe'? Nice find matherp ![]() @viscomjim; if possible, can you repeat the test with only OPTION AUTORUN ON commented out (this is just out of curiosity for me!) @Geoff; will be trying B24 in a short while and report back . . . . WW |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
No, it is only options where in the manual it says "this option will be remembered when power is removed" that cause the problem Try "option case upper" on b23 instead of autorun and you will also see the problem |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
Thanks Peter for resolving this mystery for me. Out of interest, is there a list anywhere of the instructions/commands that write to flash to save time in having to go through them all to see if they save? (I'm guessing its just potentially OPTIONS and VAR save?) |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
i had in mind that the prompting would only happen when the statement was typed at the command prompt, and not when the statement was executed as part of a program. i did think about the asking a question of the user being 'abnormal', but then it is not entirely unreasonable as the user has already demonstrated that they have access to keyboard input to reply. in effect it makes the command: OPTION AUTORUN ON<cr>y<cr> (using autorun as an example) another way to do it would to be have the commandline version as: OPTION AUTORUN ON, SAVE (where the ", SAVE" is optionally added to cause a save to flash) all things to mull over until there is time to get back it it, and well down the todo list. cheers, rob :-) |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
This is excellent!!!! Thanks Peter, Geoff, robert, TZ, WhiteWizzard and all who messed with this. Crazy how two little plus signs wreaked so much havoc on this little project. My pickit 3 has its work cut out for it today. Again, MANY THANKS!!!! |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1593 |
YES, great progress! ![]() OPTION AUTORUN ON, SAVE (where the ", SAVE" is optionally added to cause a save to flash) hmm, why OPTION AUTORUN ON, SAVE? Is OPTION AUTORUN ON without saving to flash not completely useless? But it seems, maybe we do not need to worry about AUTORUN when the new version works as expected. Michael causality ≠ correlation ≠ coincidence |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1593 |
I like that. And then later, we can list the planned LIBRARIEs (and their functions) ... ![]() causality ≠ correlation ≠ coincidence |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
Happy to report that 4.7b24 will not fall over due to sh*tty power connection. Tried very hard to make it fail. Works great. THANKS!!!! |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
Confirming the same here; 4.7B24 so far preventing the 'wipe' issue . . . . ![]() |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Excellent news. ![]() A very well hidden bug, that one!!!! Interesting thread. Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |