当前位置:网站首页>这些年用Keil遇到的坑
这些年用Keil遇到的坑
2022-07-06 06:09:00 【老白436196571】
1、今天调程序,函数中数组inBuf_32始终无法赋值
这是3个数组的定义
abc.c
这样不行
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];
这样也不行:
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];
这样就可以:
uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE]={
0};//初始化为0
//uint32_t EEPROM_FLASH_USER_DATA[FLASH_TOTAL_SIZE];//不初始化
uint32_t EEPROM_FLASH_REGCODE_DATA[FLASH_TOTAL_SIZE]={
0xaa};
static unsigned short p_InBuf_32=0;
static uint32_t inBuf_32[100];
.c文件中,定义的第一个数组,不能初始化?或者要初始化也必须是0?
经验:这类问题往前面的数组或指针上面找原因,前面可能指针越界等。
2、函数中static 变量值不能保存,改为全局变量后没问题,这个是偶尔出现,可能也与初始化有关,待回头再测试下。先mark下
边栏推荐
猜你喜欢
E - 食物链
数学三大核心领域概述:代数
Manhattan distance and Manhattan rectangle - print back font matrix
【API接口工具】postman-界面使用介绍
LeetCode 731. 我的日程安排表 II
SQLMAP使用教程(三)实战技巧二
Hypothesis testing learning notes
Postman核心功能解析-参数化和测试报告
[postman] test script writing and assertion details
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
随机推荐
Application du Groupe Li dans gtsam
win10无法操作(删除、剪切)文件
GTSAM中ISAM2和IncrementalFixedLagSmoother说明
php使用redis实现分布式锁
【C语言】qsort函数
Accélération de la lecture vidéo de l'entreprise
Leaflet map
HCIA review
selenium源码通读·9 |DesiredCapabilities类分析
联合索引的左匹配原则
[C language] string left rotation
在线问题与离线问题
Detailed explanation of BF and KMP
LeetCode 731. 我的日程安排表 II
Company video accelerated playback
Gtest之TEST宏的用法
Introduction to promql of # yyds dry goods inventory # Prometheus
Web界面元素的测试
GTSAM中李群的运用
浅谈专项测试之弱网络测试