[此贴子已经被作者于2007-8-31 14:01:50编辑过]
"而Hello LED生成的代码只有几百个字节,当然是没有用到printf函数
这个Hello World工程代码到底多在了哪儿?"
你可以看看nios_led的说明:
* This example is a freestanding program because it's entry point is the
* function:
*
* void alt_main (void)
*
* As opposed to "main()" as a "hosted" application would (see the
* "hello_world" example).
*
* Upon entry to alt_main():
* - The CPU's caches (if any) have been initialized.
* - The stack-pointer has been set.
* - That's all. The rest is up to you.
*
* If you modify this example and try to call C library functions such as
* printf, they will NOT work unless you explicitly initialize the system.
* If you wish to use C library calls, it is strongly suggested you start
* with the hosted hello_world template which uses main() as it's entry
* point.
*
* On the other hand, if you want to write a program that gets-in even
* earlier, you will need to provide your own assembly-language machine-setup
* code by defining the symbol "_start". Any definition of _start in your
* directory will override the library definition. You can find source code
* for the Nios II library _start here:
主要是alt_main.c和alt_sys_init.c引入的代码
而这俩文件又间接引入了很多设备驱动代码,比如系统包含定时器,则定时器的驱动会被自动加载到最终的可执行文件...
更详细的资料自己研究吧或者等我的书出版^_^
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |