More apps/ related changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3372 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
f0d143ee29
commit
0f7afd2932
@ -2,7 +2,7 @@
|
||||
* arch/arm/src/stm32/stm32_start.c
|
||||
* arch/arm/src/chip/stm32_start.c
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -51,6 +51,8 @@
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "stm32_internal.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Private Definitions
|
||||
@ -67,6 +69,31 @@
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
void stm32_jtag_enable(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_JTAG_FULL_ENABLE
|
||||
|
||||
#elif CONFIG_STM32_JTAG_NOJNTRST_ENABLE
|
||||
uint32_t val = getreg32(STM32_AFIO_MAPR);
|
||||
val &= 0x00FFFFFF; // clear undefined readings ...
|
||||
val |= AFIO_MAPR_SWJ; // enabled but without JNTRST
|
||||
putreg32(val, STM32_AFIO_MAPR);
|
||||
|
||||
#elif CONFIG_STM32_JTAG_SW_ENABLE
|
||||
uint32_t val = getreg32(STM32_AFIO_MAPR);
|
||||
val &= 0x00FFFFFF; // clear undefined readings ...
|
||||
val |= AFIO_MAPR_SWDP; // set JTAG-DP disabled and SW-DP enabled
|
||||
putreg32(val, STM32_AFIO_MAPR);
|
||||
|
||||
#else
|
||||
uint32_t val = getreg32(STM32_AFIO_MAPR);
|
||||
val &= 0x00FFFFFF; // clear undefined readings ...
|
||||
val |= AFIO_MAPR_DISAB; // set JTAG-DP and SW-DP Disabled
|
||||
putreg32(val, STM32_AFIO_MAPR);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: showprogress
|
||||
@ -103,6 +130,7 @@ void __start(void)
|
||||
|
||||
stm32_clockconfig();
|
||||
stm32_lowsetup();
|
||||
stm32_jtag_enable();
|
||||
showprogress('A');
|
||||
|
||||
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
|
||||
|
@ -38,7 +38,7 @@
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
MISC_SRCS = os_start.c get_errno_ptr.c sched_garbage.c \
|
||||
MISC_SRCS = os_start.c os_bringup.c get_errno_ptr.c sched_garbage.c \
|
||||
sched_setupstreams.c sched_getfiles.c sched_getsockets.c sched_getstreams.c \
|
||||
sched_setupidlefiles.c sched_setuptaskfiles.c sched_setuppthreadfiles.c \
|
||||
sched_releasefiles.c
|
||||
|
167
sched/os_bringup.c
Normal file
167
sched/os_bringup.c
Normal file
@ -0,0 +1,167 @@
|
||||
/****************************************************************************
|
||||
* sched/os_bringup.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* With extensions by:
|
||||
*
|
||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/init.h>
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
# include "pg_internal.h"
|
||||
#endif
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
# include "work_internal.h"
|
||||
#endif
|
||||
#ifdef CONFIG_BUILTIN_APPS_NUTTX
|
||||
# include "nuttx/nuttapp.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
# define START_TASK(n,p,s,e,a) task_create(n,p,s,e,a)
|
||||
#else
|
||||
# define START_TASK(n,p,s,e,a) task_create(n,p,e,a)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_bringup
|
||||
*
|
||||
* Description:
|
||||
* Start all initial system tasks. This does the "system bring-up" after
|
||||
* the conclusion of basic OS initialization. These initial system tasks
|
||||
* may include:
|
||||
*
|
||||
* - pg_worker: The page-fault worker thread (only if CONFIG_PAGING is
|
||||
* defined.
|
||||
* - work_thread: The work thread. This general thread can be used to
|
||||
* perform most any kind of queued work. Its primary
|
||||
* function is to serve as the "bottom half" of device
|
||||
* drivers.
|
||||
*
|
||||
* And the main application entry point. This may be one of two different
|
||||
* symbols:
|
||||
*
|
||||
* - user_start: This is the default entry point used for all of the
|
||||
* examples.
|
||||
* - CONFIG_BUILTIN_APP_START: The system can also be configured to start
|
||||
* custom applications at however CONFIG_BUILTIN_APP_START
|
||||
* is defined in the NuttX start-up file.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int os_bringup(void)
|
||||
{
|
||||
int init_taskid;
|
||||
|
||||
/* Start the page fill worker thread that will resolve page faults.
|
||||
* This should always be the first thread started because it may
|
||||
* have to resolve page faults in other threads
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
svdbg("Starting paging thread\n");
|
||||
|
||||
g_pgworker = START_TASK("pgfill", CONFIG_PAGING_DEFPRIO,
|
||||
CONFIG_PAGING_STACKSIZE,
|
||||
(main_t)pg_worker, (const char **)NULL);
|
||||
ASSERT(g_pgworker != ERROR);
|
||||
#endif
|
||||
|
||||
/* Start the worker thread that will perform misc garbage clean-up */
|
||||
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
svdbg("Starting worker thread\n");
|
||||
|
||||
g_worker = START_TASK("work", CONFIG_SCHED_WORKPRIORITY,
|
||||
CONFIG_SCHED_WORKSTACKSIZE,
|
||||
(main_t)work_thread, (const char **)NULL);
|
||||
ASSERT(g_worker != ERROR);
|
||||
#endif
|
||||
|
||||
/* Once the operating system has been initialized, the system must be
|
||||
* started by spawning the user init thread of execution.
|
||||
*/
|
||||
|
||||
svdbg("Starting init thread\n");
|
||||
|
||||
#if defined(CONFIG_BUILTIN_APPS_NUTTX) && defined(CONFIG_BUILTIN_APP_START)
|
||||
init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, (const char **)NULL);
|
||||
#else
|
||||
init_taskid = START_TASK("init", SCHED_PRIORITY_DEFAULT,
|
||||
CONFIG_USERMAIN_STACKSIZE,
|
||||
(main_t)user_start, (const char **)NULL);
|
||||
#endif
|
||||
ASSERT(init_taskid != ERROR);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/os_internal.h
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -248,6 +248,7 @@ extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
extern int os_bringup(void);
|
||||
extern void task_start(void);
|
||||
extern int task_schedsetup(FAR _TCB *tcb, int priority, start_t start,
|
||||
main_t main);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* sched/os_start.c
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -62,12 +62,6 @@
|
||||
#include "clock_internal.h"
|
||||
#include "timer_internal.h"
|
||||
#include "irq_internal.h"
|
||||
#ifdef CONFIG_PAGING
|
||||
# include "pg_internal.h"
|
||||
#endif
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
# include "work_internal.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -238,7 +232,6 @@ static FAR char g_idlename[] = "Idle Task";
|
||||
|
||||
void os_start(void)
|
||||
{
|
||||
int init_taskid;
|
||||
int i;
|
||||
|
||||
slldbg("Entry\n");
|
||||
@ -451,51 +444,9 @@ void os_start(void)
|
||||
|
||||
(void)sched_setupidlefiles(&g_idletcb);
|
||||
|
||||
/* Start the page fill worker thread that will resolve page faults.
|
||||
* This should always be the first thread started because it may
|
||||
* have to resolve page faults in other threads
|
||||
*/
|
||||
/* Create initial tasks and bring-up the system */
|
||||
|
||||
#ifdef CONFIG_PAGING
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
g_pgworker = task_create("pgfill", CONFIG_PAGING_DEFPRIO,
|
||||
CONFIG_PAGING_STACKSIZE,
|
||||
(main_t)pg_worker, (const char **)NULL);
|
||||
#else
|
||||
g_pgworker = task_create("pgfill", CONFIG_PAGING_DEFPRIO,
|
||||
(main_t)pg_worker, (const char **)NULL);
|
||||
#endif
|
||||
ASSERT(g_pgworker != ERROR);
|
||||
#endif
|
||||
|
||||
/* Start the worker thread that will perform misc garbage clean-up */
|
||||
|
||||
#ifdef CONFIG_SCHED_WORKQUEUE
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
g_worker = task_create("work", CONFIG_SCHED_WORKPRIORITY,
|
||||
CONFIG_SCHED_WORKSTACKSIZE,
|
||||
(main_t)work_thread, (const char **)NULL);
|
||||
#else
|
||||
g_worker = task_create("work", CONFIG_SCHED_WORKPRIORITY,
|
||||
(main_t)work_thread, (const char **)NULL);
|
||||
#endif
|
||||
ASSERT(g_worker != ERROR);
|
||||
#endif
|
||||
|
||||
/* Once the operating system has been initialized, the system must be
|
||||
* started by spawning the user init thread of execution.
|
||||
*/
|
||||
|
||||
sdbg("Starting init thread\n");
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
|
||||
CONFIG_USERMAIN_STACKSIZE,
|
||||
(main_t)user_start, (const char **)NULL);
|
||||
#else
|
||||
init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT,
|
||||
(main_t)user_start, (const char **)NULL);
|
||||
#endif
|
||||
ASSERT(init_taskid != ERROR);
|
||||
(void)os_bringup();
|
||||
|
||||
/* When control is return to this point, the system is idle. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user