summaryrefslogtreecommitdiff
path: root/src/components.c
diff options
context:
space:
mode:
authorxph <[email protected]>2020-04-09 16:35:28 +0800
committerGitHub <[email protected]>2020-04-09 16:35:28 +0800
commitca7f01d79b3e0a997c771cec298e4ebd65b75809 (patch)
tree3d2c48aae7203b14038ba7b98b500b5343ed7f2a /src/components.c
parentf763f8e7284b0492c5a65ad0abf94ee1963d7dcc (diff)
parentbaa3145bfe61b3330b6a160523cc5470fa5db3a7 (diff)
Merge pull request #1 from RT-Thread/master
sync rtt
Diffstat (limited to 'src/components.c')
-rw-r--r--src/components.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/components.c b/src/components.c
index 679a88ef11..e7824b65ef 100644
--- a/src/components.c
+++ b/src/components.c
@@ -14,6 +14,7 @@
* 2015-05-04 Bernard Rename it to components.c because compiling issue
* in some IDEs.
* 2015-07-29 Arda.Fu Add support to use RT_USING_USER_MAIN with IAR
+ * 2018-11-22 Jesven Add secondary cpu boot up
*/
#include <rthw.h>
@@ -44,7 +45,7 @@
*
* rti_end --> 6.end
*
- * These automatically initializaiton, the driver or component initial function must
+ * These automatically initialization, the driver or component initial function must
* be defined with:
* INIT_BOARD_EXPORT(fn);
* INIT_DEVICE_EXPORT(fn);
@@ -91,7 +92,7 @@ void rt_components_board_init(void)
rt_kprintf(":%d done\n", result);
}
#else
- const init_fn_t *fn_ptr;
+ volatile const init_fn_t *fn_ptr;
for (fn_ptr = &__rt_init_rti_board_start; fn_ptr < &__rt_init_rti_board_end; fn_ptr++)
{
@@ -109,7 +110,7 @@ void rt_components_init(void)
int result;
const struct rt_init_desc *desc;
- rt_kprintf("do components intialization.\n");
+ rt_kprintf("do components initialization.\n");
for (desc = &__rt_init_desc_rti_board_end; desc < &__rt_init_desc_rti_end; desc ++)
{
rt_kprintf("initialize %s", desc->fn_name);
@@ -117,7 +118,7 @@ void rt_components_init(void)
rt_kprintf(":%d done\n", result);
}
#else
- const init_fn_t *fn_ptr;
+ volatile const init_fn_t *fn_ptr;
for (fn_ptr = &__rt_init_rti_board_end; fn_ptr < &__rt_init_rti_end; fn_ptr ++)
{
@@ -125,6 +126,7 @@ void rt_components_init(void)
}
#endif
}
+#endif /* RT_USING_COMPONENTS_INIT */
#ifdef RT_USING_USER_MAIN
@@ -137,7 +139,6 @@ extern int $Super$$main(void);
/* re-define main function */
int $Sub$$main(void)
{
- rt_hw_interrupt_disable();
rtthread_startup();
return 0;
}
@@ -149,16 +150,13 @@ int __low_level_init(void)
{
// call IAR table copy function.
__iar_data_init3();
- rt_hw_interrupt_disable();
rtthread_startup();
return 0;
}
#elif defined(__GNUC__)
-extern int main(void);
/* Add -eentry to arm-none-eabi-gcc argument */
int entry(void)
{
- rt_hw_interrupt_disable();
rtthread_startup();
return 0;
}
@@ -177,9 +175,13 @@ void main_thread_entry(void *parameter)
extern int main(void);
extern int $Super$$main(void);
+#ifdef RT_USING_COMPONENTS_INIT
/* RT-Thread components initialization */
rt_components_init();
-
+#endif
+#ifdef RT_USING_SMP
+ rt_hw_secondary_cpu_up();
+#endif
/* invoke system main function */
#if defined(__CC_ARM) || defined(__CLANG_ARM)
$Super$$main(); /* for ARMCC. */
@@ -203,7 +205,7 @@ void rt_application_init(void)
result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL,
main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20);
RT_ASSERT(result == RT_EOK);
-
+
/* if not define RT_USING_HEAP, using to eliminate the warning */
(void)result;
#endif
@@ -215,7 +217,7 @@ int rtthread_startup(void)
{
rt_hw_interrupt_disable();
- /* board level initalization
+ /* board level initialization
* NOTE: please initialize heap inside board initialization.
*/
rt_hw_board_init();
@@ -243,6 +245,10 @@ int rtthread_startup(void)
/* idle thread initialization */
rt_thread_idle_init();
+#ifdef RT_USING_SMP
+ rt_hw_spin_lock(&_cpus_lock);
+#endif /*RT_USING_SMP*/
+
/* start scheduler */
rt_system_scheduler_start();
@@ -250,4 +256,3 @@ int rtthread_startup(void)
return 0;
}
#endif
-#endif