This blog post is for your own use only.
1, when the need to put some relevant data, organized into a structure into the NV, why the size of the array to the effective maximum length plus 1.
For example:
typedef struct
{
Kal_uint8 Auth_len;
Kal_uint8 auth_code[iot_lock_authcoe_max_len+1]; Auth_code
}nvram_ef_auth_code_struct;
A: Because you need to assign a value to the variable of this connector, when you assign a value, you often assign a constant string to the array in the struct, and the constant string ends with a ' + '.
static Nvram_ef_auth_code_struct Nvram_ef_iot_authcode_default =
{
6,
{"123456"},
};
2. In the NVRAM_COMMON_CONFIG.C, this section of the note, the basic instructions to add a logical data item step.
/**
* 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, constants:size and total, in nvram_user_defs.h
* 3> Define Default value of this 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 is:
* 1> Size must be even
* 2> size of default value must is equal to the logical data item ' s Size.
*/
/**
* The rule for data item changes:
* 1. To add a new data item, its name must is the next of the LID, for example,
* The last LID in the CT reign are 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, the code to walk the branch is: __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
4, when compiling MT2503, the following link error appears: \build\coretek2503a_3gtracker_11c\coretek2503a_3gtracker_11c_pcb01_gprs_mt6261_
00.elf is not existed! Please check the link error. Please check the file Pl_error_normal.log in the root directory to locate the error message.
5, 2503 of the pin name, re-use please see the Chip Manual 2.1.4 chapters. For example, KROW1 can reuse that gpio, where it can be found to be configured as GPIO20