Hi Linaro Team, I'm currently using toolchain gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz https://releases.linaro.org/components/toolchain/binaries/latest/arm-eabi/gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz to develop my bera-metal programs. My compile option is "-marm -march=armv7-a -mtune=cortex-a9 -mlittle-endian -mfloat-abi=hard -mfpu=neon"
I found an issue, when I use memcpy, and if the DEST or SOURCE address is not 4 bytes aligned, the system hangs. It seems that this toolchain doesn't support using hard float and NEON ?
My question is does this toolchain support hard float and NEON in the newlib C library? If I want to use hard float and NEON, how can I do that?
Your reply is more appreciated!!
The test code for this issue is as below: int main(int argc, char *argv[]) { uint8_t abc[40] = {0}; uint8_t def[40] = {1}; for (uint32_t i = 0; i < sizeof(abc); ++ i) { printf("Copying %u bytes, Dest Address: %p, Source Address: %p\n", sizeof(def) - i, &abc[i], &def[i]); memcpy(&abc[i], &def[i], sizeof(def) - i); } }
If &abc[i] or &def[i] is not 4 bytes aligned, the whole system hangs.
On Fri, Nov 10, 2017 at 4:04 PM Yupeng Chang changyp6@gmail.com wrote:
Hi Linaro Team, I'm currently using toolchain gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz https://releases.linaro.org/components/toolchain/binaries/latest/arm-eabi/gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz to develop my bera-metal programs. My compile option is "-marm -march=armv7-a -mtune=cortex-a9 -mlittle-endian -mfloat-abi=hard -mfpu=neon"
I found an issue, when I use memcpy, and if the DEST or SOURCE address is not 4 bytes aligned, the system hangs. It seems that this toolchain doesn't support using hard float and NEON ?
My question is does this toolchain support hard float and NEON in the newlib C library? If I want to use hard float and NEON, how can I do that?
Your reply is more appreciated!!
On Nov 10, 2017, at 11:04 AM, Yupeng Chang changyp6@gmail.com wrote:
Hi Linaro Team, I'm currently using toolchain gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz https://releases.linaro.org/components/toolchain/binaries/latest/arm-eabi/gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz to develop my bera-metal programs. My compile option is "-marm -march=armv7-a -mtune=cortex-a9 -mlittle-endian -mfloat-abi=hard -mfpu=neon"
Hi Yupeng,
Linaro's arm-eabi toolchain provides libraries only for -mfloat-abi=softfp. I'm surprised your baremetal application compiled with -mfloat-abi=hard linked against provided newlib. Can there be another library installed that the tools picked up?
I found an issue, when I use memcpy, and if the DEST or SOURCE address is not 4 bytes aligned, the system hangs. It seems that this toolchain doesn't support using hard float and NEON ?
My question is does this toolchain support hard float and NEON in the newlib C library? If I want to use hard float and NEON, how can I do that?
Your reply is more appreciated!!
-- Maxim Kuvyrkov www.linaro.org
Hi Maxim, Linaro's arm-eabi toolchain is compiled with option --enable-multilib In the libc folder, you can find all other different libraries.
I have found the reason causing my problem. Newlib implementation of memcpy-armv7a.S uses NEON and it requires "unaligned access" is enabled by the CPU. Which means, if you compile newlib with default GCC cflags, this code will be used, and LDR STR instruction may access unaligned address. My system has disabled CPU unaligned access by setting SCTRL.A to 1, this setting will enable unaligned address checking, once unaligned address is accessed by LDR STR instruction, CPU enters DATA ABORT mode.
I have re-compiled this toolchain according to my requirements by adding -mno-unalinged-access to CFLAGS of newlib. This option makes newlib use C version of memcpy, which is a little slower than the NEON version, but it generates code without any unaligned access.
Maxim Kuvyrkov maxim.kuvyrkov@linaro.org 于 2017年11月15日周三 21:04写道:
On Nov 10, 2017, at 11:04 AM, Yupeng Chang changyp6@gmail.com wrote:
Hi Linaro Team, I'm currently using toolchain gcc-linaro-7.1.1-2017.08-x86_64_arm-eabi.tar.xz <
https://releases.linaro.org/components/toolchain/binaries/latest/arm-eabi/gc...
to develop my bera-metal programs. My compile option is "-marm -march=armv7-a -mtune=cortex-a9
-mlittle-endian
-mfloat-abi=hard -mfpu=neon"
Hi Yupeng,
Linaro's arm-eabi toolchain provides libraries only for -mfloat-abi=softfp. I'm surprised your baremetal application compiled with -mfloat-abi=hard linked against provided newlib. Can there be another library installed that the tools picked up?
I found an issue, when I use memcpy, and if the DEST or SOURCE address is not 4 bytes aligned, the system hangs. It seems that this toolchain doesn't support using hard float and NEON ?
My question is does this toolchain support hard float and NEON in the newlib C library? If I want to use hard float and NEON, how can I do that?
Your reply is more appreciated!!
-- Maxim Kuvyrkov www.linaro.org
linaro-toolchain@lists.linaro.org