MT2503使用笔记
来源:互联网 发布:怎样经营淘宝网店 编辑:程序博客网 时间:2024/06/08 11:25
此博文仅供自己备忘使用。
1、当需要把某些相关的数据,组织成一个结构体存到NV里的时候,为什么数组的size要在有效的最大长度上加1?
例如:
typedef struct
{
kal_uint8 auth_len;
kal_uint8 auth_code[IOT_LOCK_AUTHCOE_MAX_LEN+1]; //auth_code
}nvram_ef_auth_code_struct;
答:是因为需要给这个接头的变量赋值,赋值的时候,经常是用常量字符串给结构体中的数组赋值的,而常量字符串末尾是有个'\0'的。
static nvram_ef_auth_code_struct NVRAM_EF_IOT_AUTHCODE_DEFAULT =
{
6,
{"123456"},
};
2、在nvram_common_config.c 里的这段注释,基本说明了添加一个logical data item的步骤。
/**
* Steps of defining logical data item:
* 1> Define LID of new logical data item into `nvram_LID_cust_enum' in
* nvram_user_defs.h
* 2> Define two constants: SIZE and TOTAL, in nvram_user_defs.h
* 3> Define default value of that new logical data item in nvram_user_config.c
* 4> Define attributes of that new logical data item into
* `logical_data_item_table_cust'
* 5> Bypass.
* 6> Change version number CODED_DATA_VERSION in nvram_user_config.c
*/
/**
* The logical data item table.
* Note:
* Each logical data item must be:
* 1> Size must be EVEN
* 2> Size of default value must be equal to the logical data item's size.
*/
/**
* The rule for data item changes:
* 1. To add a new data item, its name must be the next of the current last LID, for example,
* the last LID in the CT reign now is CT20, the new one must be CT21.
* 2. Version must be increased if
* (a) Size is changed, or
* (b) Number of sections is changed, or
* (c) Attribute is changed, or
* (d) data structure is changed.
*/
3、代码走的分支是:__MTK_TARGET__
#if defined(NVRAM_AUTO_GEN)
#define sgyouTest 1
#define ltable_entry_structnvram_ltable_entry_struct __attribute__((aligned(4)))__attribute__((__section__("_nvram_ltable")))
#define NVRAM_LIG_GRP_INIT(X)
#elif defined(__MTK_TARGET__)
#define sgyouTest 2
#define ltable_entry_structnvram_ltable_entry_struct __attribute__((section("_nvram_ltable")))
#define NVRAM_LIG_GRP_INIT(X) {\
externnvram_ltable_entry_struct X##[];\
void *X##_p = (void *)&X;\
}
#else
#define sgyouTest 3
#define ltable_entry_struct__pragma(section("_nvram_ltable_content")) \
nvram_ltable_entry_struct __declspec(allocate("_nvram_ltable_content"))
#define NVRAM_LIG_GRP_INIT(X) extern nvram_ltable_entry_struct X##[];\
static void*X##_p = (void *)&X;
#endif
#if defined(NVRAM_AUTO_GEN)
#define sgyouTest 1
#define ltable_entry_structnvram_ltable_entry_struct __attribute__((aligned(4)))__attribute__((__section__("_nvram_ltable")))
#define NVRAM_LIG_GRP_INIT(X)
#elif defined(__MTK_TARGET__)
#define sgyouTest 2
#define ltable_entry_structnvram_ltable_entry_struct __attribute__((section("_nvram_ltable")))
#define NVRAM_LIG_GRP_INIT(X) {\
externnvram_ltable_entry_struct X##[];\
void *X##_p = (void *)&X;\
}
#else
#define sgyouTest 3
#define ltable_entry_struct__pragma(section("_nvram_ltable_content")) \
nvram_ltable_entry_struct __declspec(allocate("_nvram_ltable_content"))
#define NVRAM_LIG_GRP_INIT(X) extern nvram_ltable_entry_struct X##[];\
static void*X##_p = (void *)&X;
#endif
- MT2503使用笔记
- mt2503[AT Command]AT+CKPD 如何使用
- mt2503如何使用UCS2方式发送短信
- mt2503为什么使用test machine时CB language setting不起作用?
- mt2503 如何使用META DLL API写两个以上IMEI
- mt2503 如何使用Feature Phone MDT工具Total format flash
- mt2503如何使用自己设置的SC而非sim卡上的SC发送短信
- MT2503 External Buck问题
- mt2503关于设置信息
- Mediatek MT2502/MT2503编译环境
- mt2503 Phonebook 开机初始化过程
- MT2503资料——FAQ文档
- mt2503[SMS] 手机无法发出短信
- mt2503[ADC] 如何读取external ADC value?
- 华为me909s与MT2503拨号上网流程总结
- mt2503 [ShapeEngine]泰语音标字符发生偏移
- mt2503 关于话机sos number设置
- mt2503 FDN 如何修改成100条
- java基础学习——重载与重写的区别
- 字符流的基本实现以及编码问题之读操作
- Linux修改主机名永久生效
- 简单理解线性规划的单纯形算法
- Redis 持久化(persistence)机制
- MT2503使用笔记
- Java中守护线程的总结
- int long long long 的取值范围
- GMM-HMM理解
- ambari-server setup过程
- 数据库原理 —— 关系数据库的三范式与BCNF
- 二维数组tip-tac-toe游戏
- 组原--动态RAM(DRAM)刷新方式
- OGNL的jar档、文档和源代码