[bsp/raspberry-pico] add: SMP (#6888)

This commit is contained in:
螺丝松掉的人
2023-02-02 12:19:33 +08:00
committed by GitHub
parent 4d6ceffcab
commit 6d00b28425
8 changed files with 620 additions and 4 deletions
+20 -2
View File
@@ -1,11 +1,12 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-01-28 flybreak first version
* 2023-01-22 rose_man add RT_USING_SMP
*/
#include <rthw.h>
@@ -21,12 +22,16 @@
void isr_systick(void)
{
/* enter interrupt */
#ifndef RT_USING_SMP
rt_interrupt_enter();
#endif
rt_tick_increase();
/* leave interrupt */
#ifndef RT_USING_SMP
rt_interrupt_leave();
#endif
}
uint32_t systick_config(uint32_t ticks)
@@ -47,7 +52,14 @@ void rt_hw_board_init()
{
set_sys_clock_khz(PLL_SYS_KHZ, true);
#ifdef RT_USING_HEAP
rt_system_heap_init(HEAP_BEGIN, HEAP_END);
#endif
#ifdef RT_USING_SMP
extern rt_hw_spinlock_t _cpus_lock;
rt_hw_spin_lock_init(&_cpus_lock);
#endif
alarm_pool_init_default();
@@ -64,10 +76,16 @@ void rt_hw_board_init()
}
/* Configure the SysTick */
systick_config(frequency_count_khz(CLOCKS_FC0_SRC_VALUE_PLL_SYS_CLKSRC_PRIMARY) * 1000 / RT_TICK_PER_SECOND);
systick_config(frequency_count_khz(CLOCKS_FC0_SRC_VALUE_ROSC_CLKSRC)*10000/RT_TICK_PER_SECOND);
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_SERIAL
stdio_init_all();
rt_hw_uart_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
+23
View File
@@ -0,0 +1,23 @@
# RT-Thread building script for component
from building import *
Import('rtconfig')
cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
if rtconfig.PLATFORM in ['armcc', 'armclang']:
src += Glob('*_rvds.S')
if rtconfig.PLATFORM in ['gcc']:
src += Glob('*_init.S')
src += Glob('*_gcc.S')
if rtconfig.PLATFORM in ['iccarm']:
src += Glob('*_iar.S')
group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-01-22 rose_man add RT_USING_SMP
*/
#ifndef CPUPORT_H__
#define CPUPORT_H__
typedef union {
unsigned long slock;
struct __arch_tickets {
unsigned short owner;
unsigned short next;
} tickets;
} rt_hw_spinlock_t;
#endif /*CPUPORT_H__*/
+4
View File
@@ -7,6 +7,8 @@ cwd = GetCurrentDir()
# The set of source files associated with this SConscript file.
src = Split("""
pico-sdk/src/rp2_common/hardware_flash/flash.c
pico-sdk/src/rp2_common/pico_multicore/multicore.c
pico-sdk/src/rp2_common/pico_stdlib/stdlib.c
pico-sdk/src/rp2_common/hardware_gpio/gpio.c
pico-sdk/src/rp2_common/hardware_claim/claim.c
@@ -59,6 +61,8 @@ generated/bs2_default_padded_checksummed.S
""")
path = [
cwd + '/pico-sdk/src/rp2_common/hardware_flash/include',
cwd + '/pico-sdk/src/rp2_common/pico_multicore/include',
cwd + '/pico-sdk/src/common/pico_stdlib/include',
cwd + '/pico-sdk/src/rp2_common/hardware_gpio/include',
cwd + '/pico-sdk/src/common/pico_base/include',
+1 -1
View File
@@ -3,7 +3,7 @@ import sys
# toolchains options
ARCH='arm'
CPU='cortex-m0'
CPU='cortex-m0-dual'
CROSS_TOOL='gcc'
# bsp lib config