Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
c352c2be
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
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,发现更多精彩内容 >>
未验证
提交
c352c2be
编写于
7月 19, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
7月 19, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2844 from ErnestChen1/drv_crypto
[drivers][crypto]add device CRC/RNG
上级
badac517
9333bbad
变更
48
隐藏空白更改
内联
并排
Showing
48 changed file
with
475 addition
and
33 deletion
+475
-33
bsp/stm32/libraries/HAL_Drivers/Kconfig
bsp/stm32/libraries/HAL_Drivers/Kconfig
+23
-0
bsp/stm32/libraries/HAL_Drivers/SConscript
bsp/stm32/libraries/HAL_Drivers/SConscript
+4
-1
bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
+327
-0
bsp/stm32/libraries/HAL_Drivers/drv_crypto.h
bsp/stm32/libraries/HAL_Drivers/drv_crypto.h
+16
-0
bsp/stm32/libraries/templates/stm32f0xx/board/Kconfig
bsp/stm32/libraries/templates/stm32f0xx/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32f10x/board/Kconfig
bsp/stm32/libraries/templates/stm32f10x/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32f2xx/board/Kconfig
bsp/stm32/libraries/templates/stm32f2xx/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32f4xx/board/Kconfig
bsp/stm32/libraries/templates/stm32f4xx/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32f7xx/board/Kconfig
bsp/stm32/libraries/templates/stm32f7xx/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32h7xx/board/Kconfig
bsp/stm32/libraries/templates/stm32h7xx/board/Kconfig
+2
-1
bsp/stm32/libraries/templates/stm32l4xx/board/Kconfig
bsp/stm32/libraries/templates/stm32l4xx/board/Kconfig
+2
-1
bsp/stm32/stm32f072-st-nucleo/board/Kconfig
bsp/stm32/stm32f072-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32f091-st-nucleo/board/Kconfig
bsp/stm32/stm32f091-st-nucleo/board/Kconfig
+2
-0
bsp/stm32/stm32f103-atk-nano/board/Kconfig
bsp/stm32/stm32f103-atk-nano/board/Kconfig
+3
-1
bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
+3
-1
bsp/stm32/stm32f103-dofly-M3S/board/Kconfig
bsp/stm32/stm32f103-dofly-M3S/board/Kconfig
+2
-1
bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig
bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig
+2
-1
bsp/stm32/stm32f103-fire-arbitrary/board/Kconfig
bsp/stm32/stm32f103-fire-arbitrary/board/Kconfig
+2
-1
bsp/stm32/stm32f103-gizwits-gokitv21/board/Kconfig
bsp/stm32/stm32f103-gizwits-gokitv21/board/Kconfig
+2
-1
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
+2
-0
bsp/stm32/stm32f103-mini-system/board/Kconfig
bsp/stm32/stm32f103-mini-system/board/Kconfig
+2
-1
bsp/stm32/stm32f103-yf-ufun/board/Kconfig
bsp/stm32/stm32f103-yf-ufun/board/Kconfig
+2
-1
bsp/stm32/stm32f107-uc-eval/board/Kconfig
bsp/stm32/stm32f107-uc-eval/board/Kconfig
+2
-1
bsp/stm32/stm32f401-st-nucleo/board/Kconfig
bsp/stm32/stm32f401-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32f405-smdz-breadfruit/board/Kconfig
bsp/stm32/stm32f405-smdz-breadfruit/board/Kconfig
+2
-1
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
+2
-1
bsp/stm32/stm32f407-st-discovery/board/Kconfig
bsp/stm32/stm32f407-st-discovery/board/Kconfig
+2
-1
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
+2
-0
bsp/stm32/stm32f429-atk-apollo/board/Kconfig
bsp/stm32/stm32f429-atk-apollo/board/Kconfig
+2
-0
bsp/stm32/stm32f429-fire-challenger/board/Kconfig
bsp/stm32/stm32f429-fire-challenger/board/Kconfig
+2
-0
bsp/stm32/stm32f446-st-nucleo/board/Kconfig
bsp/stm32/stm32f446-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32f469-st-disco/board/Kconfig
bsp/stm32/stm32f469-st-disco/board/Kconfig
+2
-0
bsp/stm32/stm32f746-st-disco/board/Kconfig
bsp/stm32/stm32f746-st-disco/board/Kconfig
+2
-0
bsp/stm32/stm32f767-atk-apollo/board/Kconfig
bsp/stm32/stm32f767-atk-apollo/board/Kconfig
+3
-1
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
+2
-0
bsp/stm32/stm32f767-st-nucleo/board/Kconfig
bsp/stm32/stm32f767-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32g071-st-nucleo/board/Kconfig
bsp/stm32/stm32g071-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
+3
-0
bsp/stm32/stm32l053-st-nucleo/board/Kconfig
bsp/stm32/stm32l053-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32l432-st-nucleo/board/Kconfig
bsp/stm32/stm32l432-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32l452-st-nucleo/board/Kconfig
bsp/stm32/stm32l452-st-nucleo/board/Kconfig
+2
-1
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
+3
-1
bsp/stm32/stm32l475-st-discovery/board/Kconfig
bsp/stm32/stm32l475-st-discovery/board/Kconfig
+2
-0
bsp/stm32/stm32l476-st-nucleo/board/Kconfig
bsp/stm32/stm32l476-st-nucleo/board/Kconfig
+2
-0
bsp/stm32/stm32l496-ali-developer/board/Kconfig
bsp/stm32/stm32l496-ali-developer/board/Kconfig
+3
-1
bsp/stm32/stm32l4r9-st-eval/board/Kconfig
bsp/stm32/stm32l4r9-st-eval/board/Kconfig
+2
-1
tools/mkdist.py
tools/mkdist.py
+13
-0
未找到文件。
bsp/stm32/libraries/HAL_Drivers/Kconfig
0 → 100644
浏览文件 @
c352c2be
config BSP_USING_CRC
bool "Enable CRC (CRC-32 0x04C11DB7 Polynomial)"
select RT_USING_HWCRYPTO
select RT_HWCRYPTO_USING_CRC
# "Crypto device frame dose not support above 8-bits granularity"
# "Reserve progress, running well, about 32-bits granularity, such as stm32f1, stm32f4"
depends on (SOC_SERIES_STM32L4 || SOC_SERIES_STM32F0 || SOC_SERIES_STM32F7 || SOC_SERIES_STM32H7)
default n
config BSP_USING_RNG
bool "Enable RNG (Random Number Generator)"
select RT_USING_HWCRYPTO
select RT_HWCRYPTO_USING_RNG
depends on (SOC_SERIES_STM32L4 || SOC_SERIES_STM32F4 || SOC_SERIES_STM32F7 || \
SOC_SERIES_STM32H7)
default n
config BSP_USING_UDID
bool "Enable UDID (Unique Device Identifier)"
select RT_USING_HWCRYPTO
default n
bsp/stm32/libraries/HAL_Drivers/SConscript
浏览文件 @
c352c2be
...
...
@@ -72,7 +72,10 @@ if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F7']):
if
GetDepend
([
'BSP_USING_ON_CHIP_FLASH'
,
'SOC_SERIES_STM32L4'
]):
src
+=
[
'drv_flash/drv_flash_l4.c'
]
if
GetDepend
(
'RT_USING_HWCRYPTO'
):
src
+=
[
'drv_crypto.c'
]
if
GetDepend
([
'BSP_USING_WDT'
]):
src
+=
[
'drv_wdt.c'
]
...
...
bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
0 → 100644
浏览文件 @
c352c2be
/*
* Copyright (c) 2019 Winner Microelectronics Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-07-10 Ernest 1st version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <stdlib.h>
#include <string.h>
#include "drv_crypto.h"
#include "board.h"
struct
stm32_hwcrypto_device
{
struct
rt_hwcrypto_device
dev
;
struct
rt_mutex
mutex
;
};
#if defined(BSP_USING_CRC)
struct
hash_ctx_des
{
CRC_HandleTypeDef
contex
;
};
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7)
static
struct
hwcrypto_crc_cfg
crc_backup_cfg
;
static
int
reverse_bit
(
rt_uint32_t
n
)
{
n
=
((
n
>>
1
)
&
0x55555555
)
|
((
n
<<
1
)
&
0xaaaaaaaa
);
n
=
((
n
>>
2
)
&
0x33333333
)
|
((
n
<<
2
)
&
0xcccccccc
);
n
=
((
n
>>
4
)
&
0x0f0f0f0f
)
|
((
n
<<
4
)
&
0xf0f0f0f0
);
n
=
((
n
>>
8
)
&
0x00ff00ff
)
|
((
n
<<
8
)
&
0xff00ff00
);
n
=
((
n
>>
16
)
&
0x0000ffff
)
|
((
n
<<
16
)
&
0xffff0000
);
return
n
;
}
#endif
/* defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7) */
static
rt_uint32_t
_crc_update
(
struct
hwcrypto_crc
*
ctx
,
const
rt_uint8_t
*
in
,
rt_size_t
length
)
{
rt_uint32_t
result
=
0
;
struct
stm32_hwcrypto_device
*
stm32_hw_dev
=
(
struct
stm32_hwcrypto_device
*
)
ctx
->
parent
.
device
->
user_data
;
#if defined(SOC_SERIES_STM32L4)|| defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7)
CRC_HandleTypeDef
*
HW_TypeDef
=
(
CRC_HandleTypeDef
*
)(
ctx
->
parent
.
contex
);
#endif
rt_mutex_take
(
&
stm32_hw_dev
->
mutex
,
RT_WAITING_FOREVER
);
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7)
if
(
memcmp
(
&
crc_backup_cfg
,
&
ctx
->
crc_cfg
,
sizeof
(
struct
hwcrypto_crc_cfg
))
!=
0
)
{
if
(
HW_TypeDef
->
Init
.
DefaultPolynomialUse
==
DEFAULT_POLYNOMIAL_DISABLE
)
{
HW_TypeDef
->
Init
.
GeneratingPolynomial
=
ctx
->
crc_cfg
.
poly
;
}
else
{
HW_TypeDef
->
Init
.
GeneratingPolynomial
=
DEFAULT_CRC32_POLY
;
}
switch
(
ctx
->
crc_cfg
.
flags
)
{
case
0
:
HW_TypeDef
->
Init
.
InputDataInversionMode
=
CRC_INPUTDATA_INVERSION_NONE
;
HW_TypeDef
->
Init
.
OutputDataInversionMode
=
CRC_OUTPUTDATA_INVERSION_DISABLE
;
break
;
case
CRC_FLAG_REFIN
:
HW_TypeDef
->
Init
.
InputDataInversionMode
=
CRC_INPUTDATA_INVERSION_BYTE
;
break
;
case
CRC_FLAG_REFOUT
:
HW_TypeDef
->
Init
.
OutputDataInversionMode
=
CRC_OUTPUTDATA_INVERSION_ENABLE
;
break
;
case
CRC_FLAG_REFIN
|
CRC_FLAG_REFOUT
:
HW_TypeDef
->
Init
.
InputDataInversionMode
=
CRC_INPUTDATA_INVERSION_BYTE
;
HW_TypeDef
->
Init
.
OutputDataInversionMode
=
CRC_OUTPUTDATA_INVERSION_ENABLE
;
break
;
default
:
goto
_exit
;
}
HW_TypeDef
->
Init
.
CRCLength
=
ctx
->
crc_cfg
.
width
;
if
(
HW_TypeDef
->
Init
.
DefaultInitValueUse
==
DEFAULT_INIT_VALUE_DISABLE
)
{
HW_TypeDef
->
Init
.
InitValue
=
ctx
->
crc_cfg
.
last_val
;
}
if
(
HAL_CRC_Init
(
HW_TypeDef
)
!=
HAL_OK
)
{
goto
_exit
;
}
memcpy
(
&
crc_backup_cfg
,
&
ctx
->
crc_cfg
,
sizeof
(
struct
hwcrypto_crc_cfg
));
}
if
(
HAL_CRC_STATE_READY
!=
HAL_CRC_GetState
(
HW_TypeDef
))
{
goto
_exit
;
}
#else
if
(
ctx
->
crc_cfg
.
flags
!=
0
||
ctx
->
crc_cfg
.
last_val
!=
0xFFFFFFFF
||
ctx
->
crc_cfg
.
xorout
!=
0
||
length
%
4
!=
0
)
{
goto
_exit
;
}
length
/=
4
;
#endif
/* defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7) */
result
=
HAL_CRC_Accumulate
(
ctx
->
parent
.
contex
,
(
rt_uint32_t
*
)
in
,
length
);
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7)
if
(
HW_TypeDef
->
Init
.
OutputDataInversionMode
)
{
ctx
->
crc_cfg
.
last_val
=
reverse_bit
(
result
);
}
else
{
ctx
->
crc_cfg
.
last_val
=
result
;
}
crc_backup_cfg
.
last_val
=
ctx
->
crc_cfg
.
last_val
;
result
=
(
result
?
result
^
(
ctx
->
crc_cfg
.
xorout
)
:
result
);
#endif
/* defined(SOC_SERIES_STM32L4)|| defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7) */
_exit:
rt_mutex_release
(
&
stm32_hw_dev
->
mutex
);
return
result
;
}
static
const
struct
hwcrypto_crc_ops
crc_ops
=
{
.
update
=
_crc_update
,
};
#endif
/* BSP_USING_CRC */
#if defined(BSP_USING_RNG)
static
rt_uint32_t
_rng_rand
(
struct
hwcrypto_rng
*
ctx
)
{
rt_uint32_t
gen_random
=
0
;
RNG_HandleTypeDef
*
HW_TypeDef
=
(
RNG_HandleTypeDef
*
)(
ctx
->
parent
.
contex
);
if
(
HAL_OK
==
HAL_RNG_GenerateRandomNumber
(
HW_TypeDef
,
&
gen_random
))
{
return
gen_random
;
}
return
0
;
}
static
const
struct
hwcrypto_rng_ops
rng_ops
=
{
.
update
=
_rng_rand
,
};
#endif
/* BSP_USING_RNG */
static
rt_err_t
_crypto_create
(
struct
rt_hwcrypto_ctx
*
ctx
)
{
rt_err_t
res
=
RT_EOK
;
switch
(
ctx
->
type
&
HWCRYPTO_MAIN_TYPE_MASK
)
{
#if defined(BSP_USING_RNG)
case
HWCRYPTO_TYPE_RNG
:
{
RNG_HandleTypeDef
*
hrng
=
rt_calloc
(
1
,
sizeof
(
RNG_HandleTypeDef
));
hrng
->
Instance
=
RNG
;
HAL_RNG_Init
(
hrng
);
ctx
->
contex
=
hrng
;
((
struct
hwcrypto_rng
*
)
ctx
)
->
ops
=
&
rng_ops
;
break
;
}
#endif
/* BSP_USING_RNG */
#if defined(BSP_USING_CRC)
case
HWCRYPTO_TYPE_CRC
:
{
CRC_HandleTypeDef
*
hcrc
=
rt_calloc
(
1
,
sizeof
(
CRC_HandleTypeDef
));
if
(
RT_NULL
==
hcrc
)
{
res
=
-
RT_ERROR
;
break
;
}
hcrc
->
Instance
=
CRC
;
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7)
hcrc
->
Init
.
DefaultPolynomialUse
=
DEFAULT_POLYNOMIAL_ENABLE
;
hcrc
->
Init
.
DefaultInitValueUse
=
DEFAULT_INIT_VALUE_DISABLE
;
hcrc
->
Init
.
InputDataInversionMode
=
CRC_INPUTDATA_INVERSION_BYTE
;
hcrc
->
Init
.
OutputDataInversionMode
=
CRC_OUTPUTDATA_INVERSION_ENABLE
;
hcrc
->
InputDataFormat
=
CRC_INPUTDATA_FORMAT_BYTES
;
#else
if
(
HAL_CRC_Init
(
hcrc
)
!=
HAL_OK
)
{
res
=
-
RT_ERROR
;
}
#endif
/* defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32F7) */
ctx
->
contex
=
hcrc
;
((
struct
hwcrypto_crc
*
)
ctx
)
->
ops
=
&
crc_ops
;
break
;
}
#endif
/* BSP_USING_CRC */
default:
res
=
-
RT_ERROR
;
break
;
}
return
res
;
}
static
void
_crypto_destroy
(
struct
rt_hwcrypto_ctx
*
ctx
)
{
switch
(
ctx
->
type
&
HWCRYPTO_MAIN_TYPE_MASK
)
{
#if defined(BSP_USING_RNG)
case
HWCRYPTO_TYPE_RNG
:
break
;
#endif
/* BSP_USING_RNG */
#if defined(BSP_USING_CRC)
case
HWCRYPTO_TYPE_CRC
:
__HAL_CRC_DR_RESET
((
CRC_HandleTypeDef
*
)
ctx
->
contex
);
HAL_CRC_DeInit
((
CRC_HandleTypeDef
*
)(
ctx
->
contex
));
break
;
#endif
/* BSP_USING_CRC */
default:
break
;
}
rt_free
(
ctx
->
contex
);
}
static
rt_err_t
_crypto_clone
(
struct
rt_hwcrypto_ctx
*
des
,
const
struct
rt_hwcrypto_ctx
*
src
)
{
rt_err_t
res
=
RT_EOK
;
switch
(
src
->
type
&
HWCRYPTO_MAIN_TYPE_MASK
)
{
#if defined(BSP_USING_RNG)
case
HWCRYPTO_TYPE_RNG
:
if
(
des
->
contex
&&
src
->
contex
)
{
rt_memcpy
(
des
->
contex
,
src
->
contex
,
sizeof
(
struct
hash_ctx_des
));
}
break
;
#endif
/* BSP_USING_RNG */
#if defined(BSP_USING_CRC)
case
HWCRYPTO_TYPE_CRC
:
if
(
des
->
contex
&&
src
->
contex
)
{
rt_memcpy
(
des
->
contex
,
src
->
contex
,
sizeof
(
struct
hash_ctx_des
));
}
break
;
#endif
/* BSP_USING_CRC */
default:
res
=
-
RT_ERROR
;
break
;
}
return
res
;
}
static
void
_crypto_reset
(
struct
rt_hwcrypto_ctx
*
ctx
)
{
switch
(
ctx
->
type
&
HWCRYPTO_MAIN_TYPE_MASK
)
{
#if defined(BSP_USING_RNG)
case
HWCRYPTO_TYPE_RNG
:
break
;
#endif
/* BSP_USING_RNG */
#if defined(BSP_USING_CRC)
case
HWCRYPTO_TYPE_CRC
:
__HAL_CRC_DR_RESET
((
CRC_HandleTypeDef
*
)
ctx
->
contex
);
break
;
#endif
/* BSP_USING_CRC */
default:
break
;
}
}
static
const
struct
rt_hwcrypto_ops
_ops
=
{
.
create
=
_crypto_create
,
.
destroy
=
_crypto_destroy
,
.
copy
=
_crypto_clone
,
.
reset
=
_crypto_reset
,
};
int
stm32_hw_crypto_device_init
(
void
)
{
static
struct
stm32_hwcrypto_device
_crypto_dev
;
rt_uint32_t
cpuid
[
3
]
=
{
0
};
_crypto_dev
.
dev
.
ops
=
&
_ops
;
#if defined(BSP_USING_UDID)
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F7)
cpuid
[
0
]
=
HAL_GetUIDw0
();
cpuid
[
1
]
=
HAL_GetUIDw1
();
#elif defined(SOC_SERIES_STM32F1)
HAL_GetUID
(
cpuid
);
#elif defined(SOC_SERIES_STM32H7)
cpuid
[
0
]
=
HAL_GetREVID
();
cpuid
[
1
]
=
HAL_GetDEVID
();
#endif
#endif
/* BSP_USING_UDID */
_crypto_dev
.
dev
.
id
=
0
;
rt_memcpy
(
&
_crypto_dev
.
dev
.
id
,
cpuid
,
8
);
_crypto_dev
.
dev
.
user_data
=
&
_crypto_dev
;
if
(
rt_hwcrypto_register
(
&
_crypto_dev
.
dev
,
RT_HWCRYPTO_DEFAULT_NAME
)
!=
RT_EOK
)
{
return
-
1
;
}
rt_mutex_init
(
&
_crypto_dev
.
mutex
,
RT_HWCRYPTO_DEFAULT_NAME
,
RT_IPC_FLAG_FIFO
);
return
0
;
}
INIT_DEVICE_EXPORT
(
stm32_hw_crypto_device_init
);
bsp/stm32/libraries/HAL_Drivers/drv_crypto.h
0 → 100644
浏览文件 @
c352c2be
/*
* Copyright (c) 2019 Winner Microelectronics Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-07-10 Ernest 1st version
*/
#ifndef __DRV_CRYPTO_H__
#define __DRV_CRYPTO_H__
int
l4_hw_crypto_device_init
(
void
);
#endif
/* __DRV_CRYPTO_H__ */
bsp/stm32/libraries/templates/stm32f0xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32f10x/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32f2xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32f4xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32f7xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32h7xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -26,7 +26,8 @@ menu "On-chip Peripheral Drivers"
default y
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/libraries/templates/stm32l4xx/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 176
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f072-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -77,7 +77,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f091-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -156,6 +156,8 @@ menu "On-chip Peripheral Drivers"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-atk-nano/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -200,7 +200,9 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -200,7 +200,9 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-dofly-M3S/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -125,7 +125,8 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SDIO
select RT_USING_DFS
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -30,7 +30,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-fire-arbitrary/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -288,7 +288,8 @@ menu "On-chip Peripheral Drivers"
bool "using CAN1"
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-gizwits-gokitv21/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-hw100k-ibox/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -215,6 +215,8 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-mini-system/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f103-yf-ufun/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f107-uc-eval/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -39,7 +39,8 @@ menu "On-chip Peripheral Drivers"
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f401-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f405-smdz-breadfruit/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -30,7 +30,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f407-atk-explorer/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -293,7 +293,8 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SDIO
select RT_USING_DFS
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f407-st-discovery/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,7 +68,8 @@ menu "On-chip Peripheral Drivers"
range 1 216
default 25
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f411-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -127,7 +127,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_ON_CHIP_FLASH
bool "Enable on-chip FLASH"
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f429-armfly-v6/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -218,6 +218,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_LTDC
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f429-atk-apollo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -251,6 +251,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_FMC
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f429-fire-challenger/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -240,6 +240,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_LTDC
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f446-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -30,7 +30,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f469-st-disco/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -155,6 +155,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_LTDC
bool "Enable LTDC"
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f746-st-disco/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -107,6 +107,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_LTDC
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f767-atk-apollo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -244,7 +244,9 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SDIO
select RT_USING_DFS
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -225,6 +225,8 @@ menuconfig BSP_USING_SPI
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f767-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -54,7 +54,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART3 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32g071-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -167,7 +167,8 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32h743-atk-apollo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -68,6 +68,9 @@ menu "On-chip Peripheral Drivers"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l053-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -35,7 +35,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l432-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -61,7 +61,8 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l452-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -77,7 +77,8 @@ menu "On-chip Peripheral Drivers"
range 1 176
default 16
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -250,7 +250,9 @@ menu "On-chip Peripheral Drivers"
bool "Enable OTGFS as USB device"
select RT_USING_USB_DEVICE
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l475-st-discovery/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -30,6 +30,8 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l476-st-nucleo/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -105,6 +105,8 @@ menu "On-chip Peripheral Drivers"
endchoice
endif
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l496-ali-developer/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -218,7 +218,9 @@ menu "On-chip Peripheral Drivers"
bool "Enable Watchdog Timer"
select RT_USING_WDT
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32l4r9-st-eval/board/Kconfig
浏览文件 @
c352c2be
...
...
@@ -88,7 +88,8 @@ menu "On-chip Peripheral Drivers"
config BSP_USING_FMC
bool
default n
source "../libraries/HAL_Drivers/Kconfig"
endmenu
menu "Board extended module Drivers"
...
...
tools/mkdist.py
浏览文件 @
c352c2be
...
...
@@ -141,6 +141,19 @@ def bsp_update_kconfig_library(dist_dir):
found
=
0
f
.
write
(
line
)
# change board/kconfig path
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
dist_dir
,
'board/Kconfig'
)):
return
with
open
(
os
.
path
.
join
(
dist_dir
,
'board/Kconfig'
),
'r'
)
as
f
:
data
=
f
.
readlines
()
with
open
(
os
.
path
.
join
(
dist_dir
,
'board/Kconfig'
),
'w'
)
as
f
:
for
line
in
data
:
if
line
.
find
(
'../libraries/HAL_Drivers/Kconfig'
)
!=
-
1
:
position
=
line
.
find
(
'../libraries/HAL_Drivers/Kconfig'
)
line
=
line
[
0
:
position
]
+
'libraries/HAL_Drivers/Kconfig"
\n
'
f
.
write
(
line
)
def
bs_update_ide_project
(
bsp_root
,
rtt_root
,
rttide
=
None
):
import
subprocess
# default update the projects which have template file
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录