Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
add6579d
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
add6579d
编写于
11月 10, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
11月 10, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5258 from greedyhao/ab32
[bsp/bluetrum] add ble support
上级
94a8d54a
cb81d72f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
126 addition
and
13 deletion
+126
-13
bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c
bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c
+73
-0
bsp/bluetrum/ab32vg1-ab-prougen/board/Kconfig
bsp/bluetrum/ab32vg1-ab-prougen/board/Kconfig
+17
-2
bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
+2
-4
bsp/bluetrum/ab32vg1-ab-prougen/link.lds
bsp/bluetrum/ab32vg1-ab-prougen/link.lds
+16
-5
bsp/bluetrum/libraries/hal_drivers/drv_gpio.c
bsp/bluetrum/libraries/hal_drivers/drv_gpio.c
+3
-0
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
+4
-0
bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/SConscript
bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/SConscript
+2
-2
bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c
...aries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c
+4
-0
bsp/bluetrum/libraries/hal_libraries/bmsis/source/startup.S
bsp/bluetrum/libraries/hal_libraries/bmsis/source/startup.S
+5
-0
未找到文件。
bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c
0 → 100644
浏览文件 @
add6579d
/*
* Copyright (c) 2006-2021, Bluetrum Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-15 greedyhao the first version
*/
#include <rtthread.h>
#include <stdint.h>
#include <stddef.h>
#ifdef BSP_USING_NIMBLE
void
nimble_port_run
(
void
);
void
nimble_port_init
(
void
);
int
ble_hci_rtthread_init
(
void
);
void
ble_svc_gap_init
(
void
);
void
ble_store_ram_init
(
void
);
int
blehr_main
(
void
);
void
bb_init
(
void
);
void
bthw_get_heap_info
(
void
**
p_heap
,
uint16_t
**
p_heap_size
,
uint32_t
*
p_block_size
);
typedef
void
(
*
nsmem_cb_init_func
)(
void
*
heap_buf
,
void
*
heap_size_buf
,
uint32_t
mem_block_max
);
#define nsmem_cb_init ((nsmem_cb_init_func)0x84140)
int
btctrl_mem_init
(
void
)
{
void
*
heap_buf
;
uint16_t
*
heap_size_buf
;
uint32_t
block_size
;
bthw_get_heap_info
(
&
heap_buf
,
&
heap_size_buf
,
&
block_size
);
nsmem_cb_init
(
heap_buf
,
heap_size_buf
,
block_size
);
return
0
;
}
INIT_BOARD_EXPORT
(
btctrl_mem_init
);
static
void
blehr_thread_entry
(
void
*
param
)
{
bb_init
();
nimble_port_init
();
ble_hci_rtthread_init
();
ble_svc_gap_init
();
/* XXX Need to have template for store */
ble_store_ram_init
();
blehr_main
();
nimble_port_run
();
}
static
int
blehr_sample
(
void
)
{
rt_thread_t
tid
=
rt_thread_create
(
"blehr"
,
blehr_thread_entry
,
RT_NULL
,
1024
,
15
,
1
);
if
(
tid
!=
RT_NULL
)
{
rt_thread_startup
(
tid
);
}
}
MSH_CMD_EXPORT
(
blehr_sample
,
blehr_sample
);
#endif
bsp/bluetrum/ab32vg1-ab-prougen/board/Kconfig
浏览文件 @
add6579d
...
...
@@ -5,6 +5,10 @@ config SOC_AB32VG1
select PKG_USING_BLUETRUM_SDK
default y
config PKG_USING_BLUETRUM_NIMBLE
bool
default n
menu "Onboard Peripheral Drivers"
menuconfig BSP_USING_AUDIO
...
...
@@ -231,7 +235,18 @@ menu "On-chip Peripheral Drivers"
endmenu
menu "Board extended module Drivers"
endmenu
choice
prompt "BLE STACK"
default BLE_STACK_USING_NULL
help
Select the ble stack
config BLE_STACK_USING_NULL
bool "not use the ble stack"
config BSP_USING_NIMBLE
bool "use nimble stack(iot)"
select PKG_USING_BLUETRUM_NIMBLE
endchoice
endmenu
bsp/bluetrum/ab32vg1-ab-prougen/board/board.c
浏览文件 @
add6579d
...
...
@@ -156,7 +156,6 @@ void cache_init(void)
RT_SECTION
(
".irq.cache"
)
void
os_spiflash_lock
(
void
)
{
// if (rt_thread_self()->stat == RT_THREAD_RUNNING) {
if
((
rt_thread_self
()
!=
RT_NULL
)
&&
(
rt_interrupt_nest
==
0
))
{
rt_mutex_take
(
&
mutex_spiflash
,
RT_WAITING_FOREVER
);
}
...
...
@@ -165,7 +164,6 @@ void os_spiflash_lock(void)
RT_SECTION
(
".irq.cache"
)
void
os_spiflash_unlock
(
void
)
{
// if (rt_thread_self()->stat == RT_THREAD_RUNNING) {
if
((
rt_thread_self
()
!=
RT_NULL
)
&&
(
rt_interrupt_nest
==
0
))
{
rt_mutex_release
(
&
mutex_spiflash
);
}
...
...
@@ -174,7 +172,6 @@ void os_spiflash_unlock(void)
RT_SECTION
(
".irq.cache"
)
void
os_cache_lock
(
void
)
{
// if (rt_thread_self()->stat == RT_THREAD_RUNNING) {
if
((
rt_thread_self
()
!=
RT_NULL
)
&&
(
rt_interrupt_nest
==
0
))
{
rt_mutex_take
(
&
mutex_cache
,
RT_WAITING_FOREVER
);
}
...
...
@@ -183,7 +180,6 @@ void os_cache_lock(void)
RT_SECTION
(
".irq.cache"
)
void
os_cache_unlock
(
void
)
{
// if (rt_thread_self()->stat == RT_THREAD_RUNNING) {
if
((
rt_thread_self
()
!=
RT_NULL
)
&&
(
rt_interrupt_nest
==
0
))
{
rt_mutex_release
(
&
mutex_cache
);
}
...
...
@@ -200,6 +196,8 @@ void rt_hw_console_output(const char *str)
/**
* @brief print exception error
* @note Every message needed to print, must put in .comm exction.
* @note (IRQ in Flash: %x %x - %x %x\n, -, rt_interrupt_nest, PC, miss_addr)
* miss_addr: The address in map file minus 0x10000000
*/
RT_SECTION
(
".irq.err"
)
void
exception_isr
(
void
)
...
...
bsp/bluetrum/ab32vg1-ab-prougen/link.lds
浏览文件 @
add6579d
/* Define the flash max size */
__max_flash_size = 102
4
k;
__max_flash_size = 102
0
k;
__data_ram_size =
8
k;
__data_ram_size =
16
k;
__stack_ram_size = 4k;
__comm_ram_size = 42k;
__heap_ram_size = 70k;
__heap_ram_size = 52k;
__ble_ram_size = 10k;
__base = 0x10000000;
__data_vma = 0x11000;
__bram_vma = 0x11000;
__heap_vma = __bram_vma + __ble_ram_size;
__data_vma = __heap_vma + __heap_ram_size;
__stack_vma = __data_vma + __data_ram_size;
__comm_vma = __stack_vma + __stack_ram_size;
__heap_vma = __comm_vma + __comm_ram_size;
__ram1_vma = 0x50000;
...
...
@@ -21,6 +23,7 @@ MEMORY
flash(rx) : org = __base + 512, len = __max_flash_size
comm(rx) : org = __comm_vma, len = __comm_ram_size
bram : org = __bram_vma, len = __ble_ram_size
data : org = __data_vma, len = __data_ram_size
stack : org = __stack_vma, len = __stack_ram_size
heap : org = __heap_vma, len = __heap_ram_size
...
...
@@ -89,8 +92,16 @@ SECTIONS
*(.data*)
*(.sdata*)
*(.com_text*)
*(.text.ble_mqueue_get)
*(.text.ble_mqueue_put)
*(.text.os_memblock_get)
} > comm AT > flash
.bram __bram_vma (NOLOAD) : {
*(.btmem.bthw)
*(.btmem*)
} > bram
.bss (NOLOAD):
{
__bss_start = .;
...
...
bsp/bluetrum/libraries/hal_drivers/drv_gpio.c
浏览文件 @
add6579d
...
...
@@ -128,6 +128,9 @@ static void ab32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
switch
(
mode
)
{
case
PIN_MODE_INPUT
:
gpio_init
.
pull
=
GPIO_NOPULL
;
gpio_init
.
dir
=
GPIO_DIR_INPUT
;
break
;
case
PIN_MODE_INPUT_PULLUP
:
gpio_init
.
pull
=
GPIO_PULLUP
;
gpio_init
.
dir
=
GPIO_DIR_INPUT
;
...
...
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
浏览文件 @
add6579d
...
...
@@ -16,6 +16,10 @@
#ifdef BSP_USING_ONCHIP_RTC
#if RTTHREAD_VERSION < 40004
#error "RTTHREAD_VERSION is less than 4.0.4"
#endif
//#define DRV_DEBUG
#define LOG_TAG "drv.rtc"
#include <drv_log.h>
...
...
bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/SConscript
浏览文件 @
add6579d
...
...
@@ -48,8 +48,8 @@ ASFLAGS = ""
CPPDEFINES
=
[]
LOCAL_CPPDEFINES
=
[]
LIBS
=
[
'hal'
]
LIBPATH
=
[
CWD
]
LIBS
=
[]
LIBPATH
=
[]
LINKFLAGS
=
""
...
...
bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal_gpio.c
浏览文件 @
add6579d
...
...
@@ -72,12 +72,16 @@ void hal_gpio_init(hal_sfr_t gpiox, gpio_init_t gpio_init)
switch
(
gpio_init
->
pull
)
{
case
GPIO_PULLUP
:
gpiox
[
GPIOxPD
]
&=
~
BIT
(
iocurrent
);
gpiox
[
GPIOxPU
]
|=
BIT
(
iocurrent
);
break
;
case
GPIO_PULLDOWN
:
gpiox
[
GPIOxPU
]
&=
~
BIT
(
iocurrent
);
gpiox
[
GPIOxPD
]
|=
BIT
(
iocurrent
);
break
;
case
GPIO_NOPULL
:
gpiox
[
GPIOxPU
]
&=
~
BIT
(
iocurrent
);
gpiox
[
GPIOxPD
]
&=
~
BIT
(
iocurrent
);
default:
break
;
}
...
...
bsp/bluetrum/libraries/hal_libraries/bmsis/source/startup.S
浏览文件 @
add6579d
...
...
@@ -96,6 +96,11 @@ __exception:
mret
#endif
.
org
0x1e0
1:
j
1
b
nop
mret
.
global
cpu_irq_comm
cpu_irq_comm
:
la
a5
,
__irq_stack
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录