Opened on 08/06/19 at 15:12:47
Closed on 10/25/22 at 03:10:29
#3779 closed defect (fixed)
arm_switch_reg undeclared when building libdebugger/rtems-debugger-arm
Reported by: | Andrei Chichak | Owned by: | Chris Johns |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | lib/debugger | Version: | |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
host is MacOS 10.14.6
target is stm32f4
configure string is:
$HOME/quick-start/src/rtems/configure \
--prefix=$HOME/quick-start/rtems/5 \
--target=arm-rtems5 \
--enable-rtemsbsp=stm32f4 \
--enable-tests \
--disable-networking \
--enable-posix
I am building off of a head pull of the tools and RTOS source as of Monday August 5, late evening GMT-7.
I believe the important error message is:
/Users/andreichichak/quick-start/src/rtems/c/src/../../cpukit/libdebugger/rtems-debugger-arm.c:1308:53: error: 'arm_switch_reg' undeclared (first use in this function)
#define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg
/Users/andreichichak/quick-start/src/rtems/c/src/../../cpukit/libdebugger/rtems-debugger-arm.c:1324:3: note: in expansion of macro 'EXCEPTION_ENTRY_EXC'
EXCEPTION_ENTRY_EXC();
/Users/andreichichak/quick-start/src/rtems/c/src/../../cpukit/libdebugger/rtems-debugger-arm.c:1308:53: note: each undeclared identifier is reported only once for each function it appears in
#define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg
/Users/andreichichak/quick-start/src/rtems/c/src/../../cpukit/libdebugger/rtems-debugger-arm.c:1324:3: note: in expansion of macro 'EXCEPTION_ENTRY_EXC'
EXCEPTION_ENTRY_EXC();
Change History (9)
comment:1 Changed on 10/01/19 at 12:13:53 by sprhawk
comment:2 follow-up: 3 Changed on 10/01/19 at 13:06:20 by sprhawk
I think if there is no need for arm_switch_reg, how about I void exception_entry_exc()?
-
cpukit/libdebugger/rtems-debugger-arm.c
From 46c1bd458196ff694ce04e74f68695fc620a7a65 Mon Sep 17 00:00:00 2001 From: YANG HONGBO <sprhawk@gmail.com> Date: Tue, 1 Oct 2019 20:51:03 +0800 Subject: [PATCH] try to fix failure building for STM32F4 --- cpukit/libdebugger/rtems-debugger-arm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpukit/libdebugger/rtems-debugger-arm.c b/cpukit/libdebugger/rtems-debugger-arm.c index 3d5dea0ab7..eefc83eed5 100644
a b target_exception(CPU_Exception_frame* frame) 1590 1590 #define EXCEPTION_EXIT_THREAD(_frame) EXCEPTION_EXIT_THREAD_V4(_frame) 1591 1591 #define EXCEPTION_EXIT_EXC() EXCEPTION_EXIT_EXC_V4() 1592 1592 #elif defined(ARM_MULTILIB_ARCH_V7M) 1593 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1593 #if ARM_THUMB_ONLY 1594 #define EXCEPTION_ENTRY_EXC() (void)NULL 1595 #define EXCEPTION_EXIT_EXC() (void)NULL 1596 #else 1597 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1598 #define EXCEPTION_EXIT_EXC() (void) arm_switch_reg 1599 #endif 1594 1600 #define EXCEPTION_ENTRY_THREAD(_frame) (_frame) = NULL 1595 1601 #define EXCEPTION_EXIT_THREAD(_frame) (_frame) = NULL 1596 #define EXCEPTION_EXIT_EXC() (void) arm_switch_reg1597 1602 #else 1598 1603 #error ARM architecture is not supported. 1599 1604 #endif
comment:3 follow-ups: 4 5 Changed on 10/01/19 at 23:40:23 by Chris Johns
Replying to sprhawk:
I think if there is no need for arm_switch_reg, how about I void exception_entry_exc()?
I am not so sure.
cpukit/libdebugger/rtems-debugger-arm.c
From 46c1bd458196ff694ce04e74f68695fc620a7a65 Mon Sep 17 00:00:00 2001 From: YANG HONGBO <sprhawk@gmail.com> Date: Tue, 1 Oct 2019 20:51:03 +0800 Subject: [PATCH] try to fix failure building for STM32F4 --- cpukit/libdebugger/rtems-debugger-arm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpukit/libdebugger/rtems-debugger-arm.c b/cpukit/libdebugger/rtems-debugger-arm.c index 3d5dea0ab7..eefc83eed5 100644
a b target_exception(CPU_Exception_frame* frame) 1590 1590 #define EXCEPTION_EXIT_THREAD(_frame) EXCEPTION_EXIT_THREAD_V4(_frame) 1591 1591 #define EXCEPTION_EXIT_EXC() EXCEPTION_EXIT_EXC_V4() 1592 1592 #elif defined(ARM_MULTILIB_ARCH_V7M) 1593 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1593 #if ARM_THUMB_ONLY 1594 #define EXCEPTION_ENTRY_EXC() (void)NULL 1595 #define EXCEPTION_EXIT_EXC() (void)NULL
I do not think this would work. It means NULL
is being loaded as the address. I am not familiar with the specifics of this model. Is ARM mode active when entering an exception? If so we need to switch to thumb mode and to do this we need a valid arm_switch_reg
.
What is your configure command line for RTEMS and I will see what is broken in the build?
comment:4 Changed on 10/02/19 at 00:03:27 by sprhawk
Replying to Chris Johns:
Replying to sprhawk:
I think if there is no need for arm_switch_reg, how about I void exception_entry_exc()?
I am not so sure.
cpukit/libdebugger/rtems-debugger-arm.c
From 46c1bd458196ff694ce04e74f68695fc620a7a65 Mon Sep 17 00:00:00 2001 From: YANG HONGBO <sprhawk@gmail.com> Date: Tue, 1 Oct 2019 20:51:03 +0800 Subject: [PATCH] try to fix failure building for STM32F4 --- cpukit/libdebugger/rtems-debugger-arm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpukit/libdebugger/rtems-debugger-arm.c b/cpukit/libdebugger/rtems-debugger-arm.c index 3d5dea0ab7..eefc83eed5 100644
a b target_exception(CPU_Exception_frame* frame) 1590 1590 #define EXCEPTION_EXIT_THREAD(_frame) EXCEPTION_EXIT_THREAD_V4(_frame) 1591 1591 #define EXCEPTION_EXIT_EXC() EXCEPTION_EXIT_EXC_V4() 1592 1592 #elif defined(ARM_MULTILIB_ARCH_V7M) 1593 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1593 #if ARM_THUMB_ONLY 1594 #define EXCEPTION_ENTRY_EXC() (void)NULL 1595 #define EXCEPTION_EXIT_EXC() (void)NULL I do not think this would work. It means
NULL
is being loaded as the address. I am not familiar with the specifics of this model. Is ARM mode active when entering an exception? If so we need to switch to thumb mode and to do this we need a validarm_switch_reg
.
The STM32F4 has a core of cortex-m4, which is ARMv7M instruction set, which is thumb only,
What is your configure command line for RTEMS and I will see what is broken in the build?
I used command similar as the ticket reported:
../rtems_5/configure --prefix=$RTEMS_ROOT_DIR --target=arm-rtems5 --enable-rtemsbsp=stm32f4 --disable-networking --enable-posix --disable-cxx --enable-tests=samples --disable-smp --disable-multiprocessing; make
comment:5 follow-up: 6 Changed on 10/02/19 at 00:30:49 by sprhawk
Replying to Chris Johns:
Replying to sprhawk:
I think if there is no need for arm_switch_reg, how about I void exception_entry_exc()?
I am not so sure.
cpukit/libdebugger/rtems-debugger-arm.c
From 46c1bd458196ff694ce04e74f68695fc620a7a65 Mon Sep 17 00:00:00 2001 From: YANG HONGBO <sprhawk@gmail.com> Date: Tue, 1 Oct 2019 20:51:03 +0800 Subject: [PATCH] try to fix failure building for STM32F4 --- cpukit/libdebugger/rtems-debugger-arm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpukit/libdebugger/rtems-debugger-arm.c b/cpukit/libdebugger/rtems-debugger-arm.c index 3d5dea0ab7..eefc83eed5 100644
a b target_exception(CPU_Exception_frame* frame) 1590 1590 #define EXCEPTION_EXIT_THREAD(_frame) EXCEPTION_EXIT_THREAD_V4(_frame) 1591 1591 #define EXCEPTION_EXIT_EXC() EXCEPTION_EXIT_EXC_V4() 1592 1592 #elif defined(ARM_MULTILIB_ARCH_V7M) 1593 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1593 #if ARM_THUMB_ONLY 1594 #define EXCEPTION_ENTRY_EXC() (void)NULL 1595 #define EXCEPTION_EXIT_EXC() (void)NULL I do not think this would work. It means
NULL
is being loaded as the address. I am not familiar with the specifics of this model. Is ARM mode active when entering an exception? If so we need to switch to thumb mode and to do this we need a validarm_switch_reg
.
What is your configure command line for RTEMS and I will see what is broken in the build?
I think you are right, I should simply put it empty instead?
-
cpukit/libdebugger/rtems-debugger-arm.c
From c3caf01a5674bc4da2b926d118bf5df5baa1fe4f Mon Sep 17 00:00:00 2001 From: YANG HONGBO <yanghongbo@iotpi.io> Date: Wed, 2 Oct 2019 08:12:41 +0800 Subject: [PATCH] empty EXCEPTION_ENTRY_EXC when cpu is ARM_THUMB_ONLY --- cpukit/libdebugger/rtems-debugger-arm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cpukit/libdebugger/rtems-debugger-arm.c b/cpukit/libdebugger/rtems-debugger-arm.c index 3d5dea0ab7..92b3b586b4 100644
a b target_exception(CPU_Exception_frame* frame) 1590 1590 #define EXCEPTION_EXIT_THREAD(_frame) EXCEPTION_EXIT_THREAD_V4(_frame) 1591 1591 #define EXCEPTION_EXIT_EXC() EXCEPTION_EXIT_EXC_V4() 1592 1592 #elif defined(ARM_MULTILIB_ARCH_V7M) 1593 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1594 #define EXCEPTION_ENTRY_THREAD(_frame) (_frame) = NULL 1595 #define EXCEPTION_EXIT_THREAD(_frame) (_frame) = NULL 1596 #define EXCEPTION_EXIT_EXC() (void) arm_switch_reg 1593 #if ARM_THUMB_ONLY 1594 #define EXCEPTION_ENTRY_EXC() 1595 #define EXCEPTION_ENTRY_THREAD(_frame) (_frame) = NULL 1596 #define EXCEPTION_EXIT_THREAD(_frame) (_frame) = NULL 1597 #define EXCEPTION_EXIT_EXC() 1598 #else 1599 #define EXCEPTION_ENTRY_EXC() (void) arm_switch_reg 1600 #define EXCEPTION_ENTRY_THREAD(_frame) (_frame) = NULL 1601 #define EXCEPTION_EXIT_THREAD(_frame) (_frame) = NULL 1602 #define EXCEPTION_EXIT_EXC() (void) arm_switch_reg 1603 #endif 1597 1604 #else 1598 1605 #error ARM architecture is not supported. 1599 1606 #endif
comment:6 follow-up: 7 Changed on 10/02/19 at 01:07:36 by Chris Johns
Replying to sprhawk:
Replying to Chris Johns:
I do not think this would work. It means
NULL
is being loaded as the address. I am not familiar with the specifics of this model. Is ARM mode active when entering an exception? If so we need to switch to thumb mode and to do this we need a validarm_switch_reg
.
What is your configure command line for RTEMS and I will see what is broken in the build?
I think you are right, I should simply put it empty instead?
I am not sure. If the ARM to thumb code is being used then a variable is needed.
What is your configure command line?
comment:7 follow-up: 8 Changed on 10/02/19 at 01:18:24 by sprhawk
Replying to Chris Johns:
What is your configure command line?
It was
../rtems_5/configure --prefix=$RTEMS_ROOT_DIR --target=arm-rtems5 --enable-rtemsbsp=stm32f4 --disable-networking --enable-posix --disable-cxx --enable-tests=samples --disable-smp --disable-multiprocessing; make
If cortex-m4 is thumb only, I think it should not have the operation to switch from ARM to thumb due to it lacks of ARM instructions
comment:8 Changed on 10/02/19 at 01:59:49 by Chris Johns
Replying to sprhawk:
Replying to Chris Johns:
What is your configure command line?
It was
../rtems_5/configure --prefix=$RTEMS_ROOT_DIR --target=arm-rtems5 --enable-rtemsbsp=stm32f4 --disable-networking --enable-posix --disable-cxx --enable-tests=samples --disable-smp --disable-multiprocessing; make
Thanks.
If cortex-m4 is thumb only, I think it should not have the operation to switch from ARM to thumb due to it lacks of ARM instructions
Ah ok, this would make sense. I would need to check over the code to make sure it is clean. Maybe the change is around the defines for the switching near the top. If they are blank there is no switch and no issue?
comment:9 Changed on 10/25/22 at 03:10:29 by Chris Johns
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'm new to rtems. I also encountered this problem.
I dig into source code, in
commit:8798372261ed1:cpukit/libdebugger/rtems-debugger-arm.c:83-95:
here, code for stm32f4 is compiled with flag -mpu cortex-m4, which is ARM_THUMB_ONLY, ARM_ARCH_7M, so above defines will result ARM_SWITCH_REG to empty.
in line 1592, 1593,
it is defined as
when compiled, it will report undeclared identifier arm_switch_reg