Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
混口饭吃,
rt-thread
提交
342b0a3b
R
rt-thread
项目概览
混口饭吃,
/
rt-thread
与 Fork 源项目一致
Fork自
Mr_Pangza / rt-thread
通知
1
Star
0
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,发现更多精彩内容 >>
未验证
提交
342b0a3b
编写于
4月 09, 2021
作者:
mysterywolf
提交者:
GitHub
4月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #36 from RT-Thread/master
pr
上级
f0157360
31cb379d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
83 addition
and
30 deletion
+83
-30
.github/workflows/file_check.yml
.github/workflows/file_check.yml
+1
-1
.ignore_format.yml
.ignore_format.yml
+9
-0
bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c
bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c
+6
-2
components/drivers/include/drivers/sensor.h
components/drivers/include/drivers/sensor.h
+1
-3
libcpu/arm/cortex-a/trap.c
libcpu/arm/cortex-a/trap.c
+5
-11
tools/file_check.py
tools/file_check.py
+61
-13
未找到文件。
.github/workflows/file_check.yml
浏览文件 @
342b0a3b
...
...
@@ -16,5 +16,5 @@ jobs:
-
name
:
Check Format and License
shell
:
bash
run
:
|
pip install click chardet
pip install click chardet
PyYaml
python tools/file_check.py check 'https://github.com/RT-Thread/rt-thread' 'master'
.ignore_format.yml
0 → 100644
浏览文件 @
342b0a3b
# files format check exclude path, please follow the instructions below to modify;
# If you need to exclude an entire folder, add the folder path in dir_path;
# If you need to exclude a file, add the path to the file in file_path.
file_path
:
-
bsp/allwinner_tina/libcpu/cpu.c
dir_path
:
-
tools
\ No newline at end of file
bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c
浏览文件 @
342b0a3b
...
...
@@ -54,7 +54,7 @@ struct rthw_sdio
};
/* SYSRAM SDMMC1/2 accesses */
#define SDCARD_ADDR 0x2FF
C0
000
#define SDCARD_ADDR 0x2FF
FF
000
#if defined(__CC_ARM) || defined(__CLANG_ARM)
__attribute__
((
at
(
SDCARD_ADDR
)))
static
rt_uint8_t
cache_buf
[
SDIO_BUFF_SIZE
];
#elif defined ( __GNUC__ )
...
...
@@ -579,7 +579,11 @@ int rt_hw_sdio_init(void)
#endif
#ifdef BSP_USING_SDIO2
MX_RTC_Init
();
if
(
IS_ENGINEERING_BOOT_MODE
())
{
MX_RTC_Init
();
}
LBEE5KL1DX_init
();
struct
stm32_sdio_des
sdio_des2
;
...
...
components/drivers/include/drivers/sensor.h
浏览文件 @
342b0a3b
...
...
@@ -90,8 +90,6 @@ extern "C" {
#define RT_SENSOR_UNIT_PPB (15)
/* Concentration unit: ppb */
#define RT_SENSOR_UNIT_DMS (16)
/* Coordinates unit: DMS */
#define RT_SENSOR_UNIT_DD (17)
/* Coordinates unit: DD */
#define RT_SENSOR_UNIT_PERCENT (18)
/* Percentage unit: % */
/* Sensor communication interface types */
#define RT_SENSOR_INTF_I2C (1 << 0)
...
...
@@ -219,7 +217,7 @@ struct rt_sensor_data
rt_int32_t
force
;
/* Force sensor. unit: mN */
rt_uint32_t
dust
;
/* Dust sensor. unit: ug/m3 */
rt_uint32_t
eco2
;
/* eCO2 sensor. unit: ppm */
rt_uint32_t
spo2
;
/* SpO2 sensor. unit:
%
*/
rt_uint32_t
spo2
;
/* SpO2 sensor. unit:
permillage
*/
}
data
;
};
...
...
libcpu/arm/cortex-a/trap.c
浏览文件 @
342b0a3b
...
...
@@ -47,30 +47,24 @@ void rt_hw_trap_undef(struct rt_hw_exp_stack *regs)
{
#ifdef RT_USING_FPU
{
uint32_t
ins
;
uint32_t
val
;
uint32_t
addr
;
if
(
regs
->
cpsr
&
(
1
<<
5
))
{
/* thumb mode */
addr
=
regs
->
pc
-
2
;
ins
=
(
uint32_t
)
*
(
uint16_t
*
)
addr
;
if
((
ins
&
(
3
<<
11
))
!=
0
)
{
/* 32 bit ins */
ins
<<=
16
;
ins
+=
*
(
uint16_t
*
)(
addr
+
2
);
}
}
else
{
addr
=
regs
->
pc
-
4
;
ins
=
*
(
uint32_t
*
)
addr
;
}
if
((
ins
&
0xe00
)
==
0xa00
)
asm
volatile
(
"vmrs %0, fpexc"
:
"=r"
(
val
)
::
"memory"
);
if
(
!
(
val
&
0x40000000
))
{
/* float ins */
uint32_t
val
=
(
1U
<<
30
);
val
=
(
1U
<<
30
);
asm
volatile
(
"vmsr fpexc, %0"
::
"r"
(
val
)
:
"memory"
);
regs
->
pc
=
addr
;
...
...
tools/file_check.py
浏览文件 @
342b0a3b
...
...
@@ -12,6 +12,7 @@ import os
import
re
import
sys
import
click
import
yaml
import
chardet
import
logging
import
datetime
...
...
@@ -25,18 +26,63 @@ def init_logger():
datefmt
=
date_format
,
)
class
CheckOut
:
def
__init__
(
self
,
rtt_repo
,
rtt_branch
):
self
.
root
=
os
.
getcwd
()
self
.
rtt_repo
=
rtt_repo
self
.
rtt_branch
=
rtt_branch
def
__exclude_file
(
self
,
file_path
):
dir_number
=
file_path
.
split
(
'/'
)
ignore_path
=
file_path
# gets the file path depth.
for
i
in
dir_number
:
# current directory.
dir_name
=
os
.
path
.
dirname
(
ignore_path
)
ignore_path
=
dir_name
# judge the ignore file exists in the current directory.
ignore_file_path
=
os
.
path
.
join
(
dir_name
,
".ignore_format.yml"
)
if
not
os
.
path
.
exists
(
ignore_file_path
):
continue
try
:
with
open
(
ignore_file_path
)
as
f
:
ignore_config
=
yaml
.
safe_load
(
f
.
read
())
file_ignore
=
ignore_config
.
get
(
"file_path"
,
[])
dir_ignore
=
ignore_config
.
get
(
"dir_path"
,
[])
except
Exception
as
e
:
logging
.
error
(
e
)
continue
try
:
# judge file_path in the ignore file.
for
file
in
file_ignore
:
if
file
is
not
None
:
file_real_path
=
os
.
path
.
join
(
dir_name
,
file
)
if
file_real_path
==
file_path
:
logging
.
info
(
"ignore file path: {}"
.
format
(
file_real_path
))
return
0
file_dir_path
=
os
.
path
.
dirname
(
file_path
)
for
_dir
in
dir_ignore
:
if
_dir
is
not
None
:
dir_real_path
=
os
.
path
.
join
(
dir_name
,
_dir
)
if
dir_real_path
==
file_dir_path
:
logging
.
info
(
"ignore dir path: {}"
.
format
(
dir_real_path
))
return
0
except
Exception
as
e
:
logging
.
error
(
e
)
continue
return
1
def
get_new_file
(
self
):
file_list
=
list
()
try
:
os
.
system
(
'git remote add rtt_repo {}'
.
format
(
self
.
rtt_repo
))
os
.
system
(
'git fetch rtt_repo'
)
os
.
system
(
'git reset rtt_repo/{} --soft'
.
format
(
self
.
rtt_branch
))
os
.
system
(
'git remote add rtt_repo {}
1>/dev/null
'
.
format
(
self
.
rtt_repo
))
os
.
system
(
'git fetch rtt_repo
1>/dev/null
'
)
os
.
system
(
'git reset rtt_repo/{} --soft
1>/dev/null
'
.
format
(
self
.
rtt_branch
))
os
.
system
(
'git status > git.txt'
)
except
Exception
as
e
:
logging
.
error
(
e
)
...
...
@@ -60,7 +106,9 @@ class CheckOut:
else
:
continue
file_list
.
append
(
file_path
)
result
=
self
.
__exclude_file
(
file_path
)
if
result
!=
0
:
file_list
.
append
(
file_path
)
return
file_list
...
...
@@ -69,7 +117,7 @@ class FormatCheck:
def
__init__
(
self
,
file_list
):
self
.
file_list
=
file_list
def
__check_file
(
self
,
file_lines
):
def
__check_file
(
self
,
file_lines
,
file_path
):
line_num
=
1
check_result
=
False
for
line
in
file_lines
:
...
...
@@ -77,12 +125,12 @@ class FormatCheck:
line_start
=
line
.
replace
(
' '
,
''
)
# find tab
if
line_start
.
startswith
(
'
\t
'
):
logging
.
error
(
"
line[{}]: please use space replace tab at the start of this line."
.
format
(
line_num
))
logging
.
error
(
"
{} line[{}]: please use space replace tab at the start of this line."
.
format
(
file_path
,
line_num
))
check_result
=
False
# check line end
lin_end
=
line
.
split
(
'
\n
'
)[
0
]
if
lin_end
.
endswith
(
' '
)
or
lin_end
.
endswith
(
'
\t
'
):
logging
.
error
(
"
line[{}]: please delete extra space at the end of this line."
.
format
(
line_num
))
logging
.
error
(
"
{} line[{}]: please delete extra space at the end of this line."
.
format
(
file_path
,
line_num
))
check_result
=
False
line_num
+=
1
...
...
@@ -96,13 +144,11 @@ class FormatCheck:
encoding_check_result
=
True
format_check_result
=
True
for
file_path
in
self
.
file_list
:
file_lines
=
''
code
=
''
if
file_path
.
endswith
(
".c"
)
or
file_path
.
endswith
(
".h"
):
try
:
with
open
(
file_path
,
'r'
)
as
f
:
with
open
(
file_path
,
'r
b
'
)
as
f
:
file
=
f
.
read
()
file_lines
=
f
.
readlines
()
# get file encoding
code
=
chardet
.
detect
(
file
)[
'encoding'
]
except
Exception
as
e
:
...
...
@@ -116,7 +162,9 @@ class FormatCheck:
else
:
logging
.
info
(
'[{0}]: encoding check success.'
.
format
(
file_path
))
format_check_result
=
self
.
__check_file
(
file_lines
)
with
open
(
file_path
,
'r'
)
as
f
:
file_lines
=
f
.
readlines
()
format_check_result
=
self
.
__check_file
(
file_lines
,
file_path
)
if
not
encoding_check_result
or
not
format_check_result
:
logging
.
error
(
"files format check fail."
)
...
...
@@ -155,8 +203,8 @@ class LicenseCheck:
true_year
=
'2006-{}'
.
format
(
current_year
)
if
license_year
!=
true_year
:
logging
.
warning
(
"[{0}]: license year: {} is not true: {}, please update."
.
format
(
file_path
,
license_year
,
true_year
))
license_year
,
true_year
))
else
:
logging
.
info
(
"[{0}]: license check success."
.
format
(
file_path
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录