From de95a8550f8e468396545eab1be11fd33b12be97 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Thu, 24 Feb 2022 17:28:03 +0900 Subject: [PATCH] arch, board: Add thumb support to i.MX6 Summary: - This commit adds thumb support to i.MX6 - Also, applies the same coding style to arch_elf.c Impact: - i.MX6 only Testing: - Tested with sabre-6quad:smp (QEMU, Dev board) - Tested with sabre-6quad:netnsh (QEMU) - Tested with sabre-6quad:netknsh (QEMU, not merged yet) Signed-off-by: Masayuki Ishikawa --- arch/arm/Kconfig | 1 + boards/arm/imx6/sabre-6quad/scripts/Make.defs | 2 +- libs/libc/machine/arm/armv7-a/arch_elf.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 87123ae1fc..6666d95573 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -80,6 +80,7 @@ config ARCH_CHIP_IMX1 config ARCH_CHIP_IMX6 bool "NXP/Freescale iMX.6" select ARCH_CORTEXA9 + select ARM_THUMB select ARMV7A_HAVE_L2CC_PL310 select ARCH_HAVE_FPU select ARCH_HAVE_TRUSTZONE diff --git a/boards/arm/imx6/sabre-6quad/scripts/Make.defs b/boards/arm/imx6/sabre-6quad/scripts/Make.defs index 43cc934895..224eccce5e 100644 --- a/boards/arm/imx6/sabre-6quad/scripts/Make.defs +++ b/boards/arm/imx6/sabre-6quad/scripts/Make.defs @@ -34,7 +34,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing endif -ARCHCPUFLAGS = -mcpu=cortex-a9 -mfpu=vfpv4-d16 +ARCHCPUFLAGS = -mcpu=cortex-a9 -mfpu=vfpv4-d16 -mthumb ARCHCFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new -fno-rtti ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef diff --git a/libs/libc/machine/arm/armv7-a/arch_elf.c b/libs/libc/machine/arm/armv7-a/arch_elf.c index e9c719e7c4..3e724822a7 100644 --- a/libs/libc/machine/arm/armv7-a/arch_elf.c +++ b/libs/libc/machine/arm/armv7-a/arch_elf.c @@ -174,9 +174,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, offset += sym->st_value - addr; #ifdef CONFIG_ARM_THUMB - if (offset & 2 || offset < (int32_t) 0xfe000000 || + if ((offset & 2) != 0 || offset < (int32_t) 0xfe000000 || #else - if (offset & 3 || offset < (int32_t) 0xfe000000 || + if ((offset & 3) != 0 || offset < (int32_t) 0xfe000000 || #endif offset >= (int32_t) 0x02000000) {