embed
=====
This example illustrates a simple C program, suitable for embedded
applications.
The main C program is contained in main.c. This has a main() function, which
calls subroutines to show the use of printf(), sprintf(), floating point
printf() and malloc(). This can be compiled/linked on its own and executed
in the semihosting environment (see build a below). Alternatively, the project
can be built as an embedded application with no semihosting (builds b & c).
This example can be built in three different ways, in increasing order of
complexity:
a. Non-embedded (semihosted), scatterloaded
b. Embedded, with ROM fixed at 0x0, scatterloaded
c. Embedded, ROM/RAM remapped, scatterloaded
For options b and c, all hard coded addresses are located in the scatterfile
To build the example, either:
- use the supplied batch files (build_a.bat, build_b.bat, build_c.bat), or
- use the supplied CodeWarrior project file (embed.mcp, with 3 targets:
Semihosted, EmbeddedScatter, EmbeddedScatterRemap), or
- create your own make files.
These create an ELF image (embed.axf) suitable for loading into an ARM
debugger. A Motorola32 ROM image (embed.m32) is also created, suitable
for loading into a target, for example, downloading into the flash memory
of an ARM Integrator board.
To convert it into an embeddable application, additional files are provided:
1. vectors.s contains exception vectors and exception handlers. Where there
is ROM fixed at 0x0 (build_b), these are hard-coded at 0x0.
Where ROM/RAM remapping occurs (build_c), these are copied from ROM to
RAM.
2. init.s performs ROM/RAM remapping (if required), initializes stack
pointers and interrupts for each mode, and finally branches to __main
in the C library (which eventually calls main()).
3. retarget.c implements a 'retarget' layer for low-level I/O. Typically,
this would contain your own target-dependent implementations of
fputc(), ferror(), etc. This example provides implementations of
fputc(), ferror(), _sys_exit(), _ttywrch() and
__user_initial_stackheap(). Here, semihosting SWIs are used to
display text onto the console of the host debugger. This mechanism is
portable across ARMulator, Angel and Multi-ICE.
Alternatively, to output characters from the serial port of an ARM
Integrator Board (see serial.c), use '#define USE_SERIAL_PORT' or
compile with '-DUSE_SERIAL_PORT'.
4. serial.c implements a simple (polled) RS232 serial driver for the ARM
Integrator Board. It outputs single characters on Serial
Port A at 38400 Baud, 8 bit, no parity, 1 stop bit. To monitor the
characters output, use a null-modem cable to connect Serial Port A to
an RS232 terminal or PC running a terminal emulator, e.g. HyperTerminal.
5. In addition the files stack.s and heap.s are used to create dummy variables
which are placed in memory by the scatter load file. These can then be used
to place the stack and heap respectively.
6. Finally uart.c instantiates a struction corresponding to the layout of
the uart registers. This structure is located in memory by the scatter load
file.
To ensure that no functions which use semihosting SWIs are linked in from the
C library, __use_no_semihosting_swi is used for the 2 'embeddable' builds.
The 3 different builds can be executed either on the ARMulator, or on real
hardware (e.g. Integrator board via Multi-ICE). To run the examples on real
hardware, please note:
i. For Semihosted (build_a) build targets, set $top_of_memory to a suitable
value via the debugger. The (unexpanded) Integrator CM has 256KB of SSRAM
fitted, so set $top_of_memory=0x40000. If additional SDRAM is fitted, set
$top_of_memory appropriately. It is not necessary to set $top_of_memory for
the other builds, because they implement __user_initial_stackheap().
ii. For EmbeddedScatter (build_b.bat) and EmbeddedScatterRemap (build_c.bat)
build targets, set $vector_catch=0 to prevent exceptions being caught, and to
free up a watchpoint unit in the EmbeddedICE Logic.
iii. EmbeddedScatterRemap (build_c.bat) is intended to be downloaded into Flash
(see below).
Building for Thumb
------------------
The supplied batch files (build_a.bat, build_b.bat, build_c.bat) and supplied
CodeWarrior project files build ARM-only versions of this code.
To build ARM/Thumb interworking versions of this example, where the bulk
of the C code is compiled for Thumb, change the invocations of 'armcc'
into 'tcc -apcs /interwork', so that e.g. build_c.bat becomes:
armasm -g vectors.s
armasm -g -PD "ROM_RAM_REMAP SETL {TRUE}" init.s
armasm -g stack.s
armasm -g heap.s
REM Use the following two lines to build without using the serial port.
tcc -apcs /interwork -c -g -O1 main.c -DEMBEDDED -DROM_RAM_REMAP
tcc -apcs /interwork -c -g -O1 retarget.c
REM Use the following two lines to build using the serial port.
REM tcc -apcs /interwork -c -g -O1 main.c -DEMBEDDED -DROM_RAM_REMAP -DUSE_SERIAL_PORT
REM tcc -apcs /interwork -c -g -O1 retarget.c -DUSE_SERIAL_PORT
tcc -apcs /interwork -c -g -O1 uart.c -I..\include
tcc -apcs /interwork -c -g -O1 serial.c -I..\include
armlink vectors.o init.o main.o retarget.o uart.o serial.o stack.o heap.o -scatter scat_c.scf -o embed.axf -entry 0x24000000 -info totals -info unused
fromelf embed.axf -bin -o embed.bin
fromelf embed.axf -m32 -o embed.m32
Downloading to Flash
--------------------
Follow the instrictions below to download the 'Embedded, scatterloaded'
examples 'build_b' and 'build_c' to the flash memory of an ARM Integrator
board, so that you can execute/debug the image at source level.
Use the debugger's File->Flash-download feature, which uses flash.li/.bi.
This requires a plain binary image to be built with:
fromelf embed.axf -bin -o embed.bin
See 'AXD and armsd Debuggers Guide', Appendix D, "Using the Flash Downloader".
Alternatively:
Follow the steps 1-8 below to download using the Integrator's Boot Loader:
These steps require a terminal emulator such as 'HyperTerminal'.
1. Connect the Integrator board to the host computer using a null modem
serial cable.
2. Invoke the terminal emulator and ensure it has the following settings:
- Baud rate 38400
- Data bits 8
- No parity
- Stop bits 1
- Flow control Xon/Xoff
3. Ensure switches 1 and 4 on the Integrator board are in the 'ON'
position and reset the board.
4. Enter 'l' to load flash image at the Boot Loader prompt in the terminal
window.
5. Transfer the 'embed.m32' file via the serial cable using the terminal
tools. In Hyperterminal this is done by selecting
'Transfer->Send Text File' from the menu and navigating to the
embed.m32 file.
6. Once the image has loaded (approx 25 seconds) terminate the flash
transfer by pressing Ctrl-C.
7. Ensure switch 1 is returned to the 'OFF' position.
8. The image is now present in flash and will be executed when the board
is reset. Output from the image will be sent to the terminal window
only if the image was built using the -USE_SERIAL_PORT option.
Otherwise output must be viewed using AXD with the image debug
symbols via a connection to the board such as Multi-Ice.
Memory Maps
-----------
The following diagrams illustrate the Memory Maps for this example, for each
different build:
build_a.bat:
0x08000000 (ARMulator) or
+----------+ 0x00040000 (Integrator board)
| stack |
| VV |
~ ~
| ^^ |
| heap |
+----------+ Image$$ZI$$Limit
| ZI data |
+----------+
| RW data |
+----------+
| |
| |
| program |
| (RO+RW) |
| |
| |
+----------+ 0x8000
build_b.bat
--- +----------+ 0x280800
没有合适的资源?快使用搜索试试~ 我知道了~
博创2410开发板光盘资料---UC/OS实验 源程序二
共594个文件
h:363个
o:46个
s:30个
5星 · 超过95%的资源 需积分: 9 62 下载量 104 浏览量
2009-03-30
13:36:33
上传
评论 1
收藏 12.61MB RAR 举报
温馨提示
由于代码实在太大了,共90多M,压缩之后还20多M,所以只能分成两个了。这个是第二部分,还有第一部分。 目录: Exp9 列表框控件的使用 Exp10 文本框控件 Exp11 多任务与AD转换 Exp12 音频实验 Exp13 UDP通信实验
资源推荐
资源详情
资源评论
收起资源包目录
博创2410开发板光盘资料---UC/OS实验 源程序二 (594个子文件)
minilib.a 3.88MB
ucos_lib.a 3.88MB
ucos_lib.a 3.53MB
ucos_lib.a 3.53MB
ucos_lib.a 3.53MB
ucos_lib_bck.a 334KB
ucos_lib_bck.a 334KB
minilib_bck.a 334KB
ucos_lib_bck.a 334KB
ucos_lib_bck.a 334KB
TCPIP.a 111KB
UDP.APS 29KB
Exp13.axf 746KB
Exp11.axf 722KB
Exp9.axf 704KB
Exp10.axf 702KB
Exp12.axf 692KB
Exp18.axf 333KB
Exp14.axf 323KB
Exp15.axf 323KB
Exp13.axf 308KB
Exp13.axf 294KB
Exp14.axf 285KB
Exp15.axf 275KB
system.bin 179KB
system.bin 172KB
system.bin 149KB
system.bin 144KB
system.bin 143KB
system.bin 143KB
system.bin 138KB
system.bin 110KB
system.bin 108KB
fangzhi1.bmp 557KB
MP3.bmp 469KB
yth.bmp 469KB
yf.bmp 469KB
255.bmp 469KB
2410-s.bmp 469KB
2410.bmp 469KB
270.bmp 469KB
44b0.bmp 469KB
lian.bmp 451KB
fangzhi.bmp 384KB
dian.bmp 352KB
shenzhen.bmp 311KB
Toolbar.bmp 1KB
malloc.c 182KB
malloc.c 182KB
malloc.c 182KB
malloc.c 182KB
malloc.c 182KB
main.c 11KB
main.c 8KB
main.c 7KB
retarget.c 6KB
retarget.c 6KB
retarget.c 6KB
retarget.c 6KB
retarget.c 6KB
main.c 6KB
main.c 6KB
dti.c 3KB
UDP.clw 3KB
UDP.cpp 4KB
UDPView.cpp 4KB
MainFrm.cpp 3KB
UDPDoc.cpp 2KB
MySocket.cpp 2KB
IPDialog.cpp 923B
StdAfx.cpp 205B
sys.dat 6B
sys.dat 6B
Thumbs.db 67KB
UDP.dsp 5KB
UDP.dsw 529B
UDP.exe 2.11MB
U16x16.fnt 670KB
U16x16.fnt 670KB
U16x16.fnt 670KB
u16x16.fnt 670KB
U12x12.fnt 503KB
U12x12.fnt 503KB
U12x12.fnt 503KB
u12x12.fnt 503KB
gdi.h 206KB
window.h 185KB
control.h 116KB
mgext.h 70KB
minigui.h 70KB
ucos_ii.h 51KB
ucos_ii.h 51KB
ucos_ii.h 51KB
ucos_ii.h 51KB
ucos_ii.h 51KB
2410addr.h 35KB
common.h 32KB
skin.h 30KB
own_malloc.h 24KB
own_malloc.h 24KB
共 594 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- ycl3933103392012-08-09资料完整,配合着文档看很不错,谢谢楼主了
- kejun002011-10-16资料完整,为代码型的,要配合相关文档来看,谢谢分享!
- Jennypan20092011-10-31内容很完整,也有相应的文档,谢谢楼主!
feitianhuli4229
- 粉丝: 3
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- yolo目标检测项目实验
- downloadFile-1.hc
- Centos7.9环境下离线安装开源版Nginx(亲测版)
- C++课程设计:基于Qt的航班信息管理系统
- ADS7822UVerilog驱动,前面传的有点问题
- 基于python的高性能爬虫程序,使用了多线程+缓存+xpath实现的,这里以彼-岸图库为例,实现,仅用于学习交流
- 中分辨率成像光谱仪(MODIS)烧毁面积产品信息MODIS-C6-BA-User-Guide-1.2.pdf
- Screenshot_20240427_172613_com.huawei.browser.jpg
- 关于学习Python的相关资源网站链接及相关介绍.docx
- (HAL库)基于STM32F103C8T6的温控PID系统[Dht11、ESP8266、无线透传、L298N……]
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功