完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
本帖最后由 qiangwei198 于 2015-1-8 14:25 编辑
我们建立工程之后,HEW会自动生成几个文件,此文讲解一下这几个文件,请注意注释 1、ncrt0.a30 此文件时系统生成的启动文件,单片机启动后的首先运行的代码在此文件中。 ;******************************************************************** ; C Compiler for R8C/tiny, M16C/60,30,20,10 ; Copyright(C) 1999(2000-2006). Renesas Technology Corp. ; and Renesas Solutions Corp., All rights reserved. ; ; ncrt0.a30 : Startup Program for R8C/Tiny ; ; $Date: 2006/11/22 04:13:59 $ ; $Revision: 1.1.4.1 $ ;******************************************************************** ;--------------------------------------------------------------------- ; include files ;--------------------------------------------------------------------- .list OFF .include nc_define.inc 【启动文件自动包含另外两个自动生成的头文件】 .include sect30.inc .list ON ;=================================================== ; Interrupt section start ;--------------------------------------------------------------------- .insf start,S,0 .glb start .section interrupt start: ;--------------------------------------------------------------------- ; after reset,this program will start 【单片机启动,程序从此处开始执行】 【如果用户上电就要IO口动作,请在此处添加汇编代码】 ;--------------------------------------------------------------------- ldc #istack_top,isp ;set istack pointer 【设置部分指针和CPU模式】 mov.b #02h,0ah mov.b #00h,04h ;set processer mode mov.b #00h,0ah .if __STACKSIZE__ != 0 ldc #0080h,flg ldc #stack_top,sp ;set stack pointer .else ldc #0000h,flg .endif ldc #data_SE_top,*** ;set *** register ldintb #__VECTOR_ADR__ ;=================================================== ; NEAR area initialize. 【关于小于64K区域的RAM的设置】 ;--------------------------------------------------------------------- ; bss zero clear ;--------------------------------------------------------------------- N_BZERO bss_SE_top,bss_SE N_BZERO bss_SO_top,bss_SO N_BZERO bss_NE_top,bss_NE N_BZERO bss_NO_top,bss_NO ;--------------------------------------------------------------------- ; initialize data section ;--------------------------------------------------------------------- N_BCOPY data_SEI_top,data_SE_top,data_SE N_BCOPY data_SOI_top,data_SO_top,data_SO N_BCOPY data_NEI_top,data_NE_top,data_NE N_BCOPY data_NOI_top,data_NO_top,data_NO ;=================================================== ; heap area initialize 【初始化堆】 ;--------------------------------------------------------------------- .if __HEAPSIZE__ != 0 .glb __mnext .glb __msize mov.w #(heap_top&0FFFFH), __mnext mov.w #(__HEAPSIZE__&0FFFFH), __msize .endif ;=================================================== ; Initialize standard I/O 【初始化标准IO】 ;--------------------------------------------------------------------- .if __STANDARD_IO__ == 1 .glb __init .call __init,G jsr.a __init .endif ;=================================================== ; Call main() function 【进入用户主程序】 ;--------------------------------------------------------------------- ldc #0h,fb ; for debuger .glb _main jsr.a _main ;=================================================== ; exit() function 【退出程序】 ;--------------------------------------------------------------------- .glb _exit .glb $exit _exit: ; End program $exit: jmp _exit .einsf ;=================================================== ; dummy interrupt function 【虚中断】 ;--------------------------------------------------------------------- .glb dummy_int dummy_int: reit .end ;******************************************************************** ; C Compiler for R8C/Tiny, M16C/60,30,20,10 ; Copyright(C) 1999(2000-2006). Renesas Technology Corp. ; and Renesas Solutions Corp., All rights reserved. ;******************************************************************** 2、nc_define.inc 关于部分RAM和ROM的地址分配的头文件 ;------------------------------------------------------------------------ ; | ; FILE :nc_define.inc | ; DATE :Mon, Sep 28, 2009 | ; DESCRIPTION :interrupt program. | ; CPU GROUP :1B | ; | ; This file is generated by Renesas Project Generator (Ver.4.17). | ; | ;------------------------------------------------------------------------ ; Macro Symbol definition __STANDARD_IO__ .equ 0 ; STANDARD I/O flag definition 【标准IO标志定义】 __HEAPSIZE__ .equ 080H ; HEEP SIZE definition【堆定义】 __STACKSIZE__ .equ 080H ; STACK SIZE definition【栈定义】 __ISTACKSIZE__ .equ 080H ; INTERRUPT STACK SIZE definition【中断堆栈大小定义】 __VECTOR_ADR__ .equ 0fedcH ; INTERRUPT VECTOR ADDRESS definition【中断向量起始地址】 __ROM_TOPADR__ .equ 0c900H ; ROM TOP ADDRESS definition 【用户程序开始地址】 注意:Fou*** 仿真时用户程序开始地址必须 大于 0c900H 3、sect30.inc section 定义 ;******************************************************************** ; C Compiler for R8C/Tiny, M16C/60,30,20,10 ; Copyright(C) 1999(2000-2006). Renesas Technology Corp. ; and Renesas Solutions Corp., All rights reserved. ; ; sect30.inc : section definition for R8C/Tiny ; ; $Date: 2007/11/29 09:02:11 $ ; $Revision: 1.1.14.1 $ ;******************************************************************** ;=================================================== ; ; Arrangement of section ; ;--------------------------------------------------------------------- ; Near RAM data area 【小于64K的RAM地址空间设置】 ;--------------------------------------------------------------------- ; SBDATA area .section data_SE,DATA .org 400H data_SE_top: .section bss_SE,DATA,ALIGN bss_SE_top: .section data_SO,DATA data_SO_top: .section bss_SO,DATA bss_SO_top: ; SBDATA area definition .glb __SB__ __SB__ .equ data_SE_top ; near RAM area .section data_NE,DATA,ALIGN data_NE_top: .section bss_NE,DATA,ALIGN bss_NE_top: .section data_NO,DATA data_NO_top: .section bss_NO,DATA bss_NO_top: ;--------------------------------------------------------------------- ; Stack area 【栈地址设置】 ;--------------------------------------------------------------------- .section istack,DATA,ALIGN .blkb __ISTACKSIZE__ istack_top: .if __STACKSIZE__ != 0 .section stack,DATA,ALIGN .blkb __STACKSIZE__ stack_top: .endif ;--------------------------------------------------------------------- ; heap section【堆地址设置】 ;--------------------------------------------------------------------- .if __HEAPSIZE__ != 0 .section heap,DATA heap_top: .blkb __HEAPSIZE__ .endif ;--------------------------------------------------------------------- ; Near ROM data area 【小于64K的ROM地址设置】 ;--------------------------------------------------------------------- .section rom_NE,ROMDATA .org __ROM_TOPADR__ rom_NE_top: .section rom_NO,ROMDATA rom_NO_top: ;--------------------------------------------------------------------- ; Initial data of 'data' section 【数据区】 ;--------------------------------------------------------------------- .section data_SEI,ROMDATA,ALIGN data_SEI_top: .section data_SOI,ROMDATA data_SOI_top: .section data_NEI,ROMDATA,ALIGN data_NEI_top: .section data_NOI,ROMDATA data_NOI_top: ;--------------------------------------------------------------------- ; Switch Table Section ;--------------------------------------------------------------------- ; .section switch_table,ROMDATA ;switch_table_top: ;--------------------------------------------------------------------- ; code area【代码区】 ;--------------------------------------------------------------------- .section program,CODE,ALIGN .section interrupt,CODE,ALIGN ;--------------------------------------------------------------------- ; variable vector section ;--------------------------------------------------------------------- .section vector,ROMDATA .org __VECTOR_ADR__ .if 0 【注意这里,如果有中断程序,这里一定要改成1】 .lword dummy_int ; vector 0 .lword dummy_int ; vector 1 .lword dummy_int ; vector 2 .lword dummy_int ; vector 3 .lword dummy_int ; vector 4 .lword dummy_int ; vector 5 .lword dummy_int ; vector 6 .lword dummy_int ; vector 7 .lword dummy_int ; vector 8 .lword dummy_int ; vector 9 .lword dummy_int ; vector 10 .lword dummy_int ; vector 11 【这些是中断向量】 .lword dummy_int ; vector 12 .lword dummy_int ; vector 13 .lword dummy_int ; vector 14 .lword dummy_int ; vector 15 .lword dummy_int ; vector 16 .lword dummy_int ; vector 17 .lword dummy_int ; vector 18 .lword dummy_int ; vector 19 .lword dummy_int ; vector 20 .lword dummy_int ; vector 21 .lword dummy_int ; vector 22 .lword dummy_int ; vector 23 .lword dummy_int ; vector 24 .lword dummy_int ; vector 25 .lword dummy_int ; vector 26 .lword dummy_int ; vector 27 .lword dummy_int ; vector 28 .lword dummy_int ; vector 29 .lword dummy_int ; vector 30 .lword dummy_int ; vector 31 .lword dummy_int ; vector 32 .lword dummy_int ; vector 33 .lword dummy_int ; vector 34 .lword dummy_int ; vector 35 .lword dummy_int ; vector 36 .lword dummy_int ; vector 37 .lword dummy_int ; vector 38 .lword dummy_int ; vector 39 .lword dummy_int ; vector 40 .lword dummy_int ; vector 41 .lword dummy_int ; vector 42 .lword dummy_int ; vector 43 .lword dummy_int ; vector 44 .lword dummy_int ; vector 45 .lword dummy_int ; vector 46 .lword dummy_int ; vector 47 .lword dummy_int ; vector 48 .lword dummy_int ; vector 49 .lword dummy_int ; vector 50 .lword dummy_int ; vector 51 .lword dummy_int ; vector 52 .lword dummy_int ; vector 53 .lword dummy_int ; vector 54 .lword dummy_int ; vector 55 .lword dummy_int ; vector 56 .lword dummy_int ; vector 57 .lword dummy_int ; vector 58 .lword dummy_int ; vector 59 .lword dummy_int ; vector 60 .lword dummy_int ; vector 61 .lword dummy_int ; vector 62 .lword dummy_int ; vector 63 .endif ;--------------------------------------------------------------------- ; fixed vector section【固定向量地址】 ;--------------------------------------------------------------------- .section fvector,ROMDATA .org 0ffdcH UDI: .lword dummy_int OVER_FLOW: .lword dummy_int BRKI: .lword dummy_int ADDRESS_MATCH: .lword dummy_int SINGLE_STEP: .lword dummy_int WDT: .lword dummy_int ; reserved .lword dummy_int ; reserved .lword dummy_int RESET: .lword start ;=================================================== ; ID code & Option function select register ;--------------------------------------------------------------------- ; ID code check function .id "#FFFFFFFFFFFFFF"【用户加密的密码,不要忘记了,忘记密码,芯片就报废了】 ; option function select register .ofsreg 0FFH ;--------------------------------------------------------------------- ; far ROM data area ;--------------------------------------------------------------------- ; ; .section rom_FE,ROMDATA ; .org 10000H ; ; .section rom_FO,ROMDATA ; ; .section data_FEI,ROMDATA,ALIGN ;data_FEI_top: ; ; .section data_FOI,ROMDATA ;data_FOI_top: ; ;==================================================== ; Initialize Macro declaration ;--------------------------------------------------------------------- N_BZERO .macro TOP_ ,SECT_ mov.b #00H, R0L mov.w #(TOP_ & 0FFFFH), A1 mov.w #sizeof SECT_ , R3 sstr.b .endm N_BCOPY .macro FROM_,TO_,SECT_ mov.w #(FROM_ & 0FFFFH),A0 mov.b #(FROM_ >>16),R1H mov.w #TO_ ,A1 mov.w #sizeof SECT_ , R3 smovf.b .endm ;******************************************************************** ; C Compiler for R8C/Tiny, M16C/60,30,20,10 ; Copyright(C) 1999(2000-2006). Renesas Technology Corp. ; and Renesas Solutions Corp., All rights reserved. ;******************************************************************** |
|
相关推荐 |
|
只有小组成员才能发言,加入小组>>
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】新建工程和LED灯闪烁
385 浏览 0 评论
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】LED灯模拟二进制进位
557 浏览 0 评论
【瑞萨 FPB-RA4E2 开发板测评】简介、环境搭建、程序测试
789 浏览 0 评论
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】(第三篇)PWM输出+ADC采集
877 浏览 0 评论
【RA-Eco-RA2E1-48PIN-V1.0开发板试用】尝试嵌入式操作系统Free-RTOS
1686 浏览 0 评论
1792浏览 4评论
【RA-Eco-RA0E1-32PIN-V1.0开发板试用】RA0E1-32PIN-V1.0开发板测试一下点灯
2358浏览 3评论
【RA4M2设计挑战赛】智慧农业监测RA4M2采集数据上传阿里云
1578浏览 2评论
2916浏览 2评论
2643浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-4 17:26 , Processed in 0.386054 second(s), Total 41, Slave 34 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号