Skip to content

Commit

Permalink
Merge pull request #91 from Samsung/recover_master
Browse files Browse the repository at this point in the history
Recover master
  • Loading branch information
pillip8282 committed May 15, 2017
2 parents 6d0c059 + 72435c9 commit 2a3770f
Show file tree
Hide file tree
Showing 26 changed files with 165 additions and 24 deletions.
2 changes: 1 addition & 1 deletion apps/examples/telnetd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ include $(APPDIR)/Make.defs

# built-in application info

APPNAME = telnetd
APPNAME = telnetd
THREADEXEC = TASH_EXECMD_ASYNC

# telnet daemon example
Expand Down
2 changes: 1 addition & 1 deletion build/configs/artik053/artik053_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ main()
# check existence of firmware binaries
if [ ! -f "${FW_DIR_PATH}/bl1.bin" ] ||\
[ ! -f "${FW_DIR_PATH}/bl2.bin" ] ||\
[ ! -f "${FW_DIR_PATH}/sssfw.bin"] ||\
[ ! -f "${FW_DIR_PATH}/sssfw.bin" ] ||\
[ ! -f "${FW_DIR_PATH}/wlanfw.bin" ]; then
echo "Firmware binaries for ARTIK 053 are not existed"
exit 1
Expand Down
19 changes: 19 additions & 0 deletions os/arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ choice
config ARCH_ARM
bool "ARM"
select ARCH_HAVE_INTERRUPTSTACK
select ARCH_HAVE_DABORTSTACK
select ARCH_HAVE_VFORK
select ARCH_HAVE_STACKCHECK
select ARCH_HAVE_CUSTOMOPT
Expand Down Expand Up @@ -662,6 +663,24 @@ config ARCH_INT_DISABLEALL
to used more priority levels so that we can make a cleaner distinction
with the standard interrupt handler.

comment "Exception stack options"

config ARCH_HAVE_DABORTSTACK
bool
default n

config ARCH_DABORTSTACK
int "Dabort Stack Size"
depends on ARCH_HAVE_DABORTSTACK
default 0
---help---
This architecture supports an data abort stack. If defined, this symbol
will be the size of the data abort stack in bytes. If not defined (or
defined to be zero or less than 512 bytes), the user task stacks
will be used during data abort handling. Recommended data abort stack
size is 1K.


comment "Boot options"

choice
Expand Down
49 changes: 47 additions & 2 deletions os/arch/arm/src/armv7-r/arm_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,10 +585,17 @@ static void up_dumpstate(void)
uint32_t sp = up_getsp();
uint32_t ustackbase;
uint32_t ustacksize;
#ifdef CONFIG_MPU_STACKGUARD
uint32_t uguardsize = 0;
#endif
#if CONFIG_ARCH_INTERRUPTSTACK > 3
uint32_t istackbase;
uint32_t istacksize;
#endif
#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
uint32_t dabtstackbase;
uint32_t dabtstacksize;
#endif
#ifdef CONFIG_ARCH_KERNEL_STACK
uint32_t kstackbase = 0;
#endif
Expand All @@ -601,6 +608,9 @@ static void up_dumpstate(void)
} else {
ustackbase = (uint32_t)rtcb->adj_stack_ptr;
ustacksize = (uint32_t)rtcb->adj_stack_size;
#ifdef CONFIG_MPU_STACKGUARD
uguardsize = (uint32_t)rtcb->guard_size;
#endif
}

lldbg("Current sp: %08x\n", sp);
Expand All @@ -621,6 +631,19 @@ static void up_dumpstate(void)
#endif
#endif

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
/* Get the limits on the dabort stack memory */

dabtstackbase = (uint32_t)&g_dabtstackbase;
dabtstacksize = (CONFIG_ARCH_DABORTSTACK & ~3);

/* Show data abort stack info */

lldbg("Data abort stack:\n");
lldbg(" base: %08x\n", dabtstackbase);
lldbg(" size: %08x\n", dabtstacksize);
#endif

/* Show user stack info */

lldbg("User stack:\n");
Expand Down Expand Up @@ -660,14 +683,36 @@ static void up_dumpstate(void)
}
#endif

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
/* Does the current stack pointer lie within the databort stack? */

if (sp > dabtstackbase - dabtstacksize && sp < dabtstackbase) {
/* Yes.. dump the data abort stack */

lldbg("Dataabort Stack\n", sp);
up_stackdump(sp, dabtstackbase);

/* Extract the user stack pointer which should lie
* at the base of the data abort stack.
*/

sp = g_dabtstackbase;
lldbg("User sp: %08x\n", sp);
}
#endif

/* Dump the user stack if the stack pointer lies within the allocated user
* stack memory.
* stack memory including guard size if there any.
*/

#ifdef CONFIG_MPU_STACKGUARD
if (sp > (ustackbase - ustacksize - uguardsize) && sp < ustackbase) {
#else
if (sp > ustackbase - ustacksize && sp < ustackbase) {
#endif
lldbg("User Stack\n", sp);
up_stackdump(sp, ustackbase);
}

#ifdef CONFIG_ARCH_KERNEL_STACK
/* Dump the user stack if the stack pointer lies within the allocated
* kernel stack memory.
Expand Down
57 changes: 57 additions & 0 deletions os/arch/arm/src/armv7-r/arm_vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ g_undeftmp:
g_aborttmp:
.word 0 /* Saved lr */
.word 0 /* Saved spsr */
#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
.word 0 /* Saved r0 */
#endif
#ifdef CONFIG_ARMV7R_DECODEFIQ
g_fiqtmp:
.word 0 /* Saved lr */
Expand Down Expand Up @@ -484,6 +487,10 @@ arm_vectordata:
mrs lr, spsr /* Get SPSR */
str lr, [r13, #4] /* Save in temp storage */

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
str r0, [r13, #8]
#endif

/* Then switch back to SVC mode */

bic lr, lr, #PSR_MODE_MASK /* Keep F and T bits */
Expand All @@ -494,6 +501,15 @@ arm_vectordata:
* and store r0-r12 into the frame.
*/

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
mov r0, sp /* Preserve SVC mode stack */
ldr sp, .Ldabtstackbase /* Set DABT mode stack */
str r0, [sp] /* save SVC stack pointer DABT mode stack */
ldr sp, .Ldaborttmp /* Points to temp storage */
ldr r0, [sp, #8] /* Recover r0 */
ldr sp, .Ldabtstackbase /* Set back DABT mode stack */
bic sp, sp, #7 /* Force 8-byte alignment */
#endif
sub sp, sp, #XCPTCONTEXT_SIZE
stmia sp, {r0-r12} /* Save the SVC mode regs */

Expand Down Expand Up @@ -526,7 +542,12 @@ arm_vectordata:
* and r2.
*/

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
ldr r5, .Ldabtstackbase /* Set DABT mode stack base */
ldr r1, [r5] /* Read SVC stack pointer */
#else
add r1, sp, #XCPTCONTEXT_SIZE
#endif
mov r2, r14

/* Save r13(sp), r14(lr), r15(pc), and the CPSR */
Expand All @@ -539,7 +560,12 @@ arm_vectordata:
#else
/* Get the correct values of SVC r13(sp) and r14(lr) in r1 and r2 */

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
ldr r5, .Ldabtstackbase /* Set DABT mode stack base */
ldr r1, [r5] /* Read SVC stack pointer */
#else
add r1, sp, #XCPTCONTEXT_SIZE
#endif
mov r2, r14

/* Save r13(sp), r14(lr), r15(pc), and the CPSR */
Expand All @@ -561,6 +587,12 @@ arm_vectordata:
bl arm_dataabort /* Call the handler */
mov sp, r4 /* Restore the possibly unaligned stack pointer */

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
ldr sp, .Ldabtstackbase /* Set DABT mode stack */
ldr r4, [sp] /* Recover SVC mode stack */
mov sp, r4 /* Restore SVC mode stack */
#endif

/* Upon return from arm_dataabort, r0 holds the pointer to the register
* state save area to use to restore the registers. This may or may not
* be the same value that was passed to arm_dataabort: It will differ if a
Expand Down Expand Up @@ -600,6 +632,10 @@ arm_vectordata:

.Ldaborttmp:
.word g_aborttmp
#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
.Ldabtstackbase:
.word g_dabtstackbase
#endif
.size arm_vectordata, . - arm_vectordata

.align 5
Expand Down Expand Up @@ -1069,4 +1105,25 @@ g_intstackbase:
.size g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~3)

#endif /* CONFIG_ARCH_INTERRUPTSTACK > 3 */

/************************************************************************************
* Name: g_dabtstackalloc/g_dabtstackbase
************************************************************************************/
#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
.bss
.align 4

.globl g_dabtstackalloc
.type g_dabtstackalloc, object
.globl g_dabtstackbase
.type g_dabtstackbase, object

g_dabtstackalloc:
.skip ((CONFIG_ARCH_DABORTSTACK & ~3) - 4)
g_dabtstackbase:
.skip 4
.size g_dabtstackbase, 4
.size g_dabtstackalloc, (CONFIG_ARCH_DABORTSTACK & ~3)

#endif /* defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512 */
.end
5 changes: 5 additions & 0 deletions os/arch/arm/src/common/up_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
EXTERN uint32_t g_intstackbase; /* Initial top of interrupt stack */
#endif

#if defined(CONFIG_ARCH_DABORTSTACK) && CONFIG_ARCH_DABORTSTACK >= 512
EXTERN uint32_t g_dabtstackalloc; /* Allocated data abort stack base */
EXTERN uint32_t g_dabtstackbase; /* Initial top of data abort stack */
#endif

/* These 'addresses' of these values are setup by the linker script. They are
* not actual uint32_t storage locations! They are only used meaningfully in the
* following way:
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# drivers/usbdev/Make.defs
#
# Copyright (C) 2008, 2010-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@tinyara.org>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/cdcacm.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/cdcacm.c
*
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/cdcacm.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/cdcacm.h
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/cdcacm_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/cdcacm_desc.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/composite.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/composite.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/composite.h
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/composite_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/composite_desc.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/pl2303.c
*
* Copyright (C) 2008-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* This logic emulates the Prolific PL2303 serial/USB converter
*
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbdev_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbdev_strings.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbdev_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbdev_trace.c
*
* Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbdev_trprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbdev_trprintf.c
*
* Copyright (C) 2008-2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbmsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbmsc.c
*
* Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Mass storage class device. Bulk-only with SCSI subclass.
*
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbmsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbmsc.h
*
* Copyright (C) 2008-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Mass storage class device. Bulk-only with SCSI subclass.
*
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbmsc_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbmsc_desc.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion os/drivers/usbdev/usbmsc_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* drivers/usbdev/usbmsc_scsi.c
*
* Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@tinyara.org>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Mass storage class device. Bulk-only with SCSI subclass.
*
Expand Down
Loading

0 comments on commit 2a3770f

Please sign in to comment.