搜索
bottom↓
回复: 1

在ICCAVR中如何修改启动文件

[复制链接]

出0入0汤圆

发表于 2006-5-25 11:48:03 | 显示全部楼层 |阅读模式
在使用ICCAVR编程时如发生看门狗复位,ram区被清除,如何修改启动文件使ram区不被清除。

在使用ATmega16芯片时有几个相关的文件:area.s,crtatmega.s,init.s。修改那个文件,那个部位请指教。



回复邮箱:ymdz0706@sina.com

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2006-5-26 20:21:21 | 显示全部楼层
Startup File



The linker links in the startup file before your files, and links the standard library libcavr.a with your program. The startup file is one of the following depending on the target device:



crtavr.o                Normal startup file

        crtatmega.o                ATmega startup. Uses "jmp __start" as the reset vector

        crtavrram.o                Normal startup file that also initializes the external SRAM

        crtatmegaram.o        ATmega startup file that also initializes the external SRAM

        crtboot.o                Normal bootloader startup file. Differs from crtavr.o in that it relocates the interrupt vector.

        crtboothi.o                Same as crtboot.o but uses ELPM and initializes RAMPZ to 1.



You may create your own startup file if you wish. See Project->Options->Target->NonDefaultStartup The startup file defines a global symbol __start which is the starting point of your program. The startup file functions are:



1.        Initialize the hardware and software stack pointers.

2.        Copy the initialized data from the idata area to the data area.

3.        Initialize the bss area to zero.

4.        Call the user main routine.

5.        Define the entry point for exit, which is defined as an infinite loop. If main ever returns, it will enter exit and gets stuck there (so much for "exit").



The startup also defines the reset vector. You do not need to modify the startup file to use other interrupts, see Interrupt Handlers

. Compiling or assembling the startup file requires a special switch to the assembler (-n). You can still use the IDE to compile a Startup file, just use the File->CompilerFileTo...StartupFileToObject command.



To modify and use a new startup file:



cd \icc\libsrc.avr                ; or wherever you install the compiler



<edit crtavr.s>



<open crtavr.s using the IDE>        ;



<Choose "Compile File To->Object">        ;generate a new crtavr.o



copy crtavr.o ..\lib                ; copy to the library directory



Note that you must either specify the startup with an absolute pathname or it must be located in the directory specified by the Project Options Library path.
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-23 09:31

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表