This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hard fault at misaligned memcpy memset

we made some simple tests with STM32F100 Value Line Eval Board:

//------------------------------------------------------------------------------
// Variables
static unsigned char sDstBuf[1024]; // 1KiB
static unsigned char sSrcBuf[sizeof(sDstBuf)];

printf("Copying words from misaligned src to aligned dst buffer... ");
memset(sDstBuf, 0xcd, sizeof(sDstBuf));

with optimize Level 3, optimize for time this takes
120usec

with optimize Level 0
155usec

almost the same if memcpy is used:
memcpy(sDstBuf, (const void *)0xcd, sizeof(sDstBuf));

It runs into hard fault, if optimize Level >=1 and optimise for time is not set.

I think this is a compiler error..

We ran into this before with MDK 4.60, now we use 4.70A

Werner

Parents
  • Who do you think you are directing your late response to?

    And who do you think you are? Let's see: so far all you've exhibited here is

    a) a knack for totally missing the topic of discussion in every single one of your three, well, "contributions",
    b) a total lack of understanding of the medium you're using, and
    c) a strangely narrow selection of targets for your insinuations: me

    Here's some free advice for you: the next time you decide to launch a random campaign of throwing stuff at someone, you might want to step out of that glass house of yours, first.

Reply
  • Who do you think you are directing your late response to?

    And who do you think you are? Let's see: so far all you've exhibited here is

    a) a knack for totally missing the topic of discussion in every single one of your three, well, "contributions",
    b) a total lack of understanding of the medium you're using, and
    c) a strangely narrow selection of targets for your insinuations: me

    Here's some free advice for you: the next time you decide to launch a random campaign of throwing stuff at someone, you might want to step out of that glass house of yours, first.

Children