添加注释
This commit is contained in:
@@ -4,4 +4,8 @@
|
|||||||
c_cpp_properties.json 中
|
c_cpp_properties.json 中
|
||||||
"intelliSenseMode": "linux-gcc-x86",时 sizeof(long)==4
|
"intelliSenseMode": "linux-gcc-x86",时 sizeof(long)==4
|
||||||
"intelliSenseMode": "linux-gcc-x64",时 sizeof(long)==8
|
"intelliSenseMode": "linux-gcc-x64",时 sizeof(long)==8
|
||||||
代码分析可以识别数组对齐 #pragma pack(1) 注释这个之后 sizeof 的结构体会按未1字节对齐的来计算
|
代码分析可以识别数组对齐 #pragma pack(1) 注释这个之后 sizeof 的结构体会按未1字节对齐的来计算
|
||||||
|
2024.10.22
|
||||||
|
c_cpp_properties.json 中指定了编译器路径之后 如果此编译器不在path路径中
|
||||||
|
则会出现类似找不到 stdarg.h 的问题
|
||||||
|
指定了 riscv 的编译器之后 clear_csr write_csr 宏可以正常找到
|
@@ -602,7 +602,7 @@ void iot_board_cfg_init()
|
|||||||
os_mem_set(&g_board_info, 0x0, sizeof(board_info_t));
|
os_mem_set(&g_board_info, 0x0, sizeof(board_info_t));
|
||||||
|
|
||||||
iot_board_hw_version_reload();
|
iot_board_hw_version_reload();
|
||||||
|
// 从oem中加载board配置
|
||||||
ret = board_load_oem_cfg();
|
ret = board_load_oem_cfg();
|
||||||
if(ret != ERR_OK) {
|
if(ret != ERR_OK) {
|
||||||
iot_printf("Can't find pin config for board.\n");
|
iot_printf("Can't find pin config for board.\n");
|
||||||
|
@@ -1129,10 +1129,12 @@ int system_uart_deinit();
|
|||||||
int system_uart_init()
|
int system_uart_init()
|
||||||
{
|
{
|
||||||
/* Get external port num. */
|
/* Get external port num. */
|
||||||
|
// 外置串口数目 目前是0
|
||||||
uint8_t port = iot_board_get_external_uart_port_num();
|
uint8_t port = iot_board_get_external_uart_port_num();
|
||||||
uart_info *p_uart_info = NULL;
|
uart_info *p_uart_info = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// 获得串口api
|
||||||
g_uart_ctrl = uart_e_ctrl;
|
g_uart_ctrl = uart_e_ctrl;
|
||||||
|
|
||||||
g_uart_ext_num = (int)port;
|
g_uart_ext_num = (int)port;
|
||||||
@@ -1156,10 +1158,11 @@ int system_uart_init()
|
|||||||
os_mem_set(g_uart_rs485_port, 0x0,
|
os_mem_set(g_uart_rs485_port, 0x0,
|
||||||
g_uart_rs485_num * sizeof(struct uart_rs485_ctrl));
|
g_uart_rs485_num * sizeof(struct uart_rs485_ctrl));
|
||||||
|
|
||||||
|
// 初始化所有串口,设置中断回调函数,除了打印串口
|
||||||
if (ERR_OK != uart_onchip_port_init(p_uart_info)) {
|
if (ERR_OK != uart_onchip_port_init(p_uart_info)) {
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
// 外置串口数量为0 这里直接返回成功
|
||||||
if (ERR_OK != uart_external_port_init(g_uart_ext_num,
|
if (ERR_OK != uart_external_port_init(g_uart_ext_num,
|
||||||
p_uart_info + IOT_UART_PORT_NUM_ONCHIP)) {
|
p_uart_info + IOT_UART_PORT_NUM_ONCHIP)) {
|
||||||
goto error_out;
|
goto error_out;
|
||||||
|
@@ -801,6 +801,7 @@ static uint8_t board_get_vc_uart_port(uint8_t type)
|
|||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据用途来获取串口号
|
||||||
uint8_t board_lookup_uart_port(uint8_t type)
|
uint8_t board_lookup_uart_port(uint8_t type)
|
||||||
{
|
{
|
||||||
uint8_t port = IOT_UART_PORT_SUPP_MAX;
|
uint8_t port = IOT_UART_PORT_SUPP_MAX;
|
||||||
@@ -811,7 +812,7 @@ uint8_t board_lookup_uart_port(uint8_t type)
|
|||||||
if (g_fw_mode == FTM_MODE) {
|
if (g_fw_mode == FTM_MODE) {
|
||||||
return board_lookup_uart_port_ftm(type);
|
return board_lookup_uart_port_ftm(type);
|
||||||
}
|
}
|
||||||
|
// 根据不同的板子修改type类型
|
||||||
type = board_lookup_uart_port_type_updata(type);
|
type = board_lookup_uart_port_type_updata(type);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < IOT_UART_MAX_NUM_V1; i++) {
|
for (uint8_t i = 0; i < IOT_UART_MAX_NUM_V1; i++) {
|
||||||
|
@@ -58,6 +58,7 @@ static void startup_ftm_init()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化task 然后删除自身
|
||||||
void iot_startup_init_task(void *arg)
|
void iot_startup_init_task(void *arg)
|
||||||
{
|
{
|
||||||
uint8_t gpio_3v3;
|
uint8_t gpio_3v3;
|
||||||
@@ -130,9 +131,9 @@ uint32_t iot_plc_entry(iot_build_info_t *info)
|
|||||||
sbl_param_input_t param = {0};
|
sbl_param_input_t param = {0};
|
||||||
|
|
||||||
iot_system_get_fw_boot_param(¶m);
|
iot_system_get_fw_boot_param(¶m);
|
||||||
|
// 设置app的build_info
|
||||||
iot_version_set_user_build_info(info);
|
iot_version_set_user_build_info(info);
|
||||||
|
// 设置模块运行模式 工厂模式等
|
||||||
iot_mode_set(param.fw_mode);
|
iot_mode_set(param.fw_mode);
|
||||||
mtd_set_flash_size(param.flash_size);
|
mtd_set_flash_size(param.flash_size);
|
||||||
mtd_set_psram_state(param.run_in_psram);
|
mtd_set_psram_state(param.run_in_psram);
|
||||||
|
@@ -271,26 +271,30 @@ void iot_mode_set(int fw_mode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 硬件部分初始化
|
||||||
void iot_hw_init()
|
void iot_hw_init()
|
||||||
{
|
{
|
||||||
|
// 初始化efuse
|
||||||
iot_efuse_init();
|
iot_efuse_init();
|
||||||
|
// 初始化时钟
|
||||||
system_clock_init();
|
system_clock_init();
|
||||||
|
// 初始化boardid为0
|
||||||
iot_board_info_init();
|
iot_board_info_init();
|
||||||
|
// 加密
|
||||||
iot_crypto_init();
|
iot_crypto_init();
|
||||||
|
|
||||||
/*resource initializations;*/
|
/*resource initializations;*/
|
||||||
|
// 初始化flash
|
||||||
mtd_device_init(0);
|
mtd_device_init(0);
|
||||||
|
|
||||||
/* init oem module load oem cfg from file */
|
/* init oem module load oem cfg from file */
|
||||||
|
// 初始化oem状态 cco还是sta
|
||||||
#if (PLC_SUPPORT_CCO_ROLE)
|
#if (PLC_SUPPORT_CCO_ROLE)
|
||||||
iot_oem_init(1);
|
iot_oem_init(1);
|
||||||
#else
|
#else
|
||||||
iot_oem_init(0);
|
iot_oem_init(0);
|
||||||
#endif
|
#endif
|
||||||
|
// 目前是空函数
|
||||||
iot_cal_data_init();
|
iot_cal_data_init();
|
||||||
|
|
||||||
#if (IOT_FLASH_BUILD == 1)
|
#if (IOT_FLASH_BUILD == 1)
|
||||||
@@ -308,11 +312,13 @@ void iot_hw_init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (IOT_FLASH_BUILD == 1)
|
#if (IOT_FLASH_BUILD == 1)
|
||||||
|
// 打印oem配置信息
|
||||||
iot_board_cfg_dump();
|
iot_board_cfg_dump();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iot_busmon_init();
|
iot_busmon_init();
|
||||||
/*platform intialization*/
|
/*platform intialization*/
|
||||||
|
// 这里初始化cpu中断 异常处理函数 gp定时器等
|
||||||
platform_init();
|
platform_init();
|
||||||
/* chip id checking */
|
/* chip id checking */
|
||||||
iot_chip_id_check();
|
iot_chip_id_check();
|
||||||
@@ -320,9 +326,11 @@ void iot_hw_init()
|
|||||||
iot_wdg_enable();
|
iot_wdg_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 子系统初始化
|
||||||
void iot_sub_system_init()
|
void iot_sub_system_init()
|
||||||
{
|
{
|
||||||
/* init common modules */
|
/* init common modules */
|
||||||
|
// 检查前导零数组是否正常
|
||||||
iot_bitops_init();
|
iot_bitops_init();
|
||||||
|
|
||||||
/* init os related modules and utilities */
|
/* init os related modules and utilities */
|
||||||
|
Reference in New Issue
Block a user