2010年3月19日 星期五

Source Tree設計原則 與 程式風格典範

由嵌入式系統特性
1.可移植性
2.硬體相關
3.非硬體相關
4.產品相關
5.非產品相關
----------------------
(可以容易在其他的專案中重複使用;假如下個產品的硬體平台不變,只有應用程式改變,則系統與Driver的程式目錄就可以直接拿來用.再假如下個產品的硬體被換掉,但系與應用程式只需小幅調整,則只需把驅動程式的目錄替換掉即可.)

2010年3月18日 星期四

Scope regions in C and C++

Many programmers have difficulty distinguishing the concepts of scope, storage allocation, and linkage. Dan begins the process of sorting them out.

Storage class specifiers and storage duration

Storage class specifiers don't specify scope but combine with scope to determine storage duration. Here's the second part in a series on scope, storage allocation, and linkage.
----------------------
Storage class specifier 並不是決定 scope,但是和scope合起來時,可以決定storage duration. 這裡是 "scope,storage allocation and linkage"的第二部份

2010年3月8日 星期一

2010年3月1日 星期一

Linkage in C and C++ Linkage in C and C++

A name declared in C or C++ may have attributes such as type, scope, storage duration, and linkage. Not every name has all of these attributes. For example, a function name has a type, a scope, and a linkage, but no storage duration. A statement label name has only a scope.
An object's type determines the object's size and memory address alignment, the values the object can have, and the operations that can be performed on that object. A function's type specifies the function's parameter list and return type.
 
A name's scope is that portion of a translation unit in which the name is visible.1 (A translation unit is the source code produced by the preprocessor from a source file and all its included headers.) C supports four different kinds of scope: file scope, block scope, function prototype scope, and function scope. C++ generalizes file scope into namespace scope, and adds class scope.
An object's storage duration determines the lifetime of the storage for that object.2 That is, it determines how and when during program execution the storage for that object comes and goes. Each object in C and C++ has one of the following three storage durations: static, automatic, and dynamic. Only objects have storage duration. Enumeration constants, functions, labels, and types don't.
Which brings us to linkage. A name's linkage affects whether two or more declarations for that name are valid, and if so, whether they refer to the same entity (such as a function or an object). Understanding linkage clears up a number of misconceptions about the behavior of C and C++ programs.
In my earlier article on the scope rules,1 I explained the distinction between declarations and definitions, but omitted some details. Those details are pertinent to the concept of linkage, so let's take a look at them first.
DECLARATIONS AND DEFINITIONS
A declaration associates attributes with names. A declaration either introduces a name into the current translation unit or redeclares a name introduced by a declaration that appeared earlier in the same translation unit. A declaration for a name might also be a definition. Informally, a definition is a declaration that not only says "here's a name," but also "here's all the information the compiler needs to create the code for that name".
C++ lets you declare all sorts of things that aren't valid in C, such as classes, namespaces, and linkage specifications. Not surprisingly, these features make the distinction between definitions and other declarations, as well as the linkage rules, more complicated in C++ than in C. However, we don't really need to consider all those features to explain linkage--using just functions and objects should provide adequate illustration.
For function declarations that are valid in both C and C++, the rule for deciding when a function declaration is also a definition is the same for both languages, namely, that a function declaration is also a function definition if it includes a brace-enclosed body, as in:

int abs(int v)
    {
    return v < 0 ? -v : v;
    };

A function heading without a body, as in:

int abs(int v);

is just a declaration.
For object declarations that are valid in both C and C++, the rule for deciding when an object declaration is also a definition is--surprisingly--simpler in C++ than in C. In C++, an object declaration is also a definition unless it contains an extern specifier and no initializer.
For example, all of the following object declarations are also definitions in C++:


int i;                 // definition
static int j;          // definition
extern int k = 0;      // definition

They are definitions whether they appear at file scope, namespace scope, or block scope.
The following object declaration is not a definition:


extern int m;          // non-defining declaration

//
1. 若 extern int m;
宣告在 file scope中時,若其以下的程序中並沒有使用此一變數
則在object file中並不會出現,即使不開最佳化設定 ;
反之.若以下程序中有使用到其變數 m ,但又不能在其 "有(宣告)declare extern int m的檔案中,找到其定義值時, 其object file中為

00000000 T abs
                 U foo
00000004 C i
00000000 b j
                 U m
(00000000 D m) //若有被定義時,
00000014 T main
                 U printf



2.在全域變數時,若定義其值為"0"
   其object file 的符號 為 B(BSS,未初化資料),而非D(已初始化資料,RW)
//

2009年11月9日 星期一

我對於 ARM 計畫

我將先以ARM為首先.
以目前,我所擁有的可限資源下.(*1)
對其ARM,進行更進一步的研究
如何使用以下資源
首先應是把
0.將其對ARM的所有相關的文章,閱讀
   尤其對其系統/中斷/bootload/

1.對其ehternel module,mp3 module.,,ROM,RAM.紅外線,等...
   設備的使用

2.uc/os-ii
   且要更一步對其內所有的相關的議題研究
3. 配合外部設備與uc/os-ii
    進行結合
4.發展系統,
    實現以前的專題中的網路mp3系統,並改進

2009年11月8日 星期日

如果有兩條路,一定要選艱苦的那條,它會把你最好的那些東西給榨出來

目前,我所走的路也許正是較艱苦的.
一開始時,選擇了五專.為了一時的輕鬆.
卻也走上了,艱苦的道路

然而現在,所選擇的路是否為艱苦的道路呢
我不知,但我也只能走下去了


找到了好幾個有趣的網站
-------------------------------------------
http://monoist.atmarkit.co.jp/feledev/articles/oscillo/01/oscillo01a.html
//monoist --有許多電子,電路解說(日

http://interface.cqpub.co.jp/
//interface 的主網 (日

http://kumikomi.typepad.jp/interface_2009arm/2009/03/index.html
//interface 的ARM解說(日

http://blog.goo.ne.jp/sim00/m/200707

//電子逹人(日

---------------------------------
//embedded software
http://0xlab.org/planet_zh.html

http://blog.linux.org.tw/~jserv/archives/002117.html

http://homepage3.nifty.com/takeda-toshiya/