蓝牙模块完成,编译通过,等待测试

This commit is contained in:
kkkjtr 2026-03-04 09:38:15 +08:00
parent a1666d018f
commit 5e6ed79a51
47 changed files with 4775 additions and 1768 deletions

View File

@ -1,10 +1,13 @@
#include "BLE.h"
#include "flash.h"
#include "usart.h"
#include <string.h>
#include <stdint.h>
#define BLE_DBG_EN 0 // 1=开启调试输出0=关闭
#if (BLE_DBG_EN)
#define DEBUG(format, ...) printf("[BLE] " format, ##__VA_ARGS__)
#else
@ -12,7 +15,6 @@
#endif
char ble_rx_buffer[256];
BLE_STATE curr_state;
static size_t current_cmd_index = 0;
static uint32_t cmd_start_time;
@ -20,8 +22,14 @@ static uint8_t current_try_count = 0;
static CmdExecutor_t init_executor;
static CmdExecutor_t first_connect_executor;
static CmdExecutor_t connect_executor;
static CmdExecutor_t trans_cfg_executor; // 用于 AT+TRANSPORT 的执行器
static CmdExecutor_t ready_executor;
static CmdExecutor_t set_executor;
static uint8_t recovery_level = 0; // 放在文件开头
static uint8_t FT_connect = 0; // 放在文件开头
static char host_mac[13];
char ble_rx_buffer[256]; // 定义接收缓冲区
volatile uint8_t ble_cmd_rec_done;
const char* ble_state_names[] = {
@ -29,6 +37,7 @@ const char* ble_state_names[] = {
"BLE_FIRST_CONECT",
"BLE_CONNECTED",
"BLE_READY",
"BLE_CFG_TRANS",
"BLE_ERROR",
"BLE_SET",
"BLE_WAITTING"
@ -40,6 +49,93 @@ const char* ble_sub_state_names[] = {
"BLE_SUB_STATE_PROCESS_RESP"
};
const BleAtCmd_t ble_init_sequence[] = {
{"AT\\r\\n", 100, 3, NULL, parse_general_resp},
{"AT+LADDR\\r\\n", 100, 3, NULL, parse_laddr_resp},
{NULL, 0, 0, NULL, NULL} // 结束标记
};
const BleAtCmd_t ble_first_connect_sequence[] = {
{"AT+UUID<%d>\\r\\n", 100, 3, prepare_uuid_cmd, parse_general_resp},
{"AT+RESET\\r\\n", 100, 3, NULL, parse_general_resp},
{"AT+NOTI%d\\r\\n",100, 3, prepare_noti_cmd, parse_general_resp},
{NULL, 0, 0, NULL, NULL} // 结束标记
};
const BleAtCmd_t ble_connect_sequence[] = {
// {"AT+DIRADV\\r\\n", 100, 3, NULL, parse_diradv_cmd},
{"AT+DIRADV%d,%d,%s\\r\\n", 100, 3, prepare_diradv_cmd, parse_general_resp},
{NULL, 0, 0, NULL, NULL} // 结束标记
};
const BleAtCmd_t ble_trans_cfg_sequence[] = {
{"AT+TRANSPORT%d\\r\\n", 100, 3, prepare_transport_cmd, parse_general_resp},
{NULL, 0, 0, NULL, NULL} // 结束标记
};
//software reset
const BleAtCmd_t ble_reset_sequence[] = {
{"AT+RESET\r\n", 100, 3, NULL, parse_general_resp},
{NULL, 0, 0, NULL, NULL}
};
// reset to default
const BleAtCmd_t ble_default_sequence[] = {
{"AT+DEFAULT\r\n", 100, 3, NULL, parse_general_resp},
{NULL, 0, 0, NULL, NULL}
};
// total reset sequence
const BleAtCmd_t ble_full_set_sequence[] = {
{"AT+DISC\r\n", 100, 3, NULL, NULL},
{"AT+RESET\r\n", 100, 3, NULL, parse_general_resp},
{"AT+DEFAULT\r\n", 100, 3, NULL, parse_general_resp},
{NULL, 0, 0, NULL, NULL}
};
BleErrorInfo_t g_ble_error = {0};
BleGlobalConfig_t g_ble_config = {
// 连接参数
.mac_addr = "",
.addr_type = 0,
// 广播参数
.adv_param = 0, // 改为0
.adv_type = 0, // 改为0
.target_mac = "", // 初始化为空字符串
// 通信参数
.baud_rate = 9600, // 只有这个是你想保留的非零值
.tx_power = 0,
// UUID
.service_uuid = 0, // 显式写0也可省略
// NOTI选项
.Noption = 1, // 显式写0
// TRANS选项
.Toption = 1 // 显式写0
};
// 错误码表(根据你的模块手册填充)
BleErrorCodeInfo_t g_ble_error_table[] = {
{101, "参数长度错误", RECOVERY_TARGET_RESTART_SEQ}, // 参数错,重试没用
{102, "参数格式错误", RECOVERY_TARGET_RESTART_SEQ}, // 状态错,需检查流程
{103, "参数数据异常", RECOVERY_TARGET_RESTART_SEQ}, // 可重试
{104, "指令错误", RECOVERY_TARGET_SW_RESET_MODULE}, // 可重试
};
void BLE_Init(void)
{
@ -75,12 +171,25 @@ void BLE_StateMachine_Handler(void)
ExecutorResult_t res = CmdExecutor_Process(&init_executor);
if(res == EXECUTOR_DONE)
{
/*
first connect
connected
// 尝试读取保存在本地的数据如果没有则进入first connect
// 如果有则进入connected
if(Load_MAC_From_Flash(host_mac) == 0)
{
curr_state = BLE_CONNECTED;
}
else
{
curr_state = BLE_FIRST_CONECT;
}
*/
memset(&init_executor, 0, sizeof(init_executor));
}
@ -103,25 +212,33 @@ void BLE_StateMachine_Handler(void)
case BLE_FIRST_CONECT :
{
// 惰性初始化
if (first_connect_executor.sequence == NULL)
{
first_connect_executor.sequence = ble_first_connect_sequence;
first_connect_executor.cmd_index = 0;
first_connect_executor.retry_cnt = 0;
first_connect_executor.state = EXEC_STATE_IDLE;
}
ExecutorResult_t res = CmdExecutor_Process(&first_connect_executor);
if(res == EXECUTOR_DONE)
{
/*
*/
curr_state = BLE_CONNECTED;
FT_connect = 1;
curr_state = BLE_WAIT_CONNECT;
}
else if(res == EXECUTOR_ERROR)
{
g_ble_error.cmd_index = init_executor.cmd_index;
g_ble_error.error_code =init_executor.error_code;
g_ble_error.cmd_index = first_connect_executor.cmd_index;
g_ble_error.error_code =first_connect_executor.error_code;
g_ble_error.main_state = curr_state;
g_ble_error.timestamp = HAL_GetTick();
g_ble_error.origin_state = BLE_FIRST_CONECT;
curr_state = BLE_ERROR;
memset(&init_executor, 0, sizeof(first_connect_executor));
memset(&first_connect_executor, 0, sizeof(first_connect_executor));
}
@ -133,19 +250,27 @@ void BLE_StateMachine_Handler(void)
case BLE_CONNECTED :
{
if (connect_executor.sequence == NULL)
{
connect_executor.sequence = ble_connect_sequence;
connect_executor.cmd_index = 0;
connect_executor.retry_cnt = 0;
connect_executor.state = EXEC_STATE_IDLE;
}
ExecutorResult_t res = CmdExecutor_Process(&connect_executor);
if(res == EXECUTOR_DONE)
{
/*
*/
curr_state = BLE_READY;
curr_state = BLE_WAIT_CONNECT;
}
else if(res == EXECUTOR_ERROR)
{
g_ble_error.cmd_index = init_executor.cmd_index;
g_ble_error.error_code =init_executor.error_code;
g_ble_error.cmd_index = connect_executor.cmd_index;
g_ble_error.error_code =connect_executor.error_code;
g_ble_error.main_state = curr_state;
g_ble_error.timestamp = HAL_GetTick();
g_ble_error.origin_state = BLE_CONNECTED;
@ -159,20 +284,77 @@ void BLE_StateMachine_Handler(void)
}
break;
case BLE_READY :
case BLE_WAIT_CONNECT:
{
/*
error
*/
if(ble_cmd_rec_done == 1)
{
parse_master_addr_resp(ble_rx_buffer);
if(FT_connect)
{
//写入本地flash
Save_MAC_To_Flash(host_mac);
}
curr_state = BLE_CFG_TRANS;
// 并设置一个标志让BLE_READY开始发送透传命令
ble_cmd_rec_done = 0;
}
break;
}
}
break;
case BLE_CFG_TRANS:
{
// 惰性初始化
if (trans_cfg_executor.sequence == NULL)
{
trans_cfg_executor.sequence = ble_trans_cfg_sequence; // 该序列只包含 AT+TRANSPORT
trans_cfg_executor.cmd_index = 0;
trans_cfg_executor.retry_cnt = 0;
trans_cfg_executor.state = EXEC_STATE_IDLE;
}
ExecutorResult_t res = CmdExecutor_Process(&trans_cfg_executor);
if (res == EXECUTOR_DONE)
{
// 透传开启成功,进入 BLE_READY
curr_state = BLE_READY;
memset(&trans_cfg_executor, 0, sizeof(trans_cfg_executor)); // 清理,下次可能复用
}
else if (res == EXECUTOR_ERROR)
{
g_ble_error.cmd_index = trans_cfg_executor.cmd_index;
g_ble_error.error_code = trans_cfg_executor.error_code;
g_ble_error.main_state = curr_state;
g_ble_error.timestamp = HAL_GetTick();
g_ble_error.origin_state = BLE_CFG_TRANS;
curr_state = BLE_ERROR;
memset(&trans_cfg_executor, 0, sizeof(trans_cfg_executor));
}
// 若返回 BUSY继续等待
break;
}
case BLE_READY :
{
static uint32_t last_transmit_time = 0;
uint32_t now = HAL_GetTick();
if (now - last_transmit_time >= 300) // 定义发送间隔
{
// 发送透传数据(例如从应用层获取)
uint8_t tx_data[] = "Hello BLE!\r\n";
HAL_UART_Transmit(&huart1, tx_data, sizeof(tx_data)-1, 100);
last_transmit_time = now;
}
// 接收数据已在回调中处理,无需额外操作
break;
}
break;
case BLE_ERROR :
{
@ -357,8 +539,8 @@ void BLE_StateMachine_Handler(void)
{
static const BleAtCmd_t sw_reset_sq[] = {
{"AT+RESET\r\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
{"AT+RESET\r\n", 100, 3, NULL, NULL},
{NULL, 0, 0, NULL, NULL}
};
target_seq = sw_reset_sq;
@ -369,8 +551,8 @@ void BLE_StateMachine_Handler(void)
{ //回复出厂设置
{
static const BleAtCmd_t factory_reset_seq[] = {
{"AT+DEFAULT\r\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
{"AT+DEFAULT\r\n", 100, 3, NULL, NULL},
{NULL, 0, 0, NULL, NULL}
};
target_seq = factory_reset_seq;
@ -521,7 +703,6 @@ ExecutorResult_t CmdExecutor_Process(CmdExecutor_t* ex) //
}
break;
case EXEC_STATE_SEND_WAIT:
{
@ -568,9 +749,7 @@ ExecutorResult_t CmdExecutor_Process(CmdExecutor_t* ex) //
}
break;
case EXEC_STATE_PROCESS_RESP:
{
//接受串口回传具体信息
@ -661,15 +840,17 @@ ExecutorResult_t CmdExecutor_Process(CmdExecutor_t* ex) //
uint8_t BLE_UART_RxCallback(void)
uint8_t BLE_UART_RxCallback(uint8_t *data, uint16_t len)
{
// 防止缓冲区溢出,保留一个字节给结束符
uint16_t copy_len = (len < sizeof(ble_rx_buffer)) ? len : (sizeof(ble_rx_buffer) - 1);
memcpy(ble_rx_buffer, data, copy_len);
ble_rx_buffer[copy_len] = '\0'; // 添加字符串结束符,便于字符串函数使用
// 置位接收完成标志
ble_cmd_rec_done = 1;
return 0;
}
@ -715,6 +896,7 @@ int parse_general_resp(const char* resp)
}
int prepare_diradv_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
{
if(cmd_buf == NULL || buf_size <= 0)
@ -745,12 +927,72 @@ int prepare_diradv_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
}
int parse_diradv_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
int parse_laddr_resp(const char* resp)
{
if (resp == NULL)
{
return -1; // 无效输入
}
char mac[13]; // 用于临时存储提取的MAC地址12字符 + '\0'
// 使用sscanf提取等号后面的连续12个字符自动跳过空白符
if (sscanf(resp, "+LADDR=%12s", mac) == 1)
{
// 检查提取的字符串长度是否为12防止意外截断
if (strlen(mac) == 12)
{
// 将MAC地址复制到全局配置结构体中
strncpy(g_ble_config.mac_addr, mac, 12);
g_ble_config.mac_addr[12] = '\0'; // 确保字符串终止
return 0; // 解析成功
}
}
// 如果响应格式不匹配或长度不对,则解析失败
return -1;
}
uint8_t parse_master_addr_resp(const char* resp)
{
char *res = strstr(ble_rx_buffer, "0x");
if (res != NULL)
{
char *num_start = res + 2; // 跳过 "0x"
char mac_str[13]; // 12字符 + 结束符
int i = 0;
// 遍历直到遇到非十六进制字符或字符串结束
while (*num_start != '\0')
{
char c = *num_start;
// 判断是否十六进制字符
if ((c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f'))
{
if (i < sizeof(mac_str) - 1)
{ // 防止缓冲区溢出
mac_str[i++] = c;
}
else
{
break; // 超出缓冲区,停止
}
}
else
{
break; // 遇到非十六进制字符,停止
}
num_start++;
}
mac_str[i] = '\0'; // 添加字符串结束符
// 此时 mac_str 就是提取出的字符串
// 例如保存到全局变量
strncpy(host_mac, mac_str, 12);
host_mac[12] = '\0';
}
@ -758,41 +1000,82 @@ int parse_diradv_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
}
int prepare_uuid_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
{
if (cmd_buf == NULL || buf_size <= 0)
{
return -1; // 参数错误
}
uint16_t uuid = g_ble_config.service_uuid; // 从全局配置中取出 UUID
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, uuid);
if (needed_len < 0)
{
return -1; // 格式化错误
}
else if (needed_len >= buf_size)
{
return -2; // 缓冲区不足
}
else
{
return 0; // 成功
}
}
int prepare_noti_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
{
if (cmd_buf == NULL || buf_size <= 0)
{
return -1; // 参数错误
}
uint8_t noti_opt = g_ble_config.Noption; // 从全局配置中取出通知选项0或1
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, noti_opt);
if (needed_len < 0)
{
return -1; // 格式化错误
}
else if (needed_len >= buf_size)
{
return -2; // 缓冲区不足
}
else
{
return 0; // 成功
}
}
int prepare_transport_cmd(const char* cmd_template, char* cmd_buf, int buf_size)
{
if (cmd_buf == NULL || buf_size <= 0)
{
return -1; // 参数错误
}
uint8_t transport_opt = g_ble_config.Toption; // 从全局配置中取出透传选项
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, transport_opt);
if (needed_len < 0)
{
return -1; // 格式化错误
}
else if (needed_len >= buf_size)
{
return -2; // 缓冲区不足
}
else
{
return 0; // 成功
}
}

View File

@ -2,11 +2,20 @@
#define BLE_H
#include "stm32f1xx_hal.h"
int parse_general_resp(const char* resp);
int parse_laddr_resp(const char* resp);
int prepare_diradv_cmd(const char* cmd_template, char* cmd_buf, int buf_size);
int prepare_uuid_cmd(const char* cmd_template, char* cmd_buf, int buf_size);
int prepare_noti_cmd(const char* cmd_template, char* cmd_buf, int buf_size);
int prepare_transport_cmd(const char* cmd_template, char* cmd_buf, int buf_size);
uint8_t parse_master_addr_resp(const char* resp);
typedef enum{
BLE_INIT = 0,
BLE_FIRST_CONECT,
BLE_CONNECTED,
BLE_WAIT_CONNECT,
BLE_CFG_TRANS, // 新增:配置透传模式
BLE_READY,
BLE_ERROR,
BLE_SET,
@ -44,7 +53,6 @@ typedef enum {
typedef struct {
const char* cmd;
const char* expected_resp;
uint16_t timeout_ms;
uint8_t retry_max;
// 关键升级:一个用于生成动态命令参数的回调函数
@ -53,66 +61,7 @@ typedef struct {
int (*parse_resp)(const char* resp);
} BleAtCmd_t;
const BleAtCmd_t ble_init_sequence[] = {
{"AT\\r\\n", "OK", 100, 3, NULL, NULL},
{"AT+TRANSPORT\\r\\n", "OK", 100, 3, NULL, NULL},
{"AT+TRANSPORT<%d>\\r\\n", "OK", 100, 3, set_trans_cmd, parse_trans_resp},
{"AT+DISC\\r\\n", "OK", 100, 3, NULL, NULL},
{"AT+TYPE\\r\\n", "OK", 100, 3, NULL, NULL},
// {"AT+TYPE<%x>\\r\\n", "OK", 100, 3, set_type_cmd, parse_type_resp},
{"AT+RESET\\r\\n", "OK", 100, 3, NULL, NULL},
{"AT+DEFAULT\\r\\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL} // 结束标记
};
const BleAtCmd_t ble_first_connect_sequence[] = {
{"AT\r\n", "OK", 100, 3, NULL, NULL},
{"AT+OPASS\\r\\n", "OK", 100, 3, NULL, parse_opass_resp},
{"AT+OPASS<%d>\\r\\n", "OK", 100, 3, set_opass_cmd, NULL},
{"AT+APASS\\r\\n", "OK", 100, 3, NULL, parse_apass_resp},
{"AT+APASS<%d>\\r\\n", "OK", 100, 3, set_apass_cmd, NULL},
{"AT+DIRADV\\r\\n", "OK", 100, 3, NULL, parse_diradv_cmd},
{"AT+DIRADV%d,%d,%s\\r\\n", "OK", 100, 3, prepare_diradv_cmd, NULL},
{NULL, NULL, 0, 0, NULL, NULL} // 结束标记
};
const BleAtCmd_t ble_connect_sequence[] = {
{"AT\r\n", "OK", 100, 3, NULL, NULL},
{"AT+OPASS\\r\\n", "OK", 100, 3, NULL, parse_opass_resp},
{"AT+OPASS<%d>\\r\\n", "OK", 100, 3, set_opass_cmd, NULL},
{"AT+APASS\\r\\n", "OK", 100, 3, NULL, parse_apass_resp},
{"AT+APASS<%d>\\r\\n", "OK", 100, 3, set_apass_cmd, NULL},
{"AT+DIRADV\\r\\n", "OK", 100, 3, NULL, parse_diradv_cmd},
{"AT+DIRADV%d,%d,%s\\r\\n", "OK", 100, 3, prepare_diradv_cmd, NULL},
{NULL, NULL, 0, 0, NULL, NULL} // 结束标记
};
//software reset
const BleAtCmd_t ble_reset_sequence[] = {
{"AT+RESET\r\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};
// reset to default
const BleAtCmd_t ble_default_sequence[] = {
{"AT+DEFAULT\r\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};
// total reset sequence
const BleAtCmd_t ble_full_set_sequence[] = {
{"AT+DISC\r\n", "OK", 100, 3, NULL, NULL},
{"AT+RESET\r\n", "OK", 100, 3, NULL, NULL},
{"AT+DEFAULT\r\n", "OK", 100, 3, NULL, NULL},
{"AT+WHITELIST\r\n", "OK", 100, 3, NULL, NULL},
{"AT+NOTI\r\n", "OK", 100, 3, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};
@ -129,7 +78,7 @@ typedef struct {
typedef struct {
// 连接参数
// 连接参数 AT+LADDR
char mac_addr[13]; // 蓝牙MAC地址 "A1B2C3D4E5F6"
uint8_t addr_type; // 地址类型 (0=public, 1=random)
@ -138,7 +87,7 @@ typedef struct {
uint8_t adv_type;
char target_mac[13]; // 定向广播的目标MAC
// 白名单参数 (用于 AT+WHITELIST 等)
// 白名单参数 AT+WHITELIST 暂时不用
uint8_t whitelist_count;
char whitelist_macs[3][13]; // 假设最多3个白名单设备
@ -146,25 +95,19 @@ typedef struct {
uint32_t baud_rate; // 波特率
uint8_t tx_power; // 发射功率
// 模块工作参数
uint8_t work_mode; // 透传模式等
char device_name[32]; // 设备名称
// UUID AT+UUID
uint16_t service_uuid; // 服务UUID例如 0xFFE0
// NOTIopt AT+NOTI
uint8_t Noption; // 1或者0
// TRANSopt AT+TRANSPORT
uint8_t Toption; // 1或者0
// ... 其他所有可能用到的参数
} BleGlobalConfig_t;
BleGlobalConfig_t g_ble_config = {
.mac_addr = "A1B2C3D4E5F6",
.addr_type = 0,
.adv_param = 0x10,
.adv_type = 1,
.target_mac = "FFFFFFFFFFFF",
.baud_rate = 9600,
.device_name = "MyBLEModule",
};
// 错误码信息结构体
typedef struct {
@ -173,14 +116,6 @@ typedef struct {
RecoveryTarget_t recovery_target; //store the target
} BleErrorCodeInfo_t;
// 错误码表(根据你的模块手册填充)
BleErrorCodeInfo_t g_ble_error_table[] = {
{101, "参数长度错误", RECOVERY_TARGET_RESTART_SEQ}, // 参数错,重试没用
{102, "参数格式错误", RECOVERY_TARGET_RESTART_SEQ}, // 状态错,需检查流程
{103, "参数数据异常", RECOVERY_TARGET_RESTART_SEQ}, // 可重试
{104, "指令错误", RECOVERY_TARGET_SW_RESET_MODULE}, // 可重试
};
typedef enum {
ERR_TYPE_NONE = 0,
ERR_TYPE_PREPARE_FAILED, // prepare_cmd 失败
@ -199,41 +134,15 @@ typedef struct {
uint8_t origin_state; // 原始状态(用于恢复后返回)
RecoveryTarget_t recovery_target;// error fix target
} BleErrorInfo_t;
BleErrorInfo_t g_ble_error = {0};
char ble_rx_buffer[256];
volatile uint8_t ble_cmd_rec_done;
extern char ble_rx_buffer[256];
uint8_t BLE_UART_RxCallback(uint8_t *data, uint16_t len);
ExecutorResult_t CmdExecutor_Process(CmdExecutor_t *ex);
extern void BLE_StateMachine_Handler(void);
extern void BLE_Init(void);

View File

@ -0,0 +1,51 @@
#include "flash.h"
#include "stm32f1xx_hal_flash.h"
#include "stm32f1xx_hal_flash_ex.h"
#include <string.h>
uint8_t Save_MAC_To_Flash(char *mac_str)
{
FlashData_t data;
data.magic = MAGIC_NUMBER;
strncpy(data.mac, mac_str, 12);
data.mac[12] = '\0';
uint32_t addr = HOST_MAC_FLASH_ADDR;
uint32_t *p = (uint32_t *)&data;
uint16_t num_words = sizeof(FlashData_t) / 4;
HAL_FLASH_Unlock();
FLASH_EraseInitTypeDef erase_init;
uint32_t page_error;
erase_init.TypeErase = FLASH_TYPEERASE_PAGES;
erase_init.PageAddress = addr;
erase_init.NbPages = 1;
if (HAL_FLASHEx_Erase(&erase_init, &page_error) != HAL_OK) {
HAL_FLASH_Lock();
return -1;
}
for (uint16_t i = 0; i < num_words; i++) {
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, addr + i*4, p[i]) != HAL_OK) {
HAL_FLASH_Lock();
return -1;
}
}
HAL_FLASH_Lock();
return 0;
}
uint8_t Load_MAC_From_Flash(char *mac_out)
{
FlashData_t *p = (FlashData_t *)HOST_MAC_FLASH_ADDR;
if (p->magic != MAGIC_NUMBER) {
return -1; // ÎÞÓÐЧÊý¾Ý
}
strncpy(mac_out, p->mac, 12);
mac_out[12] = '\0';
return 0;
}

View File

@ -0,0 +1,33 @@
#ifndef FLASH_H
#define FLASH_H
#include "stm32f1xx_hal.h"
#include <stdint.h> // 提供 int8_t 定义
#define HOST_MAC_FLASH_ADDR 0x0800F400
#define MAGIC_NUMBER 0xA5A5A5A5 // 自定义签名
typedef struct {
uint32_t magic; // 签名,例如 0xA5A5A5A5
char mac[13]; // MAC 地址字符串12字符 + '\0'
// 可以扩展其他字段...
} FlashData_t;
/**
* @brief MAC Flash使 HOST_MAC_FLASH_ADDR
* @param mac_str MAC 12
* @retval 0 -1
*/
uint8_t Save_MAC_To_Flash(char *mac_str);
/**
* @brief Flash MAC 使 HOST_MAC_FLASH_ADDR
* @param mac_out 13
* @retval 0 -1
*/
uint8_t Load_MAC_From_Flash(char *mac_out);
#endif

View File

@ -16,6 +16,7 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <string.h>
#include "BLE.h"
//#include "modbus.h"
/* USER CODE END Includes */
@ -31,7 +32,10 @@
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* 定义BLE专用的DMA接收缓冲区 */
#define BLE_RX_DMA_SIZE 256
__ALIGN_BEGIN uint8_t ble_rx_dma[BLE_RX_DMA_SIZE] __ALIGN_END;
static uint32_t ble_dma_last_pos = 0; // 上次处理的位置
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
@ -77,6 +81,7 @@ int main(void)
SystemClock_Config();
/* USER CODE BEGIN SysInit */
BLE_Init();
/* USER CODE END SysInit */
@ -94,7 +99,13 @@ int main(void)
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
{
BLE_StateMachine_Handler();
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
@ -146,6 +157,63 @@ void SystemClock_Config(void)
}
/* USER CODE BEGIN 4 */
/* 初始化BLE串口的DMA接收 */
void BLE_UART_DMA_Init(void)
{
HAL_UART_Receive_DMA(&huart3, ble_rx_dma, BLE_RX_DMA_SIZE);
ble_dma_last_pos = BLE_RX_DMA_SIZE - __HAL_DMA_GET_COUNTER(huart3.hdmarx);
}
/* 处理BLE串口DMA接收数据在主循环中调用 */
void BLE_UART_DMA_Process(void)
{
uint32_t current_pos = BLE_RX_DMA_SIZE - __HAL_DMA_GET_COUNTER(huart3.hdmarx);
uint32_t received_len;
// 计算新收到的字节数
if (current_pos >= ble_dma_last_pos) {
received_len = current_pos - ble_dma_last_pos;
} else {
received_len = (BLE_RX_DMA_SIZE - ble_dma_last_pos) + current_pos;
}
if (received_len == 0) return;
// 临时行缓冲区,用于组装一行数据
static uint8_t line_buf[128];
static uint8_t line_idx = 0;
for (uint32_t i = 0; i < received_len; i++) {
uint32_t idx = (ble_dma_last_pos + i) % BLE_RX_DMA_SIZE;
uint8_t byte = ble_rx_dma[idx];
// 以 '\n' 作为一帧结束的标志AT指令通常以 "\r\n" 结尾)
if (byte == '\n') {
if (line_idx > 0) {
// 去掉可能存在的 '\r'
if (line_buf[line_idx-1] == '\r') {
line_idx--;
}
// 调用BLE驱动回调传递这一行数据
BLE_UART_RxCallback(line_buf, line_idx);
line_idx = 0;
}
} else {
// 普通字符,存入行缓冲区(防止溢出)
if (line_idx < sizeof(line_buf) - 1) {
line_buf[line_idx++] = byte;
}
}
}
// 更新上次处理位置
ble_dma_last_pos = current_pos;
}
/* USER CODE END 4 */

File diff suppressed because one or more lines are too long

View File

@ -571,6 +571,30 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>28</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\BSP\flash.c</PathWithFileName>
<FilenameWithoutPath>flash.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>29</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\BSP\flash.h</PathWithFileName>
<FilenameWithoutPath>flash.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>

View File

@ -697,6 +697,16 @@
<FileType>5</FileType>
<FilePath>..\BSP\BLE.h</FilePath>
</File>
<File>
<FileName>flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\BSP\flash.c</FilePath>
</File>
<File>
<FileName>flash.h</FileName>
<FileType>5</FileType>
<FilePath>..\BSP\flash.h</FilePath>
</File>
</Files>
</Group>
<Group>

View File

@ -22,96 +22,47 @@ Dialog DLL: TCM.DLL V1.56.4.0
<h2>Project:</h2>
C:\Users\15435\Desktop\PressureSensorBoard\Software\master\PressureSensorBoardMaster\MDK-ARM\PressureSensorBoardMaster.uvprojx
Project File Date: 02/24/2026
Project File Date: 03/04/2026
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\app\Keil_v5\ARM\ARMCC\Bin'
Build target 'PressureSensorBoardMaster'
compiling dma.c...
compiling gpio.c...
compiling main.c...
Rebuild target 'PressureSensorBoardMaster'
assembling startup_stm32f103xb.s...
compiling stm32f1xx_hal_msp.c...
compiling stm32f1xx_hal_gpio_ex.c...
compiling tim.c...
compiling stm32f1xx_it.c...
compiling usart.c...
compiling tim.c...
compiling gpio.c...
compiling stm32f1xx_hal_rcc_ex.c...
compiling main.c...
..\BSP\BLE.h(150): warning: #1-D: last line of file ends without a newline
#endif
../Core/Src/main.c: 1 warning, 0 errors
compiling dma.c...
compiling stm32f1xx_hal.c...
compiling stm32f1xx_hal_cortex.c...
compiling stm32f1xx_hal_gpio.c...
compiling stm32f1xx_hal_dma.c...
compiling usart.c...
compiling stm32f1xx_hal_rcc.c...
compiling stm32f1xx_hal_tim_ex.c...
compiling stm32f1xx_hal_tim.c...
compiling BLE.c...
..\BSP\BLE.h(59): error: #20: identifier "set_trans_cmd" is undefined
{"AT+TRANSPORT<%d>\\r\\n", "OK", 100, 3, set_trans_cmd, parse_trans_resp},
..\BSP\BLE.h(59): error: #20: identifier "parse_trans_resp" is undefined
{"AT+TRANSPORT<%d>\\r\\n", "OK", 100, 3, set_trans_cmd, parse_trans_resp},
..\BSP\BLE.h(72): error: #20: identifier "parse_opass_resp" is undefined
{"AT+OPASS\\r\\n", "OK", 100, 3, NULL, parse_opass_resp},
..\BSP\BLE.h(73): error: #20: identifier "set_opass_cmd" is undefined
{"AT+OPASS<%d>\\r\\n", "OK", 100, 3, set_opass_cmd, NULL},
..\BSP\BLE.h(74): error: #20: identifier "parse_apass_resp" is undefined
{"AT+APASS\\r\\n", "OK", 100, 3, NULL, parse_apass_resp},
..\BSP\BLE.h(75): error: #20: identifier "set_apass_cmd" is undefined
{"AT+APASS<%d>\\r\\n", "OK", 100, 3, set_apass_cmd, NULL},
..\BSP\BLE.h(76): error: #20: identifier "parse_diradv_cmd" is undefined
{"AT+DIRADV\\r\\n", "OK", 100, 3, NULL, parse_diradv_cmd},
..\BSP\BLE.h(77): error: #20: identifier "prepare_diradv_cmd" is undefined
{"AT+DIRADV%d,%d,%s\\r\\n", "OK", 100, 3, prepare_diradv_cmd, NULL},
..\BSP\BLE.h(191): warning: #188-D: enumerated type mixed with another type
BleErrorInfo_t g_ble_error = {0};
..\BSP\BLE.h(229): warning: #1-D: last line of file ends without a newline
#endif
..\BSP\BLE.c(74): warning: #223-D: function "CmdExecutor_Process" declared implicitly
ExecutorResult_t res = CmdExecutor_Process(&init_executor);
..\BSP\BLE.c(74): warning: #188-D: enumerated type mixed with another type
ExecutorResult_t res = CmdExecutor_Process(&init_executor);
..\BSP\BLE.c(105): warning: #223-D: function "CmdExecutor_Process" declared implicitly
ExecutorResult_t res = CmdExecutor_Process(&first_connect_executor);
..\BSP\BLE.c(105): warning: #188-D: enumerated type mixed with another type
ExecutorResult_t res = CmdExecutor_Process(&first_connect_executor);
..\BSP\BLE.c(135): warning: #223-D: function "CmdExecutor_Process" declared implicitly
ExecutorResult_t res = CmdExecutor_Process(&connect_executor);
..\BSP\BLE.c(135): warning: #188-D: enumerated type mixed with another type
ExecutorResult_t res = CmdExecutor_Process(&connect_executor);
..\BSP\BLE.c(258): error: #29: expected an expression
if() //重新配置串口信息
..\BSP\BLE.c(265): error: #29: expected an expression
else if() //重新启动设备
..\BSP\BLE.c(307): error: #159: declaration is incompatible with previous "CmdExecutor_Process" (declared at line 74)
ExecutorResult_t CmdExecutor_Process(CmdExecutor_t* ex)
..\BSP\BLE.c(370): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(418): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(432): warning: #223-D: function "parse_general_resp" declared implicitly
result = parse_general_resp(ble_rx_buffer);
..\BSP\BLE.c(493): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(505): warning: #940-D: missing return statement at end of non-void function "CmdExecutor_Process"
}
..\BSP\BLE.c(519): warning: #940-D: missing return statement at end of non-void function "BLE_UART_RxCallback"
}
..\BSP\BLE.c(537): warning: #223-D: function "sscanf" declared implicitly
int auth = sscanf(resp, "ERROR=<%d>", &err_code);
..\BSP\BLE.c(576): warning: #223-D: function "snprintf" declared implicitly
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, para, type, mac);
..\BSP\BLE.c(600): warning: #940-D: missing return statement at end of non-void function "parse_diradv_cmd"
}
..\BSP\BLE.c(17): warning: #177-D: variable "current_cmd_index" was declared but never referenced
static size_t current_cmd_index = 0;
..\BSP\BLE.c(18): warning: #177-D: variable "cmd_start_time" was declared but never referenced
static uint32_t cmd_start_time;
..\BSP\BLE.c(19): warning: #177-D: variable "current_try_count" was declared but never referenced
static uint8_t current_try_count = 0;
..\BSP\BLE.c(23): warning: #177-D: variable "set_executor" was declared but never referenced
static CmdExecutor_t set_executor;
..\BSP\BLE.c: 21 warnings, 11 errors
compiling stm32f1xx_hal_pwr.c...
compiling stm32f1xx_hal_flash.c...
compiling stm32f1xx_hal_exti.c...
compiling flash.c...
..\BSP\flash.h(33): warning: #1-D: last line of file ends without a newline
#endif
..\BSP\flash.c(26): warning: #68-D: integer conversion resulted in a change of sign
return -1;
..\BSP\flash.c(32): warning: #68-D: integer conversion resulted in a change of sign
return -1;
..\BSP\flash.c(45): warning: #68-D: integer conversion resulted in a change of sign
return -1; // ÎÞÓÐЧÊý¾Ý
..\BSP\flash.c(51): warning: #1-D: last line of file ends without a newline
}
..\BSP\flash.c: 5 warnings, 0 errors
compiling stm32f1xx_hal_pwr.c...
compiling system_stm32f1xx.c...
compiling stm32f1xx_hal_flash.c...
compiling stm32f1xx_hal_flash_ex.c...
compiling modbus.c...
..\MiddleWares\modbus.h(55): warning: #1-D: last line of file ends without a newline
@ -121,9 +72,63 @@ compiling modbus.c...
..\MiddleWares\modbus.c(116): warning: #186-D: pointless comparison of unsigned integer with zero
if(index < 0 || index >= MAX_callback_NODES )
..\MiddleWares\modbus.c: 3 warnings, 0 errors
compiling system_stm32f1xx.c...
compiling BLE.c...
..\BSP\BLE.h(150): warning: #1-D: last line of file ends without a newline
#endif
..\BSP\flash.h(33): warning: #1-D: last line of file ends without a newline
#endif
..\BSP\BLE.c(106): warning: #188-D: enumerated type mixed with another type
BleErrorInfo_t g_ble_error = {0};
..\BSP\BLE.c(357): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(372): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(457): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(479): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(511): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(564): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(596): warning: #188-D: enumerated type mixed with another type
curr_state = g_ble_error.origin_state;
..\BSP\BLE.c(601): warning: #188-D: enumerated type mixed with another type
g_ble_error.type = set_executor.error_type;
..\BSP\BLE.c(615): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(826): warning: #111-D: statement is unreachable
break;
..\BSP\BLE.c(838): warning: #940-D: missing return statement at end of non-void function "CmdExecutor_Process"
}
..\BSP\BLE.c(872): warning: #223-D: function "sscanf" declared implicitly
int auth = sscanf(resp, "ERROR=<%d>", &err_code);
..\BSP\BLE.c(912): warning: #223-D: function "snprintf" declared implicitly
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, para, type, mac);
..\BSP\BLE.c(940): warning: #223-D: function "sscanf" declared implicitly
if (sscanf(resp, "+LADDR=%12s", mac) == 1)
..\BSP\BLE.c(1003): warning: #940-D: missing return statement at end of non-void function "parse_master_addr_resp"
}
..\BSP\BLE.c(1015): warning: #223-D: function "snprintf" declared implicitly
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, uuid);
..\BSP\BLE.c(1040): warning: #223-D: function "snprintf" declared implicitly
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, noti_opt);
..\BSP\BLE.c(1065): warning: #223-D: function "snprintf" declared implicitly
int needed_len = snprintf(cmd_buf, buf_size, cmd_template, transport_opt);
..\BSP\BLE.c(19): warning: #177-D: variable "current_cmd_index" was declared but never referenced
static size_t current_cmd_index = 0;
..\BSP\BLE.c(20): warning: #177-D: variable "cmd_start_time" was declared but never referenced
static uint32_t cmd_start_time;
..\BSP\BLE.c(21): warning: #177-D: variable "current_try_count" was declared but never referenced
static uint8_t current_try_count = 0;
..\BSP\BLE.c(26): warning: #177-D: variable "ready_executor" was declared but never referenced
static CmdExecutor_t ready_executor;
..\BSP\BLE.c: 25 warnings, 0 errors
compiling stm32f1xx_hal_uart.c...
"PressureSensorBoardMaster\PressureSensorBoardMaster.axf" - 11 Error(s), 24 Warning(s).
linking...
Program Size: Code=17520 RO-data=1308 RW-data=160 ZI-data=2432
FromELF: creating hex file...
"PressureSensorBoardMaster\PressureSensorBoardMaster.axf" - 0 Error(s), 34 Warning(s).
<h2>Software Packages used:</h2>
@ -147,7 +152,6 @@ Package Vendor: Keil
* Component: ARM::CMSIS:CORE@6.1.0
Include file: CMSIS/Core/Include/tz_context.h
Target not created.
Build Time Elapsed: 00:00:03
</pre>
</body>

View File

@ -23,6 +23,8 @@
"pressuresensorboardmaster\stm32f1xx_hal_uart.o"
"pressuresensorboardmaster\system_stm32f1xx.o"
"pressuresensorboardmaster\modbus.o"
"pressuresensorboardmaster\ble.o"
"pressuresensorboardmaster\flash.o"
--strict --scatter "PressureSensorBoardMaster\PressureSensorBoardMaster.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers

View File

@ -1,7 +1,7 @@
Dependencies for Project 'PressureSensorBoardMaster', Target 'PressureSensorBoardMaster': (DO NOT MODIFY !)
CompilerVersion: 5060960::V5.06 update 7 (build 960)::.\ARMCC
F (startup_stm32f103xb.s)(0x69420903)(--cpu Cortex-M3 -g --apcs=interwork -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include --pd "__UVISION_VERSION SETA 541" --pd "STM32F10X_MD SETA 1" --pd "_RTE_ SETA 1" --list startup_stm32f103xb.lst --xref -o pressuresensorboardmaster\startup_stm32f103xb.o --depend pressuresensorboardmaster\startup_stm32f103xb.d)
F (../Core/Src/main.c)(0x6944FE48)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\main.o --omf_browse pressuresensorboardmaster\main.crf --depend pressuresensorboardmaster\main.d)
F (../Core/Src/main.c)(0x69A786E7)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\main.o --omf_browse pressuresensorboardmaster\main.crf --depend pressuresensorboardmaster\main.d)
I (../Core/Inc/main.h)(0x68FECD59)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x69420902)
@ -35,6 +35,7 @@ I (../Core/Inc/tim.h)(0x6930E838)
I (../Core/Inc/usart.h)(0x6912E845)
I (../Core/Inc/gpio.h)(0x68FECD58)
I (C:\app\Keil_v5\ARM\ARMCC\include\string.h)(0x6025237E)
I (..\BSP\BLE.h)(0x69A786E7)
F (../Core/Src/gpio.c)(0x69142865)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\gpio.o --omf_browse pressuresensorboardmaster\gpio.crf --depend pressuresensorboardmaster\gpio.d)
I (../Core/Inc/gpio.h)(0x68FECD58)
I (../Core/Inc/main.h)(0x68FECD59)
@ -666,8 +667,42 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
I (C:\app\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x60252374)
I (C:\app\Keil_v5\ARM\ARMCC\include\string.h)(0x6025237E)
F (..\MiddleWares\modbus.h)(0x6944F6AD)()
F (..\BSP\BLE.c)(0x699C6E5C)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\ble.o --omf_browse pressuresensorboardmaster\ble.crf --depend pressuresensorboardmaster\ble.d)
I (..\BSP\BLE.h)(0x699C0EA1)
F (..\BSP\BLE.c)(0x69A786E7)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\ble.o --omf_browse pressuresensorboardmaster\ble.crf --depend pressuresensorboardmaster\ble.d)
I (..\BSP\BLE.h)(0x69A786E7)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x69420902)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h)(0x68E72B55)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h)(0x68E72B55)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h)(0x68E72B55)
I (../Drivers/CMSIS/Include/core_cm3.h)(0x68E72B29)
I (C:\app\Keil_v5\ARM\ARMCC\include\stdint.h)(0x6025237E)
I (../Drivers/CMSIS/Include/cmsis_version.h)(0x68E72B29)
I (../Drivers/CMSIS/Include/cmsis_compiler.h)(0x68E72B29)
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x68E72B29)
I (../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h)(0x68E72B55)
I (C:\app\Keil_v5\ARM\ARMCC\include\stddef.h)(0x6025237E)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
I (..\BSP\flash.h)(0x69A786E7)
I (../Core/Inc/usart.h)(0x6912E845)
I (../Core/Inc/main.h)(0x68FECD59)
I (C:\app\Keil_v5\ARM\ARMCC\include\string.h)(0x6025237E)
F (..\BSP\BLE.h)(0x69A786E7)()
F (..\BSP\flash.c)(0x69A786E7)(--c99 -c --cpu Cortex-M3 -g -O3 --apcs=interwork --split_sections -I ../Core/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc -I ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I ../Drivers/CMSIS/Include -I ..\MiddleWares -I ..\BSP -I.\RTE\_PressureSensorBoardMaster -IC:\app\Keil_v5\ARM\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include -IC:\app\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include -D__UVISION_VERSION="541" -DSTM32F10X_MD -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F103xB -o pressuresensorboardmaster\flash.o --omf_browse pressuresensorboardmaster\flash.crf --depend pressuresensorboardmaster\flash.d)
I (..\BSP\flash.h)(0x69A786E7)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h)(0x68E72B55)
I (../Core/Inc/stm32f1xx_hal_conf.h)(0x69420902)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h)(0x68E72B55)
@ -696,4 +731,4 @@ I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h)(0x68E72B55)
I (../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h)(0x68E72B55)
I (C:\app\Keil_v5\ARM\ARMCC\include\string.h)(0x6025237E)
F (..\BSP\BLE.h)(0x699C0EA1)()
F (..\BSP\flash.h)(0x69A786E7)()

View File

@ -1,16 +0,0 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x00010000 { ; load region size_region
ER_IROM1 0x08000000 0x00010000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00005000 { ; RW data
.ANY (+RW +ZI)
}
}

View File

@ -28,4 +28,7 @@ pressuresensorboardmaster\ble.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_h
pressuresensorboardmaster\ble.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
pressuresensorboardmaster\ble.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
pressuresensorboardmaster\ble.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
pressuresensorboardmaster\ble.o: ..\BSP\flash.h
pressuresensorboardmaster\ble.o: ../Core/Inc/usart.h
pressuresensorboardmaster\ble.o: ../Core/Inc/main.h
pressuresensorboardmaster\ble.o: C:\app\Keil_v5\ARM\ARMCC\Bin\..\include\string.h

View File

@ -0,0 +1,31 @@
pressuresensorboardmaster\flash.o: ..\BSP\flash.c
pressuresensorboardmaster\flash.o: ..\BSP\flash.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
pressuresensorboardmaster\flash.o: ../Core/Inc/stm32f1xx_hal_conf.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Include/core_cm3.h
pressuresensorboardmaster\flash.o: C:\app\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Include/cmsis_version.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
pressuresensorboardmaster\flash.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
pressuresensorboardmaster\flash.o: C:\app\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
pressuresensorboardmaster\flash.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h
pressuresensorboardmaster\flash.o: C:\app\Keil_v5\ARM\ARMCC\Bin\..\include\string.h

View File

@ -33,3 +33,4 @@ pressuresensorboardmaster\main.o: ../Core/Inc/tim.h
pressuresensorboardmaster\main.o: ../Core/Inc/usart.h
pressuresensorboardmaster\main.o: ../Core/Inc/gpio.h
pressuresensorboardmaster\main.o: C:\app\Keil_v5\ARM\ARMCC\Bin\..\include\string.h
pressuresensorboardmaster\main.o: ..\BSP\BLE.h