Code:
uint32_t getCycleCount()
{
uint32_t ccount;
__asm__ __volatile__("esync; rsr %0,ccount":"=a" (ccount));
return ccount;
}
#define BEGIN_MEASURE startTime = getCycleCount();
#define PRINT_TIME(x) \
endTime = getCycleCount(); \
printf(x); \
printf("%d \r\n", endTime - startTime);
...
uint32_t addr = 0x160000;
portTickType startTime, endTime;
BEGIN_MEASURE
if (flashEraseSector((addr / SPI_FLASH_SEC_SIZE)) != SPI_FLASH_RESULT_OK)
printf("error erase sector\n");
PRINT_TIME("erase sector: ")
BEGIN_MEASURE
if (flashEraseSector((addr / SPI_FLASH_SEC_SIZE) + 1) != SPI_FLASH_RESULT_OK)
printf("error erase sector\n");
PRINT_TIME("erase sector: ")
Statistics: Posted by WickedCode — Thu Nov 30, 2017 4:38 am