📄 main.s
字号:
///////////////////////////////////////////////////////////////////////////////
// /
// IAR ANSI C/C++ Compiler V6.40.1.53790/W32 for ARM 09/Aug/2012 09:28:56 /
// Copyright 1999-2012 IAR Systems AB. /
// /
// Cpu mode = thumb /
// Endian = little /
// Source file = C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\src\Sources\C\main.c /
// Command line = "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\src\Sources\C\main.c" -D IAR -D /
// TWR_K60N512 -lCN "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\bin\Flash\List\" -lB /
// "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\bin\Flash\List\" -o /
// "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\bin\Flash\Obj\" --no_cse /
// --no_unroll --no_inline --no_code_motion --no_tbaa /
// --no_clustering --no_scheduling --debug /
// --endian=little --cpu=Cortex-M4 -e --fpu=None /
// --dlib_config "C:\Program Files\IAR Systems\Embedded /
// Workbench 6.4_2\arm\INC\c\DLib_Config_Normal.h" -I /
// "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\src\Sources\H\" -I /
// "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\src\Sources\H\Component_H\" -I /
// "C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\src\Sources\H\Frame_H\" -Ol /
// --use_c++_inline /
// List file = C:\Users\305030973\Desktop\M4 /
// example\02_uart_loop\bin\Flash\List\main.s /
// /
// /
///////////////////////////////////////////////////////////////////////////////
NAME main
#define SHT_PROGBITS 0x1
EXTERN light_change
EXTERN light_init
EXTERN periph_clk_khz
EXTERN uart_init
EXTERN uart_reN
EXTERN uart_send1
EXTERN uart_sendN
PUBLIC main
// C:\Users\305030973\Desktop\M4 example\02_uart_loop\src\Sources\C\main.c
// 1 //-------------------------------------------------------------------------*
// 2 // 工 程 名: uart_loop *
// 3 // 硬件连接: 将K60核心板与扩展板连接 *
// 4 // 程序描述: 启动后发送"Hello World!",之后等待接收一个字节数据,收到后回发*
// 5 // 目 的: 初步掌握利用查询方式进行串行通信的基本知识 *
// 6 // 说 明: 波特率为9600,使用UART3口 *
// 7 //---------------苏州大学飞思卡尔嵌入式系统实验室2011年--------------------*
// 8
// 9 //头文件
// 10 #include "includes.h"
// 11
// 12 //全局变量声明
// 13 extern int periph_clk_khz;
// 14
// 15 //主函数
SECTION `.text`:CODE:NOROOT(2)
THUMB
// 16 void main(void)
// 17 {
main:
SUB SP,SP,#+8
// 18 //1 主程序使用的变量定义
// 19 uint32 runcount; //运行计数器
// 20 uint8 ch;
// 21
// 22 //2 关中断
// 23 DisableInterrupts; //禁止总中断
CPSID i
// 24
// 25 //3 模块初始化
// 26 light_init(Light_Run_PORT,Light_Run1,Light_OFF); //指示灯初始化
MOVS R2,#+1
MOVS R1,#+13
LDR.N R0,??main_0 ;; 0x400ff080
BL light_init
// 27 uart_init (UART3,periph_clk_khz,9600); //串口初始化
MOV R2,#+9600
LDR.N R0,??main_0+0x4
LDR R1,[R0, #+0]
LDR.N R0,??main_0+0x8 ;; 0x4006d000
BL uart_init
// 28
// 29
// 30 //4 开中断
// 31
// 32 uart_sendN(UART3,(uint8*)"Hello World!",12);
MOVS R2,#+12
LDR.N R1,??main_0+0xC
LDR.N R0,??main_0+0x8 ;; 0x4006d000
BL uart_sendN
// 33 //主循环
// 34 while(1)
// 35 {
// 36 //1 主循环计数到一定的值,使小灯的亮、暗状态切换
// 37 runcount++;
??main_1:
ADDS R4,R4,#+1
// 38 if(runcount>=10)
CMP R4,#+10
BCC.N ??main_2
// 39 {
// 40 light_change(Light_Run_PORT,Light_Run1);//指示灯的亮、暗状态切换
MOVS R1,#+13
LDR.N R0,??main_0 ;; 0x400ff080
BL light_change
// 41 runcount=0;
MOVS R4,#+0
// 42 }
// 43 //2 串口接收一个字节的数据
// 44 if(uart_reN(UART3,&ch,1))
??main_2:
MOVS R2,#+1
ADD R1,SP,#+0
LDR.N R0,??main_0+0x8 ;; 0x4006d000
BL uart_reN
CMP R0,#+0
BEQ.N ??main_1
// 45 {
// 46 uart_send1(UART3,ch); //发送回去
LDRB R1,[SP, #+0]
LDR.N R0,??main_0+0x8 ;; 0x4006d000
BL uart_send1
B.N ??main_1
DATA
??main_0:
DC32 0x400ff080
DC32 periph_clk_khz
DC32 0x4006d000
DC32 `?<Constant "Hello World!">`
// 47 }
// 48
// 49 }
// 50 }
SECTION `.iar_vfe_header`:DATA:REORDER:NOALLOC:NOROOT(2)
SECTION_TYPE SHT_PROGBITS, 0
DATA
DC32 0
SECTION __DLIB_PERTHREAD:DATA:REORDER:NOROOT(0)
SECTION_TYPE SHT_PROGBITS, 0
SECTION __DLIB_PERTHREAD_init:DATA:REORDER:NOROOT(0)
SECTION_TYPE SHT_PROGBITS, 0
SECTION `.rodata`:CONST:REORDER:NOROOT(2)
`?<Constant "Hello World!">`:
DATA
DC8 "Hello World!"
DC8 0, 0, 0
END
// 51
// 52
// 53
// 54
//
// 16 bytes in section .rodata
// 96 bytes in section .text
//
// 96 bytes of CODE memory
// 16 bytes of CONST memory
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -