Bob
Bob

Reputation: 4980

gcc efficient byte copy for ARM Cortex-M4

Is there a built-in gcc memcopy function that is specifically optimized to the architecture of the ARM Cortex-M4?

Upvotes: 0

Views: 1172

Answers (2)

Jocelyn
Jocelyn

Reputation: 86

For large blocks* it is worth looking at DMA options, widely available for Cortex-M4 microcontrollers range. It is efficient in a way that during the process, the CPU will be free.

Unfortunately, the Arm Embedded GCC compiler do not have native support for DMA, it will rely on your semiconductor supplier's code.

*As setting-up DMA controller takes some time, it might not be efficient for small blocks.

Upvotes: 1

cooperised
cooperised

Reputation: 2599

Yes - memcpy. Compilers and standard libraries generally have well-optimised versions of memcpy for each target platform. That's not to say that you can't beat the speed of memcpy in specific situations with knowledge of the nature of the data and its alignment, but in general you should trust the writers of the standard library to have done a good job. See this question and its answers.

Upvotes: 7

Related Questions