SEGGER Flash Loader - Performance Optimization

From SEGGER Knowledge Base
Jump to navigation Jump to search

Work Buffer for CRC Verify / Blank Check Optimization

For some operations, a statically allocated work buffer can be provided. This buffer is used to perform operations such as CRC verification and blank checking in larger chunks than would be possible with a dynamically stack-allocated buffer. The goal is to reduce the overhead of per-chunk processing and thereby increase overall performance.

The size of this work buffer effectively defines the chunk size used for blank check and CRC verify operations, and therefore has a direct impact on performance. If the size is too small, the fixed overhead per chunk reduces the overall speed. If it is too large, memory usage increases while the additional speed gain becomes marginal.

As the optimal value depends on several factors, such as register write speed, RAM write speed, the target interface, and the USB connection, it is best determined experimentally. This can be done by varying the buffer size and measuring the performance of the CRC verification. A comparison of test results across different target devices and chunk sizes is shown in the plot below. The test was conducted by running the CRC verify operation for 16 MB of data.

CRC verify speed comparison across varying target devices and chunk sizes