Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
easyflash的使用外部内存老是报错
发布于 2018-12-22 20:09:18 浏览:2123
订阅该版
由于需求在内部flash中存取50*12k的数据量,所以加大了ENV_USER_SETTING_SIZE ,用外部内存进行管理,有时候一次性存取正确,有时候存取出错,代码都出错在stm32f4xxflash.o,看了一天多的代码了,不知道外部内存,如何统一管理,只使用内部那么一点内存达不到要求 #define EF_START_ADDR (FLASH_BASE + 2*1024*1024 - 5*128 * 1024) /* on the chip position: 128KB */ /* the user setting size of ENV, must be word alignment */ #define (5*128*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 (5 * EF_ERASE_MIN_SIZE) /* 128K */ #else /* ENV area total bytes size in wear leveling mode. */ #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 384K */ #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) /* 256K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 768K */ #endif #endif /* saved log area size */ /* #define LOG_AREA_SIZE (2 * EF_ERASE_MIN_SIZE)*/ /* 256K */ /* print debug information of flash */ #define PRINT_DEBUG #endif /* EF_CFG_H_ */ //static uint32_t env_cache[ENV_USER_SETTING_SIZE / 4] = { 0 }; static uint8_t *env_cache1=RT_NULL; static uint32_t *env_cache=RT_NULL; /* ENV start address in flash */ 加入下面的代码 env_cache1=rt_malloc(ENV_USER_SETTING_SIZE); rt_memset(env_cache1,0,ENV_USER_SETTING_SIZE); env_cache=(uint32_t *)env_cache1;
查看更多
2
个回答
默认排序
按发布时间排序
hcb900330
2018-12-22
这家伙很懒,什么也没写!
#ifndef EF_CFG_H_ #define EF_CFG_H_ #include "rtthread.h" #include
/* using ENV function */ #define EF_USING_ENV //#define EF_ENV_USING_WL_MODE /* using wear leveling mode for ENV */ /* #define EF_ENV_USING_WL_MODE */ //#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 */ /* the minimum size of flash erasure */ #define EF_ERASE_MIN_SIZE (128*1024) /* it is 128K for compatibility */ /** * * 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: 3*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 + 2*1024*1024 - 5*128 * 1024) /* on the chip position: 128KB */ /* the user setting size of ENV, must be word alignment */ #define ENV_USER_SETTING_SIZE (5*128*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 (5 * EF_ERASE_MIN_SIZE) /* 128K */ #else /* ENV area total bytes size in wear leveling mode. */ #define ENV_AREA_SIZE (3 * EF_ERASE_MIN_SIZE) /* 384K */ #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) /* 256K */ #else /* ENV area total bytes size in wear leveling and power fail safeguard mode. */ #define ENV_AREA_SIZE (6 * EF_ERASE_MIN_SIZE) /* 768K */ #endif #endif /* saved log area size */ /* #define LOG_AREA_SIZE (2 * EF_ERASE_MIN_SIZE)*/ /* 256K */ /* print debug information of flash */ #define PRINT_DEBUG #endif /* EF_CFG_H_ */
hcb900330
2018-12-24
这家伙很懒,什么也没写!
用cmBacktrace追踪出来这么一个打印 Firmware name: CmBacktrace, hardware version: 2.1, software version: 2.1 Fault on interrupt or bare metal(no OS) environment Error: Main stack(80000067) was overflow ===== Thread stack information ===== ==================================== Bus fault is caused by precise data access violation The bus fault occurred address is 6f732209 Dump call stack has an error psr: 0x00000000 pc: 0x0800b043 lr: 0x0800b03f r12: 0x0800b03b r03: 0x0801c3b5 r02: 0x0800b039 r01: 0x08016c15 r00: 0x20014098 hard fault on thread: tshell thread pri status sp stack size max used left tick error -------- --- ------- ---------- ---------- ------ ---------- --- MQTT_MAN 10 suspend 0x00000074 0x00000400 11% 0x00000014 000 sub 20 suspend 0x00000284 0x0004b000 00% 0x00000014 000 etx 15 suspend 0x00000094 0x00000200 28% 0x00000010 000 erx 15 suspend 0x00000094 0x00000200 60% 0x0000000f 000 tcpip 12 suspend 0x000000d8 0x00000400 53% 0x0000000d 000 phy 30 ready 0x0000008
撰写答案
登录
注册新账号
关注者
0
被浏览
2.1k
关于作者
hcb900330
这家伙很懒,什么也没写!
提问
24
回答
37
被采纳
1
关注TA
发私信
相关问题
推荐文章
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
GD32F450 片内 flash驱动适配
2
STM32H7R7运行CherryUSB
3
RT-Smart首次线下培训,锁定2024 RT-Thread开发者大会!
4
使用RC522软件包驱动FM1722
5
常量数据类型和表达式陷阱分享
热门标签
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
UART
WIZnet_W5500
ota在线升级
freemodbus
PWM
flash
cubemx
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
中断
编译报错
Debug
SFUD
rt_mq_消息队列_msg_queue
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
a1012112796
10
个答案
1
次被采纳
踩姑娘的小蘑菇
4
个答案
1
次被采纳
红枫
4
个答案
1
次被采纳
张世争
4
个答案
1
次被采纳
Ryan_CW
4
个答案
1
次被采纳
本月文章贡献
catcatbing
3
篇文章
5
次点赞
YZRD
2
篇文章
5
次点赞
qq1078249029
2
篇文章
2
次点赞
xnosky
2
篇文章
1
次点赞
Woshizhapuren
1
篇文章
5
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部