From 928d52f31562a0776a6639bc4a4bafdb7e815852 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 20 Feb 2022 22:17:55 +0800 Subject: [PATCH] libc/machine: Implement ARM aeabi_xxx API called by clang specified here: https://developer.arm.com/documentation/ihi0043/latest Signed-off-by: Xiang Xiao --- libs/libc/machine/arm/Make.defs | 5 ++++ libs/libc/machine/arm/aeabi_memclr.c | 34 +++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memclr4.c | 34 +++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memclr8.c | 34 +++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memcpy.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memcpy4.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memcpy8.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memmove.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memmove4.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memmove8.c | 35 ++++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memset.c | 34 +++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memset4.c | 34 +++++++++++++++++++++++++ libs/libc/machine/arm/aeabi_memset8.c | 34 +++++++++++++++++++++++++ 13 files changed, 419 insertions(+) create mode 100644 libs/libc/machine/arm/aeabi_memclr.c create mode 100644 libs/libc/machine/arm/aeabi_memclr4.c create mode 100644 libs/libc/machine/arm/aeabi_memclr8.c create mode 100644 libs/libc/machine/arm/aeabi_memcpy.c create mode 100644 libs/libc/machine/arm/aeabi_memcpy4.c create mode 100644 libs/libc/machine/arm/aeabi_memcpy8.c create mode 100644 libs/libc/machine/arm/aeabi_memmove.c create mode 100644 libs/libc/machine/arm/aeabi_memmove4.c create mode 100644 libs/libc/machine/arm/aeabi_memmove8.c create mode 100644 libs/libc/machine/arm/aeabi_memset.c create mode 100644 libs/libc/machine/arm/aeabi_memset4.c create mode 100644 libs/libc/machine/arm/aeabi_memset8.c diff --git a/libs/libc/machine/arm/Make.defs b/libs/libc/machine/arm/Make.defs index d9d60cee11..fe33e11871 100644 --- a/libs/libc/machine/arm/Make.defs +++ b/libs/libc/machine/arm/Make.defs @@ -42,6 +42,11 @@ else ifeq ($(CONFIG_ARCH_ARMV8M),y) # All ARMv8-M include $(TOPDIR)/libs/libc/machine/arm/armv8-m/Make.defs endif +CSRCS += aeabi_memclr.c aeabi_memclr4.c aeabi_memclr8.c +CSRCS += aeabi_memcpy.c aeabi_memcpy4.c aeabi_memcpy8.c +CSRCS += aeabi_memmove.c aeabi_memmove4.c aeabi_memmove8.c +CSRCS += aeabi_memset.c aeabi_memset4.c aeabi_memset8.c + ifeq ($(CONFIG_CXX_EXCEPTION),y) CSRCS += gnu_unwind_find_exidx.c endif diff --git a/libs/libc/machine/arm/aeabi_memclr.c b/libs/libc/machine/arm/aeabi_memclr.c new file mode 100644 index 0000000000..0a36bd709c --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memclr.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memclr.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memclr(FAR void *s, size_t n) +{ + memset(s, 0, n); +} diff --git a/libs/libc/machine/arm/aeabi_memclr4.c b/libs/libc/machine/arm/aeabi_memclr4.c new file mode 100644 index 0000000000..86eb5fce8a --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memclr4.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memclr4.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memclr4(FAR void *s, size_t n) +{ + memset(s, 0, n); +} diff --git a/libs/libc/machine/arm/aeabi_memclr8.c b/libs/libc/machine/arm/aeabi_memclr8.c new file mode 100644 index 0000000000..9d2e4a0f47 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memclr8.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memclr8.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memclr8(FAR void *s, size_t n) +{ + memset(s, 0, n); +} diff --git a/libs/libc/machine/arm/aeabi_memcpy.c b/libs/libc/machine/arm/aeabi_memcpy.c new file mode 100644 index 0000000000..dc27033d82 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memcpy.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memcpy.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memcpy(FAR void *dest, FAR const void *src, size_t n) +{ + memcpy(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memcpy4.c b/libs/libc/machine/arm/aeabi_memcpy4.c new file mode 100644 index 0000000000..640f5edb9e --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memcpy4.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memcpy4.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memcpy4(FAR void *dest, FAR const void *src, size_t n) +{ + memcpy(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memcpy8.c b/libs/libc/machine/arm/aeabi_memcpy8.c new file mode 100644 index 0000000000..97d6debc1a --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memcpy8.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memcpy8.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memcpy8(FAR void *dest, FAR const void *src, size_t n) +{ + memcpy(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memmove.c b/libs/libc/machine/arm/aeabi_memmove.c new file mode 100644 index 0000000000..8ba83d1d38 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memmove.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memmove.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memmove(FAR void *dest, FAR const void *src, size_t n) +{ + memmove(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memmove4.c b/libs/libc/machine/arm/aeabi_memmove4.c new file mode 100644 index 0000000000..cb6e4be34c --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memmove4.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memmove4.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memmove4(FAR void *dest, FAR const void *src, size_t n) +{ + memmove(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memmove8.c b/libs/libc/machine/arm/aeabi_memmove8.c new file mode 100644 index 0000000000..5726396756 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memmove8.c @@ -0,0 +1,35 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memmove8.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function +__aeabi_memmove8(FAR void *dest, FAR const void *src, size_t n) +{ + memmove(dest, src, n); +} diff --git a/libs/libc/machine/arm/aeabi_memset.c b/libs/libc/machine/arm/aeabi_memset.c new file mode 100644 index 0000000000..f60faede5c --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memset.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memset.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memset(FAR void *s, size_t n, int c) +{ + memset(s, c, n); +} diff --git a/libs/libc/machine/arm/aeabi_memset4.c b/libs/libc/machine/arm/aeabi_memset4.c new file mode 100644 index 0000000000..cbcd2dd459 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memset4.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memset4.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memset4(FAR void *s, size_t n, int c) +{ + memset(s, c, n); +} diff --git a/libs/libc/machine/arm/aeabi_memset8.c b/libs/libc/machine/arm/aeabi_memset8.c new file mode 100644 index 0000000000..8d3b23eca3 --- /dev/null +++ b/libs/libc/machine/arm/aeabi_memset8.c @@ -0,0 +1,34 @@ +/**************************************************************************** + * libs/libc/machine/arm/aeabi_memset8.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void weak_function __aeabi_memset8(FAR void *s, size_t n, int c) +{ + memset(s, c, n); +}