博客首页
注册
建议与交流
排行榜
加入友情链接
推荐
投诉
搜索:
帮助
好好学习
bilbo.cublog.cn
管理博客
发表文章
留言
收藏夹
· Compiler
· Unix_Linux
博客圈
音乐
相册
文章
· AutoHotKey
· C/C++
· Caml
· Perl
· Tcl & Expect
· 其他编程语言
· Visual Language
· Compiler Engineering
· Embedded System
· FieldBus
· Networking
· Hardware Desing
· Safety System
· Unix_Linux
· Software Engineering
· GSM/GSM-R
· 技术幽默
· 读书时间
· Good Resource
· 关注社会
· 胡言乱语
首页
关于作者
姓名:你知道 职业:IT 年龄:每年大一岁 位置:地球 个性介绍:挺笨 Email: bilbo0214@163.com
||
<<
>>
||
我的分类
文章列表 - Embedded System
(转)Super Loop Architecture
<DIV> <P>When programming an embedded system, it is important to meet the time deadlines of the system, and to perform all the tasks of the system in a reasonable amount of time, but also in a good order. This page will talk about a common program architecture called the <B>Super-Loop Architecture</B>, that is very useful in meeting these requirements</P> <P><A id=Definition name=Definition></A></P> <H2><SPAN class=mw-headline>Definition</SPAN></H2> <P>A super loop is a program structure comprised of an infinite loop, with all the tasks of the system contained in that loop. Here is a general pseudocode for a superloop implementation:</P><PRE>Function Main_Function() { Initialization(); Do_Forever { Check_Status(); Do_Calculations(); Output_Response(); } } </PRE> <P>We perform the initialization routines before we enter the super loop, because we only want to initialize the system once. Once the infinite loop begins, we don't want to reset the values, ……
查看全文
发表于:2008-04-17 ┆
阅读(219)
┆
评论(0)
(转)Why is the line terminator CR+LF?
<DIV> <DIV class=postsub> <H2>Why is the line terminator CR+LF?</H2>This protocol dates back to the days of teletypewriters. CR stands for "carriage return" - the CR control character returned the print head ("carriage") to column 0 without advancing the paper. LF stands for "linefeed" - the LF control character advanced the paper one line without moving the print head. So if you wanted to return the print head to column zero (ready to print the next line) and advance the paper (so it prints on fresh paper), you need both CR and LF. <P></P> <P>If you go to the various internet protocol documents, such as <A href="http://www.ietf.org/rfc/rfc0821.txt"><FONT color=#0000ff>RFC 0821 (SMTP)</FONT></A>, <A href="http://www.ietf.org/rfc/rfc1939.txt"><FONT color=#0000ff>RFC 1939 (POP)</FONT></A>, <A href="http://www.ietf.org/rfc/rfc2060.txt"><FONT color=#0000ff>RFC 2060 (IMAP)</FONT></A>, or <A href="http://www.ietf.org/rfc/rfc2616.txt"><FONT color=#0000ff>RFC 2616 (HTTP)</FONT></A>, you'l……
查看全文
发表于:2008-04-14 ┆
阅读(272)
┆
评论(0)
使用C++为ARM编程
<div>我长久以来一直有个误区,认为无操作系统的程序只能使用汇编或C来编写,C++基本上是不可能的,这让我在很长的时间里远离了C++,甚至是有意识的忽略了它,即使它具备比C更好的封装。</div> <div> </div> <div>今天看到一个资料中说eCos内核是用C++编写的,让我忽然知道了以前的判断都是错误的,其实只有一层窗户纸,只要不使用语言的动态特征,完全可以用C++来写嵌入式程序。</div> <div> </div> <div>下面就是为了验证C++的可用性的一个简单代码:<br>class Sample <br>{ <br>protected:<br> int x; <br>public: <br> Sample(){}; <br> Sample(int a){ x = a + 1;} <br> Sample(Sample &a){x=a.x++ +10;} <br> void disp() { print((INT8U*)"base class"); putnum(x); outbyte('\r'); outbyte('\n'); } <br>}; </div> <div>class EXTSample : public Sample<br>{<br>public: <br> EXTSample(int a) : Sample(a) { } <br> void disp() { print((INT8U*)"inheritence class"); putnum(x); ……
查看全文
发表于:2007-11-16 ┆
阅读(603)
┆
评论(0)
检查编译器bit-field存储方式的C程序
检查编译器bit-field存储方式的C程序代码如下:<br>#include <stdio.h><br>#include <stdlib.h><br><br>struct bitfield {<br> unsigned int b7:1;<br> unsigned int b6:1;<br> unsigned int b5:1;<br> unsigned int b4:1;<br> unsigned int b3:1;<br> unsigned int b2:1;<br> unsigned int b1:1;<br> unsigned int b0:1;<br>};<br><br>union highlow {<br> struct bitfield bf;<br> unsigned char c;<br>};<br><br>int main(void)<br>{<br> union highlow h;<br> <br> h.c = 0;<br> h.bf.b0 = 1;<br> <br> if (h.c == 0x80) {<br> printf("LSB machine\n");<br> } else {<br> printf("MSB machine\n");<br> }<br> &nbs……
查看全文
发表于:2007-10-10 ┆
阅读(804)
┆
评论(1)
(转)The True Story of Hello World
<h1 align="center">The True Story of <font color="#3333ff">Hello World</font></h1> <h2 align="center">(or at least a good part of it)</h2> <p>Most of our computer science students have been through the famous "Hello World" program at least once. When compared to a typical application program ---almost always featuring a web-aware graphical user interface, "Hello World" turns into an very uninteresting fragment of code. Nevertheless, many computer science students still didn't get the real story behind it. The goal of this exercise is to cast some light in the subject by snooping in the "Hello World" life-cycle.</p> <h3>The source code</h3> <p>Let's begin with Hello World's source code:</p> <table border="0" width="100%"> <tbody> <tr> <td align="right" width="1%"><font color="#cc0000"><code lang="c">1.<br>2.<br>3.<br>4.<br>5.<br>6.<br>7. </code></font></td> <td><code lang="c">#include <stdio.h><br><br>int main(void)<br>{<br> ……
查看全文
发表于:2007-10-10 ┆
阅读(783)
┆
评论(0)
CRC
<span class="postbody">CRC, the Cyclic Redundancy Check is a simple hash function: a fixed length value computed from arbitrary length data. It is used mainly for error checking: to see if the data (program code, compressed archive, Internet message) is intact; or narrowing down the search for identical files. A few random bit flips or dropped bytes almost always result in different CRC value, but it is easy to modify the data e.g. with appending a few bytes, so the result will provide any desired CRC value. Consequently, CRC cannot be used for security (message authentication, or detecting malicious modifications). <br> <br>CRCs are based on division in the ring of polynomials over the integers modulo 2. A string of bits is interpreted as the coefficients of a polynomial of this sort, and to find the CRC, we divide it by another fixed polynomial. The coefficients of the remainder polynomial are the CRC. The IEEE 802.3 standard specifies the polynomial and the pa……
查看全文
发表于:2007-10-05 ┆
阅读(593)
┆
评论(0)
(转)Byte and Bit Order Dissection
<DIV> <H1 class=title>Byte and Bit Order Dissection</H1><!-- begin content --> <DIV class="node "><SPAN class=submitted>By <A title="View user profile." href="http://www.linuxjournal.com/user/801239"><FONT color=#0000ff>Kevin He</FONT></A> on Tue, 2003-09-02 01:00.</SPAN> <SPAN class=taxonomy><A href="http://www.linuxjournal.com/taxonomy/term/2"><FONT color=#0000ff>Software</FONT></A></SPAN> <DIV class=content>Discussing the differences between big and little endianness, bit and byte order and what it all means. <DIV class=article lang=en> <DIV class=simplesect lang=en> <DIV class=titlepage> <H2 class=title><A name=N0x850ca00.0x857399c></A></H2></DIV> <P>Editors' Note: This article has been updated since its original posting.</P> <P>Software and hardware engineers who have to deal with byte and bit order issues know the process is like walking a maze. Though we usually come out of it, we consume a handful of our brain cells each time. This article tries to summarize the vari……
查看全文
发表于:2007-09-28 ┆
阅读(910)
┆
评论(0)
使用脚本与RedBoot协作
搞嵌入式系统,用惯了Windows下的超级终端调试ARM程序,每次都要键入一大堆的字符,重复,重复,再重复。<br>为了减少无用的工作,开始寻找一种能自动与RedBoot交互的方法。<br>其实,可以有两种思路,一是自己实现类似超级终端的程序,支持XModem协议,这样交互过程就可以通过程序来控制。二是使用类似Expect的思路,使用其他的程序控制已有的通信程序。第一种方法工作量较大,而且很多时候是在reinvent the wheel,不可取;第二种方法应该是研究的重点。<br><br>SecureCRT正好提供了类似Expect的功能,它支持脚本来操作与通信的另一方的交互的能力,从而实现交互的自动化。SecureCRT支持三种脚本:vbscript, javascript和perl。前两种只要安装了IE4以上的浏览器的操作系统就支持,最后一种perl需要安装perl解释器,windows下最好的选择就是ActivePerl了。<br><br>下面是一段perl脚本来完成自动下载可执行文件demo.bin到目标板上并运行的例子:<br><span style="color: rgb(0, 1, 255);"> # $language = "PerlScript"</span><br style="color: rgb(0, 1, 255);"><span style="color: rgb(0, 1, 255);"> # $interface = "1.0"</span><br ……
查看全文
发表于:2007-09-18 ┆
阅读(750)
┆
评论(0)
收集的WCET方面的资料
<p>这段时间在研究任务调度和调度分析,在网上搜索了一些资源,记下来以后备查。</p> <p>The worst-case execution time (WCET) is the maximum execution time for a piece of code on a given target hardware. WCET analysis computes upper bounds for the WCET. </p> <div> <li><a href="http://link.springer.de/link/service/series/0558/tocs/t1474.htm"><font color="#0000ff">ACM SIGPLAN Workshop LCTES'98 (Proceedings)</font></a> - Languages, Compilers, and Tools for Embedded Systems </li><li><a href="http://www.c-lab.de/home/en/download.html"><font color="#0000ff">C-Lab</font></a> (WCET Benchmarks), <a href="http://www.timing-validation.com/"><font color="#0000ff">Timing validation</font></a> from <a href="http://www.absint.de/"><font color="#0000ff">AbsInt</font></a>, <a href="http://www.rapitasystems.com/wcet.html"><font color="#800080">RapiTime</font></a> from <a href="http://www.rapitasystems.com/"><font color="#0000ff">RapitaSystems</font></a> </li><li>International <a href="ht……
查看全文
发表于:2007-06-03 ┆
阅读(822)
┆
评论(0)
GNUARM命令行工具基本使用入门
<P>调用格式:<BR>arm-elf-gcc [stage-opt] [other-opts] -mcpu=arm7tdmi in-file -o out-file</P> <P>常见用法:<BR>将C代码编译为二进制目标文件:<BR> arm-elf-gcc -c -O2 -g -mcpu=arm7tdmi filename.c -o filename.o</P> <P>将多个二进制目标文件合并为一个可执行文件:<BR> arm-elf-ld filename1.o filename2.o … -o filename.elf</P> <P>将C代码直接编译生成可执行文件:<BR> arm-elf-gcc -O2 -g -mcpu=arm7tdmi filename.c -o filename.elf</P> <P>将C代码编译生成汇编代码:<BR> arm-elf-gcc -S -fverbose-asm -mcpu=arm7tdmi filename.c -o filename.s</P> <P>arm-elf-objdump option filename | more<BR>例如:arm-elf-objdump -S a2.o</P> <P>使用readelf查看elf文件的内容,例如:arm-elf-readelf -a a2.elf</P> <P>arm-elf-objcopy有一个很重要的作用是把代码从elf文件中抽取出来,形成可执行的机器码:<BR>例如:arm-elf-objcopy -O binary -R .comment -R .note -S a2.elf a2.bin <BR>形成的结果文件a2.bin可以烧到flash或下载到内存中去.</P> <P>arm-elf-nm用来列出elf文件中使用到的symbol,例如:arm-elf-nm a1.o</P> <DIV></DIV……
查看全文
发表于:2007-01-18 ┆
阅读(1189)
┆
评论(0)
RedBoot命令使用入门
<H1><A name=_Toc112674838><SPAN lang=EN-US>RedBoot</SPAN></A><SPAN style="mso-bookmark: _Toc112674838"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</SPAN></SPAN></H1> <H3><A name=_Toc112674839><SPAN lang=EN-US>1</SPAN></A><SPAN style="mso-bookmark: _Toc112674839"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、系统启动</SPAN></SPAN></H3> <P class=MsoNormal><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">超级终端参数设置为:</SPAN><SPAN lang=EN-US>115200</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,</SPAN><SPAN lang=EN-US>8</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,</SPAN><SPAN lang=EN-US>N</SPAN><SPAN style="FONT-FA……
查看全文
发表于:2007-01-18 ┆
阅读(1853)
┆
评论(0)
我整理的电子书(04年嵌入式系统)
<DIV>翻看自己的硬盘,找到了04年初学嵌入式系统时自学过程的一些总结,其实不该称为书,称为笔记更合适。回头看看,知道的还是太少,前面的路依然很长。我,在路上....</DIV> <DIV> </DIV> <DIV> <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#dddddd cellSpacing=0 cellPadding=0 width=360 align=center border=1> <TBODY> <TR height=60> <TD align=middle width=60><IMG alt="" src="http://control.cublog.cn/fileicon/chm.gif" border=0></TD> <TD> <TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR height=20> <TD align=middle width=40>文件:</TD> <TD>嵌入式系统实践I.chm</TD></TR> <TR height=20> <TD align=middle width=40>大小:</TD> <TD>80KB</TD></TR> <TR height=20> <TD align=middle width=40>下载:</TD> <TD><A href="http://blogimg.chinaunix.net/blog/upfile/070112135318.chm">下载</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE> <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#dddddd cellSpacing=0 cellPadding=0 width=360 a……
查看全文
发表于:2007-01-12 ┆
阅读(927)
┆
评论(0)
main函数之前(转)
<DIV>Some of the stuff that has to happen before main(): <BR> set up initial stack pointer <BR> initialize static and global data <BR> zero out uninitialized data <BR> run global constructors </DIV> <DIV><BR>Some of this comes with the runtime library's crt0.o file or its __start() function. Some of it you need to do yourself. </DIV> <DIV> </DIV> <DIV>Crt0 is a synonym for the C runtime library. <BR>Depending on the system you're using the follwing may be incomplete, but it should give you an idea. Using newlib-1.9.0/libgloss/m68k/crt0.S as an outline, the steps are: <BR>1. Set stack pointer to value of __STACK if set <BR>2. Set the initial value of the frame pointer <BR>3. Clear .bss (where all the values that start at zero go) <BR>4. Call indirect of hardware_init_hook if set to initialize hardware <BR>5. Call indirect of software_init_hook if set to initialize software <BR>6. Add __do_global_dtors and __FINI_SECTION__ to the atexit function so destructors……
查看全文
发表于:2007-01-12 ┆
阅读(853)
┆
评论(0)