From c5c8c3aab9c545e844285532febcc2e25ff1ee08 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 25 Dec 2018 13:58:43 +0000 Subject: [PATCH] Merged in masayuki2009/nuttx.nuttx/fix_lc823450_start (pull request #793) Fix lc823450 start * arch/arm/src/lc823450: Use CONFIG_STACK_COLORATION instead of CONFIG_DEBUG_STACK Signed-off-by: Masayuki Ishikawa * arch/arm/src/lc823450: Fix go_os_start() in lc823450_start.c I found a bug in go_os_start() that it returns immediately because it does not compare r1 to zero. This commit fixes this bug. Also, this commit fixes its description. Signed-off-by: Masayuki Ishikawa Approved-by: GregoryN --- arch/arm/src/lc823450/Make.defs | 2 +- arch/arm/src/lc823450/lc823450_start.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/lc823450/Make.defs b/arch/arm/src/lc823450/Make.defs index d03f95acc6..1efda9aa3c 100644 --- a/arch/arm/src/lc823450/Make.defs +++ b/arch/arm/src/lc823450/Make.defs @@ -78,7 +78,7 @@ ifeq ($(CONFIG_ARCH_MEMMOVE),y) CMN_CSRCS += up_memmove.c endif -ifeq ($(CONFIG_DEBUG_STACK),y) +ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/lc823450/lc823450_start.c b/arch/arm/src/lc823450/lc823450_start.c index a98d21ce89..2f72ea1b12 100644 --- a/arch/arm/src/lc823450/lc823450_start.c +++ b/arch/arm/src/lc823450/lc823450_start.c @@ -125,7 +125,7 @@ extern uint32_t _stext_sram, _etext_sram, _ftext, _svect; * Private Function prototypes ****************************************************************************/ -#ifdef CONFIG_DEBUG_STACK +#ifdef CONFIG_STACK_COLORATION static void go_os_start(void *pv, unsigned int nbytes) __attribute__ ((naked, no_instrument_function, noreturn)); #endif @@ -152,11 +152,11 @@ static void go_os_start(void *pv, unsigned int nbytes) * Name: go_os_start * * Description: - * Set the IDLE stack to the + * Set the IDLE stack to the coloration value and jump into os_start() * ****************************************************************************/ -#ifdef CONFIG_DEBUG_STACK +#ifdef CONFIG_STACK_COLORATION static void go_os_start(void *pv, unsigned int nbytes) { /* Set the IDLE stack to the stack coloration value then jump to @@ -169,6 +169,7 @@ static void go_os_start(void *pv, unsigned int nbytes) __asm__ __volatile__ ( "\tmov r1, r1, lsr #2\n" /* R1 = nwords = nbytes >> 2 */ + "\tcmp r1, #0\n" /* Check (nwords == 0) */ "\tbeq 2f\n" /* (should not happen) */ "\tbic r0, r0, #3\n" /* R0 = Aligned stackptr */ @@ -405,7 +406,7 @@ void __start(void) CURRENT_REGS = NULL; -#ifdef CONFIG_DEBUG_STACK +#ifdef CONFIG_STACK_COLORATION /* Set the IDLE stack to the coloration value and jump into os_start() */ go_os_start((FAR void *)&_ebss, CONFIG_IDLETHREAD_STACKSIZE);