hpw421初始版本
This commit is contained in:
@@ -0,0 +1,327 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_task.h
|
||||
*
|
||||
* @brief Header file - APPTASK.
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef APP_TASK_H_
|
||||
#define APP_TASK_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APPTASK Task
|
||||
* @ingroup APP
|
||||
* @brief Routes ALL messages to/from APP block.
|
||||
*
|
||||
* The APPTASK is the block responsible for bridging the final application with
|
||||
*the RWBLE software host stack. It communicates with the different modules of
|
||||
*the BLE host, i.e. @ref SMP, @ref GAP and @ref GATT.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "co_bt_defines.h"
|
||||
#include "dbg.h"
|
||||
#include "gapm_int.h"
|
||||
#include "gatt_msg_int.h" // GATTC Definitions
|
||||
#include "ke_task.h" // Kernel Task
|
||||
#include "rwip_task.h" // Task definitions
|
||||
#include "ota_server.h"
|
||||
#include "xc_gap_api.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h> // Standard Integer Definition
|
||||
#include <stdio.h>
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
#include "nvds.h"
|
||||
#endif // (NVDS_SUPPORT)
|
||||
|
||||
#define APP_HANDLERS(subtask) \
|
||||
{ \
|
||||
&subtask##_msg_handler_list[0], ARRAY_LEN(subtask##_msg_handler_list) \
|
||||
}
|
||||
|
||||
/// Default Device Name
|
||||
#define APP_DFLT_DEVICE_NAME ("ota_test")
|
||||
#define APP_DFLT_DEVICE_NAME_LEN (sizeof(APP_DFLT_DEVICE_NAME))
|
||||
/// Maximal length of the Device Name value
|
||||
#define APP_DEVICE_NAME_MAX_LEN (18)
|
||||
#define APP_MAX_TX_POWER (0)
|
||||
// Advertising channel map - 37, 38, 39
|
||||
#define APP_ADV_CHMAP (0x07)
|
||||
// Advertising minimum interval - 40ms (64*0.625ms)
|
||||
#define APP_ADV_INT_MIN (64)
|
||||
// Advertising maximum interval - 40ms (64*0.625ms)
|
||||
#define APP_ADV_INT_MAX (64)
|
||||
#define ADV_DATA_MAX_LENGTH 28
|
||||
|
||||
#define MANUFACTURER_DATA "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45"
|
||||
#define MANUFACTURER_DATA_LEN 10
|
||||
|
||||
/// Advertising duration (in unit of 10ms). 0 means that advertising continues
|
||||
/// until the host disable it
|
||||
#define ADV_DURATION 0
|
||||
|
||||
#define APP_SCAN_INTERVAL (0xa0)
|
||||
#define APP_SCAN_WINDOW (0x50)
|
||||
|
||||
#define APP_CONN_EST_TIME_OUT (0)
|
||||
#define APP_CONN_SCNA_INTV (32)
|
||||
#define APP_CONN_SCAN_WD (20)
|
||||
#define APP_CONN_INTV_MIN (80)
|
||||
#define APP_CONN_INV_MAX (80)
|
||||
#define APP_CONN_LATENCY (0)
|
||||
#define APP_CONN_TIME_OUT (500)
|
||||
|
||||
/// Number of APP Task Instances
|
||||
#define APP_IDX_MAX 1
|
||||
#define DEV_APPEARANCE 0
|
||||
|
||||
#define BLE_UAPDATA_MIN_INTVALUE 8
|
||||
#define BLE_UAPDATA_MAX_INTVALUE 10
|
||||
#define BLE_UAPDATA_LATENCY 0
|
||||
#define BLE_UAPDATA_TIMEOUT 200
|
||||
|
||||
#define INVALID_DATA 0xFF
|
||||
|
||||
#define TAGET_DEVICE_ADDR ("\x12\x34\x56\x78\x90\xAB")
|
||||
|
||||
|
||||
struct chip_param
|
||||
{
|
||||
uint8_t valid;
|
||||
uint8_t unique_id[6];
|
||||
uint8_t rc16m;
|
||||
uint16_t adc_2v4;
|
||||
};
|
||||
|
||||
/// Application environment structure
|
||||
struct app_env_tag
|
||||
{
|
||||
/// Connection handle
|
||||
uint16_t conhdl;
|
||||
/// Connection Index
|
||||
uint8_t conidx;
|
||||
/// Current advertising state (@see enum app_adv_state)
|
||||
uint8_t adv_state;
|
||||
/// Current advertising state (@see enum app_adv_state)
|
||||
uint8_t scan_state;
|
||||
/// Current advertising state (@see enum app_adv_state)
|
||||
uint8_t init_state;
|
||||
/// Next expected operation completed event
|
||||
uint8_t adv_op;
|
||||
|
||||
/// Last initialized profile
|
||||
uint8_t next_svc;
|
||||
|
||||
/// Bonding status
|
||||
bool bonded;
|
||||
|
||||
/// Device Name length
|
||||
uint8_t dev_name_len;
|
||||
/// Device Name
|
||||
uint8_t dev_name[APP_DEVICE_NAME_MAX_LEN];
|
||||
|
||||
/// Local device IRK
|
||||
uint8_t loc_irk[KEY_LEN];
|
||||
|
||||
/// Secure Connections on current link
|
||||
bool sec_con_enabled;
|
||||
|
||||
/// Counter used to generate IRK
|
||||
uint8_t rand_cnt;
|
||||
|
||||
/// Demonstration type length
|
||||
uint8_t demo_type_len;
|
||||
/// Demonstration type
|
||||
uint8_t demo_type;
|
||||
/// GATT user local identifier
|
||||
uint8_t user_lid;
|
||||
uint8_t adv_actv_idx;
|
||||
uint8_t slave_conidx;
|
||||
bool slave_connected;
|
||||
|
||||
};
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
/// List of Application NVDS TAG identifiers
|
||||
enum app_nvds_tag
|
||||
{
|
||||
/// Device Name
|
||||
NVDS_TAG_DEVICE_NAME = 0x02,
|
||||
NVDS_LEN_DEVICE_NAME = 62,
|
||||
|
||||
/// BD Address
|
||||
NVDS_TAG_BD_ADDRESS = 0x01,
|
||||
NVDS_LEN_BD_ADDRESS = 6,
|
||||
|
||||
/// Local device Identity resolving key
|
||||
NVDS_TAG_LOC_IRK = 0xA0,
|
||||
NVDS_LEN_LOC_IRK = KEY_LEN,
|
||||
|
||||
#if (BLE_APP_PRF)
|
||||
/// BLE Application Advertising data
|
||||
NVDS_TAG_APP_BLE_ADV_DATA = 0x0B,
|
||||
NVDS_LEN_APP_BLE_ADV_DATA = 32,
|
||||
|
||||
/// BLE Application Scan response data
|
||||
NVDS_TAG_APP_BLE_SCAN_RESP_DATA = 0x0C,
|
||||
NVDS_LEN_APP_BLE_SCAN_RESP_DATA = 32,
|
||||
|
||||
/// Mouse Sample Rate
|
||||
NVDS_TAG_MOUSE_SAMPLE_RATE = 0x38,
|
||||
NVDS_LEN_MOUSE_SAMPLE_RATE = 1,
|
||||
|
||||
/// Peripheral Bonded
|
||||
NVDS_TAG_PERIPH_BONDED = 0x39,
|
||||
NVDS_LEN_PERIPH_BONDED = 1,
|
||||
|
||||
/// Mouse NTF Cfg
|
||||
NVDS_TAG_MOUSE_NTF_CFG = 0x3A,
|
||||
NVDS_LEN_MOUSE_NTF_CFG = 2,
|
||||
|
||||
/// Mouse Timeout value
|
||||
NVDS_TAG_MOUSE_TIMEOUT = 0x3B,
|
||||
NVDS_LEN_MOUSE_TIMEOUT = 2,
|
||||
|
||||
/// Peer Device BD Address
|
||||
NVDS_TAG_PEER_BD_ADDRESS = 0x3C,
|
||||
NVDS_LEN_PEER_BD_ADDRESS = 7,
|
||||
|
||||
/// Mouse Energy Safe
|
||||
NVDS_TAG_MOUSE_ENERGY_SAFE = 0x3D,
|
||||
NVDS_LEN_MOUSE_SAFE_ENERGY = 2,
|
||||
|
||||
/// EDIV (2bytes), RAND NB (8bytes), LTK (16 bytes), Key Size (1 byte)
|
||||
NVDS_TAG_LTK = 0x3E,
|
||||
NVDS_LEN_LTK = 28,
|
||||
|
||||
/// PAIRING
|
||||
NVDS_TAG_PAIRING = 0x3F,
|
||||
NVDS_LEN_PAIRING = 54,
|
||||
|
||||
/// Audio mode 0 task
|
||||
NVDS_TAG_AM0_FIRST = 0x90,
|
||||
NVDS_TAG_AM0_LAST = 0x9F,
|
||||
|
||||
/// Peer device Resolving identity key (+identity address)
|
||||
NVDS_TAG_PEER_IRK = 0xA1,
|
||||
NVDS_LEN_PEER_IRK = sizeof(struct gapc_irk),
|
||||
|
||||
#endif //(BLE_APP_PRF)
|
||||
};
|
||||
#endif // (NVDS_SUPPORT)
|
||||
|
||||
/// Advertising state machine
|
||||
enum app_adv_state
|
||||
{
|
||||
/// Advertising activity does not exists
|
||||
APP_ADV_STATE_IDLE = 0,
|
||||
#if BLE_APP_PRF
|
||||
/// Creating advertising activity
|
||||
APP_ADV_STATE_CREATING,
|
||||
/// Setting advertising data
|
||||
APP_ADV_STATE_SETTING_ADV_DATA,
|
||||
/// Setting scan response data
|
||||
APP_ADV_STATE_SETTING_SCAN_RSP_DATA,
|
||||
|
||||
/// Advertising activity created
|
||||
APP_ADV_STATE_CREATED,
|
||||
/// Starting advertising activity
|
||||
APP_ADV_STATE_STARTING,
|
||||
/// Advertising activity started
|
||||
APP_ADV_STATE_STARTED,
|
||||
/// Stopping advertising activity
|
||||
APP_ADV_STATE_STOPPING,
|
||||
APP_ADV_STATE_STOPPED,
|
||||
#endif //(BLE_APP_PRF)
|
||||
};
|
||||
|
||||
/// Scanning state machine
|
||||
enum app_scan_state
|
||||
{
|
||||
APP_SCAN_STATE_IDLE = 0,
|
||||
APP_SCAN_STATE_CREATING,
|
||||
APP_SCAN_STATE_CREATED,
|
||||
APP_SCAN_STATE_STARTING,
|
||||
APP_SCAN_STATE_STARTED,
|
||||
APP_SCAN_STATE_STOPPING,
|
||||
APP_SCAN_STATE_STOPPED,
|
||||
};
|
||||
|
||||
/// initting state machine
|
||||
enum app_init_state
|
||||
{
|
||||
APP_INIT_STATE_IDLE = 0,
|
||||
APP_INIT_STATE_CREATING,
|
||||
APP_INIT_STATE_CREATED,
|
||||
APP_INIT_STATE_STARTING,
|
||||
APP_INIT_STATE_STARTED,
|
||||
APP_INIT_STATE_STOPPING,
|
||||
APP_INIT_STATE_STOPPED,
|
||||
};
|
||||
|
||||
/// States of APP task
|
||||
enum app_state
|
||||
{
|
||||
/// Initialization state
|
||||
APP_INIT,
|
||||
/// Database create state
|
||||
APP_CREATE_DB,
|
||||
/// Ready State
|
||||
APP_READY,
|
||||
/// Connected state
|
||||
APP_CONNECTED,
|
||||
|
||||
/// Number of defined states.
|
||||
APP_STATE_MAX
|
||||
};
|
||||
|
||||
/// APP Task messages
|
||||
/*@TRACE*/
|
||||
enum app_msg_id
|
||||
{
|
||||
APP_DUMMY_MSG = TASK_FIRST_MSG(TASK_ID_APP),
|
||||
|
||||
#if (BLE_APP_PRF)
|
||||
#if (BLE_APP_HT)
|
||||
/// Timer used to refresh the temperature measurement value
|
||||
APP_HT_MEAS_INTV_TIMER,
|
||||
#endif //(BLE_APP_HT)
|
||||
|
||||
#if (BLE_APP_HID)
|
||||
/// Timer used to disconnect the moue if no activity is detecter
|
||||
APP_HID_MOUSE_TIMEOUT_TIMER,
|
||||
#endif //(BLE_APP_HID)
|
||||
#endif //(BLE_APP_PRF)
|
||||
|
||||
};
|
||||
|
||||
struct app_subtask_handlers
|
||||
{
|
||||
/// Pointer to the message handler table
|
||||
const struct ke_msg_handler *p_msg_handler_tab;
|
||||
/// Number of messages handled
|
||||
uint16_t msg_cnt;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Initialize the BLE demo application.
|
||||
****************************************************************************************
|
||||
*/
|
||||
extern struct app_env_tag app_env;
|
||||
void app_init(void);
|
||||
struct app_env_tag *get_app_env(void);
|
||||
/// @} APPTASK
|
||||
|
||||
#endif // APP_TASK_H_
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file rwapp_config.h
|
||||
*
|
||||
* @brief Application configuration definition
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2016
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _RWAPP_CONFIG_H_
|
||||
#define _RWAPP_CONFIG_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup app
|
||||
* @brief Application configuration definition
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#define CFG_APP_BATT
|
||||
/******************************************************************************************/
|
||||
/* ------------------------- BLE APPLICATION SETTINGS
|
||||
* -----------------------------*/
|
||||
/******************************************************************************************/
|
||||
|
||||
/// Application Profile
|
||||
#if defined(CFG_APP_PRF)
|
||||
#define BLE_APP_PRF 1
|
||||
#else // defined(CFG_APP_PRF)
|
||||
#define BLE_APP_PRF 0
|
||||
#endif // defined(CFG_APP_PRF)
|
||||
|
||||
/// Health Thermometer Application
|
||||
#if defined(CFG_APP_HT)
|
||||
#define BLE_APP_HT 1
|
||||
#else // defined(CFG_APP_HT)
|
||||
#define BLE_APP_HT 0
|
||||
#endif // defined(CFG_APP_HT)
|
||||
|
||||
/// HID Application
|
||||
#if defined(CFG_APP_HID)
|
||||
#define BLE_APP_HID 1
|
||||
#else // defined(CFG_APP_HID)
|
||||
#define BLE_APP_HID 0
|
||||
#endif // defined(CFG_APP_HID)
|
||||
|
||||
/// DIS Application
|
||||
#if defined(CFG_APP_DIS)
|
||||
#define BLE_APP_DIS 1
|
||||
#else // defined(CFG_APP_DIS)
|
||||
#define BLE_APP_DIS 0
|
||||
#endif // defined(CFG_APP_DIS)
|
||||
|
||||
/// Battery Service Application
|
||||
#if defined(CFG_APP_BATT)
|
||||
#define BLE_APP_BATT 1
|
||||
#else
|
||||
#define BLE_APP_BATT 0
|
||||
#endif //(BLE_APP_BATT)
|
||||
|
||||
/// @} rwapp_config
|
||||
|
||||
#endif /* _RWAPP_CONFIG_H_ */
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
* *
|
||||
* @file aes.c
|
||||
*
|
||||
* @brief Definition file for AES crypto module functions
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2017-2018
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "aes.h"
|
||||
|
||||
#if (RWIP_AES_ENCRYPT)
|
||||
#define USE_AES_ENCRYPT 0
|
||||
#define USE_AES_DECRYPT 1
|
||||
|
||||
#if USE_AES_ENCRYPT
|
||||
uint8_t key[16]={0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x0d,0x0c,0x0b};
|
||||
uint8_t src_val[16]={0x0a,0x0a,0x0e,0x0d,0x0c,0x0b,0x0a,0x13,0x12,0x07,0x06,0x05,0x04,0x0d,0x02,0x01};
|
||||
uint8_t encrypt_val[16]={0xf7,0x3b,0x9a,0xe6,0x88,0xb0,0x06,0x3e,0x10,0xd4,0x0f,0xb6,0x80,0x4a,0x10,0xee};
|
||||
#elif USE_AES_DECRYPT
|
||||
uint8_t key[16]={0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x0d,0x0c,0x0b};
|
||||
uint8_t src_val[16]={0xf7,0x3b,0x9a,0xe6,0x88,0xb0,0x06,0x3e,0x10,0xd4,0x0f,0xb6,0x80,0x4a,0x10,0xee};
|
||||
uint8_t encrypt_val[16]={0x0a,0x0a,0x0e,0x0d,0x0c,0x0b,0x0a,0x13,0x12,0x07,0x06,0x05,0x04,0x0d,0x02,0x01};
|
||||
#endif
|
||||
|
||||
aes_func_result_cb aes_res(uint8_t status, const uint8_t* aes_res_data, uint32_t src_info)
|
||||
{
|
||||
printf("src_info:0x%x\n",src_info);
|
||||
printf("aes_res:");
|
||||
for(int i=0;i<16;i++){
|
||||
printf("%02x-",aes_res_data[i]);
|
||||
}printf("\n");
|
||||
|
||||
if(!memcmp(aes_res_data,encrypt_val,sizeof(encrypt_val))){
|
||||
printf("aes right\n");
|
||||
}else{
|
||||
printf("aes error\n");
|
||||
}
|
||||
}
|
||||
|
||||
void aes_test(void)
|
||||
{
|
||||
uint8_t copy=0;
|
||||
static uint8_t cnt;
|
||||
|
||||
if(xc_gpio_read_pin(GPIO_1) == GPIO_PIN_SET){
|
||||
if(cnt++ > 100){
|
||||
cnt = 0;
|
||||
#if USE_AES_ENCRYPT
|
||||
printf("aes_encrypt\n");
|
||||
aes_encrypt(key, src_val, 1, aes_res, 0xff);
|
||||
#elif USE_AES_DECRYPT
|
||||
printf("aes_decrypt\n");
|
||||
aes_decrypt(key, src_val, copy, aes_res, 0xff);
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
cnt = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_batt.c
|
||||
*
|
||||
* @brief Battery Application Module entry point
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h" // SW configuration
|
||||
|
||||
#if (BLE_APP_BATT)
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "app_batt.h" // Battery Application Module Definitions
|
||||
#include "app_task.h" // application task definitions
|
||||
#include "bass_msg.h" // health thermometer functions
|
||||
#include "co_bt.h"
|
||||
#include "co_utils.h"
|
||||
#include "prf_types.h" // Profile common types definition
|
||||
#include "arch.h" // Platform Definitions
|
||||
#include "prf.h"
|
||||
#include <string.h>
|
||||
#if 0
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Battery Application Module Environment Structure
|
||||
struct app_batt_env_tag app_batt_env;
|
||||
|
||||
/*
|
||||
* GLOBAL FUNCTION DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
void app_batt_init(void)
|
||||
{
|
||||
// Reset the environment
|
||||
memset(&app_batt_env, 0, sizeof(struct app_batt_env_tag));
|
||||
|
||||
// Initial battery level: 100
|
||||
app_batt_env.batt_lvl = 100;
|
||||
}
|
||||
|
||||
void app_batt_add_bas(void)
|
||||
{
|
||||
struct bass_db_cfg* db_cfg;
|
||||
// Allocate the BASS_CREATE_DB_REQ
|
||||
struct gapm_profile_task_add_cmd *req = KE_MSG_ALLOC_DYN(GAPM_PROFILE_TASK_ADD_CMD,
|
||||
TASK_GAPM, TASK_APP,
|
||||
gapm_profile_task_add_cmd, sizeof(struct bass_db_cfg));
|
||||
// Fill message
|
||||
req->operation = GAPM_PROFILE_TASK_ADD;
|
||||
req->sec_lvl = 0;//PERM(SVC_AUTH, AUTH);
|
||||
req->prf_api_id = TASK_ID_BASS;
|
||||
req->app_task = TASK_APP;
|
||||
req->start_hdl = 0;
|
||||
|
||||
// Set parameters
|
||||
db_cfg = (struct bass_db_cfg* ) req->param;
|
||||
|
||||
// Add a BAS instance
|
||||
db_cfg->bas_nb = 1;
|
||||
// Sending of notifications is supported
|
||||
db_cfg->features[0] = BAS_BATT_LVL_NTF_SUP;
|
||||
|
||||
// Send the message
|
||||
ke_msg_send(req);
|
||||
}
|
||||
|
||||
void app_batt_enable_prf(uint8_t conidx)
|
||||
{
|
||||
app_batt_env.conidx = conidx;
|
||||
|
||||
// Allocate the message
|
||||
struct bass_enable_req * req = KE_MSG_ALLOC(BASS_ENABLE_REQ,
|
||||
prf_dst_task_get(TASK_ID_BASS),
|
||||
TASK_APP,
|
||||
bass_enable_req);
|
||||
|
||||
// Fill in the parameter structure
|
||||
req->conidx = conidx;
|
||||
|
||||
// NTF initial status - Disabled
|
||||
req->ntf_cfg = PRF_CLI_STOP_NTFIND;
|
||||
req->old_batt_lvl[0] = 50;
|
||||
|
||||
// Send the message
|
||||
ke_msg_send(req);
|
||||
}
|
||||
|
||||
void app_batt_send_lvl(uint8_t batt_lvl)
|
||||
{
|
||||
ASSERT_ERR(batt_lvl <= BAS_BATTERY_LVL_MAX);
|
||||
|
||||
// Allocate the message
|
||||
struct bass_batt_level_upd_req * req = KE_MSG_ALLOC(BASS_BATT_LEVEL_UPD_REQ,
|
||||
prf_dst_task_get(TASK_ID_BASS),
|
||||
TASK_APP,
|
||||
bass_batt_level_upd_req);
|
||||
|
||||
// Fill in the parameter structure
|
||||
req->bas_instance = 0;
|
||||
req->batt_level = batt_lvl;
|
||||
|
||||
// Send the message
|
||||
ke_msg_send(req);
|
||||
}
|
||||
|
||||
static int bass_batt_level_ntf_cfg_ind_handler(ke_msg_id_t const msgid,
|
||||
struct bass_batt_level_ntf_cfg_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
static int batt_level_upd_handler(ke_msg_id_t const msgid,
|
||||
struct bass_batt_level_upd_rsp const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief
|
||||
*
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance (TASK_GAP).
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
*
|
||||
* @return If the message was consumed or not.
|
||||
****************************************************************************************
|
||||
*/
|
||||
static int app_batt_msg_dflt_handler(ke_msg_id_t const msgid,
|
||||
void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
// Drop the message
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
/*
|
||||
* LOCAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Default State handlers definition
|
||||
const struct ke_msg_handler app_batt_msg_handler_list[] =
|
||||
{
|
||||
// Note: first message is latest message checked by kernel so default is put on top.
|
||||
{KE_MSG_DEFAULT_HANDLER, (ke_msg_func_t)app_batt_msg_dflt_handler},
|
||||
|
||||
{BASS_BATT_LEVEL_NTF_CFG_IND, (ke_msg_func_t)bass_batt_level_ntf_cfg_ind_handler},
|
||||
{BASS_BATT_LEVEL_UPD_RSP, (ke_msg_func_t)batt_level_upd_handler},
|
||||
};
|
||||
|
||||
const struct app_subtask_handlers app_batt_handlers = APP_HANDLERS(app_batt);
|
||||
|
||||
#endif //BLE_APP_BATT
|
||||
#endif
|
||||
/// @} APP
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_batt.h
|
||||
*
|
||||
* @brief Battery Application Module entry point
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef APP_BATT_H_
|
||||
#define APP_BATT_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @ingroup RICOW
|
||||
*
|
||||
* @brief Battery Application Module entry point
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h" // SW configuration
|
||||
|
||||
#if (BLE_APP_BATT)
|
||||
|
||||
#include <stdint.h> // Standard Integer Definition
|
||||
#include "ke_task.h" // Kernel Task Definition
|
||||
|
||||
/*
|
||||
* STRUCTURES DEFINITION
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Battery Application Module Environment Structure
|
||||
struct app_batt_env_tag
|
||||
{
|
||||
/// Connection handle
|
||||
uint8_t conidx;
|
||||
/// Current Battery Level
|
||||
uint8_t batt_lvl;
|
||||
};
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLES DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Battery Application environment
|
||||
extern struct app_batt_env_tag app_batt_env;
|
||||
|
||||
/// Table of message handlers
|
||||
extern const struct app_subtask_handlers app_batt_handlers;
|
||||
|
||||
/*
|
||||
* FUNCTIONS DECLARATION
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* Health Thermometer Application Functions
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Initialize Battery Application Module
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_batt_init(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Add a Battery Service instance in the DB
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_batt_add_bas(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Enable the Battery Service
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_batt_enable_prf(uint8_t conidx);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Send a Battery level value
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_batt_send_lvl(uint8_t batt_lvl);
|
||||
|
||||
#endif //(BLE_APP_BATT)
|
||||
|
||||
/// @} APP
|
||||
|
||||
#endif // APP_BATT_H_
|
||||
@@ -0,0 +1,56 @@
|
||||
#if 0
|
||||
/*@TRACE*/
|
||||
enum basc_msg_id
|
||||
{
|
||||
/// Start the Battery Service Client Role - at connection
|
||||
// BASC_ENABLE_REQ = MSG_ID(BASC, 0x00),
|
||||
///Confirm that cfg connection has finished with discovery results, or that normal cnx started
|
||||
BASC_ENABLE_RSP = MSG_ID(BASC, 0x01),
|
||||
|
||||
/// Read Characteristic Value Request
|
||||
// BASC_READ_INFO_REQ = MSG_ID(BASC, 0x02),
|
||||
/// Read Characteristic Value Request
|
||||
BASC_READ_INFO_RSP = MSG_ID(BASC, 0x03),
|
||||
|
||||
/// Write Battery Level Notification Configuration Value request
|
||||
// BASC_BATT_LEVEL_NTF_CFG_REQ = MSG_ID(BASC, 0x04),
|
||||
/// Write Battery Level Notification Configuration Value response
|
||||
BASC_BATT_LEVEL_NTF_CFG_RSP = MSG_ID(BASC, 0x05),
|
||||
|
||||
/// Indicate to APP that the Battery Level value has been received
|
||||
BASC_BATT_LEVEL_IND = MSG_ID(BASC, 0x06),
|
||||
};
|
||||
#endif
|
||||
|
||||
void xc_basc_enbale_req()
|
||||
{
|
||||
//send msg
|
||||
BASC_ENABLE_REQ
|
||||
}
|
||||
|
||||
void xc_basc_read_info_req()
|
||||
{
|
||||
//send msg
|
||||
BASC_READ_INFO_REQ
|
||||
}
|
||||
|
||||
void xc_basc_batt_leval_ntf_cfg_req()
|
||||
{
|
||||
//send msg
|
||||
BASC_BATT_LEVEL_NTF_CFG_REQ
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Default State handlers definition
|
||||
KE_MSG_HANDLER_TAB(basc)
|
||||
{
|
||||
// Note: all messages must be sorted in ID ascending order
|
||||
|
||||
{BASC_ENABLE_RSP, (ke_msg_func_t) xxx_handler },
|
||||
{BASC_READ_INFO_RSP, (ke_msg_func_t) xxx_handler },
|
||||
{BASC_BATT_LEVEL_NTF_CFG_RSP, (ke_msg_func_t) xxx_handler },
|
||||
{BASC_BATT_LEVEL_IND, (ke_msg_func_t) xxx_handler },
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*----------------------------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
----------------------------------------------------------------------------------------------------*/
|
||||
//#include "Includes.h"
|
||||
#include "xc6xxx.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "xc_drv_uart.h"
|
||||
|
||||
void printf_string(char *strings)
|
||||
{
|
||||
while(*strings != '\0')
|
||||
{
|
||||
xc_uart_send_byte(UART0_IDX, *strings);
|
||||
strings ++;
|
||||
}
|
||||
}
|
||||
|
||||
void printf_int(uint32_t input_data)
|
||||
{
|
||||
uint8_t temp[96];
|
||||
uint8_t i = 0;
|
||||
|
||||
while(input_data > 0)
|
||||
{
|
||||
temp[i]=(input_data % 10) + '0';
|
||||
input_data = input_data / 10;
|
||||
i ++;
|
||||
}
|
||||
|
||||
for( ; i>0; i --)
|
||||
{
|
||||
xc_uart_send_byte(UART0_IDX, temp[i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void printf_hex(uint32_t input_data)
|
||||
{
|
||||
uint8_t temp[96];
|
||||
uint8_t i = 0;
|
||||
|
||||
while(input_data > 0)
|
||||
{
|
||||
if((input_data % 16) > 9)
|
||||
temp[i]=(input_data % 16) - 10 + 'a';
|
||||
else
|
||||
temp[i]=(input_data % 16) + '0';
|
||||
|
||||
input_data = input_data / 16;
|
||||
i ++;
|
||||
}
|
||||
|
||||
for( ; i>0; i --)
|
||||
{
|
||||
xc_uart_send_byte(UART0_IDX, temp[i-1]);
|
||||
}
|
||||
}
|
||||
int uart_printf(const char *fmt,...)
|
||||
{
|
||||
char chr;
|
||||
int argint;
|
||||
char temp;
|
||||
|
||||
char *argstr;
|
||||
va_list va;
|
||||
va_start(va,fmt);
|
||||
|
||||
while((chr= *fmt++) != '\0')
|
||||
{
|
||||
if(chr != '%')
|
||||
{
|
||||
xc_uart_send_byte(UART0_IDX, chr);
|
||||
continue;
|
||||
}
|
||||
if(*fmt != '\0')
|
||||
temp=*fmt++;
|
||||
else
|
||||
temp='\0';
|
||||
|
||||
switch(temp)
|
||||
{
|
||||
case '\0':
|
||||
xc_uart_send_byte(UART0_IDX, '%');
|
||||
break;
|
||||
case 'c':
|
||||
xc_uart_send_byte(UART0_IDX, va_arg(va,int));
|
||||
break;
|
||||
case 's':
|
||||
argstr = va_arg(va,char *);
|
||||
printf_string(argstr);
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
argint = va_arg(va,int);
|
||||
printf_hex(argint);
|
||||
break;
|
||||
case 'd':
|
||||
argint = va_arg(va,int);
|
||||
printf_int(argint);
|
||||
break;
|
||||
default :
|
||||
xc_uart_send_byte(UART0_IDX, '%');
|
||||
fmt --;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
va_end(va);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,549 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_sec.c
|
||||
*
|
||||
* @brief Application Security Entry Point
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
#include "rwip_config.h"
|
||||
#if (BLE_APP_PRESENT)
|
||||
#if (BLE_HOST_SUPPORT_SMP)
|
||||
#include "rwip_config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "co_utils.h"
|
||||
#include "co_math.h"
|
||||
//#include "gapc_task.h" // GAP Controller Task API Definition
|
||||
#include "gap.h" // GAP Definition
|
||||
#include "gapc.h" // GAPC Definition
|
||||
#include "gapc_int.h"
|
||||
#include "prf_types.h"
|
||||
|
||||
#include "app_sec.h" // Application Security API Definition
|
||||
#include "app_task.h" // Application Manager API Definition
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
#include "nvds.h" // NVDS API Definitions
|
||||
#endif //(NVDS_SUPPORT)
|
||||
|
||||
#include "app_task.h"
|
||||
|
||||
#if 0
|
||||
uint8_t bond_flag = 0;
|
||||
struct gapc_ltk g_ltk = {0};
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Application Security Environment Structure
|
||||
struct app_sec_env_tag app_sec_env;
|
||||
|
||||
/*
|
||||
* GLOBAL FUNCTION DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
void app_sec_init()
|
||||
{
|
||||
/*------------------------------------------------------
|
||||
* RETRIEVE BOND STATUS
|
||||
*------------------------------------------------------*/
|
||||
#if (NVDS_SUPPORT)
|
||||
uint8_t length = NVDS_LEN_PERIPH_BONDED;
|
||||
|
||||
// Get bond status from NVDS
|
||||
if (nvds_get(NVDS_TAG_PERIPH_BONDED, &length, (uint8_t *)&app_sec_env.bonded) != NVDS_OK)
|
||||
{
|
||||
// If read value is invalid, set status to not bonded
|
||||
app_sec_env.bonded = false;
|
||||
}
|
||||
|
||||
if ((app_sec_env.bonded != true) && (app_sec_env.bonded != false))
|
||||
{
|
||||
app_sec_env.bonded = false;
|
||||
}
|
||||
LOGI("===bond_state:%d\r\n",app_sec_env.bonded);
|
||||
#endif //(NVDS_SUPPORT)
|
||||
}
|
||||
|
||||
bool app_sec_get_bond_status(void)
|
||||
{
|
||||
return app_sec_env.bonded;
|
||||
}
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
void app_sec_remove_bond(void)
|
||||
{
|
||||
#if (BLE_APP_HID)
|
||||
uint16_t ntf_cfg = PRF_CLI_STOP_NTFIND;
|
||||
#endif //(BLE_APP_HID)
|
||||
|
||||
// Check if we are well bonded
|
||||
if (app_sec_env.bonded == true)
|
||||
{
|
||||
// Update the environment variable
|
||||
app_sec_env.bonded = false;
|
||||
|
||||
if (nvds_put(NVDS_TAG_PERIPH_BONDED, NVDS_LEN_PERIPH_BONDED,
|
||||
(uint8_t *)&app_sec_env.bonded) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
|
||||
if (nvds_del(NVDS_TAG_LTK) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
|
||||
if (nvds_del(NVDS_TAG_PEER_BD_ADDRESS) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
|
||||
#if (BLE_APP_HID)
|
||||
if (nvds_put(NVDS_TAG_MOUSE_NTF_CFG, NVDS_LEN_MOUSE_NTF_CFG,
|
||||
(uint8_t *)&ntf_cfg) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
#endif //(BLE_APP_HID)
|
||||
}
|
||||
}
|
||||
#endif //(NVDS_SUPPORT)
|
||||
|
||||
|
||||
/*
|
||||
* MESSAGE HANDLERS
|
||||
****************************************************************************************
|
||||
*/
|
||||
static int app_sec_msg_dflt_handler(ke_msg_id_t const msgid,
|
||||
void *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
// Drop the message
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int gapc_bond_req_ind_handler(ke_msg_id_t const msgid,
|
||||
void const * p_param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapc_bond_req_ind *param = (struct gapc_bond_req_ind *)p_param;
|
||||
LOGI(" [debug] gapc_bond_req_ind_handler,request:0x%x \r\n",param->request);
|
||||
// Prepare the GAPC_BOND_CFM message
|
||||
struct gapc_bond_cfm *cfm = KE_MSG_ALLOC(GAPC_BOND_CFM,
|
||||
src_id, TASK_APP,
|
||||
gapc_bond_cfm);
|
||||
switch (param->request)
|
||||
{
|
||||
case (GAPC_PAIRING_REQ):
|
||||
{
|
||||
cfm->request = GAPC_PAIRING_RSP;
|
||||
{
|
||||
cfm->accept = true;
|
||||
#if (BLE_SEC_CON)
|
||||
cfm->data.pairing_feat.auth = GAP_AUTH_REQ_SEC_CON_BOND;
|
||||
#else // (BLE_SEC_CON)
|
||||
cfm->data.pairing_feat.auth = GAP_AUTH_REQ_NO_MITM_BOND;
|
||||
#endif // (BLE_SEC_CON)
|
||||
|
||||
app_env.sec_con_enabled = true;
|
||||
cfm->data.pairing_feat.iocap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;//GAP_IO_CAP_KB_ONLY;//GAP_IO_CAP_DISPLAY_ONLY;//GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
cfm->data.pairing_feat.key_size = 16;
|
||||
cfm->data.pairing_feat.oob = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
cfm->data.pairing_feat.sec_req = GAP_SEC1_NOAUTH_PAIR_ENC;//GAP_SEC1_AUTH_PAIR_ENC;//GAP_NO_SEC;
|
||||
cfm->data.pairing_feat.rkey_dist = GAP_KDIST_ENCKEY | GAP_KDIST_IDKEY;
|
||||
cfm->data.pairing_feat.ikey_dist = GAP_KDIST_ENCKEY | GAP_KDIST_IDKEY;
|
||||
}
|
||||
} break;
|
||||
|
||||
case (GAPC_LTK_EXCH):
|
||||
{
|
||||
// Counter
|
||||
uint8_t counter;
|
||||
|
||||
cfm->accept = true;
|
||||
cfm->request = GAPC_LTK_EXCH;
|
||||
|
||||
// Generate all the values
|
||||
cfm->data.ltk.ediv = (uint16_t)co_rand_word();
|
||||
|
||||
for (counter = 0; counter < RAND_NB_LEN; counter++)
|
||||
{
|
||||
cfm->data.ltk.ltk.key[counter] = (uint8_t)co_rand_word();
|
||||
cfm->data.ltk.randnb.nb[counter] = (uint8_t)co_rand_word();
|
||||
}
|
||||
|
||||
for (counter = RAND_NB_LEN; counter < KEY_LEN; counter++)
|
||||
{
|
||||
cfm->data.ltk.ltk.key[counter] = (uint8_t)co_rand_word();
|
||||
}
|
||||
|
||||
#if (1)
|
||||
LOGI( "nvds_put cfm->ediv=0x%x\r\nparam_randnb:",cfm->data.ltk.ediv);
|
||||
for(uint8_t i=0;i<GAP_RAND_NB_LEN;i++)
|
||||
LOGI( "%x",cfm->data.ltk.randnb.nb[i]);
|
||||
LOGI("\r\nltk:");
|
||||
for(uint8_t i=0;i<GAP_KEY_LEN;i++)
|
||||
LOGI( "%x",cfm->data.ltk.ltk.key[i]);
|
||||
LOGI("\r\n");
|
||||
#endif
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
uint8_t err = nvds_del(NVDS_TAG_LTK);
|
||||
LOGI("err2 =%d \n", err);
|
||||
// Store the generated value in NVDS
|
||||
if (nvds_put(NVDS_TAG_LTK, NVDS_LEN_LTK, (uint8_t *)&cfm->data.ltk) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
|
||||
// uint8_t buff5[10] = {1,2,3,4,5,6,9,8,9,11};
|
||||
// // LOGI("nvds del:%d \r\n",nvds_del(16));
|
||||
// if (nvds_put(18, 10, buff5) != NVDS_OK)
|
||||
// {
|
||||
// LOGI("77111\r\n");
|
||||
// ASSERT_ERR(0);
|
||||
// }
|
||||
// LOGI("77222\r\n");
|
||||
|
||||
#endif // #if (NVDS_SUPPORT)
|
||||
} break;
|
||||
|
||||
|
||||
case (GAPC_IRK_EXCH):
|
||||
{
|
||||
#if (NVDS_SUPPORT)
|
||||
uint8_t addr_len = BD_ADDR_LEN;
|
||||
#endif //(NVDS_SUPPORT)
|
||||
|
||||
cfm->accept = true;
|
||||
cfm->request = GAPC_IRK_EXCH;
|
||||
|
||||
// Load IRK
|
||||
memcpy(cfm->data.irk.irk.key, app_env.loc_irk, KEY_LEN);
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
if (nvds_get(NVDS_TAG_BD_ADDRESS, &addr_len, cfm->data.irk.addr.addr) != NVDS_OK)
|
||||
#endif //(NVDS_SUPPORT)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
// load device address
|
||||
cfm->data.irk.addr.addr_type = (cfm->data.irk.addr.addr[5] & 0xC0) ? ADDR_RAND : ADDR_PUBLIC;
|
||||
} break;
|
||||
|
||||
|
||||
//#if (BLE_APP_HT)
|
||||
case (GAPC_TK_EXCH):
|
||||
{
|
||||
// Generate a PIN Code- (Between 100000 and 999999)
|
||||
uint32_t pin_code = (100000 + (co_rand_word()%900000));
|
||||
|
||||
LOGI("app_sec GAPC_TK_EXCH: tk_type=%d\r\n",param->data.tk_type);
|
||||
cfm->accept = true;
|
||||
cfm->request = GAPC_TK_EXCH;
|
||||
|
||||
// Set the TK value
|
||||
memset(cfm->data.tk.key, 0, KEY_LEN);
|
||||
|
||||
cfm->data.tk.key[0] = (uint8_t)((pin_code & 0x000000FF) >> 0);
|
||||
cfm->data.tk.key[1] = (uint8_t)((pin_code & 0x0000FF00) >> 8);
|
||||
cfm->data.tk.key[2] = (uint8_t)((pin_code & 0x00FF0000) >> 16);
|
||||
cfm->data.tk.key[3] = (uint8_t)((pin_code & 0xFF000000) >> 24);
|
||||
|
||||
LOGI("###GAPC_TK_EXCH pincode=%d\r\n", pin_code);
|
||||
|
||||
} break;
|
||||
//#endif //(BLE_APP_HT)
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
} break;
|
||||
}
|
||||
|
||||
// Send the message
|
||||
ke_msg_send(cfm);
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
static int gapc_bond_ind_handler(ke_msg_id_t const msgid,
|
||||
void const *p_param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapc_bond_ind const *param = (struct gapc_bond_ind const *)p_param;
|
||||
|
||||
LOGI(" [debug] gapc_bond_ind_handler : info=%d\r\n", param->info);
|
||||
switch (param->info)
|
||||
{
|
||||
case (GAPC_PAIRING_SUCCEED):
|
||||
{
|
||||
// Update the bonding status in the environment
|
||||
app_sec_env.bonded = true;
|
||||
bond_flag = 1;
|
||||
LOGI("GAPC_PAIRING_SUCCEED auth=%d,ltk_present=%d\r\n",
|
||||
param->data.pairing.level,param->data.pairing.ltk_present);
|
||||
|
||||
// Update the bonding status in the environment
|
||||
#if (PLF_NVDS)
|
||||
uint8_t err = nvds_del(NVDS_TAG_PERIPH_BONDED);
|
||||
LOGI("err1 =%d \n", err);
|
||||
if (nvds_put(NVDS_TAG_PERIPH_BONDED, NVDS_LEN_PERIPH_BONDED,
|
||||
(uint8_t *)&app_sec_env.bonded) != NVDS_OK)
|
||||
{
|
||||
// An error has occurred during access to the NVDS
|
||||
ASSERT_ERR(0);
|
||||
LOGI("3\n");
|
||||
}
|
||||
LOGI("4\n");
|
||||
// Set the BD Address of the peer device in NVDS
|
||||
uint8_t err2 = nvds_del(NVDS_TAG_PEER_BD_ADDRESS);
|
||||
LOGI("err2 =%d \n", err);
|
||||
struct app_env_tag *app_env = get_app_env();
|
||||
if (nvds_put(NVDS_TAG_PEER_BD_ADDRESS, NVDS_LEN_PEER_BD_ADDRESS,
|
||||
(uint8_t *)gapc_get_bdaddr(app_env->slave_conidx, GAPC_SMP_INFO_PEER)) != NVDS_OK)
|
||||
{
|
||||
// An error has occurred during access to the NVDS
|
||||
ASSERT_ERR(0);
|
||||
LOGI("5\n");
|
||||
}
|
||||
LOGI("6\n");
|
||||
#endif //(PLF_NVDS)
|
||||
|
||||
|
||||
|
||||
} break;
|
||||
|
||||
case (GAPC_REPEATED_ATTEMPT):
|
||||
{
|
||||
// app_disconnect();
|
||||
} break;
|
||||
|
||||
case (GAPC_IRK_EXCH):
|
||||
{
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
// Store peer identity in NVDS
|
||||
LOGI("GAPC_IRK_EXCH\r\n");
|
||||
uint8_t err = nvds_del(NVDS_TAG_PEER_IRK);
|
||||
LOGI("err2 =%d \n", err);
|
||||
if (nvds_put(NVDS_TAG_PEER_IRK, NVDS_LEN_PEER_IRK, (uint8_t *)¶m->data.irk.irk.key[0]) != NVDS_OK)
|
||||
|
||||
{
|
||||
LOGI("1\r\n");
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
LOGI("2\r\n");
|
||||
|
||||
#endif // (NVDS_SUPPORT)
|
||||
} break;
|
||||
|
||||
case (GAPC_PAIRING_FAILED):
|
||||
{
|
||||
// app_sec_send_security_req(0);
|
||||
} break;
|
||||
|
||||
// In Secure Connections we get BOND_IND with SMPC calculated LTK
|
||||
case (GAPC_LTK_EXCH) :
|
||||
{
|
||||
LOGI( "GAPC_LTK_EXCH sec_con_enabled=%d\r\n",app_env.sec_con_enabled);
|
||||
|
||||
LOGI( " param->ediv=0x%x\r\nparam_randnb:",param->data.ltk.ediv);
|
||||
for(uint8_t i=0;i<GAP_RAND_NB_LEN;i++)
|
||||
LOGI( "%x",param->data.ltk.randnb.nb[i]);
|
||||
LOGI("\r\nltk:");
|
||||
for(uint8_t i=0;i<GAP_KEY_LEN;i++)
|
||||
LOGI( "%x",param->data.ltk.ltk.key[i]);
|
||||
LOGI("\r\n");
|
||||
|
||||
#if (0)
|
||||
if (app_env.sec_con_enabled == true)
|
||||
{
|
||||
#if (NVDS_SUPPORT)
|
||||
// Store LTK in NVDS
|
||||
if (nvds_put(NVDS_TAG_LTK, NVDS_LEN_LTK,(uint8_t *)¶m->data.ltk.ltk.key[0]) != NVDS_OK)
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
#endif // (NVDS_SUPPORT)
|
||||
}
|
||||
#endif // (BLE_APP_SEC_CON)
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
} break;
|
||||
}
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
static int gapc_encrypt_req_ind_handler(ke_msg_id_t const msgid,
|
||||
void const *p_param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapc_encrypt_req_ind const *param = (struct gapc_encrypt_req_ind const *)p_param;
|
||||
LOGI(" [debug] gapc_encrypt_req_ind_handler \r\n");
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
// LTK value
|
||||
struct gapc_ltk ltk;
|
||||
// Length
|
||||
uint8_t length = NVDS_LEN_LTK;
|
||||
#endif // #if (NVDS_SUPPORT)
|
||||
|
||||
// Prepare the GAPC_ENCRYPT_CFM message
|
||||
struct gapc_encrypt_cfm *cfm = KE_MSG_ALLOC(GAPC_ENCRYPT_CFM,
|
||||
src_id, TASK_APP,
|
||||
gapc_encrypt_cfm);
|
||||
|
||||
cfm->found = false;
|
||||
|
||||
|
||||
LOGI("app_sec gapc_encrypt_req_ind_handler: bonded=%d\r\n", app_sec_env.bonded);
|
||||
|
||||
|
||||
// if (app_sec_env.bonded)
|
||||
{
|
||||
#if (NVDS_SUPPORT)
|
||||
// Retrieve the required informations from NVDS
|
||||
if (nvds_get(NVDS_TAG_LTK, &length, (uint8_t *)<k) == NVDS_OK)
|
||||
{
|
||||
|
||||
|
||||
LOGI( "nvds_get param->ediv=0x%x,ltk.ediv=0x%x\r\nparam_randnb:",param->ediv,ltk.ediv);
|
||||
for(uint8_t i=0;i<GAP_RAND_NB_LEN;i++)
|
||||
LOGI( "%x",param->rand_nb.nb[i]);
|
||||
LOGI("\r\nltk.randnb.nb:");
|
||||
for(uint8_t i=0;i<GAP_RAND_NB_LEN;i++)
|
||||
LOGI( "%x",ltk.randnb.nb[i]);
|
||||
LOGI("\r\n");
|
||||
|
||||
|
||||
// Check if the provided EDIV and Rand Nb values match with the stored values
|
||||
if ((param->ediv == ltk.ediv) &&
|
||||
!memcmp(¶m->rand_nb.nb[0], <k.randnb.nb[0], sizeof(struct rand_nb)))
|
||||
{
|
||||
LOGI("EDIV and randnb are same!!!\r\n");
|
||||
cfm->found = true;
|
||||
cfm->key_size = 16;
|
||||
memcpy(&cfm->ltk, <k.ltk, sizeof(struct gap_sec_key));
|
||||
bond_flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGI("EDIV and randnb not same!!!\r\n");
|
||||
}
|
||||
/*
|
||||
* else we are bonded with another device, disconnect the link
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
#endif // #if (NVDS_SUPPORT)
|
||||
}
|
||||
/*
|
||||
* else the peer device is not known, an error should trigger a new pairing procedure.
|
||||
*/
|
||||
|
||||
// Send the message
|
||||
ke_msg_send(cfm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
|
||||
static int gapc_encrypt_ind_handler(ke_msg_id_t const msgid,
|
||||
void const *p_param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapc_encrypt_ind const *param = (struct gapc_encrypt_ind const *)p_param;
|
||||
LOGI(" [debug] gapc_encrypt_ind_handler \r\n");
|
||||
|
||||
// encryption/ re-encryption succeeded
|
||||
|
||||
LOGI("app_sec gapc_encrypt_ind_handler: auth=%d\r\n", param->pairing_lvl);
|
||||
|
||||
|
||||
// struct gapc_set_le_pkt_size_cmd *req = KE_MSG_ALLOC(GAPC_SET_LE_PKT_SIZE_CMD,
|
||||
// KE_BUILD_ID(TASK_GAPC, KE_IDX_GET(src_id)), TASK_APP,
|
||||
// gapc_set_le_pkt_size_cmd);
|
||||
|
||||
// req->operation = GAPC_SET_LE_PKT_SIZE;
|
||||
// req->tx_octets = 0xFB;
|
||||
// req->tx_time = 2120;
|
||||
|
||||
// // Send the message
|
||||
// ke_msg_send(req);
|
||||
|
||||
|
||||
|
||||
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* LOCAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Default State handlers definition
|
||||
const struct ke_msg_handler app_sec_msg_handler_list[] =
|
||||
{
|
||||
// Note: first message is latest message checked by kernel so default is put on top.
|
||||
{KE_MSG_DEFAULT_HANDLER, (ke_msg_func_t)app_sec_msg_dflt_handler},
|
||||
|
||||
{GAPC_BOND_REQ_IND, (ke_msg_func_t)gapc_bond_req_ind_handler},
|
||||
{GAPC_BOND_IND, (ke_msg_func_t)gapc_bond_ind_handler},
|
||||
|
||||
{GAPC_ENCRYPT_REQ_IND, (ke_msg_func_t)gapc_encrypt_req_ind_handler},
|
||||
{GAPC_ENCRYPT_IND, (ke_msg_func_t)gapc_encrypt_ind_handler},
|
||||
};
|
||||
|
||||
const struct app_subtask_handlers app_sec_handlers = {&app_sec_msg_handler_list[0], ARRAY_LEN(app_sec_msg_handler_list)};
|
||||
#endif
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
#endif
|
||||
/// @} APP
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_sec.h
|
||||
*
|
||||
* @brief Application Security Entry Point
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP_SEC
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef APP_SEC_H_
|
||||
#define APP_SEC_H_
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h"
|
||||
#include <stdint.h> // Standard Integer Definition
|
||||
#include <stdbool.h>
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* STRUCTURES DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
struct app_sec_env_tag
|
||||
{
|
||||
// Bond status
|
||||
bool bonded;
|
||||
};
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// Application Security Environment
|
||||
extern struct app_sec_env_tag app_sec_env;
|
||||
|
||||
/// Table of message handlers
|
||||
extern const struct app_subtask_handlers app_sec_handlers;
|
||||
|
||||
/*
|
||||
* GLOBAL FUNCTIONS DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Initialize the Application Security Module
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_sec_init(void);
|
||||
|
||||
|
||||
#if (NVDS_SUPPORT)
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Remove all bond data stored in NVDS
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_sec_remove_bond(void);
|
||||
#endif //(NVDS_SUPPORT)
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Send a security request to the peer device. This function is used to require the
|
||||
* central to start the encryption with a LTK that would have shared during a previous
|
||||
* bond procedure.
|
||||
*
|
||||
* @param[in] - conidx: Connection Index
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_sec_send_security_req(uint8_t conidx);
|
||||
|
||||
|
||||
|
||||
#endif // APP_SEC_H_
|
||||
|
||||
/// @} APP_SEC
|
||||
@@ -0,0 +1,598 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file app_task.c
|
||||
*
|
||||
* @brief RW APP Task implementation
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#include "rwip_config.h"
|
||||
#if (BLE_APP_PRESENT)
|
||||
#include "app_task.h" // Application Manager Task API
|
||||
#include "app_sec.h"
|
||||
|
||||
/// Application Task Descriptor
|
||||
const struct ke_task_desc TASK_DESC_APP;
|
||||
/// Application Environment Structure
|
||||
struct app_env_tag app_env = {
|
||||
.adv_actv_idx = INVALID_DATA,
|
||||
.slave_conidx = INVALID_DATA,
|
||||
.slave_connected = false,
|
||||
|
||||
};
|
||||
|
||||
struct app_env_tag *get_app_env(void) { return &app_env; }
|
||||
|
||||
static uint8_t gapc_callback(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
static uint8_t gapm_callback(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
void app_init()
|
||||
{
|
||||
// Reset the application manager environment
|
||||
memset(&app_env, 0, sizeof(app_env));
|
||||
// Create APP task
|
||||
ke_task_create(TASK_APP, &TASK_DESC_APP);
|
||||
// Initialize Task state
|
||||
ke_state_set(TASK_APP, APP_INIT);
|
||||
#if (NVDS_SUPPORT)
|
||||
// Get the Device Name to add in the Advertising Data (Default one or NVDS
|
||||
// one)
|
||||
// app_env.dev_name_len = APP_DEVICE_NAME_MAX_LEN;
|
||||
// if (nvds_get(NVDS_TAG_DEVICE_NAME, &(app_env.dev_name_len),
|
||||
// app_env.dev_name) != NVDS_OK)
|
||||
#endif //(NVDS_SUPPORT)
|
||||
{
|
||||
// Get default Device Name (No name if not enough space)
|
||||
memcpy(app_env.dev_name, APP_DFLT_DEVICE_NAME,
|
||||
APP_DFLT_DEVICE_NAME_LEN);
|
||||
app_env.dev_name_len = APP_DFLT_DEVICE_NAME_LEN;
|
||||
}
|
||||
// Reset the stack
|
||||
xc_ble_gapm_reset();
|
||||
}
|
||||
|
||||
uint8_t app_get_dev_name(uint8_t *name)
|
||||
{
|
||||
if ((app_env.dev_name_len > 0) &&
|
||||
(app_env.dev_name_len <= APP_DEVICE_NAME_MAX_LEN) && (name != NULL)) {
|
||||
// copy name to provided pointer
|
||||
memcpy(name, app_env.dev_name, APP_DFLT_DEVICE_NAME_LEN);
|
||||
// return name length
|
||||
return app_env.dev_name_len;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void app_set_dev_name(uint8_t *name, uint8_t name_len)
|
||||
{
|
||||
if ((name_len > 0) && (name_len <= APP_DEVICE_NAME_MAX_LEN) &&
|
||||
(name != NULL)) {
|
||||
memcpy(app_env.dev_name, name, name_len);
|
||||
app_env.dev_name_len = name_len;
|
||||
}
|
||||
}
|
||||
|
||||
// adv
|
||||
void app_create_advertising(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_IDLE) {
|
||||
struct gapm_activity_create_adv_cmd param = {0};
|
||||
param.own_addr_type = GAPM_STATIC_ADDR;
|
||||
param.adv_param.type = GAPM_ADV_TYPE_LEGACY;
|
||||
param.adv_param.disc_mode = GAPM_ADV_MODE_GEN_DISC;
|
||||
param.adv_param.prop = GAPM_ADV_PROP_UNDIR_CONN_MASK;
|
||||
param.adv_param.max_tx_pwr = APP_MAX_TX_POWER;
|
||||
param.adv_param.filter_pol = ADV_ALLOW_SCAN_ANY_CON_ANY;
|
||||
param.adv_param.prim_cfg.adv_intv_min = APP_ADV_INT_MIN;
|
||||
param.adv_param.prim_cfg.adv_intv_max = APP_ADV_INT_MAX;
|
||||
param.adv_param.prim_cfg.chnl_map = APP_ADV_CHMAP;
|
||||
param.adv_param.prim_cfg.phy = GAP_PHY_1MBPS;
|
||||
|
||||
xc_ble_advertise_create(¶m);
|
||||
app_env.adv_state = APP_ADV_STATE_STARTING;
|
||||
}
|
||||
}
|
||||
|
||||
void app_set_adv_data(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_STARTING) {
|
||||
uint8_t adv_data[ADV_DATA_MAX_LENGTH] = {0};
|
||||
adv_data[0] = APP_DFLT_DEVICE_NAME_LEN + 1;
|
||||
adv_data[1] = GAP_AD_TYPE_COMPLETE_NAME;
|
||||
memcpy(&adv_data[2], APP_DFLT_DEVICE_NAME, APP_DFLT_DEVICE_NAME_LEN);
|
||||
xc_ble_set_adv_data(app_env.adv_actv_idx, APP_DFLT_DEVICE_NAME_LEN + 2,
|
||||
adv_data);
|
||||
app_env.adv_state = APP_ADV_STATE_SETTING_ADV_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
void app_set_scan_rsp_data(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_SETTING_ADV_DATA) {
|
||||
uint8_t scan_rsp_data[ADV_DATA_MAX_LENGTH] = {0};
|
||||
scan_rsp_data[0] = MANUFACTURER_DATA_LEN + 1;
|
||||
scan_rsp_data[1] = GAP_AD_TYPE_MANU_SPECIFIC_DATA;
|
||||
memcpy(&scan_rsp_data[2], MANUFACTURER_DATA, MANUFACTURER_DATA_LEN);
|
||||
xc_ble_set_scan_rsp_data(app_env.adv_actv_idx,
|
||||
MANUFACTURER_DATA_LEN + 2, scan_rsp_data);
|
||||
app_env.adv_state = APP_ADV_STATE_SETTING_SCAN_RSP_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
void app_start_advertising(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_SETTING_ADV_DATA ||
|
||||
app_env.adv_state == APP_ADV_STATE_SETTING_SCAN_RSP_DATA ||
|
||||
app_env.adv_state == APP_ADV_STATE_STOPPED) {
|
||||
struct gapm_activity_start_cmd param = {0};
|
||||
param.actv_idx = app_env.adv_actv_idx;
|
||||
param.u_param.adv_add_param.duration = ADV_DURATION;
|
||||
|
||||
xc_ble_advertise_start(¶m);
|
||||
app_env.adv_state = APP_ADV_STATE_STARTING;
|
||||
}
|
||||
}
|
||||
|
||||
void app_stop_advertising(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_STARTING) {
|
||||
xc_ble_activity_stop(app_env.adv_actv_idx);
|
||||
app_env.adv_state = APP_ADV_STATE_STOPPING;
|
||||
}
|
||||
}
|
||||
void app_delete_advertising(void)
|
||||
{
|
||||
if (app_env.adv_state == APP_ADV_STATE_STOPPED) {
|
||||
printf("app_delete_advertising\n");
|
||||
xc_ble_activity_delete(app_env.adv_actv_idx);
|
||||
app_env.adv_state = APP_ADV_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
app_get_handler(const struct app_subtask_handlers *handler_list_desc,
|
||||
ke_msg_id_t msgid, void *p_param, ke_task_id_t src_id)
|
||||
{
|
||||
// Counter
|
||||
uint8_t counter;
|
||||
// Get the message handler function by parsing the message table
|
||||
for (counter = handler_list_desc->msg_cnt; 0 < counter; counter--) {
|
||||
struct ke_msg_handler handler = (struct ke_msg_handler)(
|
||||
*(handler_list_desc->p_msg_handler_tab + counter - 1));
|
||||
if ((handler.id == msgid) || (handler.id == KE_MSG_DEFAULT_HANDLER)) {
|
||||
// If handler is NULL, message should not have been received in this
|
||||
// state
|
||||
ASSERT_ERR(handler.func);
|
||||
return (uint8_t)(handler.func(msgid, p_param, TASK_APP, src_id));
|
||||
}
|
||||
}
|
||||
|
||||
// If we are here no handler has been found, drop the message
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Handles reception of all messages sent from the lower layers to the
|
||||
*application
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] p_param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
*
|
||||
* @return If the message was consumed or not.
|
||||
****************************************************************************************
|
||||
*/
|
||||
static int app_msg_handler(ke_msg_id_t const msgid, void *p_param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
// Retrieve identifier of the task from received message
|
||||
ke_task_id_t src_task_id = MSG_T(msgid);
|
||||
// Message policy
|
||||
uint8_t msg_pol = KE_MSG_CONSUMED;
|
||||
switch (src_task_id) {
|
||||
case TASK_ID_GAPM: {
|
||||
msg_pol = gapm_callback(msgid, p_param, dest_id, src_id);
|
||||
} break;
|
||||
case TASK_ID_GAPC: {
|
||||
if ((msgid >= GAPC_BOND_CMD) &&
|
||||
(msgid <= GAPC_SECURITY_IND)){
|
||||
#if ((BLE_HOST_SUPPORT_SMP))
|
||||
// Call the Security Module
|
||||
msg_pol = app_get_handler(&app_sec_handlers, msgid, p_param, src_id);
|
||||
#endif
|
||||
}else{
|
||||
msg_pol = gapc_callback(msgid, p_param, dest_id, src_id);
|
||||
}
|
||||
|
||||
} break;
|
||||
case TASK_ID_GATT: {
|
||||
|
||||
} break;
|
||||
#if (BLE_APP_HT)
|
||||
case (TASK_ID_HTPT): {
|
||||
// Call the Health Thermometer Module
|
||||
msg_pol = app_get_handler(&app_ht_handlers, msgid, p_param, src_id);
|
||||
} break;
|
||||
#endif //(BLE_APP_HT)
|
||||
|
||||
#if (BLE_APP_DIS)
|
||||
case (TASK_ID_DISS): {
|
||||
// Call the Device Information Module
|
||||
msg_pol = app_get_handler(&app_dis_handlers, msgid, p_param, src_id);
|
||||
} break;
|
||||
#endif //(BLE_APP_DIS)
|
||||
|
||||
#if (BLE_APP_HID)
|
||||
case (TASK_ID_HOGPD): {
|
||||
// Call the HID Module
|
||||
msg_pol = app_get_handler(&app_hid_handlers, msgid, p_param, src_id);
|
||||
} break;
|
||||
#endif //(BLE_APP_HID)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (msg_pol);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Handles GAP manager command complete events.
|
||||
*
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] p_param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance (TASK_GAP).
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void gapm_cmp_evt(ke_msg_id_t const msgid,
|
||||
struct gapm_cmp_evt const *p_param,
|
||||
ke_task_id_t const dest_id, ke_task_id_t const src_id)
|
||||
{
|
||||
LOGI(" app gapm_cmp_evt operation:0x%02x, status :0x%02x\r\n",
|
||||
p_param->operation, p_param->status);
|
||||
if (p_param->status == GAP_ERR_NO_ERROR) {
|
||||
switch (p_param->operation) {
|
||||
// Reset completed
|
||||
case GAPM_RESET: {
|
||||
struct gapm_set_dev_config_cmd cfg_param = {
|
||||
.role = GAP_ROLE_PERIPHERAL,
|
||||
.sugg_max_tx_octets = BLE_MAX_OCTETS,
|
||||
// .sugg_max_tx_time = BLE_MAX_TIME,
|
||||
.sugg_max_tx_time = 2120,
|
||||
// .pairing_mode = GAPM_PAIRING_DISABLE,
|
||||
|
||||
#if (BLE_SEC_CON)
|
||||
.pairing_mode = GAPM_PAIRING_SEC_CON ,
|
||||
#else // (BLE_SEC_CON)
|
||||
.pairing_mode = GAPM_PAIRING_LEGACY ,
|
||||
#endif // (BLE_SEC_CON)
|
||||
|
||||
|
||||
};
|
||||
xc_ble_set_dev_config(&cfg_param);
|
||||
|
||||
// ((*(volatile uint32_t *)(0x53000050)) = (1<<15) | (0x7<<8) | (1 << 7) | (0x3 << 0));
|
||||
((*(volatile uint32_t *)(0x53000050)) = (1<<15) | (0x3<<8) | (1 << 7) | ( 0x1b<< 0));
|
||||
// ((*(volatile uint32_t *)(0x53000050)) = (1<<15) | (0x5<<8) | (1 << 7) | (0x5 << 0));
|
||||
} break;
|
||||
case GAPM_SET_DEV_CONFIG: {
|
||||
if (!ota_svc_add()) {
|
||||
app_create_advertising();
|
||||
}
|
||||
} break;
|
||||
case GAPM_SET_ADV_DATA: {
|
||||
app_start_advertising();
|
||||
} break;
|
||||
case GAPM_STOP_ACTIVITY:
|
||||
{
|
||||
app_delete_advertising();
|
||||
}break;
|
||||
case GAPM_DELETE_ACTIVITY:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case GAPM_CREATE_ADV_ACTIVITY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ASSERT_ERR(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void gapc_get_device_info_req_ind(
|
||||
ke_msg_id_t const msgid, struct gapc_get_dev_info_req_ind const *param,
|
||||
ke_task_id_t const dest_id, ke_task_id_t const src_id)
|
||||
{
|
||||
uint8_t conidx = KE_IDX_GET(src_id);
|
||||
struct gapc_get_dev_info_cfm cfm = {0};
|
||||
switch (param->req) {
|
||||
case GAPC_DEV_NAME: {
|
||||
cfm.req = param->req;
|
||||
cfm.token = param->token;
|
||||
cfm.status = GAP_ERR_NO_ERROR;
|
||||
cfm.info.name.value_length = app_get_dev_name(cfm.info.name.value);
|
||||
xc_ble_get_dev_info_cfm(conidx, &cfm);
|
||||
} break;
|
||||
|
||||
case GAPC_DEV_APPEARANCE: {
|
||||
cfm.req = param->req;
|
||||
cfm.info.appearance = DEV_APPEARANCE;
|
||||
cfm.token = param->token;
|
||||
cfm.status = GAP_ERR_NO_ERROR;
|
||||
xc_ble_get_dev_info_cfm(conidx, &cfm);
|
||||
} break;
|
||||
|
||||
case GAPC_DEV_SLV_PREF_PARAMS: {
|
||||
cfm.req = param->req;
|
||||
cfm.info.slv_pref_params.con_intv_min = BLE_UAPDATA_MIN_INTVALUE;
|
||||
// Slave preferred Connection interval Max
|
||||
cfm.info.slv_pref_params.con_intv_max = BLE_UAPDATA_MAX_INTVALUE;
|
||||
// Slave preferred Connection latency
|
||||
cfm.info.slv_pref_params.slave_latency = BLE_UAPDATA_LATENCY;
|
||||
// Slave preferred Link supervision timeout
|
||||
cfm.info.slv_pref_params.conn_timeout = BLE_UAPDATA_TIMEOUT;
|
||||
cfm.token = param->token;
|
||||
cfm.status = GAP_ERR_NO_ERROR;
|
||||
xc_ble_get_dev_info_cfm(conidx, &cfm);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void gapm_profile_add_ind(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapm_profile_added_ind *p_param =
|
||||
(struct gapm_profile_added_ind *)param;
|
||||
// Current State
|
||||
ke_state_t state = ke_state_get(dest_id);
|
||||
LOGI("gapm_profile_add_ind profile_task_id:0x%x,state=0x%x\r\n",
|
||||
p_param->prf_task_id, state);
|
||||
switch (p_param->prf_task_id) {
|
||||
case TASK_ID_BASS: {
|
||||
|
||||
} break;
|
||||
case TASK_ID_BASC: {
|
||||
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void gapm_activity_created_ind(ke_msg_id_t const msgid,
|
||||
void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapm_activity_created_ind *p_param =
|
||||
(struct gapm_activity_created_ind *)param;
|
||||
LOGI(" gapm_activity_created_ind actv_idx = %d,actv_type = %d \r\n",
|
||||
p_param->actv_idx, p_param->actv_type);
|
||||
switch (p_param->actv_type) {
|
||||
case GAPM_ACTV_TYPE_ADV: {
|
||||
app_env.adv_actv_idx = p_param->actv_idx;
|
||||
app_set_adv_data();
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void gapm_activity_stop_ind(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct gapm_activity_stopped_ind *p_param =
|
||||
(struct gapm_activity_stopped_ind *)param;
|
||||
LOGI(" actv_id=%d actv_type=%d, reason=0x%x\r\n", p_param->actv_idx,
|
||||
p_param->actv_type, p_param->reason);
|
||||
if (p_param->actv_idx == app_env.adv_actv_idx) {
|
||||
app_env.adv_state = APP_ADV_STATE_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t gapm_callback(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
switch (msgid) {
|
||||
case GAPM_CMP_EVT:
|
||||
gapm_cmp_evt(msgid, param, dest_id, src_id);
|
||||
break;
|
||||
case GAPM_DEV_BDADDR_IND:
|
||||
LOGI("GAPM_DEV_BDADDR_IND\r\n");
|
||||
break;
|
||||
case GAPM_GEN_RAND_NB_IND: {
|
||||
struct gapm_gen_rand_nb_ind *p_param =
|
||||
(struct gapm_gen_rand_nb_ind *)param;
|
||||
// First part of IRK
|
||||
if (app_env.rand_cnt == 1) {
|
||||
memcpy(&app_env.loc_irk[0], &p_param->randnb.nb[0], 8);
|
||||
}
|
||||
// Second part of IRK
|
||||
else if (app_env.rand_cnt == 2) {
|
||||
memcpy(&app_env.loc_irk[8], &p_param->randnb.nb[0], 8);
|
||||
}
|
||||
} break;
|
||||
case GAPM_ACTIVITY_CREATED_IND: {
|
||||
gapm_activity_created_ind(msgid, param, dest_id, src_id);
|
||||
} break;
|
||||
case GAPM_ACTIVITY_STOPPED_IND: {
|
||||
gapm_activity_stop_ind(msgid, param, dest_id, src_id);
|
||||
} break;
|
||||
case GAPM_SCAN_REQUEST_IND:
|
||||
LOGI("GAPM_SCAN_REQUEST_IND\r\n");
|
||||
break;
|
||||
case GAPM_PROFILE_ADDED_IND: {
|
||||
gapm_profile_add_ind(msgid, param, dest_id, src_id);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
static uint8_t gapc_callback(ke_msg_id_t const msgid, void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
uint8_t conidx = KE_IDX_GET(src_id);
|
||||
switch (msgid) {
|
||||
case GAPC_CMP_EVT: {
|
||||
struct gapc_cmp_evt const *p_param = (struct gapc_cmp_evt const *)param;
|
||||
LOGI("GAPC_CMP_EVT operation = 0x%x, status = 0x%x conidx = "
|
||||
"0x%x\r\n",
|
||||
p_param->operation, p_param->status, conidx);
|
||||
} break;
|
||||
case GAPC_CONNECTION_REQ_IND: {
|
||||
extern void ota_clear_status();
|
||||
ota_clear_status();
|
||||
|
||||
struct gapc_connection_req_ind *p_param =
|
||||
(struct gapc_connection_req_ind *)param;
|
||||
LOGI(" GAPC_CONNECTION_REQ_IND conhdl = x%x, conidx = 0x%x ",
|
||||
p_param->conhdl, conidx);
|
||||
LOGI("conn_intv:%d, role=%d addr: ", p_param->con_interval,
|
||||
p_param->role);
|
||||
// DUMP_DATA_PRINTF(&(p_param->peer_addr.addr[0]), GAP_BD_ADDR_LEN);
|
||||
// device as slave
|
||||
if (p_param->role == GAPM_ROLE_SLAVE) {
|
||||
app_env.slave_conidx = conidx;
|
||||
app_env.slave_connected = true;
|
||||
}
|
||||
// Check if the received connection index is valid
|
||||
if (conidx != GAP_INVALID_CONIDX) {
|
||||
struct gapc_connection_cfm cfm = {0};
|
||||
cfm.pairing_lvl = GAP_PAIRING_UNAUTH;
|
||||
xc_ble_conn_cfm(conidx, &cfm);
|
||||
xc_ble_gatt_cli_mtu_exch(conidx,app_env.user_lid);
|
||||
}
|
||||
// #if (BLE_SEC_CON)
|
||||
// xc_ble_req_security(conidx, GAP_AUTH_REQ_SEC_CON_BOND);
|
||||
// #else // (BLE_SEC_CON)
|
||||
// xc_ble_req_security(conidx, GAP_AUTH_REQ_NO_MITM_BOND);
|
||||
// #endif // (BLE_SEC_CON)
|
||||
|
||||
// xc_ble_set_pkt_size(conidx, 251, 2120);
|
||||
|
||||
} break;
|
||||
case GAPC_DISCONNECT_IND: {
|
||||
struct gapc_disconnect_ind *p_param =
|
||||
(struct gapc_disconnect_ind *)param;
|
||||
LOGI("GAPC_DISCONNECT_IND conidx = 0x%x, reason = 0x%x\r\n", conidx,
|
||||
p_param->reason);
|
||||
if (conidx == app_env.slave_conidx) {
|
||||
app_env.slave_conidx = INVALID_DATA;
|
||||
app_env.slave_connected = false;
|
||||
app_start_advertising();
|
||||
}
|
||||
} break;
|
||||
case GAPC_GET_DEV_INFO_REQ_IND: {
|
||||
gapc_get_device_info_req_ind(msgid, param, dest_id, src_id);
|
||||
} break;
|
||||
case GAPC_SET_DEV_INFO_REQ_IND: {
|
||||
struct gapc_set_dev_info_req_ind *p_param =
|
||||
(struct gapc_set_dev_info_req_ind *)param;
|
||||
struct gapc_set_dev_info_cfm cfm = {0};
|
||||
LOGI("GAPC_SET_DEV_INFO_REQ_IND param->req=0x%x,conidx=0x%x\r\n",
|
||||
p_param->req, conidx);
|
||||
xc_ble_set_dev_info_cfm(conidx, &cfm);
|
||||
} break;
|
||||
case GAPC_PARAM_UPDATE_REQ_IND: {
|
||||
struct gapc_param_update_req_ind *p_param =
|
||||
(struct gapc_param_update_req_ind *)param;
|
||||
struct gapc_param_update_cfm cfm = {0};
|
||||
LOGI("GAPC_PARAM_UPDATE_REQ_IND "
|
||||
"conidx=0x%x,intv_max=0x%x,intv_min=0x%x",
|
||||
conidx, p_param->intv_max, p_param->intv_min);
|
||||
LOGI("latency=0x%x,time_out=0x%x\r\n", p_param->latency,
|
||||
p_param->time_out);
|
||||
// Check if the received Connection Handle was valid
|
||||
if (app_env.conidx != GAP_INVALID_CONIDX) {
|
||||
cfm.accept = true;
|
||||
cfm.ce_len_min = CE_LEN_MIN;
|
||||
cfm.ce_len_max = CE_LEN_MAX;
|
||||
xc_ble_param_update_cfm(conidx, &cfm);
|
||||
}
|
||||
} break;
|
||||
case GAPC_PARAM_UPDATED_IND: {
|
||||
struct gapc_param_updated_ind *p_param =
|
||||
(struct gapc_param_updated_ind *)param;
|
||||
LOGI("GAPC_PARAM_UPDATED_IND "
|
||||
"conidx=0x%x,con_interval=0x%x,con_latency=0x%x ",
|
||||
conidx, p_param->con_interval, p_param->con_latency);
|
||||
LOGI("sup_to=0x%x\r\n", p_param->sup_to);
|
||||
} break;
|
||||
case GAPC_LE_PKT_SIZE_IND: {
|
||||
struct gapc_le_pkt_size_ind *p_param =
|
||||
(struct gapc_le_pkt_size_ind *)param;
|
||||
LOGI("GAPC_LE_PKT_SIZE_IND "
|
||||
"conidx=0x%x, max_rx_octets:%d",
|
||||
conidx, p_param->max_rx_octets);
|
||||
LOGI("max_rx_time:%d,max_tx_octets:%d, "
|
||||
"max_tx_time :%d\r\n",
|
||||
p_param->max_rx_time, p_param->max_tx_octets,
|
||||
p_param->max_tx_time);
|
||||
} break;
|
||||
case GAPC_CON_RSSI_IND: {
|
||||
struct gapc_con_rssi_ind *p_param = (struct gapc_con_rssi_ind *)param;
|
||||
LOGI("GAPC_CON_RSSI_IND conidx=0x%x,rssi = %d\r\n", conidx,
|
||||
p_param->rssi);
|
||||
} break;
|
||||
case GAPC_LE_PHY_IND: {
|
||||
struct gapc_le_phy_ind *p_param = (struct gapc_le_phy_ind *)param;
|
||||
LOGI("GAPC_LE_PHY_IND conidx=0x%x tx phy:%d rx phy:%d \r\n", conidx,
|
||||
p_param->tx_phy, p_param->rx_phy);
|
||||
} break;
|
||||
case GAPC_BOND_REQ_IND:
|
||||
// gapc_bond_req_ind_handler(msgid, p_param, dest_id,src_id)
|
||||
break;
|
||||
case GAPC_BOND_IND:
|
||||
// gapc_bond_ind_handler(msgid, p_param, dest_id,src_id)
|
||||
break;
|
||||
case GAPC_SECURITY_IND:
|
||||
// gapc_security_ind_handler(msgid, p_param, dest_id,src_id)
|
||||
break;
|
||||
case GAPC_ENCRYPT_REQ_IND:
|
||||
// gapc_encrypt_req_ind_handler(msgid, p_param, dest_id,src_id)
|
||||
break;
|
||||
case GAPC_ENCRYPT_IND:
|
||||
// gapc_encrypt_ind_handler(msgid, p_param, dest_id,src_id)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (KE_MSG_CONSUMED);
|
||||
}
|
||||
|
||||
/* Default State handlers definition. */
|
||||
KE_MSG_HANDLER_TAB(app){
|
||||
{KE_MSG_DEFAULT_HANDLER, (ke_msg_func_t)app_msg_handler},
|
||||
};
|
||||
|
||||
/* Defines the place holder for the states of all the task instances. */
|
||||
ke_state_t app_state[APP_IDX_MAX];
|
||||
|
||||
// Application task descriptor
|
||||
const struct ke_task_desc TASK_DESC_APP = {app_msg_handler_tab, app_state,
|
||||
APP_IDX_MAX,
|
||||
ARRAY_LEN(app_msg_handler_tab)};
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
/// @} APPTASK
|
||||
@@ -0,0 +1,479 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file arch_main.c
|
||||
*
|
||||
* @brief Main loop of the application.
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* INCLUDES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h" // RW SW configuration
|
||||
#include "xc_drv_pwr.h"
|
||||
#if (USE_ROM_FLASH)
|
||||
#include "xc6xxx_fmc_spi.h"
|
||||
#endif // (USE_ROM_FLASH)
|
||||
#include "app_task.h"
|
||||
#include "rom_port.h"
|
||||
|
||||
#if (BLE_TEST_MODE_SUPPORT)
|
||||
#include "uart.h" // UART initialization
|
||||
#endif // (BLE_TEST_MODE_SUPPORT)
|
||||
|
||||
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
|
||||
#include "rf.h" // RF initialization
|
||||
#endif // BLE_EMB_PRESENT || BT_EMB_PRESENT
|
||||
|
||||
#if (PLF_NVDS)
|
||||
#include "nvds.h" // NVDS definitions
|
||||
#endif // PLF_NVDS
|
||||
|
||||
#include "xc6xxx.h"
|
||||
#include "core_cm0.h"
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup DRIVERS
|
||||
* @{
|
||||
*
|
||||
*
|
||||
* ****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
/// NVDS location in FLASH : 0x000E0000 (896KB (1Mo - 128KB))
|
||||
#define NVDS_FLASH_ADDRESS (0x0003F800)//((256-2)*1024)
|
||||
|
||||
/// NVDS size in RAM : 0x00010000 (128KB)
|
||||
#define NVDS_FLASH_SIZE (0x00000800)
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* MAIN FUNCTION
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief RW main function.
|
||||
*
|
||||
* This function is called right after the booting process has completed.
|
||||
*
|
||||
* @return status exit status
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#define clrbit(x,y) ((x) &= ~(1<<(y)))
|
||||
#define AHB_CTL clrbit(*(uint32_t volatile*)(0x40000000+0x130),0)
|
||||
#define _TOSTRING(s) #s
|
||||
#define TOSTRING(s) _TOSTRING(s)
|
||||
|
||||
struct chip_param chip_param;
|
||||
extern void clock_init(void);
|
||||
extern uint8_t ota_flag;
|
||||
//void rc32k_testpin_cfg(void)
|
||||
//{
|
||||
// printf("rc 32k \n");
|
||||
// GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
// gpio_cfg.Mux = GPIO_Mux0;
|
||||
// gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
// gpio_cfg.FunSel = GPIO_Dx;
|
||||
// gpio_cfg.Int = NOT_INT;
|
||||
// gpio_cfg.Pull = GPIO_PULLDOWN;
|
||||
// gpio_cfg.Pin = 4;
|
||||
// xc_gpio_init(&gpio_cfg);
|
||||
//
|
||||
// xc_gpio_write_pin(4,1);
|
||||
// xc_gpio_write_pin(4,0);
|
||||
//
|
||||
// xc_gpio_write_pin(4,1);
|
||||
// xc_gpio_write_pin(4,0);
|
||||
//
|
||||
// xc_gpio_fun_sel(4, GPIO_Dx);
|
||||
// xc_gpio_mux_ctl(4, GPIO_Mux3); // en test_pin[0]
|
||||
// *((uint32_t volatile*)0x40000174) = 26;
|
||||
//}
|
||||
Systick_Unit_Typedef xc_systick_unit_get(void) { return clock_cb.systick_unit; }
|
||||
int flash_param_get(uint32_t flash_cap,struct chip_param *param_get)
|
||||
{
|
||||
uint8_t page_buf[256];
|
||||
__disable_irq();
|
||||
xc_fmc_spi_flash_read_page(flash_cap-256,page_buf,FLASH_PAGE_SIZE);
|
||||
__enable_irq();
|
||||
|
||||
//Data Verification
|
||||
if( (*(uint32_t*)(&page_buf[0]) != ~*(uint32_t*)(&page_buf[4])) ||(*(uint32_t*)(&page_buf[8]) != ~*(uint32_t*)(&page_buf[12])) ||(*(uint32_t*)(&page_buf[16]) != ~*(uint32_t*)(&page_buf[20])) || \
|
||||
(*(uint32_t*)(&page_buf[24]) != ~*(uint32_t*)(&page_buf[28])) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
param_get->adc_2v4 = page_buf[2]*0x100 + page_buf[3] ;
|
||||
param_get->unique_id[0] = page_buf[10];
|
||||
param_get->unique_id[1] = page_buf[11];
|
||||
param_get->unique_id[2] = page_buf[18];
|
||||
param_get->unique_id[3] = page_buf[19];
|
||||
param_get->unique_id[4] = page_buf[26];
|
||||
param_get->unique_id[5] = page_buf[27];
|
||||
|
||||
param_get->rc16m = page_buf[35];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int otp_param_get(uint32_t flash_cap,struct chip_param *param_get)
|
||||
{
|
||||
uint8_t page_buf[256];
|
||||
__disable_irq();
|
||||
xc_fmc_spi_otp_read_page(flash_cap,page_buf,FLASH_PAGE_SIZE);
|
||||
__enable_irq();
|
||||
|
||||
//Data Verification
|
||||
if( (*(uint32_t*)(&page_buf[0]) != ~*(uint32_t*)(&page_buf[4])) ||(*(uint32_t*)(&page_buf[8]) != ~*(uint32_t*)(&page_buf[12])) ||(*(uint32_t*)(&page_buf[16]) != ~*(uint32_t*)(&page_buf[20])) || \
|
||||
(*(uint32_t*)(&page_buf[24]) != ~*(uint32_t*)(&page_buf[28])) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
param_get->adc_2v4 = page_buf[2]*0x100 + page_buf[3] ;
|
||||
param_get->unique_id[0] = page_buf[10];
|
||||
param_get->unique_id[1] = page_buf[11];
|
||||
param_get->unique_id[2] = page_buf[18];
|
||||
param_get->unique_id[3] = page_buf[19];
|
||||
param_get->unique_id[4] = page_buf[26];
|
||||
param_get->unique_id[5] = page_buf[27];
|
||||
|
||||
param_get->rc16m = page_buf[35];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flash_init()
|
||||
{
|
||||
#define FLASH_2M_SIZE 0x15
|
||||
#define FLASH_1M_SIZE 0x14
|
||||
#define FLASH_512K_SIZE 0x13
|
||||
#define FLASH_256K_SIZE 0x12
|
||||
#define FLASH_128K_SIZE 0x11
|
||||
|
||||
uint8_t flash_size =0;
|
||||
uint32_t flash_cap;
|
||||
|
||||
FMC_SPI_Init_Oprt( );
|
||||
FMC_SPI_Flash_WakeUp( );
|
||||
|
||||
uint32_t mid = 0;
|
||||
FMC_SPI_Flash_RDID((uint8_t*)&mid);
|
||||
LOGI("Flash RDID: 0x%08x\n", mid);
|
||||
|
||||
uint8_t ruid[16];
|
||||
FMC_SPI_Flash_RUID(ruid);
|
||||
LOGI("Flash RUID11: ");
|
||||
for(int i = 0;i < 16;i++)
|
||||
{
|
||||
LOGI("%02x ", ruid[i]);
|
||||
}
|
||||
LOGI("\n");
|
||||
|
||||
flash_size = (mid >> 16) & 0xff;
|
||||
|
||||
switch(flash_size)
|
||||
{
|
||||
case FLASH_128K_SIZE:
|
||||
flash_cap = 1024 * 128;
|
||||
break;
|
||||
case FLASH_256K_SIZE:
|
||||
flash_cap = 1024 * 256;
|
||||
break;
|
||||
case FLASH_512K_SIZE:
|
||||
flash_cap = 1024 * 512;
|
||||
break;
|
||||
case FLASH_1M_SIZE:
|
||||
flash_cap = 1024 * 1024;
|
||||
break;
|
||||
case FLASH_2M_SIZE:
|
||||
flash_cap = 1024 * 2048;
|
||||
break;
|
||||
}
|
||||
chip_param.valid = true;
|
||||
if(-1 != flash_param_get(flash_cap,&chip_param))
|
||||
{
|
||||
LOGI("flash_param_get ok\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGI("flash_param_get error\n");
|
||||
|
||||
if(-1 != otp_param_get(OTP_PROGRAM_PAGE_1,&chip_param))
|
||||
{
|
||||
LOGI("otp_param_get ok\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
chip_param.valid = false;
|
||||
LOGI("otp_param_get error\n");
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("param_get adc_2v4=%x, rc16m=%x,unique_id=",chip_param.adc_2v4,chip_param.rc16m);
|
||||
for(int i=0;i<6;i++)LOGI("%02x-",chip_param.unique_id[i]); LOGI("\n");
|
||||
}
|
||||
|
||||
void app_uart_init(void)
|
||||
{
|
||||
GPIO_InitCfg_t gpio_cfg = {0};
|
||||
|
||||
gpio_cfg.Mux = GPIO_Mux0;
|
||||
gpio_cfg.Pull = GPIO_PULLUP;
|
||||
gpio_cfg.Int = NOT_INT;
|
||||
gpio_cfg.FunSel = UART0_TX;
|
||||
|
||||
gpio_cfg.Pin = GPIO_18;
|
||||
gpio_cfg.Dir = GPIO_DIR_OUTPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
gpio_cfg.FunSel = UART0_RX;
|
||||
gpio_cfg.Pin = GPIO_19;
|
||||
gpio_cfg.Dir = GPIO_DIR_INPUT;
|
||||
xc_gpio_init(&gpio_cfg);
|
||||
|
||||
UART_InitCfg_t uart_cfg = {0};
|
||||
|
||||
uart_cfg.Parity = UART_PARITY_DISABLE;
|
||||
uart_cfg.StopBits = UART_STOP_1_BITS;
|
||||
uart_cfg.WordLength = UART_DATA_8_BITS;
|
||||
uart_cfg.BaudRate = UART_BAUDRATE_115200;
|
||||
uart_cfg.HardwareFlowControl = UART_HWFC_DISABLE;
|
||||
|
||||
xc_uart_init(UART0_IDX, &uart_cfg);
|
||||
}
|
||||
|
||||
/* Zero the host global variable. */
|
||||
void rom_env_host_init()
|
||||
{
|
||||
uint8_t *ptr = (uint32_t *)(0x10000800);
|
||||
memset(ptr, 0 ,0x10001300-0x10000800);
|
||||
|
||||
rom_env.stack_printf = printf;
|
||||
rom_env.stack_printf("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
/* Add a protection field to determine if the stack is overflowing. */
|
||||
void stack_tag()
|
||||
{
|
||||
uint32_t StackPos;
|
||||
__IO uint32_t *pStack;
|
||||
StackPos = __get_MSP();
|
||||
printf("StackPos=0x%x\n", StackPos);
|
||||
// 0x800 is the size of the stack, which should be changed according to the configuration of the project.
|
||||
pStack = (uint32_t *)(StackPos-0x800);
|
||||
*pStack = 0xa5a5a5a5;
|
||||
}
|
||||
|
||||
void board_init()
|
||||
{
|
||||
clock_init();
|
||||
app_uart_init();
|
||||
LOGI("sdk version: %s build time: %s %s\n", TOSTRING(SDK_VERSION), __DATE__,__TIME__);
|
||||
stack_tag();
|
||||
rom_env_host_init();
|
||||
#if (SLEEP_ENABLE)
|
||||
xc_rc32k_calib_by_hw();
|
||||
//xc_rc32k_calib_by_soft();
|
||||
#endif // (SLEEP_ENABLE)
|
||||
|
||||
rom_env_init();
|
||||
uint8_t mac_addr[] = {0xac, 0xc3, 0x33, 0x46, 0x55, 0x66};
|
||||
|
||||
memcpy(co_default_bdaddr.addr, mac_addr, 6);
|
||||
AHB_CTL;
|
||||
/*
|
||||
************************************************************************************
|
||||
* Platform initialization
|
||||
************************************************************************************
|
||||
*/
|
||||
|
||||
// Initialize random process
|
||||
srand(1);
|
||||
}
|
||||
|
||||
void bluetooth_init()
|
||||
{
|
||||
uint32_t error = RESET_NO_ERROR;
|
||||
flash_init();
|
||||
#if (PLF_NVDS)
|
||||
flash_init();
|
||||
if(chip_param.valid != false)
|
||||
{
|
||||
memcpy(co_default_bdaddr.addr, chip_param.unique_id, 6);
|
||||
}
|
||||
// Initialize NVDS module
|
||||
nvds_init((uint8_t *)NVDS_FLASH_ADDRESS, NVDS_FLASH_SIZE);
|
||||
#endif // PLF_NVDS
|
||||
/*
|
||||
************************************************************************************
|
||||
* RW SW stack initialization
|
||||
************************************************************************************
|
||||
*/
|
||||
NVIC_SetPriority((IRQn_Type)BLE_IRQn,0);
|
||||
NVIC_EnableIRQ((IRQn_Type)BLE_IRQn);
|
||||
#if (!HCI_TEST_NO_IP)
|
||||
// Initialize modem
|
||||
modem_init();
|
||||
#endif
|
||||
// Initialize RF
|
||||
#if (BT_EMB_PRESENT || BLE_EMB_PRESENT)
|
||||
rf_init(&rwip_rf);
|
||||
#endif //BT_EMB_PRESENT || BLE_EMB_PRESENT
|
||||
// Initialize RW SW stack
|
||||
rwip_init(error);
|
||||
#if (BLE_TEST_MODE_SUPPORT)
|
||||
enter_test_mode();
|
||||
#else // (BLE_TEST_MODE_SUPPORT)
|
||||
// Initialize APP
|
||||
app_init();
|
||||
#endif // (BLE_TEST_MODE_SUPPORT)
|
||||
// finally start interrupt handling
|
||||
GLOBAL_INT_START();
|
||||
}
|
||||
|
||||
extern volatile uint8_t sv_lock;
|
||||
extern volatile uint8_t sv_txlen;
|
||||
#if (!CONN_EVENT_NOT_RUN_XIP)
|
||||
__RAM_CODE void PendSV_Handler(void)
|
||||
{
|
||||
uint32_t nus = sv_txlen*8 + 148;
|
||||
uint32_t unit = 32;
|
||||
uint32_t temp;
|
||||
|
||||
SysTick->CTRL = 0x00;
|
||||
SysTick->LOAD = unit * nus - unit + 1;
|
||||
|
||||
SysTick->VAL = 0;
|
||||
SysTick->CTRL = 0x05;
|
||||
|
||||
do {
|
||||
temp = SysTick->CTRL;
|
||||
if(sv_lock){
|
||||
break;
|
||||
}
|
||||
} while ( (temp & 0x01) && (!(temp & (1 << 16))) );
|
||||
}
|
||||
#else // (!CONN_EVENT_NOT_RUN_XIP)
|
||||
__RAM_CODE void PendSV_Handler(void)
|
||||
{
|
||||
while(!sv_lock);
|
||||
}
|
||||
#endif // (!CONN_EVENT_NOT_RUN_XIP)
|
||||
|
||||
#if (CONFIG_BT_WAKEUP_VIA_GPIO)
|
||||
void gpio_intr_callback(uint64_t intr_sta)
|
||||
{
|
||||
uint32_t value = ((*(volatile uint32_t *)(0x53022044)));
|
||||
|
||||
value |= 1<<14;
|
||||
((*(volatile uint32_t *)(0x53022044))) = value;
|
||||
}
|
||||
#endif
|
||||
void reverse_bytes(uint8_t *data, size_t length) {
|
||||
if (length % 2 != 0) {
|
||||
// printf("Error: Length of data must be even.\n");
|
||||
return;
|
||||
}
|
||||
size_t i =0;
|
||||
for (i= 0; i < length; i += 4) {
|
||||
// ½»»»Ã¿Á½¸ö×Ö½Ú
|
||||
uint8_t temp = data[i];
|
||||
data[i] = data[i + 1];
|
||||
data[i + 1] = temp;
|
||||
}
|
||||
}
|
||||
extern unsigned int get_crc32(unsigned int crc, unsigned char *buf, unsigned int len);
|
||||
void rewrite_pata()
|
||||
{
|
||||
uint8_t para_buf[256];
|
||||
uint8_t data[256];
|
||||
xc_fmc_spi_flash_read_page(((8*1024)-512), para_buf,FLASH_PAGE_SIZE);
|
||||
para_buf[48]=0x01;
|
||||
para_buf[96]=0x00;
|
||||
uint32_t crc =0;
|
||||
crc=get_crc32(crc,para_buf,240);
|
||||
para_buf[243]=crc>>24;
|
||||
para_buf[242]=crc>>16;
|
||||
para_buf[241]=crc>>8;
|
||||
para_buf[240]=crc;
|
||||
|
||||
GLOBAL_INT_DISABLE();
|
||||
xc_fmc_spi_flash_erase_page(0x1e00);
|
||||
xc_fmc_spi_flash_erase_page(0x1f00);
|
||||
GLOBAL_INT_RESTORE();
|
||||
|
||||
GLOBAL_INT_DISABLE();
|
||||
xc_fmc_spi_flash_write_page(((8*1024)-512), para_buf, 256);
|
||||
GLOBAL_INT_RESTORE();
|
||||
uint8_t asd;
|
||||
|
||||
for(int i=0; i<256; i+=2){
|
||||
data[i] = para_buf[i+1];
|
||||
data[i+1] = para_buf[i];
|
||||
}
|
||||
|
||||
GLOBAL_INT_DISABLE();
|
||||
xc_fmc_spi_flash_write_page(((8*1024)-256), data, 256);
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
/* Set the broadcast address of the device. */
|
||||
board_init();
|
||||
rewrite_pata();
|
||||
bluetooth_init();
|
||||
NVIC_SetPriority(PendSV_IRQn,0xff);
|
||||
NVIC_EnableIRQ(PendSV_IRQn);
|
||||
|
||||
#if (CONFIG_BT_WAKEUP_VIA_GPIO)
|
||||
uint32_t value = ((*(volatile uint32_t *)(0x53022044)));
|
||||
value |= 1<<12;
|
||||
((*(volatile uint32_t *)(0x53022044))) = value;
|
||||
#endif
|
||||
printf("ota_start!!!!!!!!!!!!!!!!!!!!!!\n");
|
||||
#if (SLEEP_ENABLE)
|
||||
sleep_init();
|
||||
#endif // (SLEEP_ENABLE)
|
||||
|
||||
#if (BLE_APP_PRESENT)
|
||||
|
||||
while(1)
|
||||
{
|
||||
// schedule all pending events
|
||||
rwip_schedule();
|
||||
xc_ota_schedule();
|
||||
#if (SLEEP_ENABLE)
|
||||
if(!ota_flag)
|
||||
{
|
||||
sleep_schedule();
|
||||
}
|
||||
#endif // (SLEEP_ENABLE)
|
||||
}
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
}
|
||||
|
||||
/// @} DRIVERS
|
||||
@@ -0,0 +1,143 @@
|
||||
#include "ota_flash_interface.h"
|
||||
#include "arch.h"
|
||||
#include "dbg.h"
|
||||
// extern uint8_t ble_flash_operation_can_check(void);
|
||||
#include "ota_protocol.h"
|
||||
op_flash_t op_flash =
|
||||
{
|
||||
OP_IDEL,
|
||||
};
|
||||
|
||||
// extern op_flash_t op_flash;
|
||||
int ble_flash_later_sector_erase(uint32_t addr)
|
||||
{
|
||||
if (op_flash.op_state != OP_IDEL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// SPI_TypeDef *spi_handle = XC_SPI0;
|
||||
|
||||
// op_flash.spi_handle = spi_handle;
|
||||
op_flash.op_state = OP_WIAT_ERASE;
|
||||
op_flash.op_addr = addr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ble_flash_later_write_page(uint8_t *buff, uint32_t PageAddR)
|
||||
{
|
||||
if (op_flash.op_state != OP_IDEL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// SPI_TypeDef *spi_handle = XC_SPI0;
|
||||
|
||||
// op_flash.spi_handle = spi_handle;
|
||||
op_flash.op_state = OP_WIAT_WRITE;
|
||||
op_flash.op_addr = PageAddR;
|
||||
|
||||
for (int i = 0; i < FLASH_PAGE_SIZE; i++)
|
||||
{
|
||||
op_flash.op_buff[i] = buff[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ble_flash_later_page_erase(uint32_t addr)
|
||||
{
|
||||
if (op_flash.op_state != OP_IDEL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
op_flash.op_state = OP_WIAT_PAGE_ERASE;
|
||||
op_flash.op_addr = addr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ble_flash_handle(void)
|
||||
{
|
||||
if (op_flash.op_state == OP_IDEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (op_flash.op_state == OP_WIAT_WRITE)
|
||||
{
|
||||
{
|
||||
// LOGI("FMC_SPI_Flash_WritePage: op_flash.op_addr=%x\n", op_flash.op_addr);
|
||||
GLOBAL_INT_DISABLE();
|
||||
FMC_SPI_Flash_WritePage(op_flash.op_addr, op_flash.op_buff, 256);
|
||||
// if(op_flash.op_addr==0x31000 || op_flash.op_addr==OTA_PARAM_ADDR){
|
||||
// uint8_t data[FLASH_PAGE_SIZE];
|
||||
// FMC_SPI_Flash_ReadPage(op_flash.op_addr, data, FLASH_PAGE_SIZE);
|
||||
// LOGI("Flash Read data: \n");
|
||||
// for(uint16_t i = 0; i<FLASH_PAGE_SIZE; i++)
|
||||
// {
|
||||
// LOGI("%02x ", data[i]);
|
||||
// }
|
||||
// LOGI("\n");
|
||||
// LOGI("raw data: \n");
|
||||
// for(uint16_t i = 0; i<FLASH_PAGE_SIZE; i++)
|
||||
// {
|
||||
// LOGI("%02x ", op_flash.op_buff[i]);
|
||||
// }
|
||||
// LOGI("\n");
|
||||
// }
|
||||
// if( op_flash.op_addr==OTA_PARAM_ADDR){
|
||||
// LOGI("Flash write data: \n");
|
||||
// FMC_SPI_Flash_ReadPage(op_flash.op_addr, data, FLASH_PAGE_SIZE);
|
||||
// LOGI("Flash Read data: \n");
|
||||
// for(uint16_t i = 0; i<FLASH_PAGE_SIZE; i++)
|
||||
// {
|
||||
// LOGI("%02x ", op_flash.op_buff[i]);
|
||||
// }
|
||||
// LOGI("\n");
|
||||
// for(uint16_t i = 0; i<FLASH_PAGE_SIZE; i++)
|
||||
// {
|
||||
// LOGI("%02x ", data[i]);
|
||||
// }
|
||||
// LOGI("\n");
|
||||
// }
|
||||
GLOBAL_INT_RESTORE();
|
||||
op_flash.op_state = OP_IDEL;
|
||||
}
|
||||
}
|
||||
else if (op_flash.op_state == OP_WIAT_ERASE)
|
||||
{
|
||||
{
|
||||
// LOGI("FMC_SPI_Flash_Erase_Sector: op_flash.op_addr=%x\n", op_flash.op_addr);
|
||||
GLOBAL_INT_DISABLE();
|
||||
FMC_SPI_Flash_Erase_Sector(op_flash.op_addr);
|
||||
GLOBAL_INT_RESTORE();
|
||||
// LOGI("FMC_SPI_Flash_Erase_Sector: op_flash.op_addr1=%x\n", op_flash.op_addr);
|
||||
// {
|
||||
// uint8_t data[FLASH_PAGE_SIZE];
|
||||
// FMC_SPI_Flash_ReadPage(op_flash.op_addr, data, FLASH_PAGE_SIZE);
|
||||
//// LOGI("Erase Read data: \n");
|
||||
//// for(uint16_t i = 0; i<FLASH_PAGE_SIZE; i++)
|
||||
//// {
|
||||
//// LOGI("%02x ", data[i]);
|
||||
//// }
|
||||
//// LOGI("\n");
|
||||
// }
|
||||
op_flash.op_state = OP_IDEL;
|
||||
}
|
||||
} else if (op_flash.op_state == OP_WIAT_PAGE_ERASE)
|
||||
{
|
||||
{
|
||||
|
||||
LOGI("FMC_SPI_Flash_Erase_Page: op_flash.op_addr=%x\n", op_flash.op_addr);
|
||||
GLOBAL_INT_DISABLE();
|
||||
FMC_SPI_Flash_Erase_Page(op_flash.op_addr);
|
||||
GLOBAL_INT_RESTORE();
|
||||
op_flash.op_state = OP_IDEL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef __OTA_FLASH_INTERFACE_H_
|
||||
#define __OTA_FLASH_INTERFACE_H_
|
||||
|
||||
#if (USE_XIP)
|
||||
#if (USE_ROM_FLASH)
|
||||
#include "xc6xxx_fmc_spi.h"
|
||||
#endif // (USE_ROM_FLASH)
|
||||
#endif // !(USE_XIP)
|
||||
#include <stdint.h>
|
||||
#define FMC_SPI_Flash_WritePage xc_fmc_spi_flash_write_page
|
||||
#define FMC_SPI_Flash_ReadPage xc_fmc_spi_flash_read_page
|
||||
#define FMC_SPI_Flash_Erase_Sector FMC_SPI_Flash_Erase_Sector
|
||||
#define FMC_SPI_Flash_Erase_Page xc_fmc_spi_flash_erase_page
|
||||
typedef enum
|
||||
{
|
||||
OP_IDEL = 0,
|
||||
OP_WIAT_WRITE ,
|
||||
OP_DO_WRITE ,
|
||||
OP_DONE_WRITE ,
|
||||
OP_WIAT_ERASE ,
|
||||
OP_DO_ERASE ,
|
||||
OP_DONE_ERASE ,
|
||||
OP_WIAT_PAGE_ERASE,
|
||||
} op_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t op_state;
|
||||
uint32_t op_addr;
|
||||
uint8_t __attribute__((aligned(4))) op_buff[(256+8)];
|
||||
// SPI_TypeDef *spi_handle;
|
||||
} op_flash_t;
|
||||
|
||||
extern op_flash_t op_flash;
|
||||
|
||||
void ble_flash_handle(void);
|
||||
|
||||
int ble_flash_later_write_page(uint8_t *buff, uint32_t PageAddR);
|
||||
|
||||
int ble_flash_later_sector_erase(uint32_t addr);
|
||||
|
||||
#endif // __OTA_FLASH_INTERFACE_H_
|
||||
|
||||
|
||||
@@ -0,0 +1,561 @@
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file ota_m4.c
|
||||
*
|
||||
* @brief
|
||||
*
|
||||
* Copyright (c) 2022 - 2025, XinChip
|
||||
* All rights reserved.p
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h"
|
||||
|
||||
#if (BLE_APP_PRESENT)
|
||||
|
||||
#include "ota_protocol.h"
|
||||
#include "ota_server.h"
|
||||
#include "ota_flash_interface.h"
|
||||
#include "xc_drv_wdt.h"
|
||||
uint8_t ota_flag=0;
|
||||
extern struct app_env_tag app_env;
|
||||
static struct fotas_write_env fotas_write_env;
|
||||
__RAM_EM struct fotas_env fota_env;
|
||||
|
||||
struct fotas_flag fotas_status={1,1,TRUES,FALSE,0,0,0,1,0};
|
||||
|
||||
unsigned int get_crc32(unsigned int crc, unsigned char *buf, unsigned int len)
|
||||
{
|
||||
const unsigned char *buffer = (const unsigned char *)buf;
|
||||
int i = 0;
|
||||
while (len--) {
|
||||
crc ^= (unsigned int)(*buffer++) << 24;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (crc & 0x80000000) {
|
||||
crc = (crc << 1) ^ 0xEDB88320;
|
||||
} else {
|
||||
crc <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return crc;
|
||||
}
|
||||
uint32_t crcaddr;
|
||||
|
||||
static uint8_t ota_crc_test()
|
||||
{
|
||||
uint32_t addrB=crcaddr;// = fotas_write_env.erase_addr;
|
||||
|
||||
uint32_t era_sectorcnt = (fota_env.bin_size) / 4096;
|
||||
era_sectorcnt = (((fota_env.bin_size) % 4096) == 0) ? era_sectorcnt : (era_sectorcnt + 1);
|
||||
|
||||
uint32_t crc = CRC32_INITIAL;
|
||||
uint32_t remain = 0;
|
||||
uint32_t pagecnt = (fota_env.bin_size) / FLASH_PAGE_SIZE;
|
||||
|
||||
pagecnt = (((fota_env.bin_size) % FLASH_PAGE_SIZE) == 0) ? pagecnt : (pagecnt + 1);
|
||||
remain = ((fota_env.bin_size) % FLASH_PAGE_SIZE);
|
||||
|
||||
if (remain == 0)
|
||||
remain = FLASH_PAGE_SIZE;
|
||||
GLOBAL_INT_DISABLE();
|
||||
for (uint32_t i = 0; i < pagecnt; i++)
|
||||
{
|
||||
|
||||
FMC_SPI_Flash_ReadPage(addrB + i * FLASH_PAGE_SIZE, fota_env.sector_buf[0][0],FLASH_PAGE_SIZE);
|
||||
crc = ((pagecnt - 1) == i) ? (get_crc32(crc, fota_env.sector_buf[0][0], ((fota_env.bin_size) % FLASH_PAGE_SIZE))) : (get_crc32(crc, fota_env.sector_buf[0][0], FLASH_PAGE_SIZE));
|
||||
|
||||
}
|
||||
GLOBAL_INT_RESTORE();
|
||||
|
||||
if(fota_env.crc!=crc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t *get_fota_env_addr(uint16_t len)
|
||||
{
|
||||
if(len > FOTA_PAGE_NUM*FLASH_PAGE_SIZE +20)
|
||||
{
|
||||
//LOGI(" len error\n ");
|
||||
return NULL;
|
||||
}
|
||||
return &fota_env;
|
||||
|
||||
}
|
||||
void xc_ota_wdt_init(WDT_InitCfg_t *wdt_cfg)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
cpr_lp_ctl__wdt_pclk_sel__setf(DISABLE);
|
||||
cpr_lp_ctl__wdt_tclk_en__setf(ENABLE);
|
||||
|
||||
wdt_cr__wdt_rmod__setf(wdt_cfg->WorkMode);
|
||||
wdt_torr__wdt_top__setf(wdt_cfg->ReloadValue);
|
||||
}
|
||||
void wdt_reset_system(void)
|
||||
{
|
||||
|
||||
WDT_InitCfg_t wdt_cfg ;
|
||||
|
||||
NVIC_EnableIRQ(WDT_IRQn);
|
||||
|
||||
wdt_cfg.WorkMode = WDT_WORK_MODE0;
|
||||
|
||||
wdt_cfg.ReloadValue = WDT_ReloadValue_0xFFFF;
|
||||
|
||||
xc_ota_wdt_init( &wdt_cfg);
|
||||
xc_wdt_start();
|
||||
|
||||
}
|
||||
|
||||
static void fota_status_set(uint8_t status)
|
||||
{
|
||||
fota_env.status = status;
|
||||
}
|
||||
|
||||
static uint8_t fota_status_get(void)
|
||||
{
|
||||
return fota_env.status;
|
||||
}
|
||||
|
||||
// DEV->APP RSP OR CMD
|
||||
void xc_fota_dev_ack_cmd(uint16_t sn,
|
||||
uint8_t cmd,
|
||||
uint8_t data_or_atype, // data or ack type
|
||||
uint16_t fnum_or_para) // frame num or parameter
|
||||
{
|
||||
fota_env.ack.sn = sn;
|
||||
fota_env.ack.cmd = cmd;
|
||||
fota_env.ack.data_or_atype = data_or_atype;
|
||||
fota_env.ack.fnum_or_para = fnum_or_para;
|
||||
FOTAS_NOTIFY((uint8_t*)&fota_env.ack, sizeof(fota_env.ack), OTA_SVC_TX_CHAR_VAL);
|
||||
}
|
||||
|
||||
// The sector CRC check and write data to flash.
|
||||
static void xc_fotas_flash_write()
|
||||
{
|
||||
// only 1 time
|
||||
if (fotas_status.first_pack_write_flag)
|
||||
{
|
||||
fotas_status.first_pack_write_flag = FALSE;
|
||||
fotas_status.sector_erase_flag=1;
|
||||
for(int j=0;j<256;j++)
|
||||
{
|
||||
fotas_write_env.para_buf[j]=fota_env.sector_buf[0][j];
|
||||
}
|
||||
|
||||
// 0x1b000
|
||||
fotas_write_env.erase_addr = (fotas_write_env.para_buf[27]<<24)+(fotas_write_env.para_buf[26]<<16)+(fotas_write_env.para_buf[25]<<8)+(fotas_write_env.para_buf[24]); // data
|
||||
fotas_write_env.write_addr = (fotas_write_env.para_buf[27]<<24)+(fotas_write_env.para_buf[26]<<16)+(fotas_write_env.para_buf[25]<<8)+(fotas_write_env.para_buf[24]); // start para
|
||||
crcaddr= fotas_write_env.erase_addr;
|
||||
fota_env.crc=(fotas_write_env.para_buf[11]<<24)+(fotas_write_env.para_buf[10]<<16)+(fotas_write_env.para_buf[9]<<8)+(fotas_write_env.para_buf[8]);
|
||||
|
||||
LOGI(" ota parameter fotas_write_env.write_addr=%x fotas_write_env.erase_addr=%x crc :%x\n ", fotas_write_env.write_addr, fotas_write_env.erase_addr,fota_env.crc);
|
||||
|
||||
FLASH_SECTOR_ERASE( fotas_write_env.erase_addr);
|
||||
fotas_status.wtite_flag=1;
|
||||
}
|
||||
else // second sector
|
||||
{
|
||||
ble_flash_later_write_page(fota_env.sector_buf[0], fotas_write_env.write_addr);
|
||||
|
||||
fotas_status.wtite_flag=1;
|
||||
fotas_write_env.write_addr += 256;
|
||||
}
|
||||
fotas_write_env.erase_addr += 256; // The erase address needs to be aligned to 4096
|
||||
|
||||
LOGI(".");
|
||||
|
||||
fotas_write_env.cur_num = 0;
|
||||
|
||||
}
|
||||
|
||||
// first sector, 15 page
|
||||
void ota_write_flash()
|
||||
{
|
||||
//LOGI("yes %x %d\n",fotas_write_env.write_addr,fotas_status.wtitten_page_num);
|
||||
ble_flash_later_write_page(fota_env.sector_buf[fotas_status.wtitten_page_num], fotas_write_env.write_addr);
|
||||
fotas_write_env.write_addr += 256;
|
||||
fotas_status.wtitten_page_num+=1;
|
||||
fotas_write_env.erase_addr+=256;
|
||||
}
|
||||
// OTA data handler.
|
||||
|
||||
void xc_fota_write_data_handle(uint8_t *buffer, uint8_t cmd2)
|
||||
{
|
||||
uint16_t pid;
|
||||
struct img_hdr_t *img;
|
||||
struct fota_data *fota_data1;
|
||||
struct fota_data_att *data_att;
|
||||
uint16_t sn ;
|
||||
uint8_t cmd ;
|
||||
uint16_t len;
|
||||
uint16_t sw_ver;
|
||||
uint16_t rom_ver;
|
||||
|
||||
(void)sn;
|
||||
(void)cmd;
|
||||
(void)len;
|
||||
|
||||
if (fota_status_get() == FOTAS_DEV_READY)
|
||||
{
|
||||
switch (cmd2)
|
||||
{
|
||||
// FOTAS_STA_CMD = 1
|
||||
case FOTAS_STA_CMD: // 1.3 App->Dev, ota start req
|
||||
LOGI("line=%d, app->dev 1.3, ver same dev->app 2.1, ver diff dev->app 1.4\n",__LINE__);
|
||||
img = (struct img_hdr_t *)buffer;
|
||||
sn = img->sn;
|
||||
cmd = img->cmd;
|
||||
len = img->len;
|
||||
sw_ver = img->sw_ver;
|
||||
rom_ver = img->rom_ver;
|
||||
fota_env.crc = img->crc;
|
||||
fota_env.bin_size = img->bin_size;
|
||||
fota_env.pack_num = img->pack_num;
|
||||
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_TRANS_SUC, 1); // 1 means fnum
|
||||
break;
|
||||
// FOTAS_INFO_CMD = 3
|
||||
case FOTAS_INFO_CMD: // 3.3 App->Dev, ota current info packet
|
||||
LOGI("line=%d,current info packet, 3.3 app->dev, 4.1 dev->app \n",__LINE__);
|
||||
if(fotas_status.sector_erase_flag && (fotas_write_env.erase_addr%4096 == 0))
|
||||
{
|
||||
ble_flash_later_sector_erase(fotas_write_env.erase_addr);
|
||||
LOGI("addr:%x\n",fotas_write_env.erase_addr);
|
||||
}
|
||||
|
||||
data_att = (struct fota_data_att *)buffer;
|
||||
fota_env.data_att.sn = data_att->sn;
|
||||
fota_env.data_att.len = data_att->len;
|
||||
fota_env.data_att.cmd = data_att->cmd;
|
||||
fota_env.data_att.segment_id = data_att->segment_id;
|
||||
fota_env.data_att.sector_size = data_att->sector_size; // 4096
|
||||
fota_env.data_att.crc = data_att->crc;
|
||||
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_TRANS_SUC, 1);
|
||||
break;
|
||||
// FOTAS_DATA_CMD = 5
|
||||
case FOTAS_DATA_CMD: // 5.3 App->Dev
|
||||
LOGI("line=%d, 5.3 ota current data packet\n",__LINE__);
|
||||
fota_data1 = (struct fota_data *)buffer;
|
||||
pid = fota_data1->sn;
|
||||
fotas_write_env.cur_num += 1;
|
||||
memcpy((uint8_t *)fota_env.sector_buf + (pid - 1) * fotas_write_env.old_length, fota_data1->data, fotas_write_env.length);
|
||||
fotas_write_env.old_length = fotas_write_env.length;
|
||||
LOGI("fotas_write_env.cur_num=%x fotas_write_env.all_fnum=%x\n", fotas_write_env.cur_num, fotas_write_env.all_fnum);
|
||||
if (fotas_write_env.cur_num != fotas_write_env.all_fnum)
|
||||
{
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_ACK, FOTAS_TANS_LOSE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_TRANS_SUC, 0);
|
||||
|
||||
uint16_t last_sector_size = fota_env.data_att.sector_size % (FOTA_PAGE_NUM*FLASH_PAGE_SIZE);
|
||||
|
||||
if (last_sector_size)
|
||||
{
|
||||
memset((uint8_t *)fota_env.sector_buf + last_sector_size, 0xff, (FOTA_PAGE_NUM*FLASH_PAGE_SIZE) - last_sector_size);
|
||||
}
|
||||
|
||||
fota_status_set(FOTAS_DEV_BUSY);
|
||||
|
||||
xc_fotas_flash_write();
|
||||
}
|
||||
break;
|
||||
// FOTAS_DATA_CMD = 6
|
||||
case FOTAS_COM_CMD:
|
||||
LOGI("line=%d, 7.3 ota over\n",__LINE__);
|
||||
uint8_t ret= ota_crc_test();
|
||||
if(ret)
|
||||
{
|
||||
ble_flash_later_write_page(fotas_write_env.para_buf,OTA_PARAM_ADDR);
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_SUCCEES, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*crc err*/
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_FAIL, 6);
|
||||
}
|
||||
|
||||
fotas_status.rsp_stat = 0;
|
||||
fotas_status.ack_idx = 0;
|
||||
|
||||
fota_status_set(FOTAS_TRANS_SUC);
|
||||
fotas_status.ota_succ_flag = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("err cmd\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_CMD, FOTAS_DEV_BUSY, 0);
|
||||
}
|
||||
}
|
||||
void fota_disconnect_reset()
|
||||
{
|
||||
fotas_status.rsp_stat = 0;
|
||||
fotas_status.ack_idx = 0;
|
||||
fotas_status.fir_rsp_stat = 1;
|
||||
fotas_status.first_pack_write_flag = TRUES;
|
||||
}
|
||||
|
||||
void ota_clear_status()
|
||||
{
|
||||
fotas_status.ota_succ_flag = 0;
|
||||
fotas_status.rsp_stat = 0;
|
||||
fotas_status.ack_idx = 0;
|
||||
fotas_write_env.cur_num = 0;
|
||||
fotas_status.fir_rsp_stat = 1;
|
||||
fotas_status.first_pack_write_flag = TRUES;
|
||||
fotas_status.sector_erase_flag=0;
|
||||
fotas_status.wtitten_page_num = 1;
|
||||
fotas_status.wtite_flag = 0; // Only when the valid data of the bin file is received, it will be set to 1
|
||||
fota_status_set(FOTAS_DEV_BUSY);
|
||||
}
|
||||
|
||||
uint16_t trans_size_cmd_ack(uint8_t num_page)
|
||||
{
|
||||
uint16_t size = 0;
|
||||
switch (num_page){
|
||||
case 16:{
|
||||
size = 0x0001; //4096
|
||||
}break;
|
||||
case 8:{
|
||||
size = 0x0101; //2048
|
||||
}break;
|
||||
case 4:{
|
||||
size = 0x0201; //1024
|
||||
}break;
|
||||
case 2:{
|
||||
size = 0x0301; //512
|
||||
}break;
|
||||
case 1:{
|
||||
size = 0x0401; //256
|
||||
}break;
|
||||
defult:
|
||||
LOGI("not support size = %d\n", num_page*256);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
// CMD and RSP handler.
|
||||
void xc_fota_cmd_rsp_handle(struct opencode_or_ack *wr_req)
|
||||
{
|
||||
uint8_t cmd = wr_req->cmd;
|
||||
uint8_t type = wr_req->data_or_atype;
|
||||
uint16_t fnum = wr_req->fnum_or_para;
|
||||
|
||||
// Each stage of ota will perform an empty packet interaction before starting data interaction
|
||||
if (cmd == FOTAS_CMD)
|
||||
{
|
||||
if (type == 0) // type is transmission
|
||||
{
|
||||
// ���յ���ǰ����Ϣ�� FOTAS_INFO_CMD ʱ�� fotas_status.rsp_stat = 1
|
||||
// ���յ� 2.2 app ������ack, �� fotas_status.ack_idx = 0 ʱ��rsp_stat += 1
|
||||
|
||||
switch (fotas_status.rsp_stat)
|
||||
{
|
||||
|
||||
// FOTAS_RSP_READY = 0
|
||||
case FOTAS_RSP_READY:
|
||||
LOGI("line=%d, [1.1 app->dev, 1.2 dev->app]\n",__LINE__);
|
||||
|
||||
ble_flash_later_page_erase(OTA_PARAM_ADDR);
|
||||
|
||||
|
||||
// xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_ACK, FOTAS_TRANS_SUC, 0x0001);
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_ACK, FOTAS_TRANS_SUC, trans_size_cmd_ack(FOTA_PAGE_NUM));
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
break;
|
||||
|
||||
// FOTAS_RCV_SECT_START = 1
|
||||
case FOTAS_RCV_SECT_START:
|
||||
// �˴��յ���Ϣ2.4 App->Dev, ����û��2.5�������Ϣ�Ƿ���Ҫ�豸�˻ظ�
|
||||
//
|
||||
LOGI("line=%d, [2.4,3.1 app->dev 3.2 dev->app] or [4.4,5.1 app->dev 5.2 dev->app ]\n",__LINE__);
|
||||
// start recv data
|
||||
fotas_write_env.all_fnum = fnum;
|
||||
xc_fota_dev_ack_cmd(FOTAS_RSP, FOTAS_ACK, FOTAS_TRANS_SUC, 1);
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
|
||||
// when default =1, disconnect=1, ota over=1, fotas_status.fir_ack_idx = 1
|
||||
|
||||
fotas_status.ack_idx = FOTAS_RECV_START;
|
||||
|
||||
break;
|
||||
|
||||
case FOTAS_RCV_SECT_CANCEL: // no use, maybe use in the future
|
||||
LOGI("FOTAS_RCV_SECT_CANCEL\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("err fotas_status.rsp_stat:%d\n", fotas_status.rsp_stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cmd == FOTAS_ACK) // type is ack, app -> dev, ������Ҫ dev ���� app һ����
|
||||
{
|
||||
if (fnum == 1)
|
||||
{
|
||||
// fotas_status.ack_idx = 1, When fotas_status.ack_idx=1, it means that the ota data packet has been delivered
|
||||
switch (fotas_status.ack_idx) // ��Ϊ app ����ָ��һ���������豸�ص�ָ�һ��
|
||||
{
|
||||
// FOTAS_RSP_START = 0
|
||||
case FOTAS_RSP_START:
|
||||
LOGI("line=%d, sn=0, app->dev ack 2.2, dev->app 2.3 \n",__LINE__);
|
||||
|
||||
fotas_status.rsp_stat = FOTAS_RCV_SECT_START;
|
||||
|
||||
fota_env.send_buf.sn = FOTAS_SENT;
|
||||
fota_env.send_buf.len = 3;
|
||||
|
||||
if (fotas_status.ota_succ_flag)
|
||||
{
|
||||
fota_env.send_buf.cmd = 7; // 8.3 Dev->App (ota upgrade result)
|
||||
}
|
||||
else
|
||||
{
|
||||
fota_env.send_buf.cmd = 2; // 2.3 Dev->App (ota start rsp)
|
||||
}
|
||||
fota_env.send_buf.status = fota_status_get();
|
||||
FOTAS_NOTIFY((uint8_t*)&fota_env.send_buf, sizeof(fota_env.send_buf), OTA_SVC_TX_CHAR_VAL);
|
||||
break;
|
||||
|
||||
// FOTAS_RSP_START = 1
|
||||
case FOTAS_RSP_CMD:
|
||||
// 4.3 Dev->App (ota current packet rsp)
|
||||
LOGI("line=%d,ota current packet rsp, app->dev 4.2 ack, dev->app 4.3 req\n",__LINE__);
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
fota_env.send_buf.sn = FOTAS_SENT;
|
||||
fota_env.send_buf.len = 3;
|
||||
fota_env.send_buf.cmd = 4;
|
||||
fota_env.send_buf.status = fota_status_get();
|
||||
FOTAS_NOTIFY((uint8_t*)&fota_env.send_buf, sizeof(fota_env.send_buf), OTA_SVC_TX_CHAR_VAL);
|
||||
break;
|
||||
|
||||
// FOTAS_RECV_START = 2
|
||||
case FOTAS_RECV_START:
|
||||
LOGI("line=%d, 4.3 ota current packet rsp \n",__LINE__);
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
fota_env.send_buf.sn = FOTAS_SENT;
|
||||
fota_env.send_buf.len = 3;
|
||||
fota_env.send_buf.cmd = 4;
|
||||
fota_env.send_buf.status = fota_status_get();
|
||||
FOTAS_NOTIFY((uint8_t*)&fota_env.send_buf, sizeof(fota_env.send_buf), OTA_SVC_TX_CHAR_VAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("fotas_status.ack_idx:%d\n", fotas_status.ack_idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (fnum == 0)
|
||||
{
|
||||
switch (fotas_status.ack_idx)
|
||||
{
|
||||
case FOTAS_RSP_START:
|
||||
if (fotas_status.ota_succ_flag)
|
||||
{
|
||||
LOGI("\r\n");
|
||||
LOGI("fotas_status.ota_succ_flag\n");
|
||||
xc_ble_disconnect(app_env.slave_conidx, 0x16);
|
||||
wdt_reset_system();
|
||||
}
|
||||
else
|
||||
{
|
||||
// LOGI("ota start rsp succeed 2.4\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case FOTAS_RECV_START:
|
||||
LOGI("line=%d, ota start recv data 4.4 \n",__LINE__);
|
||||
fota_status_set(FOTAS_DEV_READY);
|
||||
fotas_status.ack_idx = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
// LOGI(" fnum:%d fotas_status.ack_idx:%d\n",fnum,fotas_status.ack_idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGI("error!!!!rsp\n");
|
||||
}
|
||||
}
|
||||
|
||||
// uint8_t flash_size;
|
||||
void xc_fota_server_write_ind(uint8_t *buffer, uint16_t buff_size)
|
||||
{
|
||||
struct opencode_or_ack *wr_req = (struct opencode_or_ack *)buffer;
|
||||
uint16_t sn = wr_req->sn;
|
||||
// fotas_write_env.length = buff_size - 3;
|
||||
// Data buffer boundary protection
|
||||
if(buff_size >= 3) {
|
||||
fotas_write_env.length = buff_size - 3;
|
||||
} else {
|
||||
fotas_write_env.length = buff_size;
|
||||
LOGI("err buff_size=%d\n", buff_size);
|
||||
}
|
||||
ota_flag=1;
|
||||
LOGI("debug: sn = %x \n", sn);
|
||||
switch (sn)
|
||||
{
|
||||
case FOTAS_RSP:
|
||||
LOGI("FOTAS_RSP\n");
|
||||
xc_fota_cmd_rsp_handle(wr_req);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGI("FOTAS_DATA\n");
|
||||
xc_fota_write_data_handle(buffer, wr_req->cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xc_ota_schedule()
|
||||
{
|
||||
ble_flash_handle();
|
||||
|
||||
if(fotas_status.wtite_flag)
|
||||
{
|
||||
if(op_flash.op_state == OP_IDEL)
|
||||
{
|
||||
if(fotas_status.wtitten_page_num == FOTA_PAGE_NUM)
|
||||
{
|
||||
fotas_status.wtitten_page_num = 1;
|
||||
fotas_status.wtite_flag = 0;
|
||||
LOGI("func=%s,line=%d\n",__func__,__LINE__);
|
||||
xc_fota_dev_ack_cmd(0, 1, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOGI("func=%s,line=%d\n",__func__,__LINE__);
|
||||
ota_write_flash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
@@ -0,0 +1,234 @@
|
||||
#ifndef __OTA_PROTOCOL_H_
|
||||
#define __OTA_PROTOCOL_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "arch.h"
|
||||
//#include "ble.h"
|
||||
//#include "ble_flash_operation.h"
|
||||
|
||||
|
||||
// extern void data_sent(uint8_t *buffer, uint16_t length);
|
||||
|
||||
// #define DEBUG(...) //DEBUG(__VA_ARGS__)
|
||||
|
||||
#define PARAM_CNT 5
|
||||
#define TRUES 1
|
||||
#define FALSE 0
|
||||
#define CRC32_INITIAL 0
|
||||
#define DELAY_MS
|
||||
#define FLASH_INIT
|
||||
#define FLASH_WRITE_PAGE ble_flash_later_write_page
|
||||
#define FLASH_READ_PAGE
|
||||
#define FLASH_SECTOR_ERASE ble_flash_later_sector_erase
|
||||
#define FlASH_WR_ENABLE
|
||||
#define FLASH_WAIT_READY
|
||||
#define FLASH_RELEASE_PD
|
||||
#define FLASH_ENTER_PD
|
||||
#define FLASH_PAGE_ERASE
|
||||
#define CEILING(dividend, divisor) ((dividend) / (divisor) + (((dividend) % (divisor)) ? 1 : 0))
|
||||
#define FOTAS_NOTIFY ota_slave_send_data
|
||||
// #define FOTA_PAGE_NUM 16
|
||||
#define FOTA_PAGE_NUM 8
|
||||
#define OTA_PARAM_ADDR ((8*1024)-512)
|
||||
enum fota_write_cmd
|
||||
{
|
||||
FOTAS_STA_CMD = 1,
|
||||
FOTAS_STA_RSP_CMD,
|
||||
FOTAS_INFO_CMD,
|
||||
FOTAS_INFO_RSP_CMD,
|
||||
FOTAS_DATA_CMD,
|
||||
FOTAS_COM_CMD,
|
||||
FOTAS_RES_CMD,
|
||||
};
|
||||
enum fota_result_rsp
|
||||
{
|
||||
FOTAS_SUCCEES,
|
||||
FOTAS_FAIL,
|
||||
};
|
||||
enum fota_inf_stat
|
||||
{
|
||||
FOTAS_INF_OK,
|
||||
FOTAS_INF_ERR,
|
||||
};
|
||||
enum fota_stat_rsp
|
||||
{
|
||||
FOTAS_STAT_OK,
|
||||
FOTAS_SW_DIF,
|
||||
FOTAS_ROM_DIF,
|
||||
FOTAS_OVERLOUP,
|
||||
};
|
||||
|
||||
enum fota_sn
|
||||
{
|
||||
FOTAS_RSP,
|
||||
FOTAS_SENT,
|
||||
};
|
||||
|
||||
enum fota_cmd_type
|
||||
{
|
||||
FOTAS_CMD,
|
||||
FOTAS_ACK,
|
||||
};
|
||||
|
||||
enum fota_ack_type
|
||||
{
|
||||
FOTAS_TRANS_SUC,
|
||||
FOTAS_DEV_READY,
|
||||
FOTAS_DEV_BUSY,
|
||||
FOTAS_TANS_TIOUT,
|
||||
FOTAS_TANS_CANCEL,
|
||||
FOTAS_TANS_LOSE,
|
||||
FOTAS_TANS_BIN_ACK,
|
||||
FOTAS_STATE_MAX,
|
||||
};
|
||||
enum fota_rsp_stat
|
||||
{
|
||||
FOTAS_RSP_READY,
|
||||
FOTAS_RCV_SECT_START,
|
||||
FOTAS_RCV_SECT_CANCEL,
|
||||
};
|
||||
enum fota_rcv_rsp
|
||||
{
|
||||
FOTAS_RSP_START,
|
||||
FOTAS_RSP_CMD,
|
||||
FOTAS_RECV_START,
|
||||
};
|
||||
struct img_hdr_t
|
||||
{
|
||||
// Secure OTA uses the Signature for image validation instead of calculating a CRC, but the use
|
||||
// of CRC==CRC-Shadow for quick boot-up determination of a validated image is still used.
|
||||
// User-defined Image Version Number - default logic uses simple a '!=' comparison to start an OTA .
|
||||
uint16_t sn;
|
||||
uint8_t cmd;
|
||||
uint16_t len;
|
||||
uint16_t sw_ver;
|
||||
uint16_t rom_ver; // Rom ver.
|
||||
uint32_t bin_size; // Image fotas_write_env.length in 4-byte blocks ().
|
||||
uint32_t crc; // CRC must not be 0x00000000 or 0xFFFFFFFF.
|
||||
uint16_t pack_num;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct fota_data_att
|
||||
{
|
||||
uint16_t sn;
|
||||
uint16_t len;
|
||||
uint8_t cmd;
|
||||
uint32_t segment_id;
|
||||
uint32_t crc;
|
||||
uint16_t sector_size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct fota_data
|
||||
{
|
||||
uint16_t sn;
|
||||
uint8_t cmd;
|
||||
uint8_t data[256];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
APP->DEV
|
||||
sn,cmd,data,fnum
|
||||
DEV->APP
|
||||
sn,cmd,atype,para
|
||||
*/
|
||||
struct opencode_or_ack
|
||||
{
|
||||
uint16_t sn;
|
||||
uint8_t cmd;
|
||||
uint8_t data_or_atype; // data or ack type
|
||||
uint16_t fnum_or_para; // frame num or parameter
|
||||
uint16_t data;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct dev_send_buf
|
||||
{
|
||||
uint16_t sn;
|
||||
uint16_t len;
|
||||
uint8_t cmd;
|
||||
uint16_t status;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct fotas_env
|
||||
{
|
||||
uint16_t sn;
|
||||
uint32_t crc;
|
||||
uint8_t status;
|
||||
uint32_t bin_size;
|
||||
uint8_t sector_buf[FOTA_PAGE_NUM][FLASH_PAGE_SIZE];
|
||||
uint16_t pack_num;
|
||||
struct opencode_or_ack ack;
|
||||
struct dev_send_buf send_buf;
|
||||
struct fota_data_att data_att;
|
||||
} __attribute__((packed));
|
||||
struct fotas_write_env
|
||||
{
|
||||
int old_length;
|
||||
int length;
|
||||
uint32_t write_addr;
|
||||
uint32_t erase_addr;
|
||||
uint16_t all_fnum;
|
||||
uint16_t cur_num;
|
||||
uint8_t para_buf[256];
|
||||
};
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Status; /**/
|
||||
uint32_t SoftVer; /**/
|
||||
uint32_t ACheck; /*crc32*/
|
||||
uint32_t AAddr; /*sector align*/
|
||||
uint32_t ALen; /*page align*/
|
||||
uint32_t BCheck; /**/
|
||||
uint32_t BAddr; /**/
|
||||
uint32_t BLen; /**/
|
||||
uint32_t ALoadAddr;
|
||||
uint32_t BLoadAddr;
|
||||
uint32_t RESERVED0[2];
|
||||
} PARAM_UNIT;
|
||||
struct fotas_flag
|
||||
{
|
||||
uint8_t fir_ack_idx;
|
||||
uint8_t fir_rsp_stat;
|
||||
uint8_t first_pack_write_flag;
|
||||
uint8_t ota_succ_flag ;
|
||||
uint8_t rsp_stat;
|
||||
uint8_t ack_idx ;
|
||||
uint8_t sector_erase_flag;
|
||||
uint8_t wtitten_page_num ; //
|
||||
uint8_t wtite_flag; // Only when the valid data of the bin file is received, it will be set to 1
|
||||
};
|
||||
typedef enum
|
||||
{
|
||||
InvalidStat = 0,
|
||||
ActiveAStat = 1,
|
||||
EraseAStat = 2,
|
||||
OverwriteAStat = 3,
|
||||
ActiveBStat = 4,
|
||||
EraseBStat = 5,
|
||||
OverwriteBStat = 6,
|
||||
} STATUS_T;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PARAM_UNIT ParamUnit[PARAM_CNT];
|
||||
uint32_t ParamCrc32;
|
||||
uint32_t RESERVED1[3];
|
||||
} sBOOT_MESSAGE;
|
||||
extern uint32_t GenerateCrc32(uint32_t PartialCrc, char *Buffer, uint32_t Length);
|
||||
|
||||
void fota_disconnect_reset(void);
|
||||
|
||||
void xc_fota_dev_ack_cmd(uint16_t sn,
|
||||
uint8_t cmd,
|
||||
uint8_t data_or_atype,
|
||||
uint16_t fnum_or_para);
|
||||
|
||||
void xc_fota_server_write_ind(uint8_t *buffer, uint16_t buff_size);
|
||||
|
||||
void ota_write_flash(void);
|
||||
|
||||
void xc_ota_schedule(void);
|
||||
|
||||
void wdt_reset_system(void);
|
||||
|
||||
#endif // __OTA_PROTOCOL_H_
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file ota_server.c
|
||||
*
|
||||
* @brief Custom Server profile database definitions.
|
||||
*
|
||||
* Copyright (c) 2022 - 2025, XinChip
|
||||
* All rights reserved.p
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#include "rwip_config.h"
|
||||
|
||||
#if (BLE_APP_PRESENT)
|
||||
#include "ota_server.h"
|
||||
#include "ota_protocol.h"
|
||||
|
||||
uint8_t ota_srv_user_lid = GATT_INVALID_USER_LID;
|
||||
uint16_t ota_svc_start_hdl = GATT_INVALID_HDL;
|
||||
uint8_t ota_svc_tx_char_notify = DISABLE;
|
||||
|
||||
static const gatt_att_desc_t ota_server_atts[] = {
|
||||
[OTA_SVC_DECL] =
|
||||
{
|
||||
.uuid = 0x00,0x28,
|
||||
.info = GATT_ATT_RD_BIT | ATT_UUID(16),
|
||||
.ext_info = 0,
|
||||
},
|
||||
[OTA_SVC_RX_CHAR_DECL_CHAR] =
|
||||
{
|
||||
.uuid = 0x03, 0x28,
|
||||
.info = GATT_ATT_RD_BIT| ATT_UUID(16),
|
||||
.ext_info = 0,
|
||||
},
|
||||
[OTA_SVC_RX_CHAR_VAL] =
|
||||
{
|
||||
.uuid = OTA_SVC_RX_CHAR_UUID,
|
||||
.info = GATT_ATT_WC_BIT | GATT_ATT_RD_BIT | ATT_UUID(128),
|
||||
.ext_info =
|
||||
GATT_ATT_NO_OFFSET_BIT | OTA_SVC_RX_CHAR_VAL_MAX_LENGTH ,
|
||||
},
|
||||
[OTA_SVC_TX_CHAR_DECL_CHAR] =
|
||||
{
|
||||
.uuid = 0x03, 0x28,
|
||||
.info = GATT_ATT_RD_BIT| ATT_UUID(16),
|
||||
.ext_info = 0,
|
||||
},
|
||||
[OTA_SVC_TX_CHAR_VAL] =
|
||||
{
|
||||
.uuid = OTA_SVC_TX_CHAR_UUID,
|
||||
.info = GATT_ATT_N_BIT | ATT_UUID(128),
|
||||
.ext_info =
|
||||
GATT_ATT_NO_OFFSET_BIT | OTA_SVC_TX_CHAR_VAL_MAX_LENGTH,
|
||||
},
|
||||
[OTA_SVC_TX_CHAR_CFG] =
|
||||
{
|
||||
.uuid = 0x02, 0x29,
|
||||
.info = GATT_ATT_RD_BIT | GATT_ATT_WR_BIT | ATT_UUID(16),
|
||||
.ext_info = 0,
|
||||
},
|
||||
};
|
||||
|
||||
uint8_t ota_slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx);
|
||||
|
||||
uint16_t ota_srv_get_hdl_from_att_idx(uint8_t idx)
|
||||
{
|
||||
return ota_svc_start_hdl + idx ;
|
||||
}
|
||||
|
||||
// This function is called when GATT server user has initiated event send to
|
||||
// peer device or if an error occurs.
|
||||
__STATIC void ota_svc_cb_event_sent(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t dummy, uint16_t status)
|
||||
{
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, dummy:%d, status:%d \r\n", __func__,
|
||||
conidx, user_lid, dummy, status);
|
||||
}
|
||||
|
||||
// This function is called when peer want to read local attribute database
|
||||
// value.
|
||||
__STATIC void ota_svc_cb_att_read_get(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t token, uint16_t hdl,
|
||||
uint16_t offset, uint16_t max_length)
|
||||
{
|
||||
uint16_t status;
|
||||
uint8_t data[] = {0x12, 0x15, 0x46, 0x62};
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, token:%d, hdl:%d, offset:%d, "
|
||||
"max_length:%d \r\n",
|
||||
__func__, conidx, user_lid, token, hdl, offset, max_length);
|
||||
// Send result to peer device
|
||||
status = xc_ble_gatt_srv_read_cfm(conidx, user_lid, token, GAP_ERR_NO_ERROR,
|
||||
sizeof(data), sizeof(data), data);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_read_cfm error 0x%x", status);
|
||||
}
|
||||
}
|
||||
|
||||
// This function is called during a write procedure to modify attribute handle.
|
||||
__STATIC void ota_svc_cb_att_val_set(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t token, uint16_t hdl,
|
||||
uint16_t offset, co_buf_t *p_data)
|
||||
{
|
||||
uint16_t length = co_buf_data_len(p_data);
|
||||
uint16_t status;
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, token:%d, hdl:%d, offset:%d \r\n",
|
||||
__func__, conidx, user_lid, token, hdl, offset);
|
||||
status =
|
||||
xc_ble_gatt_srv_write_cfm(conidx, user_lid, token, GAP_ERR_NO_ERROR);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_write_cfm error 0x%x", status);
|
||||
}
|
||||
LOGI("length:%d data:\r\n", length);
|
||||
// DUMP_DATA_PRINTF(co_buf_data(p_data), length);
|
||||
xc_fota_server_write_ind(co_buf_data(p_data), length);
|
||||
// LOGI("hdl=%x %x\r\n", hdl, ota_srv_get_hdl_from_att_idx(OTA_SVC_TX_CHAR_CFG));
|
||||
if (hdl == ota_srv_get_hdl_from_att_idx(OTA_SVC_TX_CHAR_CFG)) {
|
||||
if ((co_buf_data(p_data)[1] == 0) && (co_buf_data(p_data)[0] == 0)) {
|
||||
ota_svc_tx_char_notify = DISABLE;
|
||||
} else {
|
||||
ota_svc_tx_char_notify = ENABLE;
|
||||
LOGI("ota_svc_tx_char_notify ENABLE\r\n");
|
||||
// uint8_t data[] = {0x12, 0x13, 0x14};
|
||||
// ota_slave_send_data(data, sizeof(data), OTA_SVC_TX_CHAR_VAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const gatt_srv_cb_t ota_src_cb = {
|
||||
.cb_event_sent = ota_svc_cb_event_sent,
|
||||
.cb_att_read_get = ota_svc_cb_att_read_get,
|
||||
.cb_att_val_set = ota_svc_cb_att_val_set,
|
||||
};
|
||||
|
||||
uint8_t ota_svc_add(void)
|
||||
{
|
||||
int nb_att = sizeof(ota_server_atts) / sizeof(ota_server_atts[0]);
|
||||
uint16_t status;
|
||||
uint8_t ota_svc_uuid[GATT_UUID_128_LEN] = OTA_SVC_UUID;
|
||||
status = xc_ble_gatt_user_srv_register(133, 0, &ota_src_cb,
|
||||
&ota_srv_user_lid);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_user_srv_register error 0x%x", status);
|
||||
}
|
||||
status = xc_ble_gatt_service_add(
|
||||
ota_srv_user_lid, GATT_UUID_128 << GATT_SVC_UUID_TYPE_LSB, ota_svc_uuid,
|
||||
nb_att, NULL, &(ota_server_atts[0]), nb_att, &ota_svc_start_hdl);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("xc_ble_gatt_service_add error 0x%x", status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
uint8_t ota_slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx)
|
||||
{
|
||||
uint16_t status = INVALID_DATA;
|
||||
struct app_env_tag * app_env = get_app_env();
|
||||
if (app_env->slave_connected && ota_svc_tx_char_notify) {
|
||||
status = xc_ble_gatt_srv_notify(app_env->slave_conidx, ota_srv_user_lid, 0,
|
||||
ota_srv_get_hdl_from_att_idx(att_idx), len,
|
||||
data);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_notify error 0x%x", status);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file ota_server.h
|
||||
*
|
||||
* @brief Custom Server profile database definitions.
|
||||
*
|
||||
* Copyright (c) 2022 - 2025, XinChip
|
||||
* All rights reserved.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#ifndef _OTA_SERVER_H_
|
||||
#define _OTA_SERVER_H_
|
||||
|
||||
#include "app_task.h"
|
||||
#include "dbg.h"
|
||||
#include "gatt.h"
|
||||
#include "gatt_msg.h"
|
||||
#include "rwble_hl_config.h"
|
||||
#include "xc_gatt_server_api.h"
|
||||
#include "xc6xxx.h"
|
||||
|
||||
#define OTA_SVC_UUID {0xFA, 0x34,0x9B,0x5F,0x80,0x00,0x00,0x80,0x00,0x10,0x00,0x00,0x10,0xFF,0x00,0x00}
|
||||
#define OTA_SVC_TX_CHAR_UUID 0xFB,0x34,0x9B,0x5F,0x80,0x00,0x00,0x80,0x00,0x10,0x00,0x00,0x11,0xFF,0x00,0x00
|
||||
#define OTA_SVC_RX_CHAR_UUID 0xFB,0x34,0x9B,0x5F,0x80,0x00,0x00,0x80,0x00,0x10,0x00,0x00,0x12,0xFF,0x00,0x00
|
||||
|
||||
|
||||
|
||||
#define OTA_SVC_RX_CHAR_VAL_MAX_LENGTH (512)
|
||||
#define OTA_SVC_TX_CHAR_VAL_MAX_LENGTH (512)
|
||||
|
||||
enum ota_svc
|
||||
{
|
||||
OTA_SVC_DECL = 0,
|
||||
OTA_SVC_RX_CHAR_DECL_CHAR,
|
||||
OTA_SVC_RX_CHAR_VAL,
|
||||
OTA_SVC_TX_CHAR_DECL_CHAR,
|
||||
OTA_SVC_TX_CHAR_VAL,
|
||||
OTA_SVC_TX_CHAR_CFG,
|
||||
};
|
||||
uint8_t ota_svc_add(void);
|
||||
uint8_t ota_slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx);
|
||||
#endif // _OTA_SERVER_H_
|
||||
|
||||
@@ -0,0 +1,429 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file arch_main.c
|
||||
*
|
||||
* @brief Main loop of the application.
|
||||
*
|
||||
* Copyright (C) RivieraWaves 2009-2015
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* INCLUDES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h" // RW SW configuration
|
||||
|
||||
#include "arch.h" // architectural platform definitions
|
||||
#include <stdlib.h> // standard lib functions
|
||||
#include <stddef.h> // standard definitions
|
||||
#include <stdint.h> // standard integer definition
|
||||
#include <stdbool.h> // boolean definition
|
||||
#include "boot.h" // boot definition
|
||||
#include "rwip.h" // RW SW initialization
|
||||
#include "xc_drv_pwr.h"
|
||||
|
||||
#if (BLE_TEST_MODE_SUPPORT)
|
||||
#include "uart.h" // UART initialization
|
||||
#endif // (BLE_TEST_MODE_SUPPORT)
|
||||
|
||||
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
|
||||
#include "rf.h" // RF initialization
|
||||
#endif // BLE_EMB_PRESENT || BT_EMB_PRESENT
|
||||
|
||||
#if (BLE_APP_PRESENT)
|
||||
//#include "app.h" // application functions
|
||||
#endif // BLE_APP_PRESENT
|
||||
|
||||
#if PLF_DMA
|
||||
#include "dma.h" // DMA initialization
|
||||
#endif // PLF_DMA
|
||||
|
||||
#if (PLF_NVDS)
|
||||
#include "nvds.h" // NVDS definitions
|
||||
#endif // PLF_NVDS
|
||||
|
||||
#include "reg_assert_mgr.h"
|
||||
#if (PLF_PROFILING || PLF_MEM_PROTECTION)
|
||||
#include "reg_sw_profiling.h"
|
||||
#endif // (PLF_PROFILING || PLF_MEM_PROTECTION)
|
||||
#include "platform.h"
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
//CPU early wake-up time (unit:us)
|
||||
#define SLEEP_TIME_EARLY (3300)
|
||||
|
||||
#define HS_TO_US(frame) (((frame) * SLOT_SIZE) >> 1)
|
||||
|
||||
CLOCK_InitCfg_t clock_cb;
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief xc_clock_bbpll_common_cfg
|
||||
* @details Common Settings for frequency doubling
|
||||
* @param[in] void
|
||||
* @param[in] void
|
||||
* @param[out] void
|
||||
* @retval void
|
||||
****************************************************************************************
|
||||
*/
|
||||
void xc_clock_bbpll_common_cfg(void)
|
||||
{
|
||||
cpr_bt_clk_ctl__bt_clk_en__setf(ENABLE);
|
||||
cpr_ctlapbclken_grctl__bt_pclk_en__setf(ENABLE);
|
||||
bt_rf_pm_reg__bt_en_pm__setf(ENABLE);
|
||||
cprao_aon_coreldo_en_set(ENABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief xc_clock_bbpll_freq_cfg
|
||||
* @details Initializes the frequency doubling clock
|
||||
* @param[in] hfclk_src :Source clock
|
||||
* @param[in] loopdiv :clock multiplier factor
|
||||
* @param[in] clk_div :Frequency division coefficient
|
||||
* @param[out] void
|
||||
* @retval void
|
||||
****************************************************************************************
|
||||
*/
|
||||
void xc_clock_bbpll_freq_cfg(CLOCK_HFCLK_Src_Typedef hfclk_src, uint16_t loopdiv,
|
||||
uint8_t clk_div)
|
||||
{
|
||||
if (CLOCK_HFCLK_SRC_RC == hfclk_src)
|
||||
rf_ana27__bbpll_16m_sel__setf(ENABLE);
|
||||
else
|
||||
rf_ana27__bbpll_16m_sel__setf(DISABLE);
|
||||
|
||||
rf_ana27__bbpll_core_96m_en__setf(ENABLE);
|
||||
rf_ana26__bbpll_loopdiv__setf(loopdiv);
|
||||
rf_ana26__clk_bbpll_en__setf(ENABLE);
|
||||
rf_ana26__clk_bbpll_rstn__setf(ENABLE);
|
||||
rf_ana26__bbpll_en__setf(ENABLE);
|
||||
rf_ana26__bbpll_core_64m_en__setf(ENABLE);
|
||||
|
||||
cpr_rf_reg4__bbpll_clk_div__setf(clk_div);
|
||||
cpr_rf_reg4__bbpll_clk_en__setf(ENABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief xc_clock_set_osc32m_bbpll_32m
|
||||
* @details osc32M Clock overclocked to 64M and hflck is 32M
|
||||
* @param[in] CLOCK_InitCfg_t *cb
|
||||
* @param[in]
|
||||
* @param[out] void
|
||||
* @retval void
|
||||
****************************************************************************************
|
||||
*/
|
||||
void xc_clock_set_osc32m_bbpll_32m(CLOCK_InitCfg_t *cb)
|
||||
{
|
||||
xc_clock_bbpll_common_cfg();
|
||||
xc_clock_bbpll_freq_cfg(cb->hfclk_src, 0x04, 0x01);
|
||||
|
||||
cpr_rf_reg3__mclk_src_sel__setf(CLOCK_SRC_BBPLL_DIV);
|
||||
cb->hfclk_in = CLOCK_HFCLK_IN_32M;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief xc_clock_hfclk_in_get
|
||||
* @details Gets the current high speed clock ( system clock )
|
||||
* @param[in]
|
||||
* @param[out] void
|
||||
* @retval clock_cb.hfclk_in
|
||||
****************************************************************************************
|
||||
*/
|
||||
CLOCK_HFCLK_In_Typedef xc_clock_hfclk_in_get(void) { return clock_cb.hfclk_in; }
|
||||
|
||||
/**
|
||||
* @brief clock_init
|
||||
* @details
|
||||
* @param void
|
||||
* @retval void
|
||||
*/
|
||||
void clock_init(void)
|
||||
{
|
||||
// CLOCK_InitCfg_t clock_cfg;
|
||||
|
||||
// clock_cfg.hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
// clock_cfg.hfclk_in = CLOCK_HFCLK_IN_32M;
|
||||
|
||||
// clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
//// clock_cfg.lfclk_src = CLOCK_LFCLK_SRC_XTAL;
|
||||
// if(clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_XTAL) {
|
||||
// clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32768;
|
||||
// } else if(clock_cfg.lfclk_src == CLOCK_LFCLK_SRC_RC) {
|
||||
// clock_cfg.lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
// }
|
||||
// xc_clock_init_cfg(&clock_cfg);
|
||||
|
||||
CLOCK_InitCfg_t *pclock_cb = &clock_cb;
|
||||
pclock_cb->hfclk_src = CLOCK_HFCLK_SRC_XTAL;
|
||||
pclock_cb->lfclk_src = CLOCK_LFCLK_SRC_RC;
|
||||
pclock_cb->lfclk_in = CLOCK_LFCLK_IN_32K;
|
||||
|
||||
xc_clock_set_osc32m_bbpll_32m(pclock_cb);
|
||||
|
||||
cprao_aon_bbldo_adj_set(0x2a);
|
||||
cprao_aon_lpoldo_adj_set(7);
|
||||
|
||||
// xc_clock_lfclk_set(CLOCK_LFCLK_SRC_RC, CLOCK_LFCLK_IN_32K);
|
||||
// xc_pwr_vol_set();
|
||||
|
||||
// SysTick_Config(xc_clock_hfclk_in_get( ) / 100);
|
||||
// SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
#if (SLEEP_ENABLE)
|
||||
|
||||
void system_sleep_init()
|
||||
{
|
||||
uint32_t wake_it_src;
|
||||
#if (USE_XIP == 1)
|
||||
#if (USE_ROM_FLASH)
|
||||
FMC_SPI_Init_Oprt();
|
||||
#else // (USE_ROM_FLASH)
|
||||
xc_fmc_spi_init_oprt();
|
||||
#endif // (USE_ROM_FLASH)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if (USE_XIP!=1)
|
||||
SPI_InitCfg_t spi_cfg = {0};
|
||||
spi_cfg.Mode = SPI_MODE_MASTER;
|
||||
spi_cfg.DataSize = SSI_CTRL0_DFS_LEN_8BIT;
|
||||
spi_cfg.Direction = SSI_CTRL0_TMOD_WR;
|
||||
spi_cfg.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
|
||||
spi_cfg.CLKPolarity = SSI_CTRL0_SCPOL_LOW;
|
||||
spi_cfg.CLKPhase = SPI_CPHA_LEAD;
|
||||
spi_cfg.FirstBit = SPI_FirstBit_MSB;
|
||||
|
||||
xc_spi_init(XC_SPI0, &spi_cfg);
|
||||
SPI_Flash_PowerDown(XC_SPI0);
|
||||
#endif
|
||||
#endif
|
||||
xc_pwr_gpio_sleep_config();
|
||||
|
||||
wake_it_src = GPIO_IRQn_WAKE | RTC_IRQn_WAKE|TIMER_AO0_IRQn_WAKE| TIMER0_IRQn_WAKE;
|
||||
|
||||
xc_pwr_wake_it_set(wake_it_src);
|
||||
}
|
||||
|
||||
void system_lightsleep_cfg()
|
||||
{
|
||||
#if (USE_XIP!=1)
|
||||
cprao_aon_puctrl1_set(0x4);/* puctrl1= 0x4 , SSI0RX must pulldown*/
|
||||
#endif
|
||||
cprao_aon_sys_time_set((RST_READY_TIME<<12) | (OSC32_STABLE_TIME));
|
||||
|
||||
xc_pwr_pd_lightsleep_set();
|
||||
xc_pwr_sleepsrc_mask_set(0x1e001e);
|
||||
xc_pwr_osc_off();
|
||||
}
|
||||
|
||||
void cpu_switch_16M()
|
||||
{
|
||||
//M0_FCLK
|
||||
cpr_m0_fclk_ctl__m0_fclk_div_p__setf(0x1);
|
||||
cpr_m0_fclk_ctl__m0_fclk_direct_sw__setf(0x1);
|
||||
|
||||
//CTL_PCLK
|
||||
cpr_ctl_pclk_grctl__ctl_pclk_gr__setf(0x8);
|
||||
cpr_ctl_pclk_grctl__ctl_pclk_gr_upd__setf(0x1);
|
||||
|
||||
cprao_aon_bbldo_adj_set(0x3c);
|
||||
/* The value needs to be configured to 7,
|
||||
otherwise the current drop will be slower during sleep
|
||||
and the clock accuracy of the rc32k will be affected.
|
||||
*/
|
||||
cprao_aon_lpoldo_adj_set(0x7);
|
||||
}
|
||||
|
||||
void sleep_init(void)
|
||||
{
|
||||
system_sleep_init();
|
||||
system_lightsleep_cfg();
|
||||
/* Timer for sleep-wake*/
|
||||
Timer_InitCfg_t timer_cfg;
|
||||
|
||||
timer_cfg.timer_src_clk = TIMER_CLK_SRC_32K;
|
||||
timer_cfg.timer_div_clk = TIMER_DIV_CLK_32000Hz;
|
||||
timer_cfg.timer_mode = TIMER_MODE_SINGLE;
|
||||
|
||||
xc_timer_init(TIMER0_IDX, &timer_cfg);
|
||||
//cpu 32M->16M
|
||||
// cpu_switch_16M();
|
||||
cprao_aon_bbldo_adj_set(0x2a);
|
||||
cprao_aon_lpoldo_adj_set(0x7);
|
||||
}
|
||||
|
||||
__RAM_CODE void xc_ble_sleep(void)
|
||||
{
|
||||
xc_adc_powerdown();
|
||||
xc_pwr_usb_off();
|
||||
xc_pwr_rc16m_off();
|
||||
|
||||
xc_pwr_rc32k_calib_off();
|
||||
|
||||
xc_pwr_opa_tempsensor_off();
|
||||
xc_pwr_opa_volr_off();
|
||||
xc_pwr_revddldo_off();
|
||||
|
||||
xc_pwr_dcdc_close();
|
||||
xc_pwr_rfdigital_off();
|
||||
xc_pwr_rc32k_calib_off();
|
||||
cprao_aon_reg4__bb_coreldo_normal_sw_mux__setf(1);
|
||||
xc_pwr_modem_off();
|
||||
xc_pwr_pd_lightsleep_set();
|
||||
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
#if (USE_ROM_FLASH)
|
||||
FMC_SPI_Flash_PowerDown();
|
||||
#else // (USE_ROM_FLASH)
|
||||
// xc_fmc_spi_flash_power_down();
|
||||
#endif // (USE_ROM_FLASH)
|
||||
xc_pwr_rom_off();
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
// cpr_fmc_ctl_set(0x3000 | (1 << 9)); // close FMC
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
// __disable_irq();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
__WFI();
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
// cpr_fmc_ctl_set(0x3503);
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
xc_pwr_rom_on();
|
||||
#if (USE_ROM_FLASH)
|
||||
FMC_SPI_Flash_WakeUp();
|
||||
#else // (USE_ROM_FLASH)
|
||||
// xc_fmc_spi_flash_wake_up();
|
||||
#endif // (USE_ROM_FLASH)
|
||||
|
||||
|
||||
xc_pwr_ao_timer_pclk32m_Set();
|
||||
|
||||
// __enable_irq();
|
||||
|
||||
#ifdef USED_DCDC
|
||||
xc_pwr_dcdc_open();
|
||||
#endif
|
||||
|
||||
xc_pwr_modem_on();
|
||||
|
||||
xc_pwr_rfdigital_on();
|
||||
|
||||
xc_adc_wakeup();
|
||||
}
|
||||
|
||||
void enter_cpu_sleep()
|
||||
{
|
||||
cpr_ctlapbclken_grctl__uart0_pclk_en__setf(0);
|
||||
cpr_ahbclken_grctl__dmas_hclk_en__setf(0);
|
||||
|
||||
cpr_slp_src_mask_set(0x1e000e);
|
||||
__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
|
||||
__WFI();
|
||||
__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
|
||||
cpr_slp_src_mask_set(0x1e001e);
|
||||
|
||||
// open uart clk
|
||||
cpr_ctlapbclken_grctl__uart0_pclk_en__setf(1);
|
||||
}
|
||||
|
||||
void sleep_schedule()
|
||||
{
|
||||
// Checks for sleep have to be done with interrupt disabled
|
||||
GLOBAL_INT_DISABLE();
|
||||
|
||||
// Check if the processor clock can be gated
|
||||
uint32_t duration = 0;
|
||||
uint32_t duration_timer = 0;
|
||||
switch(rwip_sleep(&duration, 2, \
|
||||
0x7D00, RWIP_MINIMUM_SLEEP_TIME)){
|
||||
case RWIP_DEEP_SLEEP:
|
||||
{
|
||||
// delay_us(200);
|
||||
|
||||
duration_timer = (HS_TO_US(duration) - SLEEP_TIME_EARLY);
|
||||
xc_timer_set_value(TIMER0_IDX, duration_timer);
|
||||
xc_timer_start(TIMER0_IDX);
|
||||
|
||||
xc_ble_sleep();
|
||||
|
||||
xc_timer_stop(TIMER0_IDX);
|
||||
}
|
||||
// no break
|
||||
case RWIP_CPU_SLEEP:
|
||||
{
|
||||
enter_cpu_sleep();
|
||||
}
|
||||
break;
|
||||
case RWIP_ACTIVE:
|
||||
default:
|
||||
{
|
||||
// nothing to do.
|
||||
} break;
|
||||
}
|
||||
// Checks for sleep have to be done with interrupt disabled
|
||||
GLOBAL_INT_RESTORE();
|
||||
}
|
||||
#endif // (SLEEP_ENABLE)
|
||||
@@ -0,0 +1,244 @@
|
||||
|
||||
;/*****************************************************************************
|
||||
; * @file: startup_xinc.s
|
||||
; * @purpose: CMSIS Cortex-M0 Core Device Startup File for the
|
||||
; * Device xinc.
|
||||
; *****************************************************************************/
|
||||
|
||||
Stack_Size EQU 0x00000800
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
Heap_Size EQU 0x00000000
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
; ToDo: Add here the vectors for the device specific external interrupts handler
|
||||
DCD BLE_Handler ; 0
|
||||
DCD DMA_Handler ; 1
|
||||
DCD CPR_Handler ; 2
|
||||
DCD GPIO_Handler ; 3
|
||||
DCD RTC_Handler ; 4
|
||||
DCD TIMER0_Handler ; 5
|
||||
DCD TIMER1_Handler ; 6
|
||||
DCD TIMER2_Handler ; 7
|
||||
DCD TIMER3_Handler ; 8
|
||||
DCD WDT_Handler ; 9
|
||||
DCD I2C_Handler ; 10
|
||||
DCD UART0_Handler ; 11
|
||||
DCD UART1_Handler ; 12
|
||||
DCD SPI0_Handler ; 13
|
||||
DCD SPI1_Handler ; 14
|
||||
DCD 0 ; 15
|
||||
DCD 0 ; 16
|
||||
DCD GADC_Handler ; 17
|
||||
DCD PWM_Handler ; 18
|
||||
DCD AES_Handler ; 19
|
||||
DCD USB_Handler ; 20
|
||||
DCD AUDIO_Handler ; 21
|
||||
DCD RF24G_Handler ; 22
|
||||
DCD SPI2_Handler ; 23
|
||||
DCD 0 ; 24
|
||||
DCD UART2_Handler ; 25
|
||||
DCD I2S_Handler ; 26
|
||||
DCD AOTIMER0_Handler ; 27
|
||||
DCD AOTIMER1_Handler ; 28
|
||||
DCD CMP_Handler ; 29
|
||||
DCD FMC_Handler ; 30
|
||||
DCD CAN_Handler ; 31
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
; Reset Handler
|
||||
|
||||
Reset_Handler PROC
|
||||
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
|
||||
IMPORT SystemInit
|
||||
IMPORT __main
|
||||
|
||||
LDR r0, =0x4000013C ; remap
|
||||
LDR r1, =0x10000001
|
||||
STR r1, [r0]
|
||||
|
||||
|
||||
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
EXPORT BLE_Handler [WEAK]
|
||||
EXPORT DMA_Handler [WEAK]
|
||||
EXPORT CPR_Handler [WEAK]
|
||||
EXPORT GPIO_Handler [WEAK]
|
||||
EXPORT RTC_Handler [WEAK]
|
||||
EXPORT TIMER0_Handler [WEAK]
|
||||
EXPORT TIMER1_Handler [WEAK]
|
||||
EXPORT TIMER2_Handler [WEAK]
|
||||
EXPORT TIMER3_Handler [WEAK]
|
||||
EXPORT WDT_Handler [WEAK]
|
||||
EXPORT I2C_Handler [WEAK]
|
||||
EXPORT UART0_Handler [WEAK]
|
||||
EXPORT UART1_Handler [WEAK]
|
||||
EXPORT SPI0_Handler [WEAK]
|
||||
EXPORT SPI1_Handler [WEAK]
|
||||
;EXPORT KBS_Handler [WEAK]
|
||||
;EXPORT QDEC_Handler [WEAK]
|
||||
EXPORT GADC_Handler [WEAK]
|
||||
EXPORT PWM_Handler [WEAK]
|
||||
EXPORT AES_Handler [WEAK]
|
||||
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
|
||||
EXPORT USB_Handler [WEAK];20
|
||||
EXPORT AUDIO_Handler [WEAK];21
|
||||
EXPORT RF24G_Handler [WEAK];22
|
||||
EXPORT SPI2_Handler [WEAK];23
|
||||
;EXPORT MPU_Handler [WEAK];24
|
||||
EXPORT UART2_Handler [WEAK];25
|
||||
EXPORT I2S_Handler [WEAK];26
|
||||
EXPORT AOTIMER0_Handler [WEAK];27
|
||||
EXPORT AOTIMER1_Handler [WEAK];28
|
||||
EXPORT CMP_Handler [WEAK];29
|
||||
EXPORT FMC_Handler [WEAK];30
|
||||
EXPORT CAN_Handler [WEAK];31
|
||||
|
||||
PendSV_Handler
|
||||
SysTick_Handler
|
||||
BLE_Handler
|
||||
RF24G_Handler
|
||||
DMA_Handler
|
||||
CPR_Handler
|
||||
GPIO_Handler
|
||||
RTC_Handler
|
||||
TIMER0_Handler
|
||||
TIMER1_Handler
|
||||
TIMER2_Handler
|
||||
TIMER3_Handler
|
||||
WDT_Handler
|
||||
I2C_Handler
|
||||
I2S_Handler
|
||||
UART0_Handler
|
||||
UART1_Handler
|
||||
UART2_Handler
|
||||
SPI0_Handler
|
||||
SPI1_Handler
|
||||
SPI2_Handler
|
||||
;KBS_Handler
|
||||
;QDEC_Handler
|
||||
GADC_Handler
|
||||
PWM_Handler
|
||||
AUDIO_Handler
|
||||
;SIM_Handler
|
||||
AES_Handler
|
||||
AOTIMER0_Handler
|
||||
AOTIMER1_Handler
|
||||
CMP_Handler
|
||||
FMC_Handler
|
||||
CAN_Handler
|
||||
USB_Handler
|
||||
|
||||
B .
|
||||
ENDP
|
||||
|
||||
|
||||
ALIGN
|
||||
|
||||
; User Initial Stack & Heap
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, = (Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
END
|
||||
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define __DEBUG_OUT_PORT 0
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Functions
|
||||
-------------------------------------------------------------------------------------*/
|
||||
#define VECTOR_NUM 48
|
||||
|
||||
void set_vector(void)
|
||||
{
|
||||
#if (USE_XIP == 1)
|
||||
__disable_irq();
|
||||
for (uint32_t i = 0, *Pvector = (uint32_t *)(0x1100F000 + 0),
|
||||
*_vector_table = (uint32_t *)(0x10000000);
|
||||
i < VECTOR_NUM; i++) // copy vertor table
|
||||
{
|
||||
_vector_table[i] = *Pvector++;
|
||||
}
|
||||
|
||||
*((volatile unsigned int *)(0x4000013C)) =
|
||||
0x10000001; // inter vertor table remap
|
||||
__enable_irq();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WDT_ResetInit(void)
|
||||
{
|
||||
cpr_ctlapbclken_grctl__wdt_pclk_en__setf(ENABLE);
|
||||
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_ENABLE);
|
||||
cpr_rstctl_ctlapb_sw__wdt_rstn__setf(RSTCTL_DISABLE);
|
||||
|
||||
cpr_rstctl_wdtrst_mask_set(
|
||||
(WDT_SYS_RSTN_MASK_DISABLE | WDT_M0_RSTN_MASK_ENABLE));
|
||||
|
||||
cpr_lp_ctl__wdt_tclk_en__setf(DISABLE);
|
||||
wdt_cr__wdt_en__setf(DISABLE);
|
||||
}
|
||||
|
||||
#if (SCATTER_LOAD_RAM_EM)
|
||||
#define readl(addr) (*(volatile unsigned int *) (addr))
|
||||
#define writel(addr, value) (*(volatile unsigned int *) (addr) = (value))
|
||||
#endif
|
||||
|
||||
void SystemInit(void)
|
||||
{
|
||||
WDT_ResetInit();
|
||||
|
||||
#if (USE_XIP == 1)
|
||||
|
||||
set_vector();
|
||||
#endif
|
||||
|
||||
#if (SCATTER_LOAD_RAM_EM)
|
||||
//enable BT CLK
|
||||
writel(0x40000040, readl(0x40000040) | (0x01 << 4) | 0xFFFF0000);
|
||||
#endif
|
||||
}
|
||||
|
||||
__RAM_CODE int sendchar(int c)
|
||||
{
|
||||
unsigned int status;
|
||||
#if (__DEBUG_OUT_PORT == 1)
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40011000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40011000 + 0x00))) = c;
|
||||
return (1);
|
||||
#else
|
||||
for (;;) {
|
||||
status = (*((volatile unsigned *)(0x40010000 + 0x14)));
|
||||
status &= 0x20;
|
||||
if (status == 0x20)
|
||||
break;
|
||||
}
|
||||
(*((volatile unsigned *)(0x40010000 + 0x00))) = c;
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct __FILE
|
||||
{
|
||||
int handle; /* Add whatever you need here */
|
||||
};
|
||||
|
||||
FILE __stdout;
|
||||
__RAM_CODE int fputc(int ch, FILE *f) { return (sendchar(ch)); }
|
||||
|
||||
int ferror(FILE *f)
|
||||
{
|
||||
/* Your implementation of ferror */
|
||||
return EOF;
|
||||
}
|
||||
|
||||
void _ttywrch(int ch) { sendchar(ch); }
|
||||
|
||||
void _sys_exit(int return_code)
|
||||
{
|
||||
label:
|
||||
goto label; /* endless loop */
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file usr_server.c
|
||||
*
|
||||
* @brief Custom Server profile database definitions.
|
||||
*
|
||||
* Copyright (c) 2022 - 2025, XinChip
|
||||
* All rights reserved.p
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#include "usr_server.h"
|
||||
#if (0)
|
||||
|
||||
uint8_t srv_user_lid = GATT_INVALID_USER_LID;
|
||||
uint16_t custom_svc_start_hdl = GATT_INVALID_HDL;
|
||||
uint8_t custom_svc_tx_char_notify = DISABLE;
|
||||
|
||||
static const gatt_att16_desc_t custom_server_atts[] = {
|
||||
[CUSTOM_SVC_DECL] =
|
||||
{
|
||||
.uuid16 = GATT_DECL_PRIMARY_SERVICE,
|
||||
.info = GATT_ATT_RD_BIT,
|
||||
.ext_info = 0,
|
||||
},
|
||||
[CUSTOM_SVC_RX_CHAR_DECL_CHAR] =
|
||||
{
|
||||
.uuid16 = GATT_DECL_CHARACTERISTIC,
|
||||
.info = GATT_ATT_RD_BIT,
|
||||
.ext_info = 0,
|
||||
},
|
||||
[CUSTOM_SVC_RX_CHAR_VAL] =
|
||||
{
|
||||
.uuid16 = CUSTOM_SVC_RX_CHAR_UUID,
|
||||
.info = GATT_ATT_RD_BIT | GATT_ATT_WC_BIT | GATT_ATT_WR_BIT,
|
||||
.ext_info =
|
||||
GATT_ATT_NO_OFFSET_BIT | CUSTOM_SVC_RX_CHAR_VAL_MAX_LENGTH,
|
||||
},
|
||||
[CUSTOM_SVC_TX_CHAR_DECL_CHAR] =
|
||||
{
|
||||
.uuid16 = GATT_DECL_CHARACTERISTIC,
|
||||
.info = GATT_ATT_RD_BIT,
|
||||
.ext_info = 0,
|
||||
},
|
||||
[CUSTOM_SVC_TX_CHAR_VAL] =
|
||||
{
|
||||
.uuid16 = CUSTOM_SVC_TX_CHAR_UUID,
|
||||
.info = GATT_ATT_RD_BIT | GATT_ATT_N_BIT,
|
||||
.ext_info =
|
||||
GATT_ATT_NO_OFFSET_BIT | CUSTOM_SVC_TX_CHAR_VAL_MAX_LENGTH,
|
||||
},
|
||||
[CUSTOM_SVC_TX_CHAR_CFG] =
|
||||
{
|
||||
.uuid16 = GATT_DESC_CLIENT_CHAR_CFG,
|
||||
.info = GATT_ATT_RD_BIT | GATT_ATT_WR_BIT,
|
||||
.ext_info = 0,
|
||||
},
|
||||
};
|
||||
|
||||
uint8_t slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx);
|
||||
|
||||
uint16_t srv_get_hdl_from_att_idx(uint8_t idx)
|
||||
{
|
||||
return custom_svc_start_hdl + idx ;
|
||||
}
|
||||
|
||||
// This function is called when GATT server user has initiated event send to
|
||||
// peer device or if an error occurs.
|
||||
__STATIC void custom_svc_cb_event_sent(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t dummy, uint16_t status)
|
||||
{
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, dummy:%d, status:%d \r\n", __func__,
|
||||
conidx, user_lid, dummy, status);
|
||||
}
|
||||
|
||||
// This function is called when peer want to read local attribute database
|
||||
// value.
|
||||
__STATIC void custom_svc_cb_att_read_get(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t token, uint16_t hdl,
|
||||
uint16_t offset, uint16_t max_length)
|
||||
{
|
||||
uint16_t status;
|
||||
uint8_t data[512] = {0x12, 0x15, 0x46, 0x62};
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, token:%d, hdl:%d, offset:%d, "
|
||||
"max_length:%d \r\n",
|
||||
__func__, conidx, user_lid, token, hdl, offset, max_length);
|
||||
// Send result to peer device
|
||||
status = xc_ble_gatt_srv_read_cfm(conidx, user_lid, token, GAP_ERR_NO_ERROR,
|
||||
sizeof(data), sizeof(data), data);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_read_cfm error 0x%x", status);
|
||||
}
|
||||
}
|
||||
|
||||
// This function is called during a write procedure to modify attribute handle.
|
||||
__STATIC void custom_svc_cb_att_val_set(uint8_t conidx, uint8_t user_lid,
|
||||
uint16_t token, uint16_t hdl,
|
||||
uint16_t offset, co_buf_t *p_data)
|
||||
{
|
||||
uint16_t length = co_buf_data_len(p_data);
|
||||
uint16_t status;
|
||||
LOGI("[%s] conidx:%d, usr_lid:%d, token:%d, hdl:%d, offset:%d \r\n",
|
||||
__func__, conidx, user_lid, token, hdl, offset);
|
||||
status =
|
||||
xc_ble_gatt_srv_write_cfm(conidx, user_lid, token, GAP_ERR_NO_ERROR);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_write_cfm error 0x%x", status);
|
||||
}
|
||||
LOGI("length:%d data:\r\n", length);
|
||||
// DUMP_DATA_PRINTF(&(co_buf_data(p_data)[0]), length);
|
||||
if (hdl == srv_get_hdl_from_att_idx(CUSTOM_SVC_TX_CHAR_CFG)) {
|
||||
if ((co_buf_data(p_data)[0] == 0) && (co_buf_data(p_data)[1] == 0)) {
|
||||
custom_svc_tx_char_notify = DISABLE;
|
||||
} else {
|
||||
custom_svc_tx_char_notify = ENABLE;
|
||||
uint8_t data[] = {0x12, 0x13, 0x14};
|
||||
slave_send_data(data, sizeof(data), CUSTOM_SVC_TX_CHAR_VAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const gatt_srv_cb_t custom_src_cb = {
|
||||
.cb_event_sent = custom_svc_cb_event_sent,
|
||||
.cb_att_read_get = custom_svc_cb_att_read_get,
|
||||
.cb_att_val_set = custom_svc_cb_att_val_set,
|
||||
};
|
||||
|
||||
uint8_t custom_svc_add(void)
|
||||
{
|
||||
int nb_att = sizeof(custom_server_atts) / sizeof(custom_server_atts[0]);
|
||||
uint16_t status;
|
||||
uint16_t custom_svc_uuid = CUSTOM_SVC_UUID;
|
||||
status = xc_ble_gatt_user_srv_register(133, 0, &custom_src_cb,
|
||||
&srv_user_lid);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_user_srv_register error 0x%x", status);
|
||||
}
|
||||
status = xc_ble_gatt_service16_add(
|
||||
srv_user_lid, GATT_UUID_16 << GATT_SVC_UUID_TYPE_LSB, custom_svc_uuid,
|
||||
nb_att, NULL, &(custom_server_atts[0]), nb_att, &custom_svc_start_hdl);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_service16_add error 0x%x", status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
uint8_t slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx)
|
||||
{
|
||||
uint16_t status = INVALID_DATA;
|
||||
struct app_env_tag * app_env = get_app_env();
|
||||
if (app_env->slave_connected && custom_svc_tx_char_notify) {
|
||||
status = xc_ble_gatt_srv_notify(app_env->slave_conidx, srv_user_lid, 0,
|
||||
srv_get_hdl_from_att_idx(att_idx), len,
|
||||
data);
|
||||
if (status != GATT_NO_ERROR) {
|
||||
LOGI_ERR("gatt_srv_notify error 0x%x", status);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
#endif // (BLE_APP_PRESENT)
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file usr_server.h
|
||||
*
|
||||
* @brief Custom Server profile database definitions.
|
||||
*
|
||||
* Copyright (c) 2022 - 2025, XinChip
|
||||
* All rights reserved.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#ifndef _USR_SERVER_H_
|
||||
#define _USR_SERVER_H_
|
||||
|
||||
#include "app_task.h"
|
||||
#include "dbg.h"
|
||||
#include "gatt.h"
|
||||
#include "gatt_msg.h"
|
||||
#include "rwble_hl_config.h"
|
||||
#include "xc_gatt_server_api.h"
|
||||
|
||||
#define CUSTOM_SVC_UUID 0xFFF0
|
||||
#define CUSTOM_SVC_RX_CHAR_UUID 0xFFF3
|
||||
#define CUSTOM_SVC_TX_CHAR_UUID 0xFFF4
|
||||
#define CUSTOM_SVC_RX_CHAR_VAL_MAX_LENGTH 20
|
||||
#define CUSTOM_SVC_TX_CHAR_VAL_MAX_LENGTH 20
|
||||
|
||||
enum cust_svc
|
||||
{
|
||||
CUSTOM_SVC_DECL = 0,
|
||||
CUSTOM_SVC_RX_CHAR_DECL_CHAR,
|
||||
CUSTOM_SVC_RX_CHAR_VAL,
|
||||
CUSTOM_SVC_TX_CHAR_DECL_CHAR,
|
||||
CUSTOM_SVC_TX_CHAR_VAL,
|
||||
CUSTOM_SVC_TX_CHAR_CFG,
|
||||
};
|
||||
uint8_t custom_svc_add(void);
|
||||
uint8_t slave_send_data(uint8_t *data, uint8_t len, uint8_t att_idx);
|
||||
#endif // _USR_SERVER_H_
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
SP = _RDWORD(0x10000000);
|
||||
PC = _RDWORD(0x10000004);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,39 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ARM7"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
@@ -0,0 +1,16 @@
|
||||
LOAD 0x10000000
|
||||
{
|
||||
EXE 0x10000000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
|
||||
RW +0000
|
||||
{
|
||||
* (+RW,+ZI)
|
||||
}
|
||||
|
||||
ScatterAssert(ImageLength(RW) < 1024 * 28)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
LOAD 0x1100F000
|
||||
{
|
||||
EXE 0x1100F000
|
||||
{
|
||||
startup_xinc.o (RESET, +FIRST)
|
||||
* (+RO)
|
||||
|
||||
}
|
||||
|
||||
RW 0x10001e00
|
||||
{
|
||||
startup_xinc.o(STACK)
|
||||
* (+RW,+ZI)
|
||||
*(ram_code)
|
||||
|
||||
}
|
||||
ScatterAssert((0x1e00+ImageLength(RW)) < 1024 * 32 )
|
||||
RW2 (0x530077b0)
|
||||
{
|
||||
*(ram_em)
|
||||
}
|
||||
ScatterAssert((0x530077b0)+ImageLength(RW2) < 0x53008000)
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
|
||||
FUNC void InitGpio(void)
|
||||
{
|
||||
// Config IOMUX
|
||||
/*
|
||||
gpio_mux_ctl_u(33,1);//d2
|
||||
gpio_mux_ctl_u(34,1);//d3
|
||||
gpio_mux_ctl_u(35,2);//clk
|
||||
gpio_mux_ctl_u(36,2);//cs
|
||||
gpio_mux_ctl_u(37,2);//d0 rx
|
||||
gpio_mux_ctl_u(38,2);//d1 tx
|
||||
*/
|
||||
_WDWORD(0x4000019c, 0x00002A94);
|
||||
}
|
||||
FUNC void InitFlash(void)
|
||||
{
|
||||
|
||||
}
|
||||
FUNC void InitXIP(void)
|
||||
{
|
||||
|
||||
_WDWORD(0x40000104,0x040000);//reset ssi0
|
||||
_WDWORD(0x40000104,0x040004);//reset ssi0
|
||||
_WDWORD(0x40000050,0x110000);//close spi0 mclk
|
||||
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
|
||||
|
||||
|
||||
//config fmc
|
||||
_WDWORD(0x40000270, 0x0503);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x40000270, 0x3503);
|
||||
//config cache
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x0);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_WDWORD(0x52000000, 0x21);
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
_Sleep_(1);// delay about 400us
|
||||
|
||||
|
||||
//config xip spi
|
||||
_WDWORD(0x51000008, 0); //disable spi
|
||||
|
||||
_WDWORD(0x5100002c,0); //close IE
|
||||
_WDWORD(0x51000000,0x1F); //32bit SPI data
|
||||
_WDWORD(0x51000010,0x01); //enable select slave -- SE
|
||||
_WDWORD(0x51000018,0x0); //TXFTL be set 0
|
||||
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
|
||||
|
||||
_WDWORD(0x5100010c, 0x01);//enable select slave
|
||||
_WDWORD(0x51000114, 0xFF);//XIP time out
|
||||
|
||||
_WDWORD(0x51000014, 0x2);//div 2
|
||||
|
||||
//quad
|
||||
// _WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
|
||||
// _WDWORD(0x51000100, 0x6b);//quad read cmd
|
||||
// _WDWORD(0x51000104, 0x6b);//quad read cmd
|
||||
|
||||
|
||||
//dual
|
||||
_WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
|
||||
_WDWORD(0x51000100, 0x3b);//dual read cmd
|
||||
_WDWORD(0x51000104, 0x3b);//dual read cmd
|
||||
|
||||
|
||||
_WDWORD(0x51000008, 1); //enable spi
|
||||
}
|
||||
|
||||
FUNC void Initialization(void)
|
||||
{
|
||||
InitGpio();
|
||||
InitFlash();
|
||||
InitXIP();
|
||||
SP = _RDWORD(0x11013000);
|
||||
PC = _RDWORD(0x11013004);
|
||||
_WDWORD(0x4000013C, 0x11013001);
|
||||
}
|
||||
LOAD %L INCREMENTAL
|
||||
Initialization();
|
||||
@@ -0,0 +1,588 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>ble-sdk-xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>7</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>0</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm0.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\startup_xinc.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_xinc.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\system_xinc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_xinc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>application</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\app_batt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_batt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\app_task.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_task.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\arch_main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>arch_main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\app_sec.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_sec.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>3</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\rom_symdefs.o</PathWithFileName>
|
||||
<FilenameWithoutPath>rom_symdefs.o</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\sleep.c</PathWithFileName>
|
||||
<FilenameWithoutPath>sleep.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_server.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_server.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_flash_interface.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_flash_interface.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_protocol.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_protocol.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\usr_server.c</PathWithFileName>
|
||||
<FilenameWithoutPath>usr_server.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\aes.c</PathWithFileName>
|
||||
<FilenameWithoutPath>aes.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>modules_rf</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\modules\rf\src\rf_extrc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>rf_extrc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>hal</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ringbuffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_clock.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_pwr.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_wdt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_systick.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_fmc_spi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_calib.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>ble_api</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gap_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gap_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_client_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gatt_client_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_server_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gatt_server_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>modules_nvds</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\modules\nvds\src\nvds.c</PathWithFileName>
|
||||
<FilenameWithoutPath>nvds.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>dut</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\plf\refip\src\driver\uart\uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
||||
@@ -0,0 +1,512 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>ble-sdk-xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>7</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>0</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm0.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\startup_xinc.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_xinc.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\system_xinc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_xinc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>application</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\app_task.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_task.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\arch_main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>arch_main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\sleep.c</PathWithFileName>
|
||||
<FilenameWithoutPath>sleep.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_server.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_server.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_flash_interface.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_flash_interface.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\ota_protocol.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ota_protocol.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\app_printf.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_printf.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>3</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\app\src\rom_symdefs.o</PathWithFileName>
|
||||
<FilenameWithoutPath>rom_symdefs.o</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>modules_rf</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\modules\rf\src\rf_extrc.c</PathWithFileName>
|
||||
<FilenameWithoutPath>rf_extrc.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>hal</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ringbuffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_clock.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_pwr.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_wdt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_systick.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_fmc_spi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_drv_calib.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>ble_api</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gap_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gap_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_client_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gatt_client_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_server_api.c</PathWithFileName>
|
||||
<FilenameWithoutPath>xc_gatt_server_api.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
||||
@@ -0,0 +1,730 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>ble-sdk-xip</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::.\ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM0</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:ARMCM0$Device\ARM\SVD\ARMCM0.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>Xinc_ble_sdk</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name>fromelf --text -a -c --output=@L_asm1 !L</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>fromelf --bin --output=app.bin !L</UserProg1Name>
|
||||
<UserProg2Name>.\output_tool\ge_ota.bat</UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> </TargetDllArguments>
|
||||
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4096</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M0"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>0</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>0</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>0</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>4</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>2</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>1</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--gnu --diag_suppress=66 --feedback fb.txt</MiscControls>
|
||||
<Define>CONFIG_BT_WAKEUP_VIA_GPIO=1 CONFIG_HFCLK_IS_OSC32M_PLL_32M=1 SCATTER_LOAD_RAM_EM=1 SDK_VERSION="2b8e78c6" RC_32K=1 XC60XX CFG_BLE CFG_EMB CFG_STATIC HCI_TEST_NO_IP=0 CFG_ACT=20 CFG_CON=1 CFG_RAL=1 CFG_HOST CFG_APP CFG_APP_PRF CFG_RF_EXTRC CFG_AES_RPA CFG_PERIPHERAL USE_XIP=1 DEBUG_ENABLE ROM_ENV_ENABLE=0 CODE_USE_XIP CFG_PRF_BASS USE_ROM_FLASH=1 SLEEP_ENABLE=0 CFG_ADV_LOW_POWER CFG_MIN_STACK CFG_CONN_OPTIMIZE_0x3E CFG_BLE_HOST_SUPPORT_SMP</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\..\component\ble\Include;..\app\api;..\..\..\..\..\component\ble\modules\aes\api;..\..\..\..\..\component\ble\modules\aes\src;..\..\..\..\..\component\ble\modules\common\api;..\..\..\..\..\component\ble\modules\common\src;..\..\..\..\..\component\ble\modules\ecc_p256\api;..\..\..\..\..\component\ble\modules\ecc_p256\src;..\..\..\..\..\component\ble\modules\h4tl\api;..\..\..\..\..\component\ble\modules\h4tl\src;..\..\..\..\..\component\ble\modules\ke\api;..\..\..\..\..\component\ble\modules\ke\src;..\..\..\..\..\component\ble\modules\nvds\api;..\..\..\..\..\component\ble\modules\nvds\src;..\..\..\..\..\component\ble\modules\rf\api;..\..\..\..\..\component\ble\modules\rf\src;..\..\..\..\..\component\ble\modules\rwip\api;..\..\..\..\..\component\ble\modules\rwip\src;..\..\..\..\..\component\ble\ip\ahi\api;..\..\..\..\..\component\ble\ip\ahi\src;..\..\..\..\..\component\ble\ip\ble\gaf\api;..\..\..\..\..\component\ble\ip\ble\gaf\inc;..\..\..\..\..\component\ble\ip\ble\gaf\src;..\..\..\..\..\component\ble\ip\ble\gaf\src\acc;..\..\..\..\..\component\ble\ip\ble\gaf\src\al;..\..\..\..\..\component\ble\ip\ble\gaf\src\arc;..\..\..\..\..\component\ble\ip\ble\gaf\src\bap\bc;..\..\..\..\..\component\ble\ip\ble\gaf\src\bap\capa;..\..\..\..\..\component\ble\ip\ble\gaf\src\bap\codec;..\..\..\..\..\component\ble\ip\ble\gaf\src\bap\uc;..\..\..\..\..\component\ble\ip\ble\gaf\src\iap;..\..\..\..\..\component\ble\ip\ble\hl\api;..\..\..\..\..\component\ble\ip\ble\hl\inc;..\..\..\..\..\component\ble\ip\ble\hl\src;..\..\..\..\..\component\ble\ip\ble\hl\src\gap;..\..\..\..\..\component\ble\ip\ble\hl\src\gap\gapc;..\..\..\..\..\component\ble\ip\ble\hl\src\gap\gapm;..\..\..\..\..\component\ble\ip\ble\hl\src\gatt;..\..\..\..\..\component\ble\ip\ble\hl\src\inc;..\..\..\..\..\component\ble\ip\ble\hl\src\l2cap;..\..\..\..\..\component\ble\ip\ble\ll\api;..\..\..\..\..\component\ble\ip\ble\ll\src;..\..\..\..\..\component\ble\ip\ble\ll\src\co;..\..\..\..\..\component\ble\ip\ble\ll\src\llc;..\..\..\..\..\component\ble\ip\ble\ll\src\lld;..\..\..\..\..\component\ble\ip\ble\ll\src\lli;..\..\..\..\..\component\ble\ip\ble\ll\src\llm;..\..\..\..\..\component\ble\ip\ble\profiles\bas\bass\api;..\..\..\..\..\component\ble\ip\ble\profiles\bas\bass\src;..\..\..\..\..\component\ble\ip\em\api;..\..\..\..\..\component\ble\ip\em\src;..\..\..\..\..\component\ble\ip\hci\api;..\..\..\..\..\component\ble\ip\hci\src;..\..\..\..\..\component\ble\ip\sch\api;..\..\..\..\..\component\ble\ip\sch\src;..\..\..\..\..\component\ble\plf\refip\src\build\ble-full\reg\fw;..\app\api;..\app\src;..\..\..\..\..\component\ble\plf\refip\src\arch;..\..\..\..\..\component\ble\plf\refip\src\arch\compiler\gnuarm;..\..\..\..\..\component\ble\plf\refip\src\arch\ll\gnuarm;..\..\..\..\..\component\ble\plf\refip\src\driver\reg;..\..\..\..\..\component\ble\plf\refip\src\arch\boot\rvds;..\..\..\..\..\component\ble\plf\refip\src\driver\syscntl;..\..\..\..\..\component\ble\plf\refip\src\driver\emi;..\..\..\..\..\component\ble\plf\refip\src\driver\intc;..\..\..\..\..\component\ble\plf\refip\src\driver\uart;..\..\..\..\..\component\ble\plf\refip\src\driver\flash;..\..\..\..\..\component\ble\plf\refip\src\driver\led;..\..\..\..\..\component\ble\modules\dbg\api;..\..\..\..\..\component\ble\plf\refip\src\driver\uart;..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS;..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device;..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup;..\..\..\..\..\component\xc6xx_drivers\Drivers\Startup\xc60xx;..\..\..\..\..\component\xc6xx_drivers\Drivers\Periph_HAL_Driver;..\..\..\..\..\component\xc6xx_drivers\Drivers\Periph_HAL_Driver\Bitfields;..\..\..\..\..\component\xc6xx_drivers\Drivers\Periph_HAL_Driver\Ringbuffer;..\..\..\..\..\component\xc6xx_drivers\Drivers\test_case\PWR;..\..\..\..\..\component\xc6xx_drivers\Drivers\test_case\TIMER;..\..\..\..\..\component\ble\ip\ble\api;..\..\..\..\..\component\ble\ip\ble\ll_rom_port;..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver;..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\Device\xc_m0_register;..\..\..\..\..\component\ble\modules\flash</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>1</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>.\Linker\cpu_xip.scat</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--feedback fb.txt</Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>startup</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm0.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\CMSIS\core_cm0.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_xinc.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\app\src\startup_xinc.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_xinc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\system_xinc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>application</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>app_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>arch_main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\arch_main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>sleep.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\sleep.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ota_server.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\ota_server.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ota_flash_interface.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\ota_flash_interface.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ota_protocol.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\ota_protocol.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_printf.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\app\src\app_printf.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rom_symdefs.o</FileName>
|
||||
<FileType>3</FileType>
|
||||
<FilePath>..\app\src\rom_symdefs.o</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>modules_rf</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>rf_extrc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\ble\modules\rf\src\rf_extrc.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>hal</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>ringbuffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\ringbuffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_clock.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_clock.c</FilePath>
|
||||
<FileOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>2</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>0</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<FileArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_pwr.c</FilePath>
|
||||
<FileOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>2</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>0</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<FileArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_wdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_wdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_systick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_systick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_fmc_spi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_fmc_spi.c</FilePath>
|
||||
<FileOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>2</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>2</AlwaysBuild>
|
||||
<GenerateAssemblyFile>2</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>2</AssembleAssemblyFile>
|
||||
<PublicsOnly>2</PublicsOnly>
|
||||
<StopOnExitCode>11</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<FileArmAds>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_drv_calib.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\xc6xx_drivers\Drivers\xc_driver\xc_drv_calib.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>ble_api</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>xc_gap_api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\ble\ip\ble\api\xc_gap_api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_gatt_client_api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_client_api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>xc_gatt_server_api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\..\component\ble\ip\ble\api\xc_gatt_server_api.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components/>
|
||||
<files>
|
||||
<file attr="config" category="linkerScript" condition="ARMCC5" name="Device\ARM\ARMCM0\Source\ARM\ARMCM0_ac5.sct" version="1.0.0">
|
||||
<instance index="0" removed="1">RTE\Device\ARMCM0\ARMCM0_ac5.sct</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvariant="C Startup" Cvendor="ARM" Cversion="2.0.3" condition="ARMCM0 CMSIS" isDefaultVariant="1"/>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="sourceC" name="Device\ARM\ARMCM0\Source\startup_ARMCM0.c" version="2.0.3">
|
||||
<instance index="0" removed="1">RTE\Device\ARMCM0\startup_ARMCM0.c</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvariant="C Startup" Cvendor="ARM" Cversion="2.0.3" condition="ARMCM0 CMSIS" isDefaultVariant="1"/>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="sourceC" name="Device\ARM\ARMCM0\Source\system_ARMCM0.c" version="1.0.0">
|
||||
<instance index="0" removed="1">RTE\Device\ARMCM0\system_ARMCM0.c</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvariant="C Startup" Cvendor="ARM" Cversion="2.0.3" condition="ARMCM0 CMSIS" isDefaultVariant="1"/>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
</files>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName><Project Info></LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
cd ./output_bin
|
||||
copy ..\app.bin .\
|
||||
|
||||
xinchip_bootloader2_tool.exe boot2 ^
|
||||
stack.bin 0x11003000 1 ^
|
||||
app.bin 0x11013000 0 ^
|
||||
ble_peripheral.bin 1
|
||||
|
||||
copy .\ble_peripheral.bin ..\
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
|
||||
call .\output_tool\ota_bin_ge.bat
|
||||
.\output_tool\xinchip_bootloader2.bat
|
||||
echo Done
|
||||
exit
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
.\output_tool\ge.exe .\app.bin 0x10 0x20 0x15000 0x11015000 .\ota.bin 0x1100f000 1 .\output_bin\ota_data.bin
|
||||
@@ -0,0 +1,7 @@
|
||||
.\output_tool\xinchip_bootloader2_tool.exe .\output_tool\boot2 ^
|
||||
.\output_tool\host 0x11002000 0 ^
|
||||
ota.bin 0x1100F000 0 ^
|
||||
app.bin 0x11015000 1 ^
|
||||
.\output_bin\ble_peripheral.bin 1
|
||||
|
||||
copy .\output_bin\ble_peripheral.bin .\
|
||||
Binary file not shown.
Reference in New Issue
Block a user