memcpy crashes when writing to non-cached memory on ARM M7
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
The version of memcpy in standard newlib (not the one in newlib-nano) crashes when it is used to write to memory that has been tagged as non-cacheable in the MPU. This is because non-cacheable memory only supports aligned accesses. In embedded systems using the ARM Cortex M7 processor, sections of non-cacheable memory are often required, because the write-back cache of the ARM M7 plays havoc with DMA. Although memcpy attempts to do aligned accesses, if the number of bytes to be copied is one less than a multiple of 4 then memcpy uses a 16-bit transfer to copy the last 2 bytes.
Workaround 1: use newlib-nano instead. Unfortunately, newlib-nano as provided is not compatible with programs that use exception handling.
Workaround 2: copy the source code for memcpy from newlib source into your project, and compile it with option -fno-unaligned-
Suggested fix: as it is likely that programs targeting the ARM Cortex M7 will need to use areas of non-cached memory, either all of newlib or just these memory access functions should be compiled with option -fno-unaligned-
Ich bin bis 08.01. nicht im Haus und kann Ihre Nachricht daher leider nicht bearbeiten. In dringenden Fällen wenden Sie sich bitte an <email address hidden> bzw. für technische Fragen an <email address hidden>.
I am out of office until January 8th and won't be able to read your message. In urgent cases, please refer to <email address hidden> or for technical questions to <email address hidden>.
Mit freundlichen Grüßen / Best regards
Steffen Wolfer
--
Dipl.-Inform. Steffen Wolfer
Software Engineer Embedded Systems
WEISS ROBOTICS GmbH & Co. KG Käferle- Str. 8
Karl-Heinrich-
D-71640 Ludwigsburg, Germany
Phone: +49 7141 94702-22 www.weiss- robotics. com
Fax: +49 7141 94702-99
http://
Sitz der Gesellschaft: Ludwigsburg
Registergericht Stuttgart, HRA725006
Pers. haftende Gesellschafterin:
Weiss Robotics Verwaltungs-GmbH, Sitz Ludwigsburg
Registergericht Stuttgart, HRB73310
Geschäftsführer: Dr. Karsten Weiß
Public bug reported:
The version of memcpy in standard newlib (not the one in newlib-nano)
crashes when it is used to write to memory that has been tagged as non-
cacheable in the MPU. This is because non-cacheable memory only supports
aligned accesses. In embedded systems using the ARM Cortex M7 processor,
sections of non-cacheable memory are often required, because the write-
back cache of the ARM M7 plays havoc with DMA. Although memcpy attempts
to do aligned accesses, if the number of bytes to be copied is one less
than a multiple of 4 then memcpy uses a 16-bit transfer to copy the last
2 bytes.
Workaround 1: use newlib-nano instead. Unfortunately, newlib-nano as
provided is not compatible with programs that use exception handling.
Workaround 2: copy the source code for memcpy from newlib source into access (like the
your project, and compile it with option -fno-unaligned-
rest of the project that uses non-cached memory). As a precaution I did
the same for memset, memmove and memcmp too.
Suggested fix: as it is likely that programs targeting the ARM Cortex M7
will need to use areas of non-cached memory, either all of newlib or
just these memory access functions should be compiled with option -fno-
unaligned-access when targeting the ARM Cortex M7.
** Affects: gcc-arm-embedded
Importance: Undecided
Status: New
** Tags: memcpy
-- /bugs.launchpad .net/bugs/ 1857469
You received this bug notification because you are subscribed to GNU Arm
Embedded Toolchain.
Matching subscriptions: Älles
https:/
Title:
memcpy crashes when writing to non-cached memory on ARM M7
Status in GNU Arm Embedded Toolchain:
New
Bug description:
The version of memcpy in standard newlib (not the one in newlib-nano)
crashes when it is used to write to memory that has been tagged as
non-cacheable in the MPU. This is because non-cacheable memory only
supports aligned accesses. In embedded systems using the ARM Cortex M7
processor, sections of non-cacheable memory are often required,
because the write-back cache of the ARM M7 plays havoc with DMA.
Although memcpy attempts to do aligned accesses, if the number of
bytes to be copied is one less than a multiple of 4 then memcpy uses a
16-bit transfer to copy the la...