Menu

Calculating program-memory from hex-file

2015-12-20
2015-12-20
  • Frank Steinberg

    Frank Steinberg - 2015-12-20

    Hi!

    I noticed, that the size of program memory for AVR differs from that what is calculated by avrdude (while programming) and avr-size (folder AVRDude, used by avrdudess). If I compile this demo source:
    https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/Demos/first-start-sample.gcb
    avr-size reports 124 byte and
    avrdude reports 176 byte.

    As far as i understood, the programs use two different ways to calculate the memory size in a hex-file:
    avr-size ...
    adds the count of every data-record-row.
    avrdude ...
    evaluates only the last data-record-row. Here it adds the 'Record-Length' with the 'Load-Offset'.

    IMO GCB has a bug calculating the 'Record-Length' value. If the Record-Length is 02 bytes, the Load-Offset has to be increased by 2, not by 4 (as it's done with the 16-byte (10hex)-records at the bottom of the file).

    Hex-file after compiling first-start-sample.gcb:
    
    :020000020000FC
    :0200000033C00B
    :0200040018954D
    :02000800189549
     ||  ||
     ||  Load-Offset
     Record-Length
    
    ... and so on
    
    :020064001895ED
    :1000680058E05EBF5FEF5DBF18D0259A2D9AD4E6A1
    :10007800E0E007D02D98D4E8E3E003D0F7CF8895E7
    :10008800FECFE395AEEF94E19A95F1F7AA95D9F7EB
    :10009800DA95C1F7EA95B1F7089550E055B950E0FF
    :0800A80058B950E05BB908955E
     ||  ||
     avddude adds: 08hex + A8hex = 8 + 168 = 176
    
    :00000001FF
    

    I don't know if this has any effects to the loaded programs itself.
    Btw:
    GCBs report-file still says "Program Memory: 38/16384 words"

    Regards
    Frank

     

    Last edit: Frank Steinberg 2015-12-20
  • Anobium

    Anobium - 2015-12-20

    Thanks. These are known issues and is on the release plan for 0.96. Your posting is actaully a better explaination of the issue.

    Our users need to be aware of this and I will include a list of know issues in 0.95.

    Anobium

     

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.