arch/arm-m: Clear lr before jump to __start

to fix issue about https://github.com/apache/nuttx/issues/12687

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2024-07-29 13:45:26 +08:00 committed by Xiang Xiao
parent 1bad603fe7
commit 2c24e5b430
3 changed files with 44 additions and 6 deletions

View File

@ -57,13 +57,27 @@
#endif
/****************************************************************************
* Public Functions
* Private Functions
****************************************************************************/
/* Chip-specific entrypoint */
extern void __start(void);
static void start(void)
{
/* Zero lr to mark the end of backtrace */
asm volatile ("mov lr, %0\n\t"
"bx %1\n\t"
:
: "r"(0), "r"(__start));
}
/****************************************************************************
* Public Functions
****************************************************************************/
/* Common exception entrypoint */
extern void exception_common(void);
@ -89,7 +103,7 @@ const void * const _vectors[] locate_data(".vectors") =
/* Reset exception handler */
__start,
start,
/* Vectors 2 - n point directly at the generic handler */

View File

@ -49,13 +49,25 @@
#define IDLE_STACK (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
/****************************************************************************
* Public Functions
* Private Functions
****************************************************************************/
/* Chip-specific entrypoint */
extern void __start(void);
static void start(void)
{
/* Zero lr to mark the end of backtrace */
asm volatile ("mov lr, #0\n\t"
"b __start\n\t");
}
/****************************************************************************
* Public Functions
****************************************************************************/
/* Common exception entrypoint */
extern void exception_common(void);
@ -82,7 +94,7 @@ const void * const _vectors[] locate_data(".vectors")
/* Reset exception handler */
__start,
start,
/* Vectors 2 - n point directly at the generic handler */

View File

@ -52,13 +52,25 @@
#endif
/****************************************************************************
* Public Functions
* Private Functions
****************************************************************************/
/* Chip-specific entrypoint */
extern void __start(void);
static void start(void)
{
/* Zero lr to mark the end of backtrace */
asm volatile ("mov lr, #0\n\t"
"b __start\n\t");
}
/****************************************************************************
* Public Functions
****************************************************************************/
/* Common exception entrypoint */
extern void exception_common(void);
@ -84,7 +96,7 @@ const void * const _vectors[] locate_data(".vectors") =
/* Reset exception handler */
__start,
start,
/* Vectors 2 - n point directly at the generic handler */