Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
RT-Thread一般讨论
easyflash bug 造成的程序死机问题。
发布于 2018-01-04 20:59:05 浏览:3647
订阅该版
* 本帖最后由 swet123 于 2018-1-4 21:00 编辑 * STM32F103VET6的板子,使用easyflash V2.12.08版本的时候一保存就卡死了 easyflash 选择STM32F103的Flash的最后20K,使用擦写平衡,掉电保护模式。 直接出问题的地方是擦flash函数给的地址不是擦写的合法地址: (..\..\components\easyflash\port\ef_port.c:104) (addr % EF_ERASE_MIN_SIZE == 0) has assert failed at ef_port_erase. 修改代码: ``` if (area0_is_valid) { /* current using data section address is area0 current using data section address */ set_cur_using_data_addr(area0_cur_using_addr); /* next save ENV area address is area1 current using address value */ next_save_area_addr = area1_cur_using_addr; /* read all ENV from area0 */ ef_port_read(area0_cur_using_addr, env_cache, area0_end_addr - area0_cur_using_addr); } else if (area1_is_valid) {``` 修改为: ``` if (area0_is_valid) { /* current using data section address is area0 current using data section address */ set_cur_using_data_addr(area0_cur_using_addr); /* next save ENV area address is area1 current using address value */ if (area1_is_valid) next_save_area_addr = area1_cur_using_addr; else next_save_area_addr = area1_default_cur_using_addr;```
查看更多
armink
2018-01-09
这家伙很懒,什么也没写!
配置文件的第 97 行与 106 行被你改坏了。这两行都不用改的。 参考下面的默认配置改回来就行了 [https://github.com/armink/EasyFlash/blob/master/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h](https://github.com/armink/EasyFlash/blob/master/demo/env/stm32f4xx/components/easyflash/inc/ef_cfg.h)
5
个回答
默认排序
按发布时间排序
swet123
2018-01-06
ztlchina@foxmail.com
具体出错点再这里: ``` [Flash](..\..\easyflash\src\ef_env_wl.c:148) ENV start address is 0x0807B000, size is 20480 bytes. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807b000, size:4. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807d800, size:4. [Flash](..\..\easyflash\src\ef_env_wl.c:671) area0_cur_using_addr:807d000 area1_cur_using_addr:807d8c4, 1,0. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807d000, size:4. [Flash](..\..\easyflash\src\ef_env_wl.c:690) area0_is_valid:1 area1_is_valid:0. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807d008, size:4. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807d000, size:c8. [Flash](..\..\easyflash\src\ef_env_wl.c:227) set_cur_using_data_addr :807d000. [Flash](..\..\easyflash\src\ef_env_wl.c:881) Calculate ENV CRC32 number is 0x03F1FF3A. [Flash](..\..\easyflash\src\ef_env_wl.c:893) Verify ENV CRC32 result is OK. [Flash](..\..\easyflash\src\ef_env_wl.c:227) set_cur_using_data_addr :807d000. [Flash]next_save_area_addr 1:807E000. and area1_is_valid:0. [Flash](..\..\components\easyflash\port\ef_port.c:80) ef_port_read 807d000, size:c8. [Flash](..\..\easyflash\src\easyflash.c:96) EasyFlash V2.12.08 is initialize success. [Flash](..\..\easyflash\src\easyflash.c:100) You can get the latest version on https://github.com/armink/EasyFlash . ENV init ok... ```
swet123
2018-01-06
ztlchina@foxmail.com
[Flash](..\..\easyflash\src\ef_env_wl.c:671) area0_cur_using_addr:807d000 area1_cur_using_addr:807d8c4, 1,0. 这一句里, area1_cur_using_addr的地址是0x807d8c4
armink
2018-01-06
这家伙很懒,什么也没写!
把你的 ef_cfg.h 贴出来看下吧。
swet123
2018-01-07
ztlchina@foxmail.com
``` /* * This file is part of the EasyFlash Library. * * Copyright (c) 2015, Armink,
* * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * 'Software'), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Function: It is the configure head file for this library. * Created on: 2015-07-14 */ #ifndef EF_CFG_H_ #define EF_CFG_H_ #include
/* using ENV function */ #define EF_USING_ENV /* using wear leveling mode for ENV */ #define EF_ENV_USING_WL_MODE /* using power fail safeguard mode for ENV */ #define EF_ENV_USING_PFS_MODE /* using IAP function */ //#define EF_USING_IAP /* using save log function */ //#define EF_USING_LOG /* page size for stm32 flash */ #if defined(STM32F10X_LD) || defined(STM32F10X_LD_VL) || defined (STM32F10X_MD) || defined (STM32F10X_MD_VL) #define PAGE_SIZE 1024 #else #define PAGE_SIZE 2048 #endif /* the minimum size of flash erasure */ #define EF_ERASE_MIN_SIZE PAGE_SIZE /* it is one page for STM3210x */ /** * * This all Backup Area Flash storage index. All used flash area configure is under here. * |----------------------------| Storage Size * | Environment variables area | ENV area size @see ENV_AREA_SIZE * | 1.system section | ENV_SYSTEM_SIZE * | 2:data section | ENV_AREA_SIZE - ENV_SYSTEM_SIZE * |----------------------------| * | Saved log area | Log area size @see LOG_AREA_SIZE * |----------------------------| * |(IAP)Downloaded application | IAP already downloaded application, unfixed size * |----------------------------| * * @note all area size must be aligned with EF_ERASE_MIN_SIZE * @note EasyFlash will use ram to buffered the ENV.At some time some flash's EF_ERASE_MIN_SIZE is so big, * and you want use ENV size is less than it. So you must defined ENV_USER_SETTING_SIZE for ENV. * @note ENV area size has some limitations in different modes. * 1.Normal mode: no more limitations * 2.Wear leveling mode: system section will used an flash section and the data section will used at least 2 flash sections * 3.Power fail safeguard mode: ENV area will has an backup. It is twice as normal mode. * 4.wear leveling and power fail safeguard mode: The required capacity will be 2 times the total capacity in wear leveling mode. * For example: * The EF_ERASE_MIN_SIZE is 128K and the ENV_USER_SETTING_SIZE: 2K. The ENV_AREA_SIZE in different mode you can define * 1.Normal mode: 1*EF_ERASE_MIN_SIZE * 2.Wear leveling mode: 6*EF_ERASE_MIN_SIZE (It has 2 data section to store ENV. So ENV can erase at least 200,000 times) * 3.Power fail safeguard mode: 2*EF_ERASE_MIN_SIZE * 4.Wear leveling and power fail safeguard mode: 6*EF_ERASE_MIN_SIZE * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE */ /* backup area start address */ #define EF_START_ADDR (FLASH_BASE + 246 * 2 * 1024) /* from the chip position: 100KB */ /* the user setting size of ENV, must be word alignment */ #define ENV_USER_SETTING_SIZE (2 * 1024) #ifndef EF_ENV_USING_PFS_MODE #ifndef EF_ENV_USING_WL_MODE /* ENV area total bytes size in normal mode. */ #define ENV_AREA_SIZE (1 * EF_ERASE_MIN_SIZE) /* 2K */ #else /* ENV area total bytes size in wear leveling mode. */ #define ENV_AREA_SIZE (9 * EF_ERASE_MIN_SIZE) /* 18K */ #endif #else #ifndef EF_ENV_USING_WL_MODE /* ENV area total bytes size in power fail safeguard mode. */ #define ENV_AREA_SIZE (2 * EF_ERASE_MIN_SIZE) /* 4K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ //ztlchina we use this page size. #define ENV_AREA_SIZE (10 * EF_ERASE_MIN_SIZE) /* 12K */ #endif #endif /* saved log area size */ #define LOG_AREA_SIZE (102 * EF_ERASE_MIN_SIZE) /* 204K */ /* print debug information of flash */ #define PRINT_DEBUG #endif /* EF_CFG_H_ */ ```
撰写答案
登录
注册新账号
关注者
0
被浏览
3.6k
关于作者
swet123
ztlchina@foxmail.com
提问
13
回答
57
被采纳
2
关注TA
发私信
相关问题
1
有关动态模块加载的一篇论文
2
最近的调程序总结
3
晕掉了,这么久都不见layer2的踪影啊
4
继续K9ii的历程
5
[GUI相关] FreeType 2
6
[GUI相关]嵌入式系统中文输入法的设计
7
20081101 RT-Thread开发者聚会总结
8
嵌入式系统基础
9
linux2.4.19在at91rm9200 上的寄存器设置
10
[转]基于嵌入式Linux的通用触摸屏校准程序
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
【24嵌入式设计大赛】基于RT-Thread星火一号的智慧家居系统
2
RT-Thread EtherKit开源以太网硬件正式发布
3
如何在master上的BSP中添加配置yml文件
4
使用百度AI助手辅助编写一个rt-thread下的ONVIF设备发现功能的功能代码
5
RT-Thread 发布 EtherKit开源以太网硬件!
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
WIZnet_W5500
UART
ota在线升级
PWM
cubemx
freemodbus
flash
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
Debug
编译报错
msh
SFUD
keil_MDK
rt_mq_消息队列_msg_queue
MicroPython
ulog
C++_cpp
本月问答贡献
踩姑娘的小蘑菇
7
个答案
3
次被采纳
a1012112796
16
个答案
2
次被采纳
张世争
9
个答案
2
次被采纳
rv666
6
个答案
2
次被采纳
用户名由3_15位
13
个答案
1
次被采纳
本月文章贡献
程序员阿伟
9
篇文章
2
次点赞
hhart
3
篇文章
4
次点赞
大龄码农
1
篇文章
5
次点赞
RTT_逍遥
1
篇文章
2
次点赞
ThinkCode
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部