提交 836e6a71 编写于 作者: A armink

1、【增加】stm32f10x裸机的Demo。

Signed-off-by: Narmink <armink.ztl@gmail.com>
上级 40583525
# EasyFlash 使用说明
标签(空格分隔): EasyFlash Flash
---
## 1、介绍
......@@ -25,7 +23,8 @@ EasyFlash是一款开源的轻量级嵌入式Flash存储器库,主要为MCU(Mi
|\flash\src\flash_utils.c |EasyFlash常用小工具,例如:CRC32|
|\flash\src\flash.c |目前只包含EasyFlash初始化方法|
|\flash\port\flash_port.c |不同平台下的EasyFlash移植接口及配置参数|
|\demo\stm32f10x |stm32f10x平台下的demo|
|\demo\non_os\stm32f10x |stm32f10x裸机的demo|
|\demo\rtt\stm32f10x |stm32f10x基于RT-Thread的demo|
|\demo\stm32f4xx |stm32f4xx平台下的demo|
### 1.2、资源占用
......@@ -39,7 +38,7 @@ Demo平台:STM32F103RET6 + RT-Thread 1.2.2 + Env(2K bytes)
### 1.3、支持平台
目前已移植平台有 `stm32f10x``stm32f4xx` 系列的片内Flash,这个也是笔者产品使用的平台。其余平台的移植难度不大,在项目的设计之初就有考虑针对所有平台的适配性问题(64位除外),所以对所有移植接口都有做预留。移植只需修改 `\flash\port\flash_port.c` 一个文件,实现里面的擦、写、读及打印功能即可。
目前已移植硬件平台有 `stm32f10x``stm32f4xx` 系列的片内Flash,这个也是笔者产品使用的平台。其余平台的移植难度不大,在项目的设计之初就有考虑针对所有平台的适配性问题(64位除外),所以对所有移植接口都有做预留。移植只需修改 `\flash\port\flash_port.c` 一个文件,实现里面的擦、写、读及打印功能即可。
欢迎大家 **fork and pull request**([Github](https://github.com/armink/EasyFlash)|[OSChina](http://git.oschina.net/armink/EasyFlash)|[Coding](https://coding.net/u/armink/p/EasyFlash/git)) 。开源软件的成功离不开所有人的努力,也希望该项目能够帮助大家降低开发周期,让产品更早的获得成功。
......
# stm32f10x 平台测试例子
# stm32f10x Demo
---
## 1、简介
## 1、文件说明
通过 `app\src\app_task.c``test_env()` 方法来演示环境变量的读取及修改功能,每次系统启动并且初始化EasyFlash成功后会调用该方法。
`non_os` 裸机(无操作系统)的测试Demo
`test_env()` 方法中,会先读取系统的启动次数,读取后对启动次数加一,再存入到环境变量中,实现记录系统启动(开机)次数的功能。
### 1.1、使用方法
- 1、打开电脑的终端与Demo的串口1进行连接,串口配置 115200 8 1 N,此时在终端中就可以输入《EasyFlash 使用说明》中提到的常用命令(目前只有环境变量操作命令)。
- 2、在终端输入 `printenv` 查看当前的系统启动次数,即 `boot_times` 的value。
- 3、输入 `reboot` 命令,或者直接重启Demo平台
- 4、等待系统重启完成后,再次输入 `printenv` ,即可查看到启动次数有所增加
> 注意:对于无法连接终端的用户,也可以使用仿真器与Demo平台进行连接,来观察启动次数的变化
## 2、文件说明
`\demo\stm32f10x\components\flash\port\flash_port.c` 移植参考文件
`\demo\stm32f10x\RVMDK` 下为Keil工程文件
`\demo\stm32f10x\EWARM` 下为IAR工程文件
\ No newline at end of file
`rtt` 基于RT-Thread操作系统平台的测试Demo
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
此差异已折叠。
<?xml version="1.0" encoding="iso-8859-1"?>
<Project>
<Desktop>
<Static>
<Debug-Log>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1621</ColumnWidth1></Debug-Log>
<Build>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build>
<Workspace>
<ColumnWidths>
<Column0>167</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<col-names>
<item>Disassembly</item><item>_I0</item></col-names>
<col-widths>
<item>500</item><item>20</item></col-widths>
<DisasmHistory/>
<PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ShowCodeCoverage>1</ShowCodeCoverage><ShowInstrProfiling>1</ShowInstrProfiling></Disassembly>
<Find-All-Declarations><ColumnWidth0>580</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>994</ColumnWidth2></Find-All-Declarations><WATCH_1><expressions><item>eMasterRcvState</item><item>eMasterSndState</item><item>CpuUsageMinor</item><item/></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>138</item><item>150</item><item>100</item><item>221</item></col-widths><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>StaticWatch</Factory></Window></Windows></PreferedWindows></WATCH_1><Auto><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>WATCH_1</Factory></Window><Window><Factory>StaticWatch</Factory></Window></Windows></PreferedWindows><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>100</item><item>150</item><item>100</item><item>100</item></col-widths></Auto><StaticWatch><expressions><item></item></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>140</item><item>150</item><item>100</item><item>139</item></col-widths></StaticWatch></Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-27820-6871</Identity>
<TabName>Debug Log</TabName>
<Factory>Debug-Log</Factory>
<Session/>
</Tab>
<Tab>
<Identity>TabID-27297-6881</Identity>
<TabName>Build</TabName>
<Factory>Build</Factory>
<Session/>
</Tab>
<Tab><Identity>TabID-23458-14555</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-5800-6874</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>EasyFlash</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd1><Wnd3><Tabs><Tab><Identity>TabID-15165-9557</Identity><TabName>Live Watch</TabName><Factory>StaticWatch</Factory></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\app\src\app.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>112</SelStart2><SelEnd2>112</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\components\others\bsp.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>157</YPos2><SelStart2>5817</SelStart2><SelEnd2>5817</SelEnd2></Tab><ActiveTab>1</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-03658f08><key>iaridepm.enu1</key></Toolbar-03658f08><Toolbar-0af72e80><key>armjlink.enu1</key></Toolbar-0af72e80><Toolbar-0af72840><key>debuggergui.enu1</key></Toolbar-0af72840></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>727</Bottom><Right>241</Right><x>-2</x><y>-2</y><xscreen>100</xscreen><yscreen>197</yscreen><sizeHorzCX>59524</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>144643</sizeVertCX><sizeVertCY>753878</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>727</Bottom><Right>477</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>206825</sizeHorzCY><sizeVertCX>285119</sizeVertCX><sizeVertCY>753878</sizeVertCY></Rect></Wnd3></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>195</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>197</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203723</sizeHorzCY><sizeVertCX>59524</sizeVertCX><sizeVertCY>203723</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>
[Stack]
FillEnabled=0
OverflowWarningsEnabled=1
WarningThreshold=90
SpWarningsEnabled=1
WarnLogOnly=1
UseTrigger=1
TriggerName=main
LimitSize=0
ByteLimit=50
[DebugChecksum]
Checksum=-181543210
[Exceptions]
StopOnUncaught=_ 0
StopOnThrow=_ 0
[CallStack]
ShowArgs=0
[Disassembly]
MixedMode=1
[JLinkDriver]
CStepIntDis=_ 0
[watch_formats]
Fmt0={W}0:CpuUsageMinor 3 0
Fmt1={W}42:CpuUsageMajor 3 0
Fmt2={W}42:CpuUsageMinor 3 0
[SWOTraceHWSettings]
OverrideDefaultClocks=0
CpuClock=72000000
ClockAutoDetect=0
ClockWanted=2000000
JtagSpeed=2250000
Prescaler=32
TimeStampPrescIndex=0
TimeStampPrescData=0
PcSampCYCTAP=1
PcSampPOSTCNT=15
PcSampIndex=0
DataLogMode=0
ITMportsEnable=0
ITMportsTermIO=0
ITMportsLogFile=0
ITMlogFile=$PROJ_DIR$\ITM.log
[Interrupts]
Enabled=1
[MemoryMap]
Enabled=0
Base=0
UseAuto=0
TypeViolation=1
UnspecRange=1
ActionState=1
[Trace1]
Enabled=0
ShowSource=1
[PowerLog]
LogEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=0
Title0=I0
Symbol0=0 4
LiveEnabled=0
LiveFile=PowerLogLive.log
[DataLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
[EventLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
Title0=Ch0
Symbol0=0 4
Title1=Ch1
Symbol1=0 4
Title2=Ch2
Symbol2=0 4
Title3=Ch3
Symbol3=0 4
SumSortOrder=0
Event0=1 1 1
Event1=1 1 1
Event2=1 1 1
Event3=1 1 1
[InterruptLog]
LogEnabled=0
SumEnabled=0
GraphEnabled=0
ShowTimeLog=1
ShowTimeSum=1
SumSortOrder=0
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
Category=_ 0
[TermIOLog]
LoggingEnabled=_ 0
LogFile=_ ""
[Trace2]
Enabled=0
ShowSource=0
[SWOTraceWindow]
PcSampling=0
InterruptLogs=0
ForcedTimeStamps=0
EventCPI=0
EventEXC=0
EventFOLD=0
EventLSU=0
EventSLEEP=0
[PowerProbe]
Frequency=10000
Probe0=I0
ProbeSetup0=2 1 1 2 0 0
[CallStackLog]
Enabled=0
[DriverProfiling]
Enabled=0
Mode=3
Graph=0
Symbiont=0
Exclusions=
[Disassemble mode]
mode=0
[Breakpoints2]
Count=0
[Aliases]
Count=0
SuppressDialog=0
<?xml version="1.0" encoding="iso-8859-1"?>
<Workspace>
<ConfigDictionary>
<CurrentConfigs><Project>EasyFlash/stm32f103xE</Project></CurrentConfigs></ConfigDictionary>
<Desktop>
<Static>
<Workspace>
<ColumnWidths>
<Column0>240</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1215</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>19</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log><Find-All-Declarations><ColumnWidth0>580</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>994</ColumnWidth2></Find-All-Declarations></Static>
<Windows>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-30370-1297</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>EasyFlash</ExpandedNode><ExpandedNode>EasyFlash/FreeModbusMaster</ExpandedNode><ExpandedNode>EasyFlash/FreeModbusMaster/Modbus</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-24390-6730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-3984-13619</Identity><TabName>Find All Declarations</TabName><Factory>Find-All-Declarations</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\app\src\app.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>137</SelStart2><SelEnd2>137</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-03658f08><key>iaridepm.enu1</key></Toolbar-03658f08></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>744</Bottom><Right>314</Right><x>-2</x><y>-2</y><xscreen>510</xscreen><yscreen>51</yscreen><sizeHorzCX>303571</sizeHorzCX><sizeHorzCY>52740</sizeHorzCY><sizeVertCX>188095</sizeVertCX><sizeVertCY>771458</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>178</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>180</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>186143</sizeHorzCY><sizeVertCX>303571</sizeVertCX><sizeVertCY>52740</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
;* File Name : startup_stm32f10x_hd.s
;* Author : MCD Application Team
;* Version : V3.5.0
;* Date : 11-March-2011
;* Description : STM32F10x High Density Devices vector table for MDK-ARM
;* toolchain.
;* This module performs:
;* - Set the initial SP
;* - Set the initial PC == Reset_Handler
;* - Set the vector table entries with the exceptions ISR address
;* - Configure the clock system and also configure the external
;* SRAM mounted on STM3210E-EVAL board to be used as data
;* memory (optional, to be enabled by user)
;* - Branches to __main in the C library (which eventually
;* calls main()).
;* After Reset the CortexM3 processor is in Thread mode,
;* priority is Privileged, and the Stack is set to Main.
;* <<< Use Configuration Wizard in Context Menu >>>
;*******************************************************************************
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;*******************************************************************************
; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>
Stack_Size EQU 0x00000400
AREA STACK, NOINIT, READWRITE, ALIGN=3