~psmay/+junk/ardpicprog-add54

« back to all changes in this revision

Viewing changes to host/hexfile.cpp

  • Committer: Rhys Weatherley
  • Date: 2012-05-29 06:53:49 UTC
  • Revision ID: git-v1:3aae47839a6e23f8d2bd4e7d0cf0f1e861a25cab
Better handling for --force-calibration in the host

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
        fflush(stdout);
282
282
        if (forceCalibration || _reservedStart > _reservedEnd) {
283
283
            // Calibration forced or no reserved words to worry about.
284
 
            if (!writeBlock(port, _programStart, _programEnd))
 
284
            if (!writeBlock(port, _programStart, _programEnd, forceCalibration))
285
285
                return false;
286
286
        } else {
287
287
            // Assumes: reserved words are always at the end of program memory.
288
 
            if (!writeBlock(port, _programStart, _reservedStart - 1))
 
288
            if (!writeBlock(port, _programStart, _reservedStart - 1, forceCalibration))
289
289
                return false;
290
290
        }
291
291
        reportCount();
298
298
    if (_dataStart <= _dataEnd) {
299
299
        printf("burning data memory,");
300
300
        fflush(stdout);
301
 
        if (!writeBlock(port, _dataStart, _dataEnd))
 
301
        if (!writeBlock(port, _dataStart, _dataEnd, forceCalibration))
302
302
            return false;
303
303
        reportCount();
304
304
    } else {
309
309
    if (_configStart <= _configEnd) {
310
310
        printf("burning id words and fuses,");
311
311
        fflush(stdout);
312
 
        if (!writeBlock(port, _configStart, _configEnd))
 
312
        if (!writeBlock(port, _configStart, _configEnd, forceCalibration))
313
313
            return false;
314
314
        reportCount();
315
315
    } else {
320
320
    return true;
321
321
}
322
322
 
323
 
bool HexFile::writeBlock(SerialPort *port, Address start, Address end)
 
323
bool HexFile::writeBlock(SerialPort *port, Address start, Address end, bool forceCalibration)
324
324
{
325
325
    std::vector<HexFileBlock>::const_iterator it;
326
326
    for (it = blocks.begin(); it != blocks.end(); ++it) {
341
341
                overlapEnd = end;
342
342
            else
343
343
                overlapEnd = blockEnd;
344
 
            if (!port->writeData(overlapStart, overlapEnd, data))
 
344
            if (!port->writeData(overlapStart, overlapEnd, data, forceCalibration))
345
345
                return false;
346
346
            count += overlapEnd - overlapStart + 1;
347
347
        }