当前位置:网站首页>The pit encountered by keil over the years

The pit encountered by keil over the years

2022-07-06 06:18:00 Laobai 436196571

1、 Adjust the program today , Array in function inBuf_32 Always unable to assign
This is a 3 The definition of an array
abc.c
That's not good

uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE]={
    0xFF};
uint32_t EEPROM_FLASH_REGCODE_DATA[FLASH_TOTAL_SIZE]={
    0xaa};

static unsigned short p_InBuf_32=0;
static uint32_t inBuf_32[100];

It doesn't work :

static unsigned short p_InBuf_32=0;
uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE]={
    0xFF};
uint32_t EEPROM_FLASH_REGCODE_DATA[FLASH_TOTAL_SIZE]={
    0xFF};

static uint32_t inBuf_32[100];

In this way, we can :

uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE]={
    0};// Initialize to 0
//uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE];// Not initialized 
uint32_t EEPROM_FLASH_REGCODE_DATA[FLASH_TOTAL_SIZE]={
    0xaa};

static unsigned short p_InBuf_32=0;
static uint32_t inBuf_32[100];

.c In file , The first array defined , Can't initialize ? Or to initialize, it must also be 0?
Experience : Find the reason for this kind of problem from the previous array or pointer , The front pointer may be out of bounds .

2、 Function static Variable values cannot be saved , No problem after changing to global variables , This happens occasionally , It may also be related to initialization , Test it later . First mark Next

原网站

版权声明
本文为[Laobai 436196571]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060609345040.html