From 80b877d8edce03fbc5344ef31b2ed709d5f0dae6 Mon Sep 17 00:00:00 2001 From: armink Date: Sat, 1 Aug 2015 14:39:27 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91F?= =?UTF-8?q?lash=20Log=E5=8A=9F=E8=83=BDDemo=EF=BC=8C=E4=BD=8D=E4=BA=8Edemo?= =?UTF-8?q?\os\rt-thread\stm32f10x=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: armink --- README.md | 16 +- .../rt-thread/stm32f10x/EWARM/EasyLogger.dep | 1491 ++++++++++------- .../rt-thread/stm32f10x/EWARM/EasyLogger.ewp | 45 + .../stm32f10x/EWARM/settings/EasyLogger.dbgdt | 6 +- .../stm32f10x/EWARM/settings/EasyLogger.dni | 6 +- .../stm32f10x/EWARM/settings/EasyLogger.wsdt | 8 +- demo/os/rt-thread/stm32f10x/README.md | 32 +- .../os/rt-thread/stm32f10x/app/src/app_task.c | 34 +- .../stm32f10x/app/src/user_finsh_cmd.c | 29 +- .../components/easyflash/inc/easyflash.h | 147 ++ .../components/easyflash/inc/ef_cfg.h | 115 ++ .../components/easyflash/port/ef_port.c | 235 +++ .../components/easyflash/src/easyflash.c | 103 ++ .../components/easyflash/src/ef_env.c | 759 +++++++++ .../components/easyflash/src/ef_env_wl.c | 926 ++++++++++ .../components/easyflash/src/ef_iap.c | 265 +++ .../components/easyflash/src/ef_log.c | 439 +++++ .../components/easyflash/src/ef_utils.c | 160 ++ .../easylogger/plugins/flash/elog_flash_cfg.h | 37 + .../plugins/flash/elog_flash_port.c | 71 + .../components/easylogger/port/elog_port.c | 6 +- easylogger/plugins/flash/elog_flash.h | 2 +- 22 files changed, 4268 insertions(+), 664 deletions(-) create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/inc/ef_cfg.h create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/port/ef_port.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env_wl.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_iap.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c create mode 100644 demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_cfg.h create mode 100644 demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_port.c diff --git a/README.md b/README.md index 209f006..09c7111 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # 1. 介绍 -EasyLogger是一款超轻量级(ROM<1.6K, RAM<0.3K)、高性能的C日志库,非常适合对资源敏感的软件项目,例如:IoT产品、可穿戴设备、智能家居等等。相比log4c、zlog这些知名的C日志库,EasyLogger的功能更加简单,提供给用户的接口更少,但上手会很快,更多实用功能支持以插件形式进行动态扩展。 +[EasyLogger](https://github.com/armink/EasyLogger)是一款超轻量级(ROM<1.6K, RAM<0.3K)、高性能的C日志库,非常适合对资源敏感的软件项目,例如:IoT产品、可穿戴设备、智能家居等等。相比log4c、zlog这些知名的C日志库,EasyLogger的功能更加简单,提供给用户的接口更少,但上手会很快,更多实用功能支持以插件形式进行动态扩展。 ## 1.1 主要特性 @@ -71,7 +71,7 @@ EasyLogger拥有过滤方式、输出格式、输出开关这些属性。 ### 2.4 输出格式 -输出格式支持:级别、时间、标签、进程信息、线程信息、文件路径、行号、方法名 +输出格式支持:级别、时间、标签、进程信息、线程信息、文件路径、行号、方法名。每种优先级别可以独立设置输出格式。 > 注:默认为 **RAW格式**,RAW格式日志不支持标签过滤 @@ -88,14 +88,20 @@ EasyLogger拥有过滤方式、输出格式、输出开关这些属性。 下图为在终端中输入命令来控制日志的输出及过滤器的设置,更加直观的展示了EasyLogger核心功能。 -![easylogger](http://git.oschina.net/Armink/EasyLogger/raw/master/docs/zh/images/EasyLoggerDemo.gif) +- Demo路径:`demo` +- API文档:`docs\zh\api.md` +- 移植文档:即将发布…… -> 注:以上内容对应的API,可以打开[思维导图](http://naotu.baidu.com/viewshare.html?shareId=ausqm3j44f4k)看到更清晰的逻辑。 +![easylogger](http://git.oschina.net/Armink/EasyLogger/raw/master/docs/zh/images/EasyLoggerDemo.gif) -### 2.6.2 Flash Log +### 2.6.2 Flash Log(将日志保存到Flash中) 下图过程为通过控制台输出日志,并将输出的日志存储到Flash中。重启再读取上次保存的日志,最后清空Flash日志。 +- Demo路径:`demo\os\rt-thread\stm32f10x` +- API文档:`docs\zh\api.md` +- 移植文档:即将发布…… + ![FlashLog](http://git.oschina.net/Armink/EasyLogger/raw/master/docs/zh/images/LogDemo.gif) # 3. 后期 diff --git a/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.dep b/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.dep index 5dbc063..9293031 100644 --- a/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.dep +++ b/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.dep @@ -2,468 +2,523 @@ 2 - 256146963 + 2163240764 stm32f103xE - $PROJ_DIR$\..\app\inc\rtconfig.h - $PROJ_DIR$\..\app\src\app_task.c - $PROJ_DIR$\..\app\src\user_finsh_cmd.c - $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog.c - $PROJ_DIR$\..\app\src\app.c - $PROJ_DIR$\..\components\others\bsp.c - $PROJ_DIR$\..\components\easylogger\port\elog_port.c - $PROJ_DIR$\..\app\src\stm32f10x_it.c - $PROJ_DIR$\..\components\rtt_uart\usart.c - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_hd.s - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c - $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog_utils.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c - $PROJ_DIR$\..\components\others\utils.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_compiler.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\scheduler.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\completion.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\ringbuffer.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\portal.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\dataqueue.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\serial\serial.c - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\cmd.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\cpuusage.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\ipc.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\kservice.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\symbol.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_vm.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\device.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\mem.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\irq.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_error.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\mempool.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.h - $PROJ_DIR$\..\RT-Thread-1.2.2\src\object.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\slab.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\idle.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\memheap.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh_cmd.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_init.c - $PROJ_DIR$\..\RT-Thread-1.2.2\src\clock.c - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\shell.c - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_i2c.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_tim.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_flash.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_pwr.o - $PROJ_DIR$\stm32f103xE\Obj\shell.o - $PROJ_DIR$\stm32f103xE\Obj\user_finsh_cmd.o - $PROJ_DIR$\stm32f103xE\Obj\completion.o - $PROJ_DIR$\stm32f103xE\Obj\msh_cmd.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_cec.pbi - $PROJ_DIR$\stm32f103xE\Obj\EasyLogger.pbd - $PROJ_DIR$\stm32f103xE\Obj\irq.o - $PROJ_DIR$\stm32f103xE\Obj\usart.o - $PROJ_DIR$\stm32f103xE\Obj\context_iar.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_can.pbi - $TOOLKIT_DIR$\inc\c\stdlib.h - $PROJ_DIR$\stm32f103xE\Obj\object.o - $PROJ_DIR$\stm32f103xE\Obj\bsp.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rtc.o - $PROJ_DIR$\stm32f103xE\Obj\ringbuffer.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_sdio.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_can.o - $PROJ_DIR$\stm32f103xE\Obj\wrokqueue.o - $PROJ_DIR$\stm32f103xE\Obj\portal.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_heap.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_init.o - $TOOLKIT_DIR$\inc\c\stdio.h - $PROJ_DIR$\stm32f103xE\Obj\finsh_parser.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_it.o - $PROJ_DIR$\stm32f103xE\Obj\user_finsh_cmd.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_compiler.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_exti.pbi - $PROJ_DIR$\stm32f103xE\Obj\ipc.o - $PROJ_DIR$\stm32f103xE\Obj\thread.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_wwdg.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dbgmcu.o - $PROJ_DIR$\stm32f103xE\Obj\cmd.o - $PROJ_DIR$\..\RT-Thread-1.2.2\src\thread.c - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_spi.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_error.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_bkp.o - $PROJ_DIR$\stm32f103xE\Obj\dataqueue.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_usart.o - $PROJ_DIR$\stm32f103xE\Obj\slab.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_iwdg.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_error.pbi $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dac.o $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_gpio.o - $PROJ_DIR$\stm32f103xE\Obj\pipe.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_fsmc.o - $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c - $PROJ_DIR$\stm32f103xE\Obj\serial.o - $PROJ_DIR$\..\RT-Thread-1.2.2\src\timer.c - $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\context_iar.S - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dma.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_adc.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rcc.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_crc.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_cec.o - $PROJ_DIR$\stm32f103xE\Obj\elog.o $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_exti.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_node.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_i2c.pbi - $PROJ_DIR$\stm32f103xE\Obj\timer.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_vm.pbi - $PROJ_DIR$\stm32f103xE\Obj\memheap.pbi - $PROJ_DIR$\stm32f103xE\Obj\msh.pbi - $TOOLKIT_DIR$\inc\c\xtls.h - $PROJ_DIR$\stm32f103xE\Obj\finsh_error.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_it.pbi $PROJ_DIR$\stm32f103xE\Obj\utils.pbi + $PROJ_DIR$\stm32f103xE\Obj\slab.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_iwdg.o $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_gpio.pbi $PROJ_DIR$\stm32f103xE\Obj\msh_cmd.pbi + $TOOLKIT_DIR$\inc\c\xtls.h + $PROJ_DIR$\stm32f103xE\Obj\msh.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_bkp.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_it.pbi $PROJ_DIR$\stm32f103xE\Obj\device.pbi $PROJ_DIR$\stm32f103xE\Obj\portal.pbi - $PROJ_DIR$\stm32f103xE\Obj\ringbuffer.pbi - $PROJ_DIR$\stm32f103xE\Obj\clock.pbi - $PROJ_DIR$\stm32f103xE\Obj\usart.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_parser.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_adc.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_i2c.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_fsmc.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dma.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_error.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_usart.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_crc.o + $PROJ_DIR$\stm32f103xE\Obj\serial.o + $PROJ_DIR$\stm32f103xE\Obj\memheap.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rcc.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_node.pbi + $PROJ_DIR$\stm32f103xE\Obj\timer.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_adc.o + $PROJ_DIR$\stm32f103xE\Obj\elog.o + $PROJ_DIR$\stm32f103xE\Obj\pipe.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_vm.pbi + $PROJ_DIR$\stm32f103xE\Obj\dataqueue.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_cec.o $PROJ_DIR$\stm32f103xE\Obj\completion.pbi - $PROJ_DIR$\stm32f103xE\Exe\EasyFlash.bin - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_sdio.pbi - $PROJ_DIR$\stm32f103xE\Obj\shell.pbi - $PROJ_DIR$\stm32f103xE\Obj\cpuport.pbi - $PROJ_DIR$\stm32f103xE\Obj\module.pbi - $PROJ_DIR$\stm32f103xE\Obj\slab.pbi - $PROJ_DIR$\stm32f103xE\Obj\mempool.pbi - $PROJ_DIR$\stm32f103xE\Obj\scheduler.pbi - $PROJ_DIR$\stm32f103xE\Obj\startup_stm32f10x_hd.o - $PROJ_DIR$\stm32f103xE\Obj\idle.pbi - $PROJ_DIR$\stm32f103xE\Obj\scheduler.o - $PROJ_DIR$\stm32f103xE\Obj\misc.pbi - $TOOLKIT_DIR$\inc\c\DLib_Threads.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_flash.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_exti.h $PROJ_DIR$\stm32f103xE\Obj\kservice.o + $PROJ_DIR$\stm32f103xE\Obj\misc.pbi + $PROJ_DIR$\stm32f103xE\Obj\module.pbi $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtservice.h + $PROJ_DIR$\stm32f103xE\Obj\shell.pbi $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_bkp.pbi $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtdef.h - $PROJ_DIR$\stm32f103xE\Obj\cpuusage.pbi $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtthread.h - $TOOLKIT_DIR$\inc\c\xencoding_limits.h - $PROJ_DIR$\..\components\rtt_uart\usart.h - $TOOLKIT_DIR$\inc\c\yvals.h - $PROJ_DIR$\stm32f103xE\Obj\finsh_compiler.pbi - $PROJ_DIR$\stm32f103xE\Obj\ipc.pbi - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_fsmc.h - $PROJ_DIR$\..\app\inc\app_task.h - $PROJ_DIR$\stm32f103xE\Obj\app.pbi - $TOOLKIT_DIR$\inc\c\string.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_usart.h - $TOOLKIT_DIR$\inc\c\stdbool.h - $PROJ_DIR$\stm32f103xE\Obj\dataqueue.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dac.pbi - $TOOLKIT_DIR$\inc\c\cmsis_iar.h - $TOOLKIT_DIR$\inc\c\ycheck.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\include\drivers\serial.h + $PROJ_DIR$\stm32f103xE\Obj\startup_stm32f10x_hd.o + $PROJ_DIR$\stm32f103xE\Obj\idle.pbi + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_flash.h + $PROJ_DIR$\stm32f103xE\Obj\cpuusage.pbi + $PROJ_DIR$\stm32f103xE\Obj\finsh_parser.pbi + $PROJ_DIR$\stm32f103xE\Obj\cpuport.pbi + $PROJ_DIR$\stm32f103xE\Exe\EasyFlash.bin + $PROJ_DIR$\stm32f103xE\Obj\mempool.pbi + $PROJ_DIR$\stm32f103xE\Obj\usart.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_adc.pbi + $PROJ_DIR$\stm32f103xE\Obj\scheduler.o + $PROJ_DIR$\stm32f103xE\Obj\clock.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_sdio.pbi + $PROJ_DIR$\stm32f103xE\Obj\scheduler.pbi + $PROJ_DIR$\stm32f103xE\Obj\slab.pbi + $TOOLKIT_DIR$\inc\c\DLib_Threads.h + $PROJ_DIR$\stm32f103xE\Obj\ringbuffer.pbi $PROJ_DIR$\stm32f103xE\Obj\finsh_token.pbi - $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtdebug.h + $PROJ_DIR$\..\components\rtt_uart\usart.h $PROJ_DIR$\..\app\inc\stm32f10x_conf.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_adc.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_wwdg.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_tim.h + $PROJ_DIR$\stm32f103xE\Obj\ipc.pbi $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include\core_cm3.h - $TOOLKIT_DIR$\inc\c\DLib_Product.h $TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\misc.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_iwdg.h - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include\core_cmInstr.h $TOOLKIT_DIR$\inc\c\xlocale_c.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_fsmc.h + $TOOLKIT_DIR$\inc\c\xencoding_limits.h + $PROJ_DIR$\stm32f103xE\Obj\dataqueue.pbi + $PROJ_DIR$\..\app\inc\app_task.h + $TOOLKIT_DIR$\inc\c\cmsis_iar.h $PROJ_DIR$\stm32f103xE\Obj\finsh_ops.o + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_adc.h $PROJ_DIR$\stm32f103xE\Obj\cmd.pbi + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\include\drivers\serial.h + $TOOLKIT_DIR$\inc\c\stdbool.h + $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtdebug.h $PROJ_DIR$\..\components\others\bsp.h - $PROJ_DIR$\..\..\..\..\..\easylogger\inc\elog.h + $PROJ_DIR$\stm32f103xE\Obj\finsh_compiler.pbi + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_usart.h + $TOOLKIT_DIR$\inc\c\ycheck.h + $TOOLKIT_DIR$\inc\c\DLib_Product.h + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include\core_cmInstr.h + $TOOLKIT_DIR$\inc\c\yvals.h + $PROJ_DIR$\stm32f103xE\Obj\app.pbi + $TOOLKIT_DIR$\inc\c\string.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_wwdg.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\misc.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dac.pbi + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_i2c.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_spi.h + $TOOLKIT_DIR$\inc\c\DLib_Defaults.h $TOOLKIT_DIR$\inc\c\intrinsics.h - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rcc.pbi + $PROJ_DIR$\stm32f103xE\Obj\finsh_var.pbi $PROJ_DIR$\..\RT-Thread-1.2.2\include\rtm.h + $TOOLKIT_DIR$\inc\c\DLib_Product_string.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_rcc.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_can.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_gpio.h + $PROJ_DIR$\..\..\..\..\..\easylogger\inc\elog.h $TOOLKIT_DIR$\inc\c\stdarg.h - $TOOLKIT_DIR$\inc\c\DLib_Product_string.h $PROJ_DIR$\..\RT-Thread-1.2.2\include\rthw.h - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_spi.pbi - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.h - $TOOLKIT_DIR$\inc\c\xmtx.h - $PROJ_DIR$\stm32f103xE\Obj\finsh_var.pbi - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_rcc.h $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\include\rtdevice.h - $TOOLKIT_DIR$\inc\c\DLib_Defaults.h - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_flash.pbi - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_rtc.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rcc.pbi $TOOLKIT_DIR$\inc\c\wchar.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_i2c.h $PROJ_DIR$\stm32f103xE\Obj\pipe.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_spi.pbi + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_rtc.h + $TOOLKIT_DIR$\inc\c\xmtx.h + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_gpio.h + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\stm32f10x.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dac.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_spi.h $TOOLKIT_DIR$\lib\dl7M_tln.a $PROJ_DIR$\stm32f103xE\Obj\system_stm32f10x.pbi $TOOLKIT_DIR$\inc\c\ysizet.h - $TOOLKIT_DIR$\inc\c\stdint.h - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include\core_cmFunc.h - $TOOLKIT_DIR$\lib\rt7M_tl.a + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_flash.pbi + $TOOLKIT_DIR$\lib\m7M_tl.a + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_sdio.h + $TOOLKIT_DIR$\inc\c\xlocaleuse.h + $PROJ_DIR$\stm32f103xE\Obj\idle.o $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.h - $TOOLKIT_DIR$\inc\c\xlocale.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dma.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dma.pbi + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.h + $TOOLKIT_DIR$\lib\shb_l.a + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_cec.h $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_vm.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_bkp.h + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include\core_cmFunc.h $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_error.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_bkp.h $PROJ_DIR$\..\components\others\stm32f103xE.icf $PROJ_DIR$\..\app\inc\stm32f10x_it.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_pwr.h - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dbgmcu.h - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.h - $TOOLKIT_DIR$\lib\m7M_tl.a - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_cec.h - $TOOLKIT_DIR$\lib\shb_l.a $PROJ_DIR$\stm32f103xE\List\EasyLogger.map - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_sdio.h $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_crc.h - $TOOLKIT_DIR$\inc\c\xlocaleuse.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dbgmcu.h + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.h + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_dma.h $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_fsmc.pbi - $PROJ_DIR$\stm32f103xE\Obj\misc.o - $PROJ_DIR$\stm32f103xE\Obj\idle.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dma.pbi + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc\stm32f10x_pwr.h $PROJ_DIR$\stm32f103xE\Obj\mempool.o $PROJ_DIR$\stm32f103xE\Obj\finsh_token.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dbgmcu.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_node.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_var.o - $PROJ_DIR$\stm32f103xE\Obj\elog_port.pbi - $PROJ_DIR$\stm32f103xE\Obj\timer.o - $PROJ_DIR$\stm32f103xE\Obj\mem.o - $PROJ_DIR$\stm32f103xE\Obj\cpuport.o - $PROJ_DIR$\stm32f103xE\Obj\symbol.o - $PROJ_DIR$\stm32f103xE\Obj\module.o - $TOOLKIT_DIR$\inc\c\stddef.h - $TOOLKIT_DIR$\inc\c\ystdio.h - $PROJ_DIR$\stm32f103xE\Obj\elog.pbi - $PROJ_DIR$\..\app\inc\delay_conf.h - $PROJ_DIR$\stm32f103xE\Obj\elog_utils.pbi - $PROJ_DIR$\stm32f103xE\Obj\cpuusage.o - $PROJ_DIR$\stm32f103xE\Obj\finsh_vm.o - $PROJ_DIR$\..\RT-Thread-1.2.2\include\cpuusage.h + $TOOLKIT_DIR$\lib\rt7M_tl.a + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.h + $PROJ_DIR$\stm32f103xE\Obj\misc.o + $TOOLKIT_DIR$\inc\c\stdint.h + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.h + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.h + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.h + $TOOLKIT_DIR$\inc\c\xlocale.h $PROJ_DIR$\stm32f103xE\Obj\memheap.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dbgmcu.pbi $PROJ_DIR$\stm32f103xE\Obj\elog_utils.o $PROJ_DIR$\stm32f103xE\Obj\system_stm32f10x.o + $PROJ_DIR$\stm32f103xE\Obj\timer.o + $TOOLKIT_DIR$\inc\c\ystdio.h $PROJ_DIR$\stm32f103xE\Obj\device.o $PROJ_DIR$\stm32f103xE\Obj\thread.pbi $PROJ_DIR$\stm32f103xE\Obj\msh.o $PROJ_DIR$\stm32f103xE\Obj\app_task.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_var.o + $PROJ_DIR$\..\RT-Thread-1.2.2\include\cpuusage.h + $PROJ_DIR$\stm32f103xE\Obj\elog_utils.pbi $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh.h $PROJ_DIR$\stm32f103xE\Obj\wrokqueue.pbi $PROJ_DIR$\stm32f103xE\Obj\app_task.pbi + $PROJ_DIR$\stm32f103xE\Obj\mem.o + $PROJ_DIR$\stm32f103xE\Obj\module.o + $PROJ_DIR$\stm32f103xE\Obj\elog_port.pbi + $PROJ_DIR$\stm32f103xE\Obj\elog.pbi + $PROJ_DIR$\stm32f103xE\Obj\cpuusage.o + $PROJ_DIR$\stm32f103xE\Obj\cpuport.o + $TOOLKIT_DIR$\inc\c\stddef.h + $PROJ_DIR$\stm32f103xE\Obj\finsh_vm.o + $PROJ_DIR$\..\app\inc\delay_conf.h + $PROJ_DIR$\stm32f103xE\Obj\finsh_node.o + $PROJ_DIR$\stm32f103xE\Obj\symbol.o + $PROJ_DIR$\stm32f103xE\Obj\serial.pbi $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_tim.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_ops.pbi - $TOOLKIT_DIR$\inc\c\ctype.h - $PROJ_DIR$\stm32f103xE\Obj\finsh_init.pbi - $PROJ_DIR$\stm32f103xE\Obj\mem.pbi - $PROJ_DIR$\..\components\others\utils.h - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rtc.pbi - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_wwdg.pbi - $PROJ_DIR$\stm32f103xE\Obj\utils.o $PROJ_DIR$\stm32f103xE\Obj\app.o + $PROJ_DIR$\stm32f103xE\Obj\irq.pbi + $PROJ_DIR$\stm32f103xE\Obj\object.pbi + $PROJ_DIR$\stm32f103xE\Obj\kservice.pbi $PROJ_DIR$\stm32f103xE\Obj\clock.o - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_crc.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_iwdg.pbi + $PROJ_DIR$\stm32f103xE\Obj\bsp.o + $TOOLKIT_DIR$\inc\c\ctype.h $PROJ_DIR$\stm32f103xE\Obj\elog_port.o $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\shell.h - $PROJ_DIR$\stm32f103xE\Obj\object.pbi + $PROJ_DIR$\stm32f103xE\Exe\EasyLogger.out + $PROJ_DIR$\stm32f103xE\Obj\finsh_init.pbi + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rtc.pbi + $PROJ_DIR$\..\components\others\utils.h $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_usart.pbi - $PROJ_DIR$\stm32f103xE\Obj\kservice.pbi - $PROJ_DIR$\stm32f103xE\Obj\finsh_heap.pbi - $PROJ_DIR$\stm32f103xE\Obj\irq.pbi - $PROJ_DIR$\stm32f103xE\Obj\serial.pbi $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_pwr.pbi - $PROJ_DIR$\stm32f103xE\Exe\EasyLogger.out - $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_iwdg.pbi + $PROJ_DIR$\stm32f103xE\Obj\mem.pbi $PROJ_DIR$\stm32f103xE\Obj\symbol.pbi - $PROJ_DIR$\stm32f103xE\Obj\bsp.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_crc.pbi $PROJ_DIR$\..\components\easylogger\inc\elog_cfg.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_wwdg.pbi + $PROJ_DIR$\stm32f103xE\Obj\utils.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_ops.pbi + $PROJ_DIR$\stm32f103xE\Obj\finsh_heap.pbi + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_vm.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c + $PROJ_DIR$\..\app\src\app.c + $PROJ_DIR$\..\components\others\bsp.c + $PROJ_DIR$\..\app\src\stm32f10x_it.c + $PROJ_DIR$\..\app\inc\rtconfig.h + $PROJ_DIR$\..\components\rtt_uart\usart.c + $PROJ_DIR$\..\app\src\user_finsh_cmd.c + $PROJ_DIR$\..\app\src\app_task.c + $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog.c + $PROJ_DIR$\..\components\others\utils.c + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_hd.s + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c + $PROJ_DIR$\..\components\easylogger\port\elog_port.c + $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog_utils.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_compiler.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\serial\serial.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\completion.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\ringbuffer.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\dataqueue.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\cmd.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_error.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_init.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\portal.c + $PROJ_DIR$\stm32f103xE\Obj\finsh_init.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_cec.pbi + $PROJ_DIR$\stm32f103xE\Obj\wrokqueue.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_it.o + $PROJ_DIR$\stm32f103xE\Obj\cmd.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_wwdg.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_dbgmcu.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_spi.o + $PROJ_DIR$\stm32f103xE\Obj\msh_cmd.o + $PROJ_DIR$\stm32f103xE\Obj\ringbuffer.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_can.o + $PROJ_DIR$\stm32f103xE\Obj\usart.o + $PROJ_DIR$\stm32f103xE\Obj\context_iar.o + $TOOLKIT_DIR$\inc\c\stdlib.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_sdio.o + $PROJ_DIR$\stm32f103xE\Obj\portal.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_rtc.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_can.pbi + $PROJ_DIR$\stm32f103xE\Obj\finsh_heap.o + $PROJ_DIR$\stm32f103xE\Obj\user_finsh_cmd.o + $PROJ_DIR$\stm32f103xE\Obj\finsh_parser.o + $PROJ_DIR$\stm32f103xE\Obj\object.o + $PROJ_DIR$\stm32f103xE\Obj\bsp.pbi + $PROJ_DIR$\stm32f103xE\Obj\user_finsh_cmd.pbi + $PROJ_DIR$\stm32f103xE\Obj\finsh_compiler.o + $TOOLKIT_DIR$\inc\c\stdio.h + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_exti.pbi + $PROJ_DIR$\stm32f103xE\Obj\ipc.o + $PROJ_DIR$\stm32f103xE\Obj\thread.o + $PROJ_DIR$\stm32f103xE\Obj\completion.o + $PROJ_DIR$\stm32f103xE\Obj\EasyLogger.pbd + $PROJ_DIR$\stm32f103xE\Obj\irq.o + $PROJ_DIR$\..\RT-Thread-1.2.2\src\memheap.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\idle.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\object.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\mem.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\thread.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\mempool.c + $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\context_iar.S + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_i2c.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_tim.o + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh_cmd.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\timer.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\shell.c + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_flash.o + $PROJ_DIR$\stm32f103xE\Obj\shell.o + $PROJ_DIR$\stm32f103xE\Obj\stm32f10x_pwr.o + $PROJ_DIR$\..\RT-Thread-1.2.2\src\cpuusage.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\symbol.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.h + $PROJ_DIR$\..\RT-Thread-1.2.2\src\slab.c + $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\ipc.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\clock.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\device.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\scheduler.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\irq.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\kservice.c + $PROJ_DIR$\stm32f103xE\Obj\elog_flash.o + $PROJ_DIR$\stm32f103xE\Obj\ef_utils.pbi + $PROJ_DIR$\stm32f103xE\Obj\elog_flash.pbi + $PROJ_DIR$\..\components\easyflash\inc\easyflash.h + $PROJ_DIR$\..\components\easyflash\inc\ef_cfg.h + $PROJ_DIR$\stm32f103xE\Obj\ef_env_wl.o + $PROJ_DIR$\stm32f103xE\Obj\ef_utils.o + $PROJ_DIR$\stm32f103xE\Obj\ef_iap.o + $PROJ_DIR$\stm32f103xE\Obj\easyflash.o + $PROJ_DIR$\stm32f103xE\Obj\ef_env.o + $PROJ_DIR$\stm32f103xE\Obj\ef_log.o + $PROJ_DIR$\stm32f103xE\Obj\easyflash.pbi + $PROJ_DIR$\stm32f103xE\Obj\ef_env.pbi + $PROJ_DIR$\stm32f103xE\Obj\ef_port.pbi + $PROJ_DIR$\stm32f103xE\Obj\ef_port.o + $PROJ_DIR$\stm32f103xE\Obj\elog_flash_port.o + $PROJ_DIR$\stm32f103xE\Obj\elog_flash_port.pbi + $PROJ_DIR$\..\components\easylogger\plugins\flash\elog_flash_port.c + $PROJ_DIR$\..\components\easyflash\src\ef_log.c + $PROJ_DIR$\..\components\easyflash\src\ef_utils.c + $PROJ_DIR$\..\components\easyflash\src\easyflash.c + $PROJ_DIR$\..\components\easyflash\src\ef_iap.c + $PROJ_DIR$\..\..\..\..\..\easylogger\plugins\flash\elog_flash.c + $PROJ_DIR$\..\components\easyflash\port\ef_port.c + $PROJ_DIR$\..\components\easyflash\src\ef_env.c + $PROJ_DIR$\..\components\easyflash\src\ef_env_wl.c + $PROJ_DIR$\..\components\easylogger\plugins\flash\elog_flash_cfg.h + $PROJ_DIR$\stm32f103xE\Obj\ef_env_wl.pbi + $PROJ_DIR$\stm32f103xE\Obj\ef_log.pbi + $PROJ_DIR$\..\..\..\..\..\easylogger\plugins\flash\elog_flash.h + $PROJ_DIR$\stm32f103xE\Obj\ef_iap.pbi + $PROJ_DIR$\..\..\..\..\..\easylogger\plugins\flash\elog_flash_cfg.h + + $PROJ_DIR$\stm32f103xE\Exe\EasyLogger.out + + + ILINK + 133 + + + OBJCOPY + 48 + + + + + ILINK + 131 179 159 185 183 262 287 270 171 170 30 156 325 326 322 324 327 331 323 27 317 332 187 152 282 18 276 258 175 73 278 141 160 173 121 285 289 34 166 150 140 144 167 158 266 279 28 273 267 52 21 304 5 42 26 11 268 31 20 1 264 17 3 303 16 2 298 261 6 305 23 274 272 265 299 19 263 176 153 286 154 269 277 200 260 125 142 118 114 + + + [ROOT_NODE] ILINK - 312 254 + 189 133 - $PROJ_DIR$\..\app\src\app_task.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.c ICCARM - 287 + 175 BICOMP - 290 + 24 ICCARM - 179 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 191 192 221 195 232 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 87 231 98 274 204 174 205 316 273 183 288 293 237 138 216 257 201 224 181 212 304 280 276 296 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 129 143 148 + + + BICOMP + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 129 143 148 - $PROJ_DIR$\..\app\src\user_finsh_cmd.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.c ICCARM - 78 + 278 BICOMP - 101 + 46 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 191 192 221 195 232 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 288 293 237 138 216 87 231 257 201 224 181 212 280 205 316 273 183 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 146 124 129 136 143 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 191 192 221 195 232 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 288 293 237 138 216 87 231 257 201 224 181 212 280 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 146 124 129 136 143 - $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_vm.c ICCARM - 130 + 173 BICOMP - 275 + 29 ICCARM - 205 316 232 187 175 220 197 196 173 164 273 231 183 181 212 211 98 274 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 127 143 147 BICOMP - 205 316 232 187 175 220 197 196 173 164 273 231 183 181 212 211 98 274 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 127 143 147 - $PROJ_DIR$\..\app\src\app.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c ICCARM - 300 + 3 BICOMP - 180 + 284 ICCARM - 179 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 191 192 221 195 232 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 + 33 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 44 68 111 66 98 62 81 88 89 BICOMP - 179 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 191 192 221 195 232 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 + 33 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\components\others\bsp.c + $PROJ_DIR$\..\app\src\app.c ICCARM - 315 + 179 BICOMP - 89 + 86 ICCARM - 204 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 213 172 0 190 170 211 168 208 174 + 71 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 204 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 213 172 0 190 170 211 168 208 174 + 71 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\components\easylogger\port\elog_port.c + $PROJ_DIR$\..\components\others\bsp.c ICCARM - 303 + 185 BICOMP - 267 + 280 ICCARM - 205 316 232 187 175 220 197 196 173 164 273 231 183 213 172 0 190 170 211 168 208 + 79 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 102 41 210 78 40 101 37 96 60 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 79 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 102 41 210 78 40 101 37 96 60 @@ -472,21 +527,21 @@ ICCARM - 100 + 261 BICOMP - 140 + 12 ICCARM - 246 204 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 213 172 0 190 170 211 168 208 174 + 132 79 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 102 41 210 78 40 101 37 96 60 BICOMP - 246 204 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 213 172 0 190 170 211 168 208 174 + 132 79 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 102 41 210 78 40 101 37 96 60 @@ -495,21 +550,113 @@ ICCARM - 84 + 269 + + + BICOMP + 50 + + + + + ICCARM + 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 60 102 41 210 78 40 101 37 96 79 103 76 + + + BICOMP + 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 60 102 41 210 78 40 101 37 96 79 103 76 + + + + + $PROJ_DIR$\..\app\src\user_finsh_cmd.c + + + ICCARM + 277 + + + BICOMP + 281 + + + + + ICCARM + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 163 186 149 9 109 271 116 120 67 105 87 97 161 346 100 198 172 77 343 + + + BICOMP + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 163 186 149 9 109 271 116 120 67 105 87 97 161 346 100 198 172 77 343 + + + + + $PROJ_DIR$\..\app\src\app_task.c + + + ICCARM + 159 + + + BICOMP + 165 + + + + + ICCARM + 71 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 271 116 283 155 79 60 346 100 198 172 77 343 320 321 163 186 149 9 109 120 67 105 87 97 188 161 174 192 + + + BICOMP + 71 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 61 74 112 64 145 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 271 116 283 155 79 60 346 100 198 172 77 343 320 321 163 186 149 9 109 120 67 105 87 97 188 161 174 192 + + + + + $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog.c + + + ICCARM + 27 + + + BICOMP + 169 + + + + + ICCARM + 100 198 145 82 85 93 65 83 69 57 172 116 77 87 97 101 283 155 + + + BICOMP + 100 198 145 82 85 93 65 83 69 57 172 116 77 87 97 101 283 155 + + + + + $PROJ_DIR$\..\components\others\utils.c + + + ICCARM + 200 BICOMP - 148 + 4 ICCARM - 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 174 213 172 0 190 170 211 168 208 204 219 188 + 192 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 41 210 78 40 101 37 96 BICOMP - 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 174 213 172 0 190 170 211 168 208 204 219 188 + 192 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 41 210 78 40 101 37 96 @@ -518,559 +665,628 @@ AARM - 160 + 42 + + + + + $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c + + + ICCARM + 153 + + + BICOMP + 115 + + + + + ICCARM + 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + + BICOMP + 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + + + + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c + + + ICCARM + 264 + + + BICOMP + 151 + + + + + ICCARM + 135 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + + BICOMP + 135 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + + + + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c + + + ICCARM + 1 + + + BICOMP + 90 + + + ICCARM + 113 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + + BICOMP + 113 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 + + - $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c ICCARM - 283 + 26 BICOMP - 230 + 51 ICCARM - 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog_utils.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c ICCARM - 282 + 11 BICOMP - 277 + 39 ICCARM - 205 316 232 187 175 220 197 196 173 164 273 231 183 + 130 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 205 316 232 187 175 220 197 196 173 164 273 231 183 + 130 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c ICCARM - 259 + 303 BICOMP - 163 + 117 ICCARM - 198 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 + 44 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 68 111 66 98 62 81 88 89 BICOMP - 198 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 + 44 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\components\others\utils.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c ICCARM - 299 + 268 BICOMP - 141 + 275 ICCARM - 296 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 172 0 190 170 211 168 208 + 99 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 33 44 68 111 66 98 62 81 88 89 BICOMP - 296 191 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 209 166 165 178 210 199 218 194 182 193 198 172 0 190 170 211 168 208 + 99 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c ICCARM - 126 + 16 BICOMP - 150 + 138 ICCARM - 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 209 166 165 178 210 199 218 194 182 193 198 + 68 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 111 66 98 62 81 88 89 BICOMP - 192 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 209 166 165 178 210 199 218 194 182 193 198 + 68 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 111 66 98 62 81 88 89 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_compiler.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c ICCARM - 102 + 31 BICOMP - 176 + 259 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 243 247 238 240 + 126 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 243 247 238 240 + 126 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\scheduler.c + $PROJ_DIR$\..\components\easylogger\port\elog_port.c ICCARM - 162 + 187 BICOMP - 159 + 168 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 100 198 145 82 85 93 65 83 69 57 172 116 77 346 343 102 41 210 78 40 101 37 96 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 100 198 145 82 85 93 65 83 69 57 172 116 77 346 343 102 41 210 78 40 101 37 96 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c + $PROJ_DIR$\..\..\..\..\..\easylogger\src\elog_utils.c ICCARM - 116 + 152 BICOMP - 313 + 162 ICCARM - 199 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 218 194 182 193 198 + 100 198 145 82 85 93 65 83 69 57 172 116 77 BICOMP - 199 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 218 194 182 193 198 + 100 198 145 82 85 93 65 83 69 57 172 116 77 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\misc.c ICCARM - 114 + 144 BICOMP - 306 + 35 ICCARM - 182 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 193 198 + 89 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 BICOMP - 182 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 193 198 + 89 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c ICCARM - 125 + 20 BICOMP - 261 + 197 ICCARM - 239 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 134 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 239 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 134 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c ICCARM - 131 + 17 BICOMP - 103 + 123 ICCARM - 166 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 165 178 210 199 218 194 182 193 198 + 137 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 166 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 165 178 210 199 218 194 182 193 198 + 137 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c ICCARM - 112 + 305 BICOMP - 169 + 194 ICCARM - 242 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 139 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 242 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 139 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c ICCARM - 92 + 28 BICOMP - 153 + 106 ICCARM - 255 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 BICOMP - 255 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\completion.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_compiler.c ICCARM - 79 + 282 BICOMP - 151 + 80 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 129 143 147 127 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 129 143 147 127 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.c ICCARM - 129 + 160 BICOMP - 81 + 95 ICCARM - 252 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 BICOMP - 252 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\serial\serial.c ICCARM - 94 + 21 BICOMP - 289 + 177 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh.c ICCARM - 118 + 158 BICOMP - 142 + 10 ICCARM - 210 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 199 218 194 182 193 198 + 122 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 188 BICOMP - 210 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 199 218 194 182 193 198 + 122 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 188 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c ICCARM - 75 + 299 BICOMP - 222 + 178 ICCARM - 165 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 178 210 199 218 194 182 193 198 + 62 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 81 88 89 BICOMP - 165 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 178 210 199 218 194 182 193 198 + 62 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 81 88 89 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\pipe.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\completion.c ICCARM - 119 + 287 BICOMP - 226 + 32 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\ringbuffer.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c ICCARM - 91 + 6 BICOMP - 146 + 184 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 181 231 212 + 66 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 98 62 81 88 89 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 181 231 212 + 66 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c ICCARM - 73 + 272 BICOMP - 133 + 54 ICCARM - 225 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 119 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 225 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 119 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\ringbuffer.c ICCARM - 110 + 267 BICOMP - 214 + 58 ICCARM - 228 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 87 116 97 BICOMP - 228 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 87 116 97 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\portal.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\wrokqueue.c ICCARM - 95 + 260 BICOMP - 145 + 164 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c ICCARM - 117 + 263 BICOMP - 185 + 199 ICCARM - 227 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 88 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 89 BICOMP - 227 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 88 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 89 @@ -1079,90 +1295,90 @@ ICCARM - 113 + 30 BICOMP - 184 + 70 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 102 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 102 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c ICCARM - 107 + 19 BICOMP - 264 + 193 ICCARM - 249 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 81 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 88 89 BICOMP - 249 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 81 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c ICCARM - 76 + 265 BICOMP - 311 + 107 ICCARM - 248 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 92 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 248 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 92 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\cmd.c ICCARM - 93 + 262 BICOMP - 86 + 75 ICCARM - 209 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 166 165 178 210 199 218 194 182 193 198 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 BICOMP - 209 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 166 165 178 210 199 218 194 182 193 198 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 @@ -1171,877 +1387,904 @@ ICCARM - 127 + 23 BICOMP - 207 + 104 ICCARM - 218 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 194 182 193 198 + 98 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 62 81 88 89 BICOMP - 218 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 194 182 193 198 + 98 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_error.c ICCARM - 90 + 18 BICOMP - 297 + 0 ICCARM - 223 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 129 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 BICOMP - 223 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 129 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.c ICCARM - 74 + 276 BICOMP - 291 + 202 ICCARM - 194 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 182 193 198 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 BICOMP - 194 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 182 193 198 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c ICCARM - 106 + 274 BICOMP - 298 + 191 ICCARM - 193 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 198 + 108 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 193 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 198 + 108 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c ICCARM - 120 + 298 BICOMP - 258 + 15 ICCARM - 178 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 210 199 218 194 182 193 198 + 91 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 BICOMP - 178 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 210 199 218 194 182 193 198 + 91 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 111 66 98 62 81 88 89 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\serial\serial.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_init.c ICCARM - 122 + 258 BICOMP - 310 + 190 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 127 143 136 129 148 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 219 188 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 124 127 143 136 129 148 - $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.c ICCARM - 128 + 73 BICOMP - 302 + 201 ICCARM - 256 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 147 127 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 BICOMP - 256 221 195 232 187 175 220 197 196 173 164 200 186 206 233 215 191 192 209 166 165 178 210 199 218 194 182 193 198 + 147 127 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 143 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\cmd.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.c ICCARM - 108 + 141 BICOMP - 203 + 59 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 146 129 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 146 129 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\cpuusage.c + $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c ICCARM - 278 + 2 BICOMP - 171 + 7 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 111 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 66 98 62 81 88 89 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 111 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 61 74 99 33 44 68 66 98 62 81 88 89 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\ipc.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\drivers\src\portal.c ICCARM - 104 + 273 BICOMP - 177 + 14 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 103 76 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\kservice.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\memheap.c ICCARM - 167 + 150 BICOMP - 307 + 22 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_var.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.c ICCARM - 266 + 167 BICOMP - 217 + 36 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\symbol.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\idle.c ICCARM - 271 + 121 BICOMP - 314 + 43 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_node.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\object.c ICCARM - 265 + 279 BICOMP - 132 + 181 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 243 247 241 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 243 247 241 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_vm.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\mem.c ICCARM - 279 + 166 BICOMP - 135 + 195 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 240 247 238 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 240 247 238 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\device.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\thread.c ICCARM - 284 + 286 BICOMP - 144 + 157 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_heap.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\mempool.c ICCARM - 96 + 140 BICOMP - 308 + 49 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\mem.c + $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\context_iar.S + + + AARM + 270 + + + + + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh_cmd.c ICCARM - 269 + 266 BICOMP - 295 + 8 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 122 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 122 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\irq.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\timer.c ICCARM - 83 + 154 BICOMP - 309 + 25 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_error.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\shell.c ICCARM - 111 + 304 BICOMP - 139 + 38 ICCARM - 243 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 188 122 BICOMP - 243 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 163 186 149 9 109 271 116 120 67 105 87 97 188 122 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_token.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\cpuusage.c ICCARM - 263 + 170 BICOMP - 189 + 45 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 236 243 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 236 243 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\mempool.c + $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\symbol.c ICCARM - 262 + 176 BICOMP - 158 + 196 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 163 41 210 78 40 101 82 85 93 65 83 69 57 37 96 186 149 9 109 271 116 120 67 105 87 97 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\module.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\slab.c ICCARM - 272 + 5 BICOMP - 156 + 56 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\object.c + $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c ICCARM - 88 + 171 BICOMP - 305 + 47 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\slab.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\ipc.c ICCARM - 115 + 285 BICOMP - 157 + 63 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_ops.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\clock.c ICCARM - 202 + 183 BICOMP - 292 + 53 ICCARM - 238 240 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 238 240 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 247 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\idle.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\device.c ICCARM - 260 + 156 BICOMP - 161 + 13 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\memheap.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\scheduler.c ICCARM - 281 + 52 BICOMP - 136 + 55 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh_cmd.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\irq.c ICCARM - 80 + 289 BICOMP - 143 + 180 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 235 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 235 + 102 41 210 78 40 101 82 85 93 65 83 69 57 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_parser.c + $PROJ_DIR$\..\RT-Thread-1.2.2\src\kservice.c ICCARM - 99 + 34 BICOMP - 149 + 182 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 236 244 243 250 247 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 236 244 243 250 247 + 41 210 78 40 101 82 85 93 65 83 69 57 37 96 102 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\msh.c + $PROJ_DIR$\..\components\easylogger\plugins\flash\elog_flash_port.c ICCARM - 286 + 332 BICOMP - 137 + 333 ICCARM - 235 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 304 + 346 100 198 145 82 85 93 65 83 69 57 172 116 77 343 102 41 210 78 40 101 37 96 BICOMP - 235 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 304 + 346 100 198 145 82 85 93 65 83 69 57 172 116 77 343 102 41 210 78 40 101 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\finsh_init.c + $PROJ_DIR$\..\components\easyflash\src\ef_log.c ICCARM - 97 + 327 BICOMP - 294 + 345 ICCARM - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 240 247 250 243 241 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 BICOMP - 288 172 0 190 170 211 187 175 220 197 196 173 164 168 208 293 237 138 216 87 231 257 201 224 181 212 244 240 247 250 243 241 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\clock.c + $PROJ_DIR$\..\components\easyflash\src\ef_utils.c ICCARM - 301 + 323 BICOMP - 147 + 318 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 - $PROJ_DIR$\..\RT-Thread-1.2.2\components\finsh\shell.c + $PROJ_DIR$\..\components\easyflash\src\easyflash.c ICCARM - 77 + 325 BICOMP - 154 + 328 ICCARM - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 304 235 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 BICOMP - 213 172 0 190 170 211 187 175 220 197 196 173 164 168 208 288 293 237 138 216 87 231 257 201 224 181 212 304 235 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\thread.c + $PROJ_DIR$\..\components\easyflash\src\ef_iap.c ICCARM - 105 + 324 BICOMP - 285 + 347 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 - $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c + $PROJ_DIR$\..\..\..\..\..\easylogger\plugins\flash\elog_flash.c ICCARM - 270 + 317 BICOMP - 155 + 319 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 346 100 198 145 82 85 93 65 83 69 57 172 116 77 343 320 321 61 74 112 64 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 283 155 271 87 97 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 + 346 100 198 145 82 85 93 65 83 69 57 172 116 77 343 320 321 61 74 112 64 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 283 155 271 87 97 - $PROJ_DIR$\..\RT-Thread-1.2.2\src\timer.c + $PROJ_DIR$\..\components\easyflash\port\ef_port.c ICCARM - 268 + 331 BICOMP - 134 + 330 ICCARM - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 102 41 210 78 40 101 37 96 BICOMP - 172 0 190 170 211 187 175 220 197 196 173 164 168 208 213 + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 102 41 210 78 40 101 37 96 - $PROJ_DIR$\..\RT-Thread-1.2.2\libcpu\arm\cortex-m3\context_iar.S + $PROJ_DIR$\..\components\easyflash\src\ef_env.c - AARM - 85 + ICCARM + 326 + + + BICOMP + 329 + + + ICCARM + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 87 97 271 + + + BICOMP + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 87 97 271 + + - $PROJ_DIR$\stm32f103xE\Exe\EasyLogger.out + $PROJ_DIR$\..\components\easyflash\src\ef_env_wl.c - OBJCOPY - 152 + ICCARM + 322 - ILINK - 254 + BICOMP + 344 - ILINK - 245 300 287 315 301 108 79 85 270 278 113 284 130 303 282 102 111 96 97 265 202 99 263 266 279 260 104 83 167 269 281 262 259 272 286 80 88 119 95 91 162 122 77 115 160 126 112 93 129 128 117 107 125 131 75 120 118 73 100 116 76 127 90 92 110 74 114 106 271 283 105 268 84 78 299 94 253 234 251 229 + ICCARM + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 87 97 271 + + + BICOMP + 320 321 61 74 112 64 145 82 85 93 65 83 69 57 84 72 94 128 110 99 33 44 68 111 66 98 62 81 88 89 172 116 77 87 97 271 diff --git a/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.ewp b/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.ewp index dfa2977..7c92feb 100644 --- a/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.ewp +++ b/demo/os/rt-thread/stm32f10x/EWARM/EasyLogger.ewp @@ -297,7 +297,9 @@ CCIncludePath2 $PROJ_DIR$\..\app\inc $PROJ_DIR$\..\components\rtt_uart + $PROJ_DIR$\..\components\easyflash\inc $PROJ_DIR$\..\components\easylogger\inc + $PROJ_DIR$\..\components\easylogger\plugins\flash $PROJ_DIR$\..\components\others $PROJ_DIR$\..\Libraries\STM32F10x_StdPeriph_Driver\inc $PROJ_DIR$\..\RT-Thread-1.2.2\include @@ -307,6 +309,7 @@ $PROJ_DIR$\..\Libraries\CMSIS_EWARM\Include $PROJ_DIR$\..\Libraries\CMSIS_EWARM\CM3\DeviceSupport\ST\STM32F10x $PROJ_DIR$\..\..\..\..\..\easylogger\inc + $PROJ_DIR$\..\..\..\..\..\easylogger\plugins\flash diff --git a/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.dni b/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.dni index d8fd027..38a612e 100644 --- a/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.dni +++ b/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.dni @@ -15,8 +15,8 @@ OverrideDefaultClocks=0 CpuClock=72000000 ClockAutoDetect=0 ClockWanted=2000000 -JtagSpeed=2250000 -Prescaler=32 +JtagSpeed=2000000 +Prescaler=36 TimeStampPrescIndex=0 TimeStampPrescData=0 PcSampCYCTAP=1 @@ -28,7 +28,7 @@ ITMportsTermIO=0 ITMportsLogFile=0 ITMlogFile=$PROJ_DIR$\ITM.log [DebugChecksum] -Checksum=-1118035218 +Checksum=-483865419 [Exceptions] StopOnUncaught=_ 0 StopOnThrow=_ 0 diff --git a/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.wsdt b/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.wsdt index 86d560e..7f3ea34 100644 --- a/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.wsdt +++ b/demo/os/rt-thread/stm32f10x/EWARM/settings/EasyLogger.wsdt @@ -17,7 +17,7 @@ 20121532481201621 - + TabID-24465-26237 @@ -29,20 +29,20 @@ - 0TabID-28731-28409BuildBuildTabID-15495-1620Debug LogDebug-Log0 + 0TabID-28731-28409BuildBuildTabID-15495-1620Debug LogDebug-Log0 - TextEditor$WS_DIR$\..\app\src\app_task.c000000969600100000010000001 + TextEditor$WS_DIR$\..\app\src\app_task.c000000989800100000010000001 - iaridepm.enu1-2-2724306-2-2200200119048206825183333750776-2-21981682-2-216842001002381206825119048206825 + iaridepm.enu1-2-2724306-2-2200200119048206825183333750776-2-21981682-2-216842001002381206825119048206825 diff --git a/demo/os/rt-thread/stm32f10x/README.md b/demo/os/rt-thread/stm32f10x/README.md index 220623d..1bed570 100644 --- a/demo/os/rt-thread/stm32f10x/README.md +++ b/demo/os/rt-thread/stm32f10x/README.md @@ -6,24 +6,34 @@ ͨ `app\src\app_task.c` `test_elog()` ־ûԽն־á -### 1.1ʹ÷ +## 2ʹ÷ 򿪵ԵնDemoĴ1ӣ 115200 8 1 NʱնоͿ "2.6 Demo" Gifᵽij£ -- 1elogʹʧ־elog onʹܣelog offʧ -- 2elog_lvlù˼(0-5) -- 3elog_tagù˱ǩúֻе־ıǩ˱ǩʱŻᱻκβչ˱ǩ +### 2.1 Ĺ + +- 1elogʹʧ־elog onʹܣelog offʧܣʾ־࣬Եʱ򣬿Խ־ʧܣ +- 2elog_lvlù˼(0-5) +- 3elog_tagù˱ǩúֻе־ıǩ˱ǩʱŻᱻκβչ˱ǩ - 4elog_kwù˹ؼʣúֻе־ **** ˹ؼʱŻᱻκβչ˹ؼʡ -## 2ļУ˵ +### 2.2 Flash Log־浽FlashУ + +`components\easylogger\plugins\flash\elog_flash_cfg.h`ÿģʽʱֻл˲ŻFlashд롣 -`components\easylogger\port\elog_port.c` ֲοļ +-1elog_flash readȡ洢Flashе־ + - 1.1elog_flash read xxxxȡxxxxֽڴС־ +-2elog_flash flush̽е־FlashУע⣺ֻп˻幦ܲŻЧ +-3elog_flash cleanFlashеѱ־ʱ־Ҳա -`RVMDK` ΪKeilļ +## 3ļУ˵ -`EWARM` ΪIARļ +- `components\easylogger\port\elog_port.c` Ĺֲοļ +- `components\easylogger\plugins\flash\elog_flash_port.c` Flash Logֲοļ +- `RVMDK` ΪKeilļ +- `EWARM` ΪIARļ -## 3 +## 4 -- 1 RTTԼӲ쳣Ĺӷʹϵͳڳ쳣ʱ־ȻԱ򱣴档ο `app\src\app_task.c` е `rtt_user_assert_hook` `exception_hook` -- 2 EasyLoggerԵĹӷʹϵͳڳ쳣ʱ־ȻԱ򱣴档ο `app\src\app_task.c` е `elog_user_assert_hook` \ No newline at end of file +- 1 RTTԼӲ쳣ĹӷʹϵͳMCUڳ쳣ʱ־ȻԱͬʱFlashο `app\src\app_task.c` е `rtt_user_assert_hook` `exception_hook` +- 2 EasyLoggerԵĹӷʹϵͳڳ쳣ʱ־ȻԱͬʱFlashο `app\src\app_task.c` е `elog_user_assert_hook` \ No newline at end of file diff --git a/demo/os/rt-thread/stm32f10x/app/src/app_task.c b/demo/os/rt-thread/stm32f10x/app/src/app_task.c index ee55aa7..843111b 100644 --- a/demo/os/rt-thread/stm32f10x/app/src/app_task.c +++ b/demo/os/rt-thread/stm32f10x/app/src/app_task.c @@ -2,7 +2,8 @@ #include #include #include "bsp.h" -#include "elog.h" +#include "elog_flash.h" +#include "easyflash.h" #include "finsh.h" #include "shell.h" #include "cpuusage.h" @@ -88,8 +89,8 @@ static void test_elog(void) { void sys_init_thread(void* parameter){ set_system_status(SYSTEM_STATUS_INIT); - /* EasyLogger initialization */ - if (elog_init() == ELOG_NO_ERR) { + /* initialize EasyFlash and EasyLogger */ + if ((easyflash_init() == EF_NO_ERR)&&(elog_init() == ELOG_NO_ERR)) { /* set enabled format */ elog_set_fmt(ELOG_LVL_ASSERT, ELOG_FMT_ALL & ~ELOG_FMT_P_INFO); elog_set_fmt(ELOG_LVL_ERROR, ELOG_FMT_LVL | ELOG_FMT_TAG | ELOG_FMT_TIME); @@ -99,6 +100,8 @@ void sys_init_thread(void* parameter){ elog_set_fmt(ELOG_LVL_VERBOSE, ELOG_FMT_ALL & ~(ELOG_FMT_FUNC | ELOG_FMT_P_INFO)); /* set EasyLogger assert hook */ elog_assert_set_hook(elog_user_assert_hook); + /* initialize EasyLogger Flash plugin */ + elog_flash_init(); /* start EasyLogger */ elog_start(); /* set hardware exception hook */ @@ -116,18 +119,26 @@ void sys_init_thread(void* parameter){ } static void elog_user_assert_hook(const char* ex, const char* func, size_t line) { + /* disable logger output lock */ elog_output_lock_enabled(false); -// elog_flash_lock_enabled(false); - elog_a("elog", "(%s) has assert failed at %s:%ld.", ex, func, line); -// elog_flash_flush(); + /* disable flash plugin lock */ + elog_flash_lock_enabled(false); + /* output logger assert information */ + elog_a("elog", "(%s) has assert failed at %s:%ld.\n", ex, func, line); + /* write all buffered log to flash */ + elog_flash_flush(); while(1); } static void rtt_user_assert_hook(const char* ex, const char* func, rt_size_t line) { + /* disable logger output lock */ elog_output_lock_enabled(false); -// elog_flash_lock_enabled(false); + /* disable flash plugin lock */ + elog_flash_lock_enabled(false); + /* output rtt assert information */ elog_a("rtt", "(%s) has assert failed at %s:%ld.\n", ex, func, line); -// elog_flash_flush(); + /* write all buffered log to flash */ + elog_flash_flush(); while(1); } @@ -144,8 +155,10 @@ static rt_err_t exception_hook(void *context) { }; struct exception_stack_frame *exception_stack = (struct exception_stack_frame *) context; + /* disable logger output lock */ elog_output_lock_enabled(false); - //elog_flash_lock_enabled(false); + /* disable flash plugin lock */ + elog_flash_lock_enabled(false); elog_e("hw_fault", "psr: 0x%08x", exception_stack->psr); elog_e("hw_fault", " pc: 0x%08x", exception_stack->pc); @@ -157,7 +170,8 @@ static rt_err_t exception_hook(void *context) { elog_e("hw_fault", "r00: 0x%08x", exception_stack->r0); elog_e("hw_fault", "hard fault on thread: %s", rt_thread_self()->name); - //elog_flash_flush(); + /* write all buffered log to flash */ + elog_flash_flush(); return RT_EOK; } diff --git a/demo/os/rt-thread/stm32f10x/app/src/user_finsh_cmd.c b/demo/os/rt-thread/stm32f10x/app/src/user_finsh_cmd.c index be12965..02b7a7b 100644 --- a/demo/os/rt-thread/stm32f10x/app/src/user_finsh_cmd.c +++ b/demo/os/rt-thread/stm32f10x/app/src/user_finsh_cmd.c @@ -9,7 +9,7 @@ #include #include #include "cpuusage.h" -#include "elog.h" +#include "elog_flash.h" static void reboot(uint8_t argc, char **argv) { NVIC_SystemReset(); @@ -77,3 +77,30 @@ static void elog_kw(uint8_t argc, char **argv) { } } MSH_CMD_EXPORT(elog_kw, Set EasyLogger filter keyword); + +static void elog_flash(uint8_t argc, char **argv) { + if (argc >= 2) { + if (!strcmp(argv[1], "read")) { + if (argc >= 3) { + elog_flash_outout_recent(atol(argv[2])); + }else { + elog_flash_outout_all(); + } + } else if (!strcmp(argv[1], "clean")) { + elog_flash_clean(); + } else if (!strcmp(argv[1], "flush")) { + +#ifdef ELOG_FLASH_USING_BUF_MODE + elog_flash_flush(); +#else + rt_kprintf("EasyLogger flash log buffer mode is not open.\n"); +#endif + + } else { + rt_kprintf("Please input elog_flash {, , }.\n"); + } + } else { + rt_kprintf("Please input elog_flash {, , }.\n"); + } +} +MSH_CMD_EXPORT(elog_flash, EasyLogger flash log); diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h new file mode 100644 index 0000000..cc7f374 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/easyflash.h @@ -0,0 +1,147 @@ +/* + * This file is part of the EasyFlash Library. + * + * Copyright (c) 2014, 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 an head file for this library. You can see all be called functions. + * Created on: 2014-09-10 + */ + + +#ifndef EASYFLASH_H_ +#define EASYFLASH_H_ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(EF_USING_ENV) && (!defined(ENV_USER_SETTING_SIZE) || !defined(ENV_AREA_SIZE)) + #error "Please configure user setting ENV size or ENV area size (in ef_cfg.h)" +#endif + +#if defined(EF_USING_LOG) && !defined(LOG_AREA_SIZE) + #error "Please configure log area size (in ef_cfg.h)" +#endif + +#if !defined(EF_START_ADDR) + #error "Please configure backup area start address (in ef_cfg.h)" +#endif + +#if !defined(EF_USING_ENV) + #error "Please configure minimum size of flash erasure (in ef_cfg.h)" +#endif + +/* EasyFlash debug print function. Must be implement by user. */ +#define EF_DEBUG(...) ef_log_debug(__FILE__, __LINE__, __VA_ARGS__) +/* EasyFlash routine print function. Must be implement by user. */ +#define EF_INFO(...) ef_log_info(__VA_ARGS__) +/* EasyFlash assert for developer. */ +#define EF_ASSERT(EXPR) \ +if (!(EXPR)) \ +{ \ + EF_DEBUG("(%s) has assert failed at %s.\n", #EXPR, __FUNCTION__); \ + while (1); \ +} +/* EasyFlash software version number */ +#define EF_SW_VERSION "1.07.29" + +typedef struct _eflash_env{ + char *key; + char *value; +}ef_env, *ef_env_t; + +/* EasyFlash error code */ +typedef enum { + EF_NO_ERR, + EF_ERASE_ERR, + EF_WRITE_ERR, + EF_ENV_NAME_ERR, + EF_ENV_NAME_EXIST, + EF_ENV_FULL, +} EfErrCode; + +/* the flash sector current status */ +typedef enum { + FLASH_SECTOR_EMPTY, + FLASH_SECTOR_USING, + FLASH_SECTOR_FULL, +}FlashSecrorStatus; + +/* easyflash.c */ +EfErrCode easyflash_init(void); + +#ifdef EF_USING_ENV +/* ef_env.c ef_env_wl.c */ +void ef_load_env(void); +void ef_print_env(void); +char *ef_get_env(const char *key); +EfErrCode ef_set_env(const char *key, const char *value); +EfErrCode ef_save_env(void); +EfErrCode ef_env_set_default(void); +size_t ef_get_env_write_bytes(void); +EfErrCode ef_set_and_save_env(const char *key, const char *value); +#endif + +#ifdef EF_USING_IAP +/* ef_iap.c */ +EfErrCode ef_erase_bak_app(size_t app_size); +EfErrCode ef_erase_user_app(uint32_t user_app_addr, size_t user_app_size); +EfErrCode ef_erase_bl(uint32_t bl_addr, size_t bl_size); +EfErrCode ef_write_data_to_bak(uint8_t *data, size_t size, size_t *cur_size, + size_t total_size); +EfErrCode ef_copy_app_from_bak(uint32_t user_app_addr, size_t app_size); +EfErrCode ef_copy_bl_from_bak(uint32_t bl_addr, size_t bl_size); +#endif + +#ifdef EF_USING_LOG +/* ef_log.c */ +EfErrCode ef_log_read(size_t index, uint32_t *log, size_t size); +EfErrCode ef_log_write(const uint32_t *log, size_t size); +EfErrCode ef_log_clean(void); +size_t ef_log_get_used_size(void); +#endif + +/* ef_utils.c */ +uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size); +FlashSecrorStatus ef_get_sector_status(uint32_t addr, size_t sec_size); +uint32_t ef_find_sec_using_end_addr(uint32_t addr, size_t sec_size); + +/* ef_port.c */ +EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size); +EfErrCode ef_port_erase(uint32_t addr, size_t size); +EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size); +void ef_port_env_lock(void); +void ef_port_env_unlock(void); +void ef_log_debug(const char *file, const long line, const char *format, ...); +void ef_log_info(const char *format, ...); +void ef_print(const char *format, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* EASYFLASH_H_ */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/inc/ef_cfg.h b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/ef_cfg.h new file mode 100644 index 0000000..d3a733f --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/inc/ef_cfg.h @@ -0,0 +1,115 @@ +/* + * 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 system section will used an flash section. + * The data section is twice as wear leveling mode data section size. + * 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: 2*EF_ERASE_MIN_SIZE (It has 2 flash 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: 5*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 + 80 * 1024) /* from the chip position: 80KB */ +/* 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 (4 * EF_ERASE_MIN_SIZE) /* 8K */ + #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. */ + #define ENV_AREA_SIZE (5 * EF_ERASE_MIN_SIZE) /* 10K */ + #endif +#endif +/* saved log area size */ +#define LOG_AREA_SIZE (10 * EF_ERASE_MIN_SIZE) /* 20K */ + +/* print debug information of flash */ +#define PRINT_DEBUG + +#endif /* EF_CFG_H_ */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/port/ef_port.c b/demo/os/rt-thread/stm32f10x/components/easyflash/port/ef_port.c new file mode 100644 index 0000000..7c81b62 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/port/ef_port.c @@ -0,0 +1,235 @@ +/* + * 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: Portable interface for stm32f10x platform. + * Created on: 2015-01-16 + */ + +#include +#include +#include +#include + +/* default environment variables set for user */ +static const ef_env default_env_set[] = { + {"iap_need_copy_app","0"}, + {"iap_copy_app_size","0"}, + {"stop_in_bootloader","0"}, + {"device_id","1"}, + {"boot_times","0"}, +}; + +static char log_buf[128]; +static struct rt_semaphore env_cache_lock; + +/** + * Flash port for hardware initialize. + * + * @param default_env default ENV set for user + * @param default_env_size default ENV size + * + * @return result + */ +EfErrCode ef_port_init(ef_env const **default_env, size_t *default_env_size) { + EfErrCode result = EF_NO_ERR; + + *default_env = default_env_set; + *default_env_size = sizeof(default_env_set) / sizeof(default_env_set[0]); + + rt_sem_init(&env_cache_lock, "env lock", 1, RT_IPC_FLAG_PRIO); + + return result; +} + +/** + * Read data from flash. + * @note This operation's units is word. + * + * @param addr flash address + * @param buf buffer to store read data + * @param size read bytes size + * + * @return result + */ +EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(size % 4 == 0); + + /*copy from flash to ram */ + for (; size > 0; size -= 4, addr += 4, buf++) { + *buf = *(uint32_t *) addr; + } + + return result; +} + +/** + * Erase data on flash. + * @note This operation is irreversible. + * @note This operation's units is different which on many chips. + * + * @param addr flash address + * @param size erase bytes size + * + * @return result + */ +EfErrCode ef_port_erase(uint32_t addr, size_t size) { + EfErrCode result = EF_NO_ERR; + FLASH_Status flash_status; + size_t erase_pages, i; + + /* make sure the start address is a multiple of FLASH_ERASE_MIN_SIZE */ + EF_ASSERT(addr % EF_ERASE_MIN_SIZE == 0); + + /* calculate pages */ + erase_pages = size / PAGE_SIZE; + if (size % PAGE_SIZE != 0) { + erase_pages++; + } + + /* start erase */ + FLASH_Unlock(); + FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); + for (i = 0; i < erase_pages; i++) { + flash_status = FLASH_ErasePage(addr + (PAGE_SIZE * i)); + if (flash_status != FLASH_COMPLETE) { + result = EF_ERASE_ERR; + break; + } + } + FLASH_Lock(); + + return result; +} +/** + * Write data to flash. + * @note This operation's units is word. + * @note This operation must after erase. @see flash_erase. + * + * @param addr flash address + * @param buf the write data buffer + * @param size write bytes size + * + * @return result + */ +EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size) { + EfErrCode result = EF_NO_ERR; + size_t i; + uint32_t read_data; + + EF_ASSERT(size % 4 == 0); + + FLASH_Unlock(); + FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); + for (i = 0; i < size; i += 4, buf++, addr += 4) { + /* write data */ + FLASH_ProgramWord(addr, *buf); + read_data = *(uint32_t *)addr; + /* check data */ + if (read_data != *buf) { + result = EF_WRITE_ERR; + break; + } + } + FLASH_Lock(); + + return result; +} + +/** + * lock the ENV ram cache + */ +void ef_port_env_lock(void) { + rt_sem_take(&env_cache_lock, RT_WAITING_FOREVER); +} + +/** + * unlock the ENV ram cache + */ +void ef_port_env_unlock(void) { + rt_sem_release(&env_cache_lock); +} + + +/** + * This function is print flash debug info. + * + * @param file the file which has call this function + * @param line the line number which has call this function + * @param format output format + * @param ... args + * + */ +void ef_log_debug(const char *file, const long line, const char *format, ...) { + +#ifdef PRINT_DEBUG + + va_list args; + + /* args point to the first variable parameter */ + va_start(args, format); + ef_print("[Flash](%s:%ld) ", file, line); + /* must use vprintf to print */ + rt_vsprintf(log_buf, format, args); + ef_print("%s", log_buf); + va_end(args); + +#endif + +} + +/** + * This function is print flash routine info. + * + * @param format output format + * @param ... args + */ +void ef_log_info(const char *format, ...) { + va_list args; + + /* args point to the first variable parameter */ + va_start(args, format); + ef_print("[Flash]"); + /* must use vprintf to print */ + rt_vsprintf(log_buf, format, args); + ef_print("%s", log_buf); + va_end(args); +} +/** + * This function is print flash non-package info. + * + * @param format output format + * @param ... args + */ +void ef_print(const char *format, ...) { + va_list args; + + /* args point to the first variable parameter */ + va_start(args, format); + /* must use vprintf to print */ + rt_vsprintf(log_buf, format, args); + rt_kprintf("%s", log_buf); + va_end(args); +} diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c new file mode 100644 index 0000000..c4fdfd5 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/easyflash.c @@ -0,0 +1,103 @@ +/* + * This file is part of the EasyFlash Library. + * + * Copyright (c) 2014, 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: Initialize interface for this library. + * Created on: 2014-09-09 + */ + +/** + * + * 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 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 system section will used an flash section. + * The data section is twice as wear leveling mode data section size. + * 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 flash 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: 5*EF_ERASE_MIN_SIZE + * @note the log area size must be more than twice of EF_ERASE_MIN_SIZE + */ +#include + +/** + * EasyFlash system initialize. + * + * @return result + */ +EfErrCode easyflash_init(void) { + extern EfErrCode ef_port_init(ef_env const **default_env, size_t *default_env_size); + extern EfErrCode ef_env_init(ef_env const *default_env, size_t default_env_size); + extern EfErrCode ef_iap_init(void); + extern EfErrCode ef_log_init(void); + + size_t default_env_set_size = 0; + const ef_env *default_env_set; + EfErrCode result = EF_NO_ERR; + + result = ef_port_init(&default_env_set, &default_env_set_size); + +#ifdef EF_USING_ENV + if (result == EF_NO_ERR) { + result = ef_env_init(default_env_set, default_env_set_size); + } +#endif + +#ifdef EF_USING_IAP + if (result == EF_NO_ERR) { + result = ef_iap_init(); + } +#endif + +#ifdef EF_USING_LOG + if (result == EF_NO_ERR) { + result = ef_log_init(); + } +#endif + + if (result == EF_NO_ERR) { + EF_DEBUG("EasyFlash V%s is initialize success.\n", EF_SW_VERSION); + } else { + EF_DEBUG("EasyFlash V%s is initialize fail.\n", EF_SW_VERSION); + } + + return result; +} diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env.c new file mode 100644 index 0000000..02678c5 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env.c @@ -0,0 +1,759 @@ +/* + * This file is part of the EasyFlash Library. + * + * Copyright (c) 2014, 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: Environment variables operating interface. (normal mode) + * Created on: 2014-10-06 + */ + +#include +#include +#include + +#ifdef EF_USING_ENV + +#ifndef EF_ENV_USING_WL_MODE + +/** + * ENV area has 2 sections + * 1. System section + * It storage ENV parameters. (Units: Word) + * 2. Data section + * It storage all ENV. Storage format is key=value\0. + * All ENV must be 4 bytes alignment. The remaining part must fill '\0'. + * + * @note Word = 4 Bytes in this file + * @note It will has two ENV areas(Area0, Area1) when used power fail safeguard mode. + */ + +/* flash ENV parameters index and size in system section */ +enum { + /* data section ENV end address index in system section */ + ENV_PARAM_INDEX_END_ADDR = 0, + +#ifdef EF_ENV_USING_PFS_MODE + /* saved count for ENV area */ + ENV_PARAM_INDEX_SAVED_COUNT, +#endif + + /* data section CRC32 code index in system section */ + ENV_PARAM_INDEX_DATA_CRC, + /* flash ENV parameters word size */ + ENV_PARAM_WORD_SIZE, + /* flash ENV parameters byte size */ + ENV_PARAM_BYTE_SIZE = ENV_PARAM_WORD_SIZE * 4, +}; + +/* default ENV set, must be initialized by user */ +static ef_env const *default_env_set = NULL; +/* default ENV set size, must be initialized by user */ +static size_t default_env_set_size = NULL; +/* ENV ram cache */ +static uint32_t env_cache[ENV_USER_SETTING_SIZE / 4] = { 0 }; +/* ENV start address in flash */ +static uint32_t env_start_addr = NULL; +/* ENV ram cache has changed when ENV created, deleted and changed value. */ +static bool env_cache_changed = false; + +#ifdef EF_ENV_USING_PFS_MODE +/* current load ENV area address */ +static uint32_t cur_load_area_addr = NULL; +/* next save ENV area address */ +static uint32_t next_save_area_addr = NULL; +#endif + +static uint32_t get_env_system_addr(void); +static uint32_t get_env_data_addr(void); +static uint32_t get_env_end_addr(void); +static void set_env_end_addr(uint32_t end_addr); +static EfErrCode write_env(const char *key, const char *value); +static char *find_env(const char *key); +static EfErrCode del_env(const char *key); +static size_t get_env_data_size(void); +static EfErrCode create_env(const char *key, const char *value); +static uint32_t calc_env_crc(void); +static bool env_crc_is_ok(void); + +/** + * Flash ENV initialize. + * + * @param default_env default ENV set for user + * @param default_env_size default ENV set size + * + * @note user_size must equal with total_size in normal mode + * + * @return result + */ +EfErrCode ef_env_init(ef_env const *default_env, size_t default_env_size) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(ENV_AREA_SIZE); + EF_ASSERT(ENV_USER_SETTING_SIZE); + EF_ASSERT(EF_ERASE_MIN_SIZE); + /* must be word alignment for ENV */ + EF_ASSERT(ENV_USER_SETTING_SIZE % 4 == 0); + EF_ASSERT(ENV_AREA_SIZE % 4 == 0); + EF_ASSERT(default_env); + EF_ASSERT(default_env_size < ENV_USER_SETTING_SIZE); + +#ifndef EF_ENV_USING_PFS_MODE + /* total_size must be aligned with erase_min_size */ + if (ENV_USER_SETTING_SIZE % EF_ERASE_MIN_SIZE == 0) { + EF_ASSERT(ENV_USER_SETTING_SIZE == ENV_AREA_SIZE); + } else { + EF_ASSERT((ENV_USER_SETTING_SIZE/EF_ERASE_MIN_SIZE + 1)*EF_ERASE_MIN_SIZE == ENV_AREA_SIZE); + } +#else + /* total_size must be aligned with erase_min_size */ + if (ENV_USER_SETTING_SIZE % EF_ERASE_MIN_SIZE == 0) { + /* it has double area when used power fail safeguard mode */ + EF_ASSERT(2*ENV_USER_SETTING_SIZE == ENV_AREA_SIZE); + } else { + /* it has double area when used power fail safeguard mode */ + EF_ASSERT(2*(ENV_USER_SETTING_SIZE/EF_ERASE_MIN_SIZE + 1)*EF_ERASE_MIN_SIZE == ENV_AREA_SIZE); + } +#endif + + env_start_addr = EF_START_ADDR; + default_env_set = default_env; + default_env_set_size = default_env_size; + + EF_DEBUG("ENV start address is 0x%08X, size is %d bytes.\n", EF_START_ADDR, ENV_AREA_SIZE); + + ef_load_env(); + + return result; +} + +/** + * ENV set default. + * + * @return result + */ +EfErrCode ef_env_set_default(void){ + EfErrCode result = EF_NO_ERR; + size_t i; + + EF_ASSERT(default_env_set); + EF_ASSERT(default_env_set_size); + + /* lock the ENV cache */ + ef_port_env_lock(); + + /* set environment end address is at data section start address */ + set_env_end_addr(get_env_data_addr()); + +#ifdef EF_ENV_USING_PFS_MODE + /* set saved count to default 0 */ + env_cache[ENV_PARAM_INDEX_SAVED_COUNT] = 0; +#endif + + /* create default ENV */ + for (i = 0; i < default_env_set_size; i++) { + create_env(default_env_set[i].key, default_env_set[i].value); + } + + /* unlock the ENV cache */ + ef_port_env_unlock(); + + ef_save_env(); + + return result; +} + +/** + * Get ENV system section start address. + * + * @return system section start address + */ +static uint32_t get_env_system_addr(void) { +#ifndef EF_ENV_USING_PFS_MODE + EF_ASSERT(env_start_addr); + return env_start_addr; +#else + EF_ASSERT(cur_load_area_addr); + return cur_load_area_addr; +#endif +} + +/** + * Get ENV data section start address. + * + * @return data section start address + */ +static uint32_t get_env_data_addr(void) { + return get_env_system_addr() + ENV_PARAM_BYTE_SIZE; +} + +/** + * Get ENV end address. + * It's the first word in ENV. + * + * @return ENV end address + */ +static uint32_t get_env_end_addr(void) { + /* it is the first word */ + return env_cache[ENV_PARAM_INDEX_END_ADDR]; +} + +/** + * Set ENV end address. + * It's the first word in ENV. + * + * @param end_addr ENV end address + */ +static void set_env_end_addr(uint32_t end_addr) { + env_cache[ENV_PARAM_INDEX_END_ADDR] = end_addr; +} + +/** + * Get current ENV data section size. + * + * @return size + */ +static size_t get_env_data_size(void) { + return get_env_end_addr() - get_env_data_addr(); +} + +/** + * Get current ENV already write bytes. + * + * @return write bytes + */ +size_t ef_get_env_write_bytes(void) { +#ifndef EF_ENV_USING_PFS_MODE + return get_env_end_addr() - env_start_addr; +#else + /* It has two ENV areas(Area0, Area1) on used power fail safeguard mode */ + return 2 * (get_env_end_addr() - get_env_system_addr()); +#endif +} + +/** + * Write an ENV at the end of cache. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +static EfErrCode write_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + size_t ker_len = strlen(key), value_len = strlen(value), env_str_len; + char *env_cache_bak = (char *)env_cache; + + /* calculate ENV storage length, contain '=' and '\0'. */ + env_str_len = ker_len + value_len + 2; + if (env_str_len % 4 != 0) { + env_str_len = (env_str_len / 4 + 1) * 4; + } + /* check capacity of ENV */ + if (env_str_len + get_env_data_size() >= ENV_USER_SETTING_SIZE) { + return EF_ENV_FULL; + } + + /* calculate current ENV ram cache end address */ + env_cache_bak += get_env_end_addr() - get_env_system_addr(); + + /* copy key name */ + memcpy(env_cache_bak, key, ker_len); + env_cache_bak += ker_len; + /* copy equal sign */ + *env_cache_bak = '='; + env_cache_bak++; + /* copy value */ + memcpy(env_cache_bak, value, value_len); + env_cache_bak += value_len; + /* fill '\0' for string end sign */ + *env_cache_bak = '\0'; + env_cache_bak ++; + /* fill '\0' for word alignment */ + memset(env_cache_bak, 0, env_str_len - (ker_len + value_len + 2)); + set_env_end_addr(get_env_end_addr() + env_str_len); + /* ENV ram cache has changed */ + env_cache_changed = true; + + return result; +} + +/** + * Find ENV. + * + * @param key ENV name + * + * @return found ENV in ram cache + */ +static char *find_env(const char *key) { + char *env_start, *env_end, *env, *found_env = NULL; + size_t key_len = strlen(key), env_len; + + EF_ASSERT(env_start_addr); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not empty!\n"); + return NULL; + } + + /* from data section start to data section end */ + env_start = (char *) ((char *) env_cache + ENV_PARAM_BYTE_SIZE); + env_end = (char *) ((char *) env_cache + (get_env_end_addr() - get_env_system_addr())); + + /* ENV is null */ + if (env_start == env_end) { + return NULL; + } + + env = env_start; + while (env < env_end) { + /* the key length must be equal */ + if (!strncmp(env, key, key_len) && (env[key_len] == '=')) { + found_env = env; + break; + } else { + /* calculate ENV length, contain '\0'. */ + env_len = strlen(env) + 1; + /* next ENV and word alignment */ + if (env_len % 4 == 0) { + env += env_len; + } else { + env += (env_len / 4 + 1) * 4; + } + } + } + return found_env; +} + +/** + * If the ENV is not exist, create it. + * @see flash_write_env + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +static EfErrCode create_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(key); + EF_ASSERT(value); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not empty!\n"); + return EF_ENV_NAME_ERR; + } + + if (strchr(key, '=')) { + EF_INFO("Flash ENV name can't contain '='.\n"); + return EF_ENV_NAME_ERR; + } + + /* find ENV */ + if (find_env(key)) { + EF_INFO("The name of \"%s\" is already exist.\n", key); + return EF_ENV_NAME_EXIST; + } + /* write ENV at the end of cache */ + result = write_env(key, value); + + return result; +} + +/** + * Delete an ENV in cache. + * + * @param key ENV name + * + * @return result + */ +static EfErrCode del_env(const char *key){ + EfErrCode result = EF_NO_ERR; + char *del_env = NULL; + size_t del_env_length, remain_env_length; + + EF_ASSERT(key); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not NULL!\n"); + return EF_ENV_NAME_ERR; + } + + if (strchr(key, '=')) { + EF_INFO("Flash ENV name or value can't contain '='.\n"); + return EF_ENV_NAME_ERR; + } + + /* find ENV */ + del_env = find_env(key); + + if (!del_env) { + EF_INFO("Not find \"%s\" in ENV.\n", key); + return EF_ENV_NAME_ERR; + } + del_env_length = strlen(del_env); + /* '\0' also must be as ENV length */ + del_env_length ++; + /* the address must multiple of 4 */ + if (del_env_length % 4 != 0) { + del_env_length = (del_env_length / 4 + 1) * 4; + } + /* calculate remain ENV length */ + remain_env_length = get_env_data_size() + - (((uint32_t) del_env + del_env_length) - ((uint32_t) env_cache + ENV_PARAM_BYTE_SIZE)); + /* remain ENV move forward */ + memcpy(del_env, del_env + del_env_length, remain_env_length); + /* reset ENV end address */ + set_env_end_addr(get_env_end_addr() - del_env_length); + /* ENV ram cache has changed */ + env_cache_changed = true; + + return result; +} + +/** + * Set an ENV. If it value is empty, delete it. + * If not find it in ENV table, then create it. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +EfErrCode ef_set_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + char *old_env, *old_value; + + /* lock the ENV cache */ + ef_port_env_lock(); + + /* if ENV value is empty, delete it */ + if (*value == NULL) { + result = del_env(key); + } else { + old_env = find_env(key); + /* If find this ENV, then compare the new value and old value. */ + if (old_env) { + /* find the old value address */ + old_env = strchr(old_env, '='); + old_value = old_env + 1; + /* If it is changed then delete it and recreate it */ + if (strcmp(old_value, value)) { + result = del_env(key); + if (result == EF_NO_ERR) { + result = create_env(key, value); + } + } + } else { + result = create_env(key, value); + } + } + /* unlock the ENV cache */ + ef_port_env_unlock(); + + return result; +} + +/** + * Get an ENV value by key name. + * + * @param key ENV name + * + * @return value + */ +char *ef_get_env(const char *key) { + char *env = NULL, *value = NULL; + + /* find ENV */ + env = find_env(key); + + if (env == NULL) { + return NULL; + } + /* get value address */ + value = strchr(env, '='); + if (value != NULL) { + /* the equal sign next character is value */ + value++; + } + return value; +} +/** + * Print ENV. + */ +void ef_print_env(void) { + uint32_t *env_cache_data_addr = env_cache + ENV_PARAM_WORD_SIZE, + *env_cache_end_addr = + (uint32_t *) (env_cache + ENV_PARAM_WORD_SIZE + get_env_data_size() / 4); + uint8_t j; + char c; + + for (; env_cache_data_addr < env_cache_end_addr; env_cache_data_addr += 1) { + for (j = 0; j < 4; j++) { + c = (*env_cache_data_addr) >> (8 * j); + ef_print("%c", c); + if (c == NULL) { + ef_print("\n"); + break; + } + } + } + +#ifndef EF_ENV_USING_PFS_MODE + ef_print("\nENV size: %ld/%ld bytes.\n", ef_get_env_write_bytes(), ENV_AREA_SIZE); +#else + ef_print("\nENV size: %ld/%ld bytes, saved count: %ld, mode: power fail safeguard.\n", + ef_get_env_write_bytes(), ENV_AREA_SIZE, env_cache[ENV_PARAM_INDEX_SAVED_COUNT]); + +#endif +} + +/** + * Load flash ENV to ram. + */ +#ifndef EF_ENV_USING_PFS_MODE +void ef_load_env(void) { + uint32_t *env_cache_bak, env_end_addr; + + /* read ENV end address from flash */ + ef_port_read(get_env_system_addr() + ENV_PARAM_INDEX_END_ADDR * 4, &env_end_addr, 4); + /* if ENV is not initialize or flash has dirty data, set default for it */ + if ((env_end_addr == 0xFFFFFFFF) || (env_end_addr < env_start_addr) + || (env_end_addr > env_start_addr + ENV_USER_SETTING_SIZE)) { + ef_env_set_default(); + } else { + /* set ENV end address */ + set_env_end_addr(env_end_addr); + + env_cache_bak = env_cache + ENV_PARAM_WORD_SIZE; + /* read all ENV from flash */ + ef_port_read(get_env_data_addr(), env_cache_bak, get_env_data_size()); + /* read ENV CRC code from flash */ + ef_port_read(get_env_system_addr() + ENV_PARAM_INDEX_DATA_CRC * 4, + &env_cache[ENV_PARAM_INDEX_DATA_CRC] , 4); + /* if ENV CRC32 check is fault, set default for it */ + if (!env_crc_is_ok()) { + EF_INFO("Warning: ENV CRC check failed. Set it to default.\n"); + ef_env_set_default(); + } + } +} +#else +void ef_load_env(void) { + uint32_t area0_start_address = env_start_addr, area1_start_address = env_start_addr + + ENV_AREA_SIZE / 2; + uint32_t area0_end_addr, area1_end_addr, area0_crc, area1_crc, area0_saved_count, area1_saved_count; + bool area0_is_valid = true, area1_is_valid = true; + /* read ENV area end address from flash */ + ef_port_read(area0_start_address + ENV_PARAM_INDEX_END_ADDR * 4, &area0_end_addr, 4); + ef_port_read(area1_start_address + ENV_PARAM_INDEX_END_ADDR * 4, &area1_end_addr, 4); + if ((area0_end_addr == 0xFFFFFFFF) || (area0_end_addr < area0_start_address) + || (area0_end_addr > area0_start_address + ENV_USER_SETTING_SIZE)) { + area0_is_valid = false; + } + if ((area1_end_addr == 0xFFFFFFFF) || (area1_end_addr < area1_start_address) + || (area1_end_addr > area1_start_address + ENV_USER_SETTING_SIZE)) { + area1_is_valid = false; + } + /* check area0 CRC when it is valid */ + if (area0_is_valid) { + /* read ENV area0 crc32 code from flash */ + ef_port_read(area0_start_address + ENV_PARAM_INDEX_DATA_CRC * 4, &area0_crc, 4); + /* read ENV from ENV area0 */ + ef_port_read(area0_start_address, env_cache, area0_end_addr - area0_start_address); + /* current load ENV area address is area0 start address */ + cur_load_area_addr = area0_start_address; + if (!env_crc_is_ok()) { + area0_is_valid = false; + } + } + /* check area1 CRC when it is valid */ + if (area1_is_valid) { + /* read ENV area1 crc32 code from flash */ + ef_port_read(area1_start_address + ENV_PARAM_INDEX_DATA_CRC * 4, &area1_crc, 4); + /* read ENV from ENV area1 */ + ef_port_read(area1_start_address, env_cache, area1_end_addr - area1_start_address); + /* current load ENV area address is area1 start address */ + cur_load_area_addr = area1_start_address; + if (!env_crc_is_ok()) { + area1_is_valid = false; + } + } + /* all ENV area CRC is OK then compare saved count */ + if (area0_is_valid && area1_is_valid) { + /* read ENV area saved count from flash */ + ef_port_read(area0_start_address + ENV_PARAM_INDEX_SAVED_COUNT * 4, + &area0_saved_count, 4); + ef_port_read(area1_start_address + ENV_PARAM_INDEX_SAVED_COUNT * 4, + &area1_saved_count, 4); + /* the bigger saved count area is valid */ + if ((area0_saved_count > area1_saved_count)||((area0_saved_count == 0)&&(area1_saved_count == 0xFFFFFFFF))) { + area1_is_valid = false; + } else { + area0_is_valid = false; + } + } + if (area0_is_valid) { + /* current load ENV area address is area0 start address */ + cur_load_area_addr = area0_start_address; + /* next save ENV area address is area1 start address */ + next_save_area_addr = area1_start_address; + /* read all ENV from area0 */ + ef_port_read(area0_start_address, env_cache, area0_end_addr - area0_start_address); + } else if (area1_is_valid) { + /* next save ENV area address is area0 start address */ + next_save_area_addr = area0_start_address; + } else { + /* current load ENV area address is area1 start address */ + cur_load_area_addr = area1_start_address; + /* next save ENV area address is area0 start address */ + next_save_area_addr = area0_start_address; + /* set the ENV to default */ + ef_env_set_default(); + } +} +#endif + +/** + * Save ENV to flash. + */ +EfErrCode ef_save_env(void) { + EfErrCode result = EF_NO_ERR; + uint32_t write_addr, write_size; + + /* ENV ram cache has not changed don't need to save */ + if (!env_cache_changed) { + return result; + } + +#ifndef EF_ENV_USING_PFS_MODE + write_addr = get_env_system_addr(); + write_size = get_env_end_addr() - get_env_system_addr(); + /* calculate and cache CRC32 code */ + env_cache[ENV_PARAM_INDEX_DATA_CRC] = calc_env_crc(); +#else + write_addr = next_save_area_addr; + write_size = get_env_end_addr() - get_env_system_addr(); + /* replace next_save_area_addr with cur_load_area_addr */ + next_save_area_addr = cur_load_area_addr; + cur_load_area_addr = write_addr; + /* change the ENV end address to next save area address */ + set_env_end_addr(write_addr + write_size); + /* ENV area saved count +1 */ + env_cache[ENV_PARAM_INDEX_SAVED_COUNT]++; + /* calculate and cache CRC32 code */ + env_cache[ENV_PARAM_INDEX_DATA_CRC] = calc_env_crc(); +#endif + + /* erase ENV */ + result = ef_port_erase(write_addr, write_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Erased ENV OK.\n"); + break; + } + case EF_ERASE_ERR: { + EF_INFO("Warning: Erased ENV fault!\n"); + /* will return when erase fault */ + return result; + } + } + + /* write ENV to flash */ + result = ef_port_write(write_addr, env_cache, write_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Saved ENV OK.\n"); + break; + } + case EF_WRITE_ERR: { + EF_INFO("Warning: Saved ENV fault!\n"); + break; + } + } + + env_cache_changed = false; + + return result; +} + +/** + * Calculate the cached ENV CRC32 value. + * + * @return CRC32 value + */ +static uint32_t calc_env_crc(void) { + uint32_t crc32 = 0; + + /* Calculate the ENV end address CRC32. The 4 is ENV end address bytes size. */ + crc32 = ef_calc_crc32(crc32, &env_cache[ENV_PARAM_INDEX_END_ADDR], 4); + +#ifdef EF_ENV_USING_PFS_MODE + /* Calculate the ENV area saved count CRC32. */ + crc32 = ef_calc_crc32(crc32, &env_cache[ENV_PARAM_INDEX_SAVED_COUNT], 4); +#endif + + /* Calculate the all ENV data CRC32. */ + crc32 = ef_calc_crc32(crc32, &env_cache[ENV_PARAM_WORD_SIZE], get_env_data_size()); + + EF_DEBUG("Calculate ENV CRC32 number is 0x%08X.\n", crc32); + + return crc32; +} + +/** + * Check the ENV CRC32 + * + * @return true is ok + */ +static bool env_crc_is_ok(void) { + if (calc_env_crc() == env_cache[ENV_PARAM_INDEX_DATA_CRC]) { + EF_DEBUG("Verify ENV CRC32 result is OK.\n"); + return true; + } else { + return false; + } +} + +/** + * Set and save an ENV. If set ENV is success then will save it. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +EfErrCode ef_set_and_save_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + + result = ef_set_env(key, value); + + if (result == EF_NO_ERR) { + result = ef_save_env(); + } + + return result; +} + +#endif /* EF_ENV_USING_WL_MODE */ + +#endif /* EF_USING_ENV */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env_wl.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env_wl.c new file mode 100644 index 0000000..eb51800 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_env_wl.c @@ -0,0 +1,926 @@ +/* + * 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: Environment variables operating interface. (wear leveling mode) + * Created on: 2015-02-11 + */ + +#include +#include +#include + +#ifdef EF_USING_ENV + +#ifdef EF_ENV_USING_WL_MODE + +/** + * ENV area has 2 sections + * 1. System section + * Storage ENV current using data section address. + * Units: Word. Total size: @see EF_ERASE_MIN_SIZE. + * 2. Data section + * The data section storage ENV's parameters and detail. + * When an exception has occurred on flash erase or write. The current using data section + * address will move to next available position. This position depends on EF_ERASE_MIN_SIZE. + * 2.1 ENV parameters part + * It storage ENV's parameters. + * 2.2 ENV detail part + * It storage all ENV. Storage format is key=value\0. + * All ENV must be 4 bytes alignment. The remaining part must fill '\0'. + * + * @note Word = 4 Bytes in this file + * @note It will has two ENV areas(Area0, Area1) in data section when used power fail safeguard mode. + */ + +/* flash ENV parameters part index and size */ +enum { + /* data section ENV detail part end address index */ + ENV_PARAM_PART_INDEX_END_ADDR = 0, + +#ifdef EF_ENV_USING_PFS_MODE + /* saved count for ENV area */ + ENV_PARAM_PART_INDEX_SAVED_COUNT, +#endif + + /* data section CRC32 code index */ + ENV_PARAM_PART_INDEX_DATA_CRC, + /* ENV parameters part word size */ + ENV_PARAM_PART_WORD_SIZE, + /* ENV parameters part byte size */ + ENV_PARAM_PART_BYTE_SIZE = ENV_PARAM_PART_WORD_SIZE * 4, +}; + +/* default ENV set, must be initialized by user */ +static ef_env const *default_env_set = NULL; +/* default ENV set size, must be initialized by user */ +static size_t default_env_set_size = NULL; +/* flash ENV data section size */ +static size_t env_data_section_size = NULL; +/* ENV ram cache */ +static uint32_t env_cache[ENV_USER_SETTING_SIZE / 4] = { 0 }; +/* ENV start address in flash */ +static uint32_t env_start_addr = NULL; +/* current using data section address */ +static uint32_t cur_using_data_addr = NULL; +/* ENV ram cache has changed when ENV created, deleted and changed value. */ +static bool env_cache_changed = false; + +#ifdef EF_ENV_USING_PFS_MODE +/* next save ENV area address */ +static uint32_t next_save_area_addr = NULL; +#endif + +static uint32_t get_env_start_addr(void); +static uint32_t get_cur_using_data_addr(void); +static uint32_t get_env_detail_addr(void); +static uint32_t get_env_detail_end_addr(void); +static void set_cur_using_data_addr(uint32_t using_data_addr); +static void set_env_detail_end_addr(uint32_t end_addr); +static EfErrCode write_env(const char *key, const char *value); +static char *find_env(const char *key); +static size_t get_env_detail_size(void); +static size_t get_env_user_used_size(void); +static EfErrCode create_env(const char *key, const char *value); +static EfErrCode del_env(const char *key); +static EfErrCode save_cur_using_data_addr(uint32_t cur_data_addr); +static uint32_t calc_env_crc(void); +static bool env_crc_is_ok(void); + +/** + * Flash ENV initialize. + * + * @param default_env default ENV set for user + * @param default_env_size default ENV set size + * + * @return result + */ +EfErrCode ef_env_init(ef_env const *default_env, size_t default_env_size) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(ENV_AREA_SIZE); + EF_ASSERT(ENV_USER_SETTING_SIZE); + /* must be word alignment for ENV */ + EF_ASSERT(ENV_USER_SETTING_SIZE % 4 == 0); + EF_ASSERT(ENV_AREA_SIZE % 4 == 0); + EF_ASSERT(default_env); + EF_ASSERT(default_env_size < ENV_USER_SETTING_SIZE); + /* system section size is erase_min_size, so last part is data section */ + env_data_section_size = ENV_AREA_SIZE - EF_ERASE_MIN_SIZE; + /* the ENV data section size should be an integral multiple of erase minimum size. */ + EF_ASSERT(env_data_section_size % EF_ERASE_MIN_SIZE == 0); + +#ifndef EF_ENV_USING_PFS_MODE + EF_ASSERT(env_data_section_size >= ENV_USER_SETTING_SIZE); +#else + /* it has double area when used power fail safeguard mode */ + EF_ASSERT(env_data_section_size >= 2*ENV_USER_SETTING_SIZE); + EF_ASSERT((env_data_section_size / EF_ERASE_MIN_SIZE) % 2 == 0); +#endif + + + env_start_addr = EF_START_ADDR; + default_env_set = default_env; + default_env_set_size = default_env_size; + + EF_DEBUG("ENV start address is 0x%08X, size is %d bytes.\n", EF_START_ADDR, ENV_AREA_SIZE); + + ef_load_env(); + + return result; +} + +/** + * ENV set default. + * + * @return result + */ +EfErrCode ef_env_set_default(void){ + EfErrCode result = EF_NO_ERR; + size_t i; + + EF_ASSERT(default_env_set); + EF_ASSERT(default_env_set_size); + + /* lock the ENV cache */ + ef_port_env_lock(); + + /* set ENV detail part end address is at ENV detail part start address */ + set_env_detail_end_addr(get_env_detail_addr()); + +#ifdef EF_ENV_USING_PFS_MODE + /* set saved count to default 0 */ + env_cache[ENV_PARAM_PART_INDEX_SAVED_COUNT] = 0; +#endif + + /* create default ENV */ + for (i = 0; i < default_env_set_size; i++) { + create_env(default_env_set[i].key, default_env_set[i].value); + } + + /* unlock the ENV cache */ + ef_port_env_unlock(); + + ef_save_env(); + + return result; +} + +/** + * Get ENV start address in flash. + * + * @return ENV start address in flash + */ +static uint32_t get_env_start_addr(void) { + EF_ASSERT(env_start_addr); + return env_start_addr; +} +/** + * Get current using data section address. + * + * @return current using data section address + */ +static uint32_t get_cur_using_data_addr(void) { + EF_ASSERT(cur_using_data_addr); + return cur_using_data_addr; +} + +/** + * Set current using data section address. + * + * @param using_data_addr current using data section address + */ +static void set_cur_using_data_addr(uint32_t using_data_addr) { + cur_using_data_addr = using_data_addr; +} + +/** + * Get ENV detail part start address. + * + * @return detail part start address + */ +static uint32_t get_env_detail_addr(void) { + EF_ASSERT(cur_using_data_addr); + return get_cur_using_data_addr() + ENV_PARAM_PART_BYTE_SIZE; +} + +/** + * Get ENV detail part end address. + * It's the first word in ENV. + * + * @return ENV end address + */ +static uint32_t get_env_detail_end_addr(void) { + /* it is the first word */ + return env_cache[ENV_PARAM_PART_INDEX_END_ADDR]; +} + +/** + * Set ENV detail part end address. + * It's the first word in ENV. + * + * @param end_addr ENV end address + */ +static void set_env_detail_end_addr(uint32_t end_addr) { + env_cache[ENV_PARAM_PART_INDEX_END_ADDR] = end_addr; +} + +/** + * Get current ENV detail part size. + * + * @return size + */ +static size_t get_env_detail_size(void) { + return get_env_detail_end_addr() - get_env_detail_addr(); +} + +/** + * Get current user used ENV size. + * + * @see ENV_USER_SETTING_SIZE + * + * @return size + */ + /* must be initialized */ +static size_t get_env_user_used_size(void) { + return get_env_detail_end_addr() - get_cur_using_data_addr(); +} + +/** + * Get current ENV already write bytes. + * + * @return write bytes + */ +size_t ef_get_env_write_bytes(void) { +#ifndef EF_ENV_USING_PFS_MODE + return get_env_detail_end_addr() - get_env_start_addr(); +#else + if (get_cur_using_data_addr() + < get_env_start_addr() + EF_ERASE_MIN_SIZE + env_data_section_size / 2) { + /* current using is ENV area0 */ + return EF_ERASE_MIN_SIZE + 2 * (get_env_detail_end_addr() - (get_env_start_addr() + +EF_ERASE_MIN_SIZE)); + } else { + /* current using is ENV area1 */ + return EF_ERASE_MIN_SIZE + 2 * (get_env_detail_end_addr() - (get_env_start_addr() + + EF_ERASE_MIN_SIZE + env_data_section_size / 2)); + } +#endif +} + +/** + * Write an ENV at the end of cache. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +static EfErrCode write_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + size_t ker_len = strlen(key), value_len = strlen(value), env_str_len; + char *env_cache_bak = (char *)env_cache; + + /* calculate ENV storage length, contain '=' and '\0'. */ + env_str_len = ker_len + value_len + 2; + if (env_str_len % 4 != 0) { + env_str_len = (env_str_len / 4 + 1) * 4; + } + /* check capacity of ENV */ + if (env_str_len + get_env_detail_size() >= ENV_USER_SETTING_SIZE) { + return EF_ENV_FULL; + } + /* calculate current ENV ram cache end address */ + env_cache_bak += ENV_PARAM_PART_BYTE_SIZE + get_env_detail_size(); + /* copy key name */ + memcpy(env_cache_bak, key, ker_len); + env_cache_bak += ker_len; + /* copy equal sign */ + *env_cache_bak = '='; + env_cache_bak++; + /* copy value */ + memcpy(env_cache_bak, value, value_len); + env_cache_bak += value_len; + /* fill '\0' for string end sign */ + *env_cache_bak = '\0'; + env_cache_bak ++; + /* fill '\0' for word alignment */ + memset(env_cache_bak, 0, env_str_len - (ker_len + value_len + 2)); + set_env_detail_end_addr(get_env_detail_end_addr() + env_str_len); + /* ENV ram cache has changed */ + env_cache_changed = true; + + return result; +} + +/** + * Find ENV. + * + * @param key ENV name + * + * @return found ENV in ram cache + */ +static char *find_env(const char *key) { + char *env_start, *env_end, *env, *found_env = NULL; + size_t key_len = strlen(key), env_len; + + EF_ASSERT(cur_using_data_addr); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not empty!\n"); + return NULL; + } + + /* from data section start to data section end */ + env_start = (char *) ((char *) env_cache + ENV_PARAM_PART_BYTE_SIZE); + env_end = (char *) ((char *) env_cache + ENV_PARAM_PART_BYTE_SIZE + get_env_detail_size()); + + /* ENV is null */ + if (env_start == env_end) { + return NULL; + } + + env = env_start; + while (env < env_end) { + /* the key length must be equal */ + if (!strncmp(env, key, key_len) && (env[key_len] == '=')) { + found_env = env; + break; + } else { + /* calculate ENV length, contain '\0'. */ + env_len = strlen(env) + 1; + /* next ENV and word alignment */ + if (env_len % 4 == 0) { + env += env_len; + } else { + env += (env_len / 4 + 1) * 4; + } + } + } + + return found_env; +} + +/** + * If the ENV is not exist, create it. + * @see flash_write_env + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +static EfErrCode create_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(key); + EF_ASSERT(value); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not empty!\n"); + return EF_ENV_NAME_ERR; + } + + if (strchr(key, '=')) { + EF_INFO("Flash ENV name can't contain '='.\n"); + return EF_ENV_NAME_ERR; + } + + /* find ENV */ + if (find_env(key)) { + EF_INFO("The name of \"%s\" is already exist.\n", key); + return EF_ENV_NAME_EXIST; + } + /* write ENV at the end of cache */ + result = write_env(key, value); + + return result; +} + +/** + * Delete an ENV in cache. + * + * @param key ENV name + * + * @return result + */ +static EfErrCode del_env(const char *key) { + EfErrCode result = EF_NO_ERR; + char *del_env = NULL; + size_t del_env_length, remain_env_length; + + EF_ASSERT(key); + + if (*key == NULL) { + EF_INFO("Flash ENV name must be not NULL!\n"); + return EF_ENV_NAME_ERR; + } + + if (strchr(key, '=')) { + EF_INFO("Flash ENV name or value can't contain '='.\n"); + return EF_ENV_NAME_ERR; + } + + /* find ENV */ + del_env = find_env(key); + + if (!del_env) { + EF_INFO("Not find \"%s\" in ENV.\n", key); + return EF_ENV_NAME_ERR; + } + del_env_length = strlen(del_env); + /* '\0' also must be as ENV length */ + del_env_length ++; + /* the address must multiple of 4 */ + if (del_env_length % 4 != 0) { + del_env_length = (del_env_length / 4 + 1) * 4; + } + /* calculate remain ENV length */ + remain_env_length = get_env_detail_size() + - (((uint32_t) del_env + del_env_length) - ((uint32_t) env_cache + ENV_PARAM_PART_BYTE_SIZE)); + /* remain ENV move forward */ + memcpy(del_env, del_env + del_env_length, remain_env_length); + /* reset ENV end address */ + set_env_detail_end_addr(get_env_detail_end_addr() - del_env_length); + /* ENV ram cache has changed */ + env_cache_changed = true; + + return result; +} + +/** + * Set an ENV. If it value is empty, delete it. + * If not find it in ENV table, then create it. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +EfErrCode ef_set_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + char *old_env, *old_value; + + /* lock the ENV cache */ + ef_port_env_lock(); + + /* if ENV value is empty, delete it */ + if (*value == NULL) { + result = del_env(key); + } else { + old_env = find_env(key); + /* If find this ENV, then compare the new value and old value. */ + if (old_env) { + /* find the old value address */ + old_env = strchr(old_env, '='); + old_value = old_env + 1; + /* If it is changed then delete it and recreate it */ + if (strcmp(old_value, value)) { + result = del_env(key); + if (result == EF_NO_ERR) { + result = create_env(key, value); + } + } + } else { + result = create_env(key, value); + } + } + /* unlock the ENV cache */ + ef_port_env_unlock(); + + return result; +} + +/** + * Get an ENV value by key name. + * + * @param key ENV name + * + * @return value + */ +char *ef_get_env(const char *key) { + char *env = NULL, *value = NULL; + + /* find ENV */ + env = find_env(key); + + if (env == NULL) { + return NULL; + } + /* get value address */ + value = strchr(env, '='); + if (value != NULL) { + /* the equal sign next character is value */ + value++; + } + return value; +} +/** + * Print ENV. + */ +void ef_print_env(void) { + uint32_t *env_cache_detail_addr = env_cache + ENV_PARAM_PART_WORD_SIZE, *env_cache_end_addr = + (uint32_t *) (env_cache + ENV_PARAM_PART_WORD_SIZE + get_env_detail_size() / 4); + uint8_t j; + char c; + + for (; env_cache_detail_addr < env_cache_end_addr; env_cache_detail_addr += 1) { + for (j = 0; j < 4; j++) { + c = (*env_cache_detail_addr) >> (8 * j); + ef_print("%c", c); + if (c == NULL) { + ef_print("\n"); + break; + } + } + } + +#ifndef EF_ENV_USING_PFS_MODE + ef_print("\nENV size: %ld/%ld bytes, write bytes %ld/%ld, mode: wear leveling.\n", + get_env_user_used_size(), ENV_USER_SETTING_SIZE, ef_get_env_write_bytes(), + ENV_AREA_SIZE); +#else + ef_print("\nENV size: %ld/%ld bytes, write bytes %ld/%ld, saved count: %ld, mode: wear leveling and power fail safeguard.\n", + get_env_user_used_size(), ENV_USER_SETTING_SIZE, ef_get_env_write_bytes(), + ENV_AREA_SIZE, env_cache[ENV_PARAM_PART_INDEX_SAVED_COUNT]); +#endif +} + +/** + * Load flash ENV to ram. + */ +#ifndef EF_ENV_USING_PFS_MODE +void ef_load_env(void) { + uint32_t *env_cache_bak, env_end_addr, using_data_addr; + + /* read current using data section address */ + ef_port_read(get_env_start_addr(), &using_data_addr, 4); + /* if ENV is not initialize or flash has dirty data, set default for it */ + if ((using_data_addr == 0xFFFFFFFF) + || (using_data_addr > get_env_start_addr() + ENV_AREA_SIZE) + || (using_data_addr < get_env_start_addr() + EF_ERASE_MIN_SIZE)) { + /* initialize current using data section address */ + set_cur_using_data_addr(get_env_start_addr() + EF_ERASE_MIN_SIZE); + /* save current using data section address to flash*/ + save_cur_using_data_addr(get_cur_using_data_addr()); + /* set default ENV */ + ef_env_set_default(); + } else { + /* set current using data section address */ + set_cur_using_data_addr(using_data_addr); + /* read ENV detail part end address from flash */ + ef_port_read(get_cur_using_data_addr() + ENV_PARAM_PART_INDEX_END_ADDR * 4, &env_end_addr, 4); + /* if ENV end address has error, set default for ENV */ + if (env_end_addr > get_env_start_addr() + ENV_AREA_SIZE) { + ef_env_set_default(); + } else { + /* set ENV detail part end address */ + set_env_detail_end_addr(env_end_addr); + + env_cache_bak = env_cache + ENV_PARAM_PART_WORD_SIZE; + /* read all ENV from flash */ + ef_port_read(get_env_detail_addr(), env_cache_bak, get_env_detail_size()); + /* read ENV CRC code from flash */ + ef_port_read(get_cur_using_data_addr() + ENV_PARAM_PART_INDEX_DATA_CRC * 4, + &env_cache[ENV_PARAM_PART_INDEX_DATA_CRC], 4); + /* if ENV CRC32 check is fault, set default for it */ + if (!env_crc_is_ok()) { + EF_INFO("Warning: ENV CRC check failed. Set it to default.\n"); + ef_env_set_default(); + } + } + + } +} +#else +void ef_load_env(void) { + /* ENV area0 current using address default value */ + uint32_t area0_default_cur_using_addr = get_env_start_addr() + EF_ERASE_MIN_SIZE; + /* ENV area1 current using address default value */ + uint32_t area1_default_cur_using_addr = area0_default_cur_using_addr + env_data_section_size / 2; + uint32_t area0_cur_using_addr, area1_cur_using_addr, area0_end_addr, area1_end_addr; + uint32_t area0_crc, area1_crc, area0_saved_count, area1_saved_count; + bool area0_is_valid = true, area1_is_valid = true; + + /* read ENV area0 and area1 current using address */ + ef_port_read(get_env_start_addr(), &area0_cur_using_addr, 4); + ef_port_read(get_env_start_addr() + 4, &area1_cur_using_addr, 4); + /* if ENV is not initialize or flash has dirty data, set it isn't valid */ + if ((area0_cur_using_addr == 0xFFFFFFFF) + || (area0_cur_using_addr > get_env_start_addr() + ENV_AREA_SIZE) + || (area0_cur_using_addr < get_env_start_addr() + EF_ERASE_MIN_SIZE)) { + area0_is_valid = false; + } + if ((area1_cur_using_addr == 0xFFFFFFFF) + || (area1_cur_using_addr > get_env_start_addr() + ENV_AREA_SIZE) + || (area1_cur_using_addr < get_env_start_addr() + EF_ERASE_MIN_SIZE)) { + area1_is_valid = false; + } + /* check area0 end address when it is valid */ + if (area0_is_valid) { + /* read ENV area end address from flash */ + ef_port_read(area0_cur_using_addr + ENV_PARAM_PART_INDEX_END_ADDR * 4, &area0_end_addr, 4); + if ((area0_end_addr == 0xFFFFFFFF) || (area0_end_addr < area0_cur_using_addr) + || (area0_end_addr > area0_cur_using_addr + ENV_USER_SETTING_SIZE)) { + area0_is_valid = false; + } + } + /* check area1 end address when it is valid */ + if (area1_is_valid) { + /* read ENV area end address from flash */ + ef_port_read(area1_cur_using_addr + ENV_PARAM_PART_INDEX_END_ADDR * 4, &area1_end_addr, 4); + if ((area1_end_addr == 0xFFFFFFFF) || (area1_end_addr < area1_cur_using_addr) + || (area1_end_addr > area1_cur_using_addr + ENV_USER_SETTING_SIZE)) { + area1_is_valid = false; + } + } + /* check area0 CRC when it is valid */ + if (area0_is_valid) { + /* read ENV area0 crc32 code from flash */ + ef_port_read(area0_cur_using_addr + ENV_PARAM_PART_INDEX_DATA_CRC * 4, &area0_crc, 4); + /* read ENV from ENV area0 */ + ef_port_read(area0_cur_using_addr, env_cache, area0_end_addr - area0_cur_using_addr); + /* current using data section address is area0 current using data section address */ + set_cur_using_data_addr(area0_cur_using_addr); + if (!env_crc_is_ok()) { + area0_is_valid = false; + } + } + /* check area1 CRC when it is valid */ + if (area1_is_valid) { + /* read ENV area1 crc32 code from flash */ + ef_port_read(area1_cur_using_addr + ENV_PARAM_PART_INDEX_DATA_CRC * 4, &area1_crc, 4); + /* read ENV from ENV area1 */ + ef_port_read(area1_cur_using_addr, env_cache, area1_end_addr - area1_cur_using_addr); + /* current using data section address is area1 current using data section address */ + set_cur_using_data_addr(area1_cur_using_addr); + if (!env_crc_is_ok()) { + area1_is_valid = false; + } + } + /* all ENV area CRC is OK then compare saved count */ + if (area0_is_valid && area1_is_valid) { + /* read ENV area saved count from flash */ + ef_port_read(area0_cur_using_addr + ENV_PARAM_PART_INDEX_SAVED_COUNT * 4, + &area0_saved_count, 4); + ef_port_read(area1_cur_using_addr + ENV_PARAM_PART_INDEX_SAVED_COUNT * 4, + &area1_saved_count, 4); + /* the bigger saved count area is valid */ + if ((area0_saved_count > area1_saved_count)||((area0_saved_count == 0)&&(area1_saved_count == 0xFFFFFFFF))) { + area1_is_valid = false; + } else { + area0_is_valid = false; + } + } + 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 default value */ + next_save_area_addr = area1_default_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) { + /* next save ENV area address is area0 current using address default value */ + next_save_area_addr = area0_default_cur_using_addr; + } else { + /* current using data section address is area1 current using address default value */ + set_cur_using_data_addr(area1_default_cur_using_addr); + /* next save ENV area address default is area0 current using address default value */ + next_save_area_addr = area0_default_cur_using_addr; + /* save current using data section address to flash*/ + save_cur_using_data_addr(area0_default_cur_using_addr); + save_cur_using_data_addr(area1_default_cur_using_addr); + /* set the ENV to default */ + ef_env_set_default(); + } +} +#endif + +/** + * Save ENV to flash. + */ +EfErrCode ef_save_env(void) { + EfErrCode result = EF_NO_ERR; + uint32_t cur_using_addr_bak, move_offset_addr; + size_t env_used_size = get_env_user_used_size(); + + /* ENV ram cache has not changed don't need to save */ + if (!env_cache_changed) { + return result; + } + +#ifndef EF_ENV_USING_PFS_MODE + cur_using_addr_bak = get_cur_using_data_addr(); +#else + cur_using_addr_bak = next_save_area_addr; + /* replace next_save_area_addr with cur_using_data_addr */ + next_save_area_addr = get_cur_using_data_addr(); + set_cur_using_data_addr(cur_using_addr_bak); + /* change the ENV detail end address to next save area address */ + set_env_detail_end_addr(get_cur_using_data_addr() + env_used_size); + /* ENV area saved count +1 */ + env_cache[ENV_PARAM_PART_INDEX_SAVED_COUNT]++; +#endif + + /* wear leveling process, automatic move ENV to next available position */ + while (get_cur_using_data_addr() + env_used_size < get_env_start_addr() + ENV_AREA_SIZE) { + /* calculate and cache CRC32 code */ + env_cache[ENV_PARAM_PART_INDEX_DATA_CRC] = calc_env_crc(); + /* erase ENV */ + result = ef_port_erase(get_cur_using_data_addr(), env_used_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Erased ENV OK.\n"); + break; + } + case EF_ERASE_ERR: { + EF_INFO("Warning: Erased ENV fault!\n"); + EF_INFO("Moving ENV to next available position.\n"); + /* Calculate move offset address. + * Current strategy is optimistic. It will offset the flash erasure minimum size. + */ + move_offset_addr = EF_ERASE_MIN_SIZE; + /* calculate and set next available data section address */ + set_cur_using_data_addr(get_cur_using_data_addr() + move_offset_addr); + /* calculate and set next available ENV detail part end address */ + set_env_detail_end_addr(get_env_detail_end_addr() + move_offset_addr); + continue; + } + } + /* write ENV to flash */ + result = ef_port_write(get_cur_using_data_addr(), env_cache, env_used_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Saved ENV OK.\n"); + break; + } + case EF_WRITE_ERR: { + EF_INFO("Warning: Saved ENV fault!\n"); + EF_INFO("Moving ENV to next available position.\n"); + /* Calculate move offset address. + * Current strategy is optimistic. It will offset the flash erasure minimum size. + */ + move_offset_addr = EF_ERASE_MIN_SIZE; + /* calculate and set next available data section address */ + set_cur_using_data_addr(get_cur_using_data_addr() + move_offset_addr); + /* calculate and set next available ENV detail part end address */ + set_env_detail_end_addr(get_env_detail_end_addr() + move_offset_addr); + continue; + } + } + /* save ENV success */ + if (result == EF_NO_ERR) { + break; + } + } + + if (get_cur_using_data_addr() + env_used_size < get_env_start_addr() + ENV_AREA_SIZE) { + /* current using data section address has changed, save it */ + if (get_cur_using_data_addr() != cur_using_addr_bak) { + save_cur_using_data_addr(get_cur_using_data_addr()); + } + } else { + result = EF_ENV_FULL; + EF_INFO("Error: The flash has no available space to save ENV.\n"); + /* clear current using data section address on flash */ + save_cur_using_data_addr(0xFFFFFFFF); + } + + env_cache_changed = false; + + return result; +} + +/** + * Calculate the cached ENV CRC32 value. + * + * @return CRC32 value + */ +static uint32_t calc_env_crc(void) { + uint32_t crc32 = 0; + + /* Calculate the ENV end address and all ENV data CRC32. + * The 4 is ENV end address bytes size. */ + crc32 = ef_calc_crc32(crc32, &env_cache[ENV_PARAM_PART_INDEX_END_ADDR], 4); + crc32 = ef_calc_crc32(crc32, &env_cache[ENV_PARAM_PART_WORD_SIZE], get_env_detail_size()); + EF_DEBUG("Calculate ENV CRC32 number is 0x%08X.\n", crc32); + + return crc32; +} + +/** + * Check the ENV CRC32 + * + * @return true is ok + */ +static bool env_crc_is_ok(void) { + if (calc_env_crc() == env_cache[ENV_PARAM_PART_INDEX_DATA_CRC]) { + EF_DEBUG("Verify ENV CRC32 result is OK.\n"); + return true; + } else { + return false; + } +} + +/** + * Save current using data section address to flash. + * + * @param cur_data_addr current using data section address + * + * @return result + */ +#ifndef EF_ENV_USING_PFS_MODE +static EfErrCode save_cur_using_data_addr(uint32_t cur_data_addr) { + EfErrCode result = EF_NO_ERR; + + /* erase ENV system section */ + result = ef_port_erase(get_env_start_addr(), 4); + if (result == EF_NO_ERR) { + /* write current using data section address to flash */ + result = ef_port_write(get_env_start_addr(), &cur_data_addr, 4); + if (result == EF_WRITE_ERR) { + EF_INFO("Error: Write system section fault!\n"); + EF_INFO("Note: The ENV can not be used.\n"); + } + } else { + EF_INFO("Error: Erased system section fault!\n"); + EF_INFO("Note: The ENV can not be used\n"); + } + return result; +} +#else +static EfErrCode save_cur_using_data_addr(uint32_t cur_data_addr) { + EfErrCode result = EF_NO_ERR; + uint32_t cur_using_addr[2]; + + /* read area0 and area1 current using data section address for backup */ + ef_port_read(get_env_start_addr(), &cur_using_addr[0], 4); + ef_port_read(get_env_start_addr() + 4, &cur_using_addr[1], 4); + + if (cur_data_addr < get_env_start_addr() + EF_ERASE_MIN_SIZE + env_data_section_size / 2){ + /* current using data section is in ENV area0 */ + cur_using_addr[0] = cur_data_addr; + } else { + /* current using data section is in ENV area1 */ + cur_using_addr[1] = cur_data_addr; + } + /* erase ENV system section */ + result = ef_port_erase(get_env_start_addr(), 8); + if (result == EF_NO_ERR) { + /* write area0 and area1 current using data section address to flash */ + result = ef_port_write(get_env_start_addr(), cur_using_addr, 8); + if (result == EF_WRITE_ERR) { + EF_INFO("Error: Write system section fault!\n"); + EF_INFO("Note: The ENV can not be used.\n"); + } + } else { + EF_INFO("Error: Erased system section fault!\n"); + EF_INFO("Note: The ENV can not be used\n"); + } + return result; +} +#endif + +/** + * Set and save an ENV. If set ENV is success then will save it. + * + * @param key ENV name + * @param value ENV value + * + * @return result + */ +EfErrCode ef_set_and_save_env(const char *key, const char *value) { + EfErrCode result = EF_NO_ERR; + + result = ef_set_env(key, value); + + if (result == EF_NO_ERR) { + result = ef_save_env(); + } + + return result; +} + +#endif /* EF_ENV_USING_WL_MODE */ + +#endif /* EF_USING_ENV */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_iap.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_iap.c new file mode 100644 index 0000000..010bd47 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_iap.c @@ -0,0 +1,265 @@ +/* + * 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: IAP(In-Application Programming) operating interface. + * Created on: 2015-01-05 + */ + +#include + +#ifdef EF_USING_IAP + +/* IAP section backup application section start address in flash */ +static uint32_t bak_app_start_addr = NULL; + +static uint32_t get_bak_app_start_addr(void); + +/** + * Flash IAP function initialize. + * + * @return result + */ +EfErrCode ef_iap_init(void) { + EfErrCode result = EF_NO_ERR; + + bak_app_start_addr = EF_START_ADDR ; + +#if defined(EF_USING_ENV) + bak_app_start_addr += ENV_AREA_SIZE; +#endif + +#if defined(EF_USING_LOG) + bak_app_start_addr += LOG_AREA_SIZE; +#endif + + return result; +} + +/** + * Erase backup area application data. + * + * @param app_size application size + * + * @return result + */ +EfErrCode ef_erase_bak_app(size_t app_size) { + EfErrCode result = EF_NO_ERR; + + result = ef_port_erase(get_bak_app_start_addr(), app_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Erased backup area application OK.\n"); + break; + } + case EF_ERASE_ERR: { + EF_INFO("Warning: Erase backup area application fault!\n"); + /* will return when erase fault */ + return result; + } + } + + return result; +} + + +/** + * Erase user old application + * + * @param user_app_addr application entry address + * @param app_size application size + * + * @return result + */ +EfErrCode ef_erase_user_app(uint32_t user_app_addr, size_t app_size) { + EfErrCode result = EF_NO_ERR; + + result = ef_port_erase(user_app_addr, app_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Erased user application OK.\n"); + break; + } + case EF_ERASE_ERR: { + EF_INFO("Warning: Erase user application fault!\n"); + /* will return when erase fault */ + return result; + } + } + + return result; +} + +/** + * Erase old bootloader + * + * @param bl_addr bootloader entry address + * @param bl_size bootloader size + * + * @return result + */ +EfErrCode ef_erase_bl(uint32_t bl_addr, size_t bl_size) { + EfErrCode result = EF_NO_ERR; + + result = ef_port_erase(bl_addr, bl_size); + switch (result) { + case EF_NO_ERR: { + EF_INFO("Erased bootloader OK.\n"); + break; + } + case EF_ERASE_ERR: { + EF_INFO("Warning: Erase bootloader fault!\n"); + /* will return when erase fault */ + return result; + } + } + + return result; +} + +/** + * Write data of application to backup area. + * + * @param data a part of application + * @param size data size + * @param cur_size current write application size + * @param total_size application total size + * + * @return result + */ +EfErrCode ef_write_data_to_bak(uint8_t *data, size_t size, size_t *cur_size, + size_t total_size) { + EfErrCode result = EF_NO_ERR; + + /* make sure don't write excess data */ + if (*cur_size + size > total_size) { + size = total_size - *cur_size; + } + + result = ef_port_write(get_bak_app_start_addr() + *cur_size, (uint32_t *) data, size); + switch (result) { + case EF_NO_ERR: { + *cur_size += size; + EF_INFO("Write data to backup area OK.\n"); + break; + } + case EF_WRITE_ERR: { + EF_INFO("Warning: Write data to backup area fault!\n"); + break; + } + } + + return result; +} + +/** + * Copy backup area application to application entry. + * + * @param user_app_addr application entry address + * @param app_size application size + * + * @return result + */ +EfErrCode ef_copy_app_from_bak(uint32_t user_app_addr, size_t app_size) { + size_t cur_size; + uint32_t app_cur_addr, bak_cur_addr; + EfErrCode result = EF_NO_ERR; + /* 32 words size buffer */ + uint32_t buff[32]; + + /* cycle copy data */ + for (cur_size = 0; cur_size < app_size; cur_size += sizeof(buff)) { + app_cur_addr = user_app_addr + cur_size; + bak_cur_addr = get_bak_app_start_addr() + cur_size; + ef_port_read(bak_cur_addr, buff, sizeof(buff)); + result = ef_port_write(app_cur_addr, buff, sizeof(buff)); + if (result != EF_NO_ERR) { + break; + } + } + + switch (result) { + case EF_NO_ERR: { + EF_INFO("Write data to application entry OK.\n"); + break; + } + case EF_WRITE_ERR: { + EF_INFO("Warning: Write data to application entry fault!\n"); + break; + } + } + + return result; +} + +/** + * Copy backup area bootloader to bootloader entry. + * + * @param bl_addr bootloader entry address + * @param bl_size bootloader size + * + * @return result + */ +EfErrCode ef_copy_bl_from_bak(uint32_t bl_addr, size_t bl_size) { + size_t cur_size; + uint32_t bl_cur_addr, bak_cur_addr; + EfErrCode result = EF_NO_ERR; + /* 32 words buffer */ + uint32_t buff[32]; + + /* cycle copy data by 32bytes buffer */ + for (cur_size = 0; cur_size < bl_size; cur_size += sizeof(buff)) { + bl_cur_addr = bl_addr + cur_size; + bak_cur_addr = get_bak_app_start_addr() + cur_size; + ef_port_read(bak_cur_addr, buff, sizeof(buff)); + result = ef_port_write(bl_cur_addr, buff, sizeof(buff)); + if (result != EF_NO_ERR) { + break; + } + } + + switch (result) { + case EF_NO_ERR: { + EF_INFO("Write data to bootloader entry OK.\n"); + break; + } + case EF_WRITE_ERR: { + EF_INFO("Warning: Write data to bootloader entry fault!\n"); + break; + } + } + + return result; +} + +/** + * Get IAP section start address in flash. + * + * @return size + */ +static uint32_t get_bak_app_start_addr(void) { + EF_ASSERT(bak_app_start_addr); + return bak_app_start_addr; +} + +#endif /* EF_USING_IAP */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c new file mode 100644 index 0000000..44f00c8 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_log.c @@ -0,0 +1,439 @@ +/* + * 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: Save logs to flash. + * Created on: 2015-06-04 + */ + +#include + +#ifdef EF_USING_LOG + +/* the stored logs start address and end address. It's like a ring buffer which implement by flash. */ +static uint32_t log_start_addr = 0, log_end_addr = 0; +/* saved log area address for flash */ +static uint32_t log_area_start_addr = 0; +/* initialize OK flag */ +static bool init_ok = false; + +static void find_start_and_end_addr(void); +static uint32_t get_next_flash_sec_addr(uint32_t cur_addr); + +/** + * The flash save log function initialize. + * + * @return result + */ +EfErrCode ef_log_init(void) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(LOG_AREA_SIZE); + EF_ASSERT(EF_ERASE_MIN_SIZE); + /* the log area size must be an integral multiple of erase minimum size. */ + EF_ASSERT(LOG_AREA_SIZE % EF_ERASE_MIN_SIZE == 0); + /* the log area size must be more than twice of EF_ERASE_MIN_SIZE */ + EF_ASSERT(LOG_AREA_SIZE / EF_ERASE_MIN_SIZE >= 2); + +#ifdef EF_USING_ENV + log_area_start_addr = EF_START_ADDR + ENV_AREA_SIZE; +#else + log_area_start_addr = EF_START_ADDR; +#endif + + /* find the log store start address and end address */ + find_start_and_end_addr(); + /* initialize OK */ + init_ok = true; + + return result; +} + +/** + * Find the log store start address and end address. + * It's like a ring buffer which implement by flash. + * The flash log area has two state when find start address and end address. + * state 1 state 2 + * |============| |============| + * log area start--> |############| <-- start address |############| <-- end address + * |############| | empty | + * |------------| |------------| + * |############| |############| <-- start address + * |############| |############| + * |------------| |------------| + * | . | | . | + * | . | | . | + * | . | | . | + * |------------| |------------| + * |############| <-- end address |############| + * | empty | |############| + * log area end --> |============| |============| + * + * LOG_AREA_SIZE = log area end - log area star + * + */ +static void find_start_and_end_addr(void) { + size_t cur_size = 0; + FlashSecrorStatus cur_sec_status, last_sec_status; + uint32_t cur_using_sec_addr = 0; + /* all status sector counts */ + size_t empty_sec_counts = 0, using_sec_counts = 0, full_sector_counts = 0; + /* total sector number */ + size_t total_sec_num = LOG_AREA_SIZE / EF_ERASE_MIN_SIZE; + /* see comment of find_start_and_end_addr function */ + uint8_t cur_log_sec_state = 0; + + /* get the first sector status */ + cur_sec_status = ef_get_sector_status(log_area_start_addr, EF_ERASE_MIN_SIZE); + last_sec_status = cur_sec_status; + + for (cur_size = EF_ERASE_MIN_SIZE; cur_size < LOG_AREA_SIZE; cur_size += EF_ERASE_MIN_SIZE) { + /* get current sector status */ + cur_sec_status = ef_get_sector_status(log_area_start_addr + cur_size, EF_ERASE_MIN_SIZE); + /* compare last and current status */ + switch (last_sec_status) { + case FLASH_SECTOR_EMPTY: { + switch (cur_sec_status) { + case FLASH_SECTOR_EMPTY: + break; + case FLASH_SECTOR_USING: + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + case FLASH_SECTOR_FULL: + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + } + empty_sec_counts++; + break; + } + case FLASH_SECTOR_USING: { + switch (cur_sec_status) { + case FLASH_SECTOR_EMPTY: + /* like state 1 */ + cur_log_sec_state = 1; + log_start_addr = log_area_start_addr; + cur_using_sec_addr = log_area_start_addr + cur_size - EF_ERASE_MIN_SIZE; + break; + case FLASH_SECTOR_USING: + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + case FLASH_SECTOR_FULL: + /* like state 2 */ + cur_log_sec_state = 2; + log_start_addr = log_area_start_addr + cur_size; + cur_using_sec_addr = log_area_start_addr + cur_size - EF_ERASE_MIN_SIZE; + break; + } + using_sec_counts++; + break; + } + case FLASH_SECTOR_FULL: { + switch (cur_sec_status) { + case FLASH_SECTOR_EMPTY: + /* like state 1 */ + if (cur_log_sec_state == 2) { + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + } else { + cur_log_sec_state = 1; + log_start_addr = log_area_start_addr; + /* word alignment */ + log_end_addr = log_area_start_addr + cur_size - 4; + cur_using_sec_addr = log_area_start_addr + cur_size - EF_ERASE_MIN_SIZE; + } + break; + case FLASH_SECTOR_USING: + if(total_sec_num <= 2) { + /* like state 1 */ + cur_log_sec_state = 1; + log_start_addr = log_area_start_addr; + cur_using_sec_addr = log_area_start_addr + cur_size; + } else { + /* state 1 or 2*/ + } + break; + case FLASH_SECTOR_FULL: + break; + } + full_sector_counts++; + break; + } + } + last_sec_status = cur_sec_status; + } + + /* the last sector status counts */ + if (cur_sec_status == FLASH_SECTOR_EMPTY) { + empty_sec_counts++; + } else if (cur_sec_status == FLASH_SECTOR_USING) { + using_sec_counts++; + } else if (cur_sec_status == FLASH_SECTOR_FULL) { + full_sector_counts++; + } + + if (using_sec_counts > 1) { + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + } else if (empty_sec_counts == total_sec_num) { + log_start_addr = log_end_addr = log_area_start_addr; + } else if (full_sector_counts == total_sec_num) { + /* this state is almost impossible */ + EF_DEBUG("Error: Log area error! Now will clean all log area.\n"); + ef_log_clean(); + return; + } else if (((cur_log_sec_state == 1) && (cur_using_sec_addr != 0)) + || (cur_log_sec_state == 2)) { + /* find the end address */ + log_end_addr = ef_find_sec_using_end_addr(cur_using_sec_addr, EF_ERASE_MIN_SIZE); + } +} + +/** + * Get log used flash total size. + * + * @return log used flash total size + */ +size_t ef_log_get_used_size(void) { + EF_ASSERT(log_start_addr); + EF_ASSERT(log_end_addr); + + /* must be call this function after initialize OK */ + EF_ASSERT(init_ok); + + if (log_start_addr < log_end_addr) { + return log_end_addr - log_start_addr + 4; + } else if (log_start_addr > log_end_addr) { + return LOG_AREA_SIZE - (log_start_addr - log_end_addr) + 4; + } else { + return 0; + } +} + +/** + * Read log from flash. + * + * @param index index for saved log. + * Minimum index is 0. + * Maximum index is log used flash total size - 1. + * @param log the log which will read from flash + * @param size read bytes size + * + * @return result + */ +EfErrCode ef_log_read(size_t index, uint32_t *log, size_t size) { + EfErrCode result = EF_NO_ERR; + size_t cur_using_size = ef_log_get_used_size(); + size_t read_size_temp = 0; + + EF_ASSERT(size % 4 == 0); + EF_ASSERT(index + size <= cur_using_size); + /* must be call this function after initialize OK */ + EF_ASSERT(init_ok); + + if (!size) { + return result; + } + + if (log_start_addr < log_end_addr) { + result = ef_port_read(log_area_start_addr + index, log, size); + } else if (log_start_addr > log_end_addr) { + if (log_start_addr + index + size <= log_area_start_addr + LOG_AREA_SIZE) { + /* Flash log area + * |--------------| + * log_area_start_addr --> |##############| + * |##############| + * |##############| + * |--------------| + * |##############| + * |##############| + * |##############| <-- log_end_addr + * |--------------| + * log_start_addr --> |##############| + * read start --> |**************| <-- read end + * |##############| + * |--------------| + * + * read from (log_start_addr + index) to (log_start_addr + index + size) + */ + result = ef_port_read(log_start_addr + index, log, size); + } else if (log_start_addr + index < log_area_start_addr + LOG_AREA_SIZE) { + /* Flash log area + * |--------------| + * log_area_start_addr --> |**************| <-- read end + * |##############| + * |##############| + * |--------------| + * |##############| + * |##############| + * |##############| <-- log_end_addr + * |--------------| + * log_start_addr --> |##############| + * read start --> |**************| + * |**************| + * |--------------| + * read will by 2 steps + * step1: read from (log_start_addr + index) to flash log area end address + * step2: read from flash log area start address to read size's end address + */ + read_size_temp = (log_area_start_addr + LOG_AREA_SIZE) - (log_start_addr + index); + result = ef_port_read(log_start_addr + index, log, read_size_temp); + if (result == EF_NO_ERR) { + result = ef_port_read(log_area_start_addr, log + read_size_temp, + size - read_size_temp); + } + } else { + /* Flash log area + * |--------------| + * log_area_start_addr --> |##############| + * read start --> |**************| + * |**************| <-- read end + * |--------------| + * |##############| + * |##############| + * |##############| <-- log_end_addr + * |--------------| + * log_start_addr --> |##############| + * |##############| + * |##############| + * |--------------| + * read from (log_start_addr + index - LOG_AREA_SIZE) to read size's end address + */ + result = ef_port_read(log_start_addr + index - LOG_AREA_SIZE, log, size); + } + } + + return result; +} + +/** + * Write log to flash. + * + * @param log the log which will be write to flash + * @param size write bytes size + * + * @return result + */ +EfErrCode ef_log_write(const uint32_t *log, size_t size) { + EfErrCode result = EF_NO_ERR; + size_t cur_using_size = ef_log_get_used_size(), write_size = 0, writable_size = 0; + uint32_t write_addr, erase_addr; + + EF_ASSERT(size % 4 == 0); + /* must be call this function after initialize OK */ + EF_ASSERT(init_ok); + + /* write address is after log end address */ + write_addr = log_end_addr + 4; + /* write the already erased but not used area */ + writable_size = EF_ERASE_MIN_SIZE - ((write_addr - log_area_start_addr) % EF_ERASE_MIN_SIZE); + if (writable_size != EF_ERASE_MIN_SIZE) { + if (size > writable_size) { + result = ef_port_write(write_addr, log, writable_size); + if (result != EF_NO_ERR) { + goto exit; + } + write_size += writable_size; + } else { + result = ef_port_write(write_addr, log, size); + log_end_addr = write_addr + size - 4; + goto exit; + } + } + /* erase and write remain log */ + while (true) { + /* calculate next available sector address */ + erase_addr = write_addr = get_next_flash_sec_addr(write_addr - 4); + /* move the flash log start address to next available sector address */ + if (log_start_addr == erase_addr) { + log_start_addr = get_next_flash_sec_addr(log_start_addr); + } + /* erase sector */ + result = ef_port_erase(erase_addr, EF_ERASE_MIN_SIZE); + if (result == EF_NO_ERR) { + if (size - write_size > EF_ERASE_MIN_SIZE) { + result = ef_port_write(write_addr, log + write_size / 4, EF_ERASE_MIN_SIZE); + if (result != EF_NO_ERR) { + goto exit; + } + log_end_addr = write_addr + EF_ERASE_MIN_SIZE - 4; + write_size += EF_ERASE_MIN_SIZE; + write_addr += EF_ERASE_MIN_SIZE; + } else { + result = ef_port_write(write_addr, log + write_size / 4, size - write_size); + if (result != EF_NO_ERR) { + goto exit; + } + log_end_addr = write_addr + (size - write_size) - 4; + break; + } + } else { + goto exit; + } + } + +exit: + return result; +} + +/** + * Get next flash sector address.The log total sector like ring buffer which implement by flash. + * + * @param cur_addr cur flash address + * + * @return next flash sector address + */ +static uint32_t get_next_flash_sec_addr(uint32_t cur_addr) { + size_t cur_sec_id = (cur_addr - log_area_start_addr) / EF_ERASE_MIN_SIZE; + size_t sec_total_num = LOG_AREA_SIZE / EF_ERASE_MIN_SIZE; + if (cur_sec_id + 1 >= sec_total_num) { + /* return to ring head */ + return log_area_start_addr; + } else { + return log_area_start_addr + (cur_sec_id + 1) * EF_ERASE_MIN_SIZE; + } +} + +/** + * Clean all log which in flash. + * + * @return result + */ +EfErrCode ef_log_clean(void) { + EfErrCode result = EF_NO_ERR; + + EF_ASSERT(log_area_start_addr); + + /* clean address */ + log_start_addr = log_end_addr = log_area_start_addr; + /* erase log flash area */ + result = ef_port_erase(log_area_start_addr, LOG_AREA_SIZE); + + return result; +} + +#endif /* EF_USING_LOG */ diff --git a/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c new file mode 100644 index 0000000..7a12a56 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easyflash/src/ef_utils.c @@ -0,0 +1,160 @@ +/* + * 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: Some utils for this library. + * Created on: 2015-01-14 + */ + +#include + +static const uint32_t crc32_table[] = +{ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +/** + * Calculate the CRC32 value of a memory buffer. + * + * @param crc accumulated CRC32 value, must be 0 on first call + * @param buf buffer to calculate CRC32 value for + * @param size bytes in buffer + * + * @return calculated CRC32 value + */ +uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size) +{ + const uint8_t *p; + + p = buf; + crc = crc ^ ~0U; + + while (size--) { + crc = crc32_table[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + } + + return crc ^ ~0U; +} + +/** + * Get this flash sector current status. + * + * @param addr sector address + * @param sec_size sector address + * + * @return the flash sector current status + */ +FlashSecrorStatus ef_get_sector_status(uint32_t addr, size_t sec_size) { + uint32_t cur_using_addr = ef_find_sec_using_end_addr(addr, sec_size); + /* get current status by current using address */ + if (cur_using_addr == addr) { + return FLASH_SECTOR_EMPTY; + } else if (cur_using_addr < addr + sec_size - 4) { + return FLASH_SECTOR_USING; + } else { + return FLASH_SECTOR_FULL; + } +} + +/** + * Find the current flash sector using end address by continuous 0xFF. + * + * @param addr sector address + * @param sec_size sector address + * + * @return current flash sector using end address + */ +uint32_t ef_find_sec_using_end_addr(uint32_t addr, size_t sec_size) { + size_t start, continue_ff; + /* counts continuous 0xFF */ + for (start = 0; start < sec_size; start++) { + if (*(uint8_t *) (addr + start) == 0xFF) { + /* make sure it is not the last byte */ + if (start < sec_size - 1) { + /* start counts */ + for (continue_ff = 1; continue_ff < sec_size - start; continue_ff++) { + if (*(uint8_t *) (addr + start + continue_ff) != 0xFF) { + start += continue_ff; + break; + } + } + /* all sector counts finish */ + if (continue_ff == sec_size - start) { + break; + } + } + } + } + if ((start == 0) && (continue_ff == sec_size)) { + /* from 0 to sec_size all sector is 0xFF, so the sector is empty */ + return addr; + } else if (start < sec_size) { + /* form start to sec_size all area is 0xFF, so it's used part of the sector */ + return addr + start; + } else { + /* all sector not has continuous 0xFF, alignment by word */ + return addr + sec_size - 4; + } +} diff --git a/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_cfg.h b/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_cfg.h new file mode 100644 index 0000000..4c49df6 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_cfg.h @@ -0,0 +1,37 @@ +/* + * This file is part of the EasyLogger 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 flash log plugin. + * Created on: 2015-07-30 + */ + +#ifndef _ELOG_FLASH_CFG_H_ +#define _ELOG_FLASH_CFG_H_ + +/* EasyLogger flash log plugin's using buffer mode */ +#define ELOG_FLASH_USING_BUF_MODE +/* EasyLogger flash log plugin's RAM buffer size */ +#define ELOG_FLASH_BUF_SIZE 1024 + +#endif /* _ELOG_FLASH_CFG_H_ */ diff --git a/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_port.c b/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_port.c new file mode 100644 index 0000000..790b2e1 --- /dev/null +++ b/demo/os/rt-thread/stm32f10x/components/easylogger/plugins/flash/elog_flash_port.c @@ -0,0 +1,71 @@ +/* + * This file is part of the EasyLogger 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: Portable interface for EasyLogger's flash log pulgin. + * Created on: 2015-07-28 + */ + +#include "elog_flash.h" +#include +#include + +static struct rt_semaphore flash_log_lock; + +/** + * EasyLogger flash log pulgin port initialize + * + * @return result + */ +ElogErrCode elog_flash_port_init(void) { + ElogErrCode result = ELOG_NO_ERR; + + rt_sem_init(&flash_log_lock, "elog flash lock", 1, RT_IPC_FLAG_PRIO); + + return result; +} + +/** + * output flash saved log port interface + * + * @param log flash saved log + * @param size log size + */ +void elog_flash_port_output(const char *log, size_t size) { + /* output to terminal */ + rt_kprintf("%.*s", size, log); +} + +/** + * flash log lock + */ +void elog_flash_port_lock(void) { + rt_sem_take(&flash_log_lock, RT_WAITING_FOREVER); +} + +/** + * flash log unlock + */ +void elog_flash_port_unlock(void) { + rt_sem_release(&flash_log_lock); +} diff --git a/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c b/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c index 9377bb8..e1e1034 100644 --- a/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c +++ b/demo/os/rt-thread/stm32f10x/components/easylogger/port/elog_port.c @@ -26,7 +26,8 @@ * Created on: 2015-04-28 */ -#include "elog.h" +#include +#include #include #include @@ -54,7 +55,8 @@ ElogErrCode elog_port_init(void) { void elog_port_output(const char *log, size_t size) { /* output to terminal */ rt_kprintf("%.*s", size, log); - //TODO output to flash + /* output to flash */ + elog_flash_write(log, size); } /** diff --git a/easylogger/plugins/flash/elog_flash.h b/easylogger/plugins/flash/elog_flash.h index fa9ee41..19fe645 100644 --- a/easylogger/plugins/flash/elog_flash.h +++ b/easylogger/plugins/flash/elog_flash.h @@ -30,7 +30,7 @@ #define __ELOG_FLASH_H__ #include -#include "elog_flash_cfg.h" +#include #ifdef __cplusplus extern "C" {