Community
    • Login

    Intel Hex not higlighting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    29 Posts 5 Posters 4.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • David GriffithsD
      David Griffiths
      last edited by

      I have NPP 7.8.7 on my laptop and opening an Intel Hex file shows nice colour highlighting. Open the same file on my desktop running the same version - no highlighting ??
      Uninstalled NPP and installed 7.8.9 64 bit - still no highlighting.
      Intel Hex is listed on the Language list.
      Other languages have highlighting. Global colour overwrite is not checked.

      What am I missing?

      On a related question - NPP obviously knows how to calculate the checksum on the end of each line of the Intel Hex file, because it flags it in red when the checksum is wrong (on laptop). Question - is there a way to get NPP to insert (or show) the correct checksum after some of the data has been modified?

      Sample data:

      :10001C001FEF1093063F08951EE0109300040895FF
      :10002C00FBDF109104041460109304041091040479
      :10003C0012601093040410E008EC7CD110910404BD
      :10004C001D7F1093040410E008EC74D114E110939C
      :10005C000E3F10E8212A78941091063F112309F4E1
      :10006C00BCC010E01093063F10E010930A3F10E064
      :10007C001093093FE7E0FFE32497FB83EA8319E041
      

      TIA
      DG

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @David Griffiths
        last edited by

        @David-Griffiths said in Intel Hex not higlighting:

        It works for me on 7.8.9 as well.
        5e2e1587-7a91-4943-bb8e-b04647cc4e51-image.png

        Could it be that you are using a theme on your desktop which is different
        from the one on the laptop?

        is there a way to get NPP to insert (or show) the correct checksum after some of the data has been modified?

        I guess yes, one could use the Pythonscript plugin and either replaces the wrong value with the correct one or shows an annotation with the correct value.

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @Ekopalypse
          last edited by

          @David-Griffiths

          NPP obviously knows how to calculate the checksum on the end of each line of the Intel Hex file

          It does? Without a plugin doing it?

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE
            Ekopalypse @Alan Kilborn
            last edited by

            @Alan-Kilborn

            It does? Without a plugin doing it?

            Yes.

            6a071885-a9e4-4650-8e4d-9df8c8f348f0-image.png

            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @Ekopalypse
              last edited by Alan Kilborn

              @Ekopalypse

              I guess really ambitious lexing! :-)

              Hmmm, when I try it with that data the FF is green like you first showed, not red like your second screenshot.

              EkopalypseE David GriffithsD 2 Replies Last reply Reply Quote 1
              • EkopalypseE
                Ekopalypse @Alan Kilborn
                last edited by

                @Alan-Kilborn said in Intel Hex not higlighting:

                I guess really ambitious lexing!

                Lol
                It would be nice if the builtin lexers would show code which isn’t efficient :-D

                1 Reply Last reply Reply Quote 1
                • David GriffithsD
                  David Griffiths @Alan Kilborn
                  last edited by David Griffiths

                  @Alan-Kilborn Did you change the last digit before the FF from 5 to 6 like Eko did?

                  1 Reply Last reply Reply Quote 3
                  • guy038G
                    guy038
                    last edited by guy038

                    Hello, @david-griffiths, @ekopalypse, @alan-kilborn and All

                    You can find a good documentation on the Intel Hex File Format from below :

                    https://developer.arm.com/documentation/ka003292/latest

                    https://en.wikipedia.org/wiki/Intel_HEX

                    And I deduced that the checksum can be calculated from this formula :

                    CheckSum = 256 - ( ∑ Byte Values ) MOD 256

                    Each Byte Value represents the decimal value of the next two hexadecimal codes, minus the last two ones, standing for the checksum

                    For instance, the fourth line, of your example, is :

                                                             vv----- CheckSum
                    :10004C001D7F1093040410E008EC74D114E110939C
                     <-------------------------------------->        Data Range
                    

                    So its checksum is :

                     
                    = 256 - (10h + 00h + 4Ch + 00h + 1Dh + 7Fh + 10h + 93h + 04h + 04h + 10h + E0h + 08h + ECh + 74h + D1h + 14h + E1h + 10h + 93h) mod 256
                    
                    = 256 - ( 16 +   0  + 76  +  0  + 29 + 127 +  16 + 147 +   4 +   4 + 16  + 224  +  8 + 236 + 116 + 209 +  20 + 225 +  16 + 147) mod 256
                    
                    = 256 - 1636 mod 256
                    
                    = 256 - 100
                    

                    Thus, the checksum of the fourth line is 156 , so 9C


                    BTW, it’s work pointing out that the background color of the CHECKSUM and CHECKSUM_WRONG styles of the Intel Hex language are totally transparent ( α = 0 ) So, for instance, the default red background of a wrong checksum is not visible if this line is the current N++ line with usual very pale blue background color !

                    Best Regards,

                    guy038

                    Alan KilbornA David GriffithsD 2 Replies Last reply Reply Quote 1
                    • Alan KilbornA
                      Alan Kilborn @guy038
                      last edited by

                      @guy038 said in Intel Hex not higlighting:

                      BTW, it’s work pointing out that the background color of the CHECKSUM and CHECKSUM_WRONG styles of the Intel Hex language are totally transparent ( α = 0 ) So, for instance, the default red background of a wrong checksum is not visible if this line is the current N++ line with usual very pale blue background color !

                      Interesting. What’s the way around that, if any?

                      PeterJonesP 1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Alan Kilborn
                        last edited by

                        @Alan-Kilborn said in Intel Hex not higlighting:

                        What’s the way around that, if any?

                        Change the foreground color of CHECKSUM_WRONG to something that contrasts both with its red background color and with your Global Styles > Current Line Background > Background color.

                        Alan KilbornA 1 Reply Last reply Reply Quote 1
                        • Alan KilbornA
                          Alan Kilborn @PeterJones
                          last edited by

                          @PeterJones said in Intel Hex not higlighting:

                          Change the foreground color of CHECKSUM_WRONG to something that contrasts both with its red background color and with your Global Styles > Current Line Background > Background color.

                          Well…yea…but I meant, isn’t there a way to do something to the current-line-background color so that you can just get the red there (or close to it due to blending of colors) for the non-current line case?

                          PeterJonesP 1 Reply Last reply Reply Quote 0
                          • PeterJonesP
                            PeterJones @Alan Kilborn
                            last edited by

                            @Alan-Kilborn

                            isn’t there a way to do something to the current-line-background color so that you can just get the red there (or close

                            I think the problem isn’t that the red has transparency; I think the problem is that the current-line-background has no transparency and is drawn over the red, so the current-line-background is the only visible background. It might be possible if the current-line-transparency could be set to 50% or something of that ilk, but that cannot be done in the GUI.

                            I tried editing stylers.xml to use either the MSB or LSB as an alpha value for the current line background

                                    <WidgetStyle name="Current line background colour" styleID="0" bgColor="E8E8FF80" colorStyle="1" fontStyle="0" />
                            or
                                    <WidgetStyle name="Current line background colour" styleID="0" bgColor="80E8E8FF" colorStyle="1" fontStyle="0" />
                            

                            But either was interpreted as invalid color, and current-line-background became black.

                            So to add transparency to current line background, it would have to be a codebase edit.

                            Alan KilbornA 1 Reply Last reply Reply Quote 1
                            • Alan KilbornA
                              Alan Kilborn @PeterJones
                              last edited by

                              @PeterJones said in Intel Hex not higlighting:

                              So to add transparency to current line background, it would have to be a codebase edit.

                              I did some searching and found THIS as probably related.

                              1 Reply Last reply Reply Quote 2
                              • David GriffithsD
                                David Griffiths @guy038
                                last edited by

                                @guy038 Thanks Guy. I know how to calculate the checksum but so does N++ and I would like it to be automatically calculated for me when I edit a line.

                                BTW I am still none the wiser as to why my desktop PC only wants to show Intel Hex in monochrome ??

                                Alan KilbornA 1 Reply Last reply Reply Quote 0
                                • Alan KilbornA
                                  Alan Kilborn @David Griffiths
                                  last edited by

                                  @David-Griffiths said in Intel Hex not higlighting:

                                  I know how to calculate the checksum but so does N++ and I would like it to be automatically calculated for me when I edit a line.

                                  This goes beyond the responsibility N++ signs up for. :-)
                                  You could certainly do something for it with a scripting plugin, e.g. Pythonscript.

                                  David GriffithsD 1 Reply Last reply Reply Quote 0
                                  • David GriffithsD
                                    David Griffiths @Alan Kilborn
                                    last edited by

                                    @Alan-Kilborn Yes I agree it is more than I expected from N++ but as it does know how to calculate the checksum, it would be a very small step to add a right click or such that inserted the correct value, would it not?

                                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                                    • Alan KilbornA
                                      Alan Kilborn @David Griffiths
                                      last edited by

                                      @David-Griffiths said in Intel Hex not higlighting:

                                      N++ … does know how to calculate the checksum

                                      Notepad++ code has absolutely no idea how to do this checksum.
                                      It isn’t doing it.
                                      The underlying lexer is doing it, which comes from a separate project, called Scintilla.

                                      David GriffithsD 1 Reply Last reply Reply Quote 1
                                      • David GriffithsD
                                        David Griffiths @Alan Kilborn
                                        last edited by

                                        @Alan-Kilborn Thanks for clarifying Alan. My knowledge of the inner workings of N++ needs work :-)

                                        EkopalypseE 1 Reply Last reply Reply Quote 0
                                        • EkopalypseE
                                          Ekopalypse @David Griffiths
                                          last edited by

                                          @David-Griffiths

                                          Sorry, I was busy with some personal matters.
                                          Here’s a python script that hopefully does what you want. If there is something else you might want to have or it doesn’t do what you want it to be done I would kindly ask to use the github issue tracker in my repo.

                                          David GriffithsD 1 Reply Last reply Reply Quote 2
                                          • David GriffithsD
                                            David Griffiths @Ekopalypse
                                            last edited by

                                            @Ekopalypse Thanks for posting this - sorry I only just noticed it. Better late than never :-)
                                            Where should I save the file and how do invoke the script?
                                            Any ideas why I am not seeing the highlighting on my Win10 PC?

                                            Alan KilbornA 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors