Menu

Error in generated AVR ASM for maths calc

2022-08-13
2022-11-28
<< < 1 2 (Page 2 of 2)
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-14

    Yes, I modified the dat file ... I think really that my dinosaurs don't yet have a hardware multiplier. (Worse, I have even about 10 units of 90S8515 in my stock which I don't use presently ; their dat file is OK).
    All the way, the program works now correctly, even with the one line instruction. Thanks again !

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-14

    I found some old datasheets ; it seems really that the Mega8515 (but not the 90S) had already a hardware multiplier, but it seems also that my build 1137 does not "like" it. So the best thing to do was to disable it in the dat file ; and I won't use the 90S anymore, since I should use an external brown out detector. At the beginning I used the 90S on my layout and this caused transients during power down, resulting in "wild" back and forth switching of the turnouts, which is in fact not very good for a "long life" !

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-14

    PS : and I did the same for Mega162 !

     
  • Anobium

    Anobium - 2022-08-14

    Pleasure - this was a real learning experience for me.

    I had to walk the program using an emulator. Thank to Vladimir Soso at OshonSoft who recently provided me his wonderful software - I am able to see the ASM source and see the registers change when the hardware multiplier was used. Get the software here - https://www.oshonsoft.com/avr.php


    Oshonsoft - walking the code to see that MUL was active on the Mega8515.

    Oshonsoft - walking the code to see that MUL was active on the Mega8515.


    I have also made the following changes to the compiler to ensure this does not happen again.

    1. The compiler assesses the maths calc and it will automatically switch HARDWAREMULT off to manage the registers in a very robust manner using the AVR method SYSMULTSUB. The ASM will show ;AVR MUL using SYSMULTSUB software maths to indicate this action.
    2. The compiler supports turning HARDWAREMULT off from the user program so all multiplications are done in software. So, users will be able to selectively disable HARDWAREMULT. This capability was part of the update anyway.
    #UNDEFINE HardwareMult
    

    All sorted - good

     

    Last edit: Anobium 2022-08-14
  • Anobium

    Anobium - 2022-08-18

    I have resolved - properly - the maths error.

    The proper resolution was to examine the generation of the variable being used in the 'sum'. The compiler now automatically uses a variable that is not overwritten by the MUL directive.

    This means the HardwareMult can be set back to HardwareMult=y as the compiler should do AVR maths correctly.

    You need build 1152 or greater.

    Great Cow BASIC (1.00.00 Release Candidate 2022-08-18 (Windows 64 bit) : Build 1152)

    Evan

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-27

    Sorry, I tested with the patch from Aug 25 : IT DOES NOT WORK ! (I erased all old gcbasic*.exe in the original installation, in the patch the gcbasic.exe and gcbasic32.exe and renamed gcbasic64.exe as gcbasic.exe before patching). And the error occurs even with the newest version (from today) ; it concerns line 239.

     

    Last edit: Bertrand BAROTH 2022-08-27
  • Anobium

    Anobium - 2022-08-27

    Thank you for the source. I am looking at the moment.

     
  • Anobium

    Anobium - 2022-08-27

    THANK YOU for retesting. I am truly grateful.

    Resolved in build 1163

    The issue was the slight change in line 239. The new braces caused the compiler to treat the math analysis differently. Not a user issue the compiler should cope.

    So, I have move the 'sum' analysis to CompCalc() (which is further up the stack of maths analysis) to resolve. If the compiler can use simple multiplication it will MUL, else it will force software MULtiplication .

    So, please try build 1163 - it should resolve the issue.

    Evan

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-27

    Thanks, now it "seems" to work, at least for my formula ; hope only that there are no "side effects", You know one rule in the collection about "Murphy's law" : Correcting one error causes other new errors to appear, much more difficult to correct ...

    :)

     
    • Anobium

      Anobium - 2022-08-27

      The code generate is good. Excellent.

      The method does not change the ASM generation, it change the imput into that process. So, very low risk, but, better than before... hopefullly.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-08-27

    PS : Despite of the fact that I kept here the code to manage the EasyVR3, finally I won't use it on my layout, it needs a feedback to show when it is ready to listen (here the Led at PB.7), and either blinking a Led or beeping can be very quickly boring.

     

    Last edit: Bertrand BAROTH 2022-08-27
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.