The execution time of memset() is different in different MCUs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-02-01 12:58 AM
I now have two copies of basically identical code running in both MCUs. It was found that the two MCUs took different times to execute memset() of the same length.
Observe the running time by adding an IO flip before and after memset(). buffer is a global variable.
HAL_GPIO_WritePin(TEST_GPIO_Port, TEST_Pin, GPIO_PIN_RESET);
memset(buffer, 0, 256);
HAL_GPIO_WritePin(TEST_GPIO_Port, TEST_Pin, GPIO_PIN_SET);
lower is 6us, higher is 36us.(The loop runs with this value every time)
I can confirm that the frequency or settings of the two MCUs are consistent. And there are no operations like interrupts during running memset(). Micro used is STM32F746VGK. The library is libc_nano.a.
Any ideal? Is it related to memory alignment? thanks.
- Labels:
-
STM32Cube MCU Packages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-02-01 4:05 AM
+1 Would also be agnostic to clock settings, say if HSE or PLL didn't start.
Would print out bus clock values as perceived by system, and DWT CYC counts over test function.
Up vote any posts that you find helpful, it shows what's working..

- « Previous
-
- 1
- 2
- Next »