⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lss

📁 AVRGCC编写的很好用的串口通讯源程序
💻 LSS
📖 第 1 页 / 共 4 页
字号:

main.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000ce2  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000006  00800060  00000ce2  00000d76  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          000001a7  00800066  00800066  00000d7c  2**2
                  ALLOC
  3 .noinit       00000000  0080020d  0080020d  00000d7c  2**0
                  CONTENTS
  4 .eeprom       00000000  00810000  00810000  00000d7c  2**0
                  CONTENTS
  5 .stab         00002844  00000000  00000000  00000d7c  2**2
                  CONTENTS, READONLY, DEBUGGING
  6 .stabstr      000011fb  00000000  00000000  000035c0  2**0
                  CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:

00000000 <__vectors>:
   0:	0c 94 4e 00 	jmp	0x9c
   4:	0c 94 73 00 	jmp	0xe6
   8:	0c 94 69 00 	jmp	0xd2
   c:	0c 94 69 00 	jmp	0xd2
  10:	0c 94 69 00 	jmp	0xd2
  14:	0c 94 69 00 	jmp	0xd2
  18:	0c 94 69 00 	jmp	0xd2
  1c:	0c 94 69 00 	jmp	0xd2
  20:	0c 94 69 00 	jmp	0xd2
  24:	0c 94 6b 00 	jmp	0xd6
  28:	0c 94 69 00 	jmp	0xd2
  2c:	0c 94 cf 00 	jmp	0x19e
  30:	0c 94 69 00 	jmp	0xd2
  34:	0c 94 ff 00 	jmp	0x1fe
  38:	0c 94 69 00 	jmp	0xd2
  3c:	0c 94 69 00 	jmp	0xd2
  40:	0c 94 69 00 	jmp	0xd2
  44:	0c 94 69 00 	jmp	0xd2
  48:	0c 94 69 00 	jmp	0xd2
  4c:	0c 94 69 00 	jmp	0xd2
  50:	0c 94 69 00 	jmp	0xd2

00000054 <DisplayTcb>:
  54:	81 01 99 00 66 00 05                                ....f..

0000005b <KeyPressTcb>:
  5b:	f2 00 7b 00 f3 00 05                                ..{....

00000062 <__c.1>:
  62:	6b 65 79 20 62 6e d6 d0 b9 fa 20 70 6f 6f 6c 20     key bn.... pool 
  72:	70 72 65 73 73 65 64 21 0d 00                       pressed!..

0000007c <__c.0>:
  7c:	30 31 32 33 34 35 36 37 38 39 d6 d0 bb aa c8 cb     0123456789......
  8c:	c3 f1 b9 b2 ba cd b9 fa cd f2 cb ea a3 a1 0d 00     ................

0000009c <__init>:
  9c:	11 24       	eor	r1, r1
  9e:	1f be       	out	0x3f, r1	; 63
  a0:	cf e5       	ldi	r28, 0x5F	; 95
  a2:	d4 e0       	ldi	r29, 0x04	; 4
  a4:	de bf       	out	0x3e, r29	; 62
  a6:	cd bf       	out	0x3d, r28	; 61

000000a8 <__do_copy_data>:
  a8:	10 e0       	ldi	r17, 0x00	; 0
  aa:	a0 e6       	ldi	r26, 0x60	; 96
  ac:	b0 e0       	ldi	r27, 0x00	; 0
  ae:	e2 ee       	ldi	r30, 0xE2	; 226
  b0:	fc e0       	ldi	r31, 0x0C	; 12
  b2:	02 c0       	rjmp	.+4      	; 0xb8

000000b4 <.do_copy_data_loop>:
  b4:	05 90       	lpm	r0, Z+
  b6:	0d 92       	st	X+, r0

000000b8 <.do_copy_data_start>:
  b8:	a6 36       	cpi	r26, 0x66	; 102
  ba:	b1 07       	cpc	r27, r17
  bc:	d9 f7       	brne	.-10     	; 0xb4

000000be <__do_clear_bss>:
  be:	12 e0       	ldi	r17, 0x02	; 2
  c0:	a6 e6       	ldi	r26, 0x66	; 102
  c2:	b0 e0       	ldi	r27, 0x00	; 0
  c4:	01 c0       	rjmp	.+2      	; 0xc8

000000c6 <.do_clear_bss_loop>:
  c6:	1d 92       	st	X+, r1

000000c8 <.do_clear_bss_start>:
  c8:	ad 30       	cpi	r26, 0x0D	; 13
  ca:	b1 07       	cpc	r27, r17
  cc:	e1 f7       	brne	.-8      	; 0xc6
  ce:	0c 94 ad 00 	jmp	0x15a

000000d2 <__bad_interrupt>:
  d2:	0c 94 00 00 	jmp	0x0

000000d6 <__vector_9>:

// 1ms
AVRX_SIGINT(SIG_OVERFLOW0) 
{
	IntProlog();
  d6:	0e 94 46 04 	call	0x88c
    TCNT0 = (0xFF - F_CPU / 256 / 1000);//TCNT0_INIT;
  da:	83 ee       	ldi	r24, 0xE3	; 227
  dc:	82 bf       	out	0x32, r24	; 50
	AvrXTimerHandler();
  de:	0e 94 e8 05 	call	0xbd0
	Epilog();
  e2:	0e 94 9e 04 	call	0x93c

000000e6 <__vector_1>:
}

AVRX_SIGINT(SIG_INTERRUPT0) 
{
	IntProlog();
  e6:	0e 94 46 04 	call	0x88c
	AvrXSetSemaphore(&key_pressed);
  ea:	89 ef       	ldi	r24, 0xF9	; 249
  ec:	90 e0       	ldi	r25, 0x00	; 0
  ee:	0e 94 56 05 	call	0xaac
	Epilog();
  f2:	0e 94 9e 04 	call	0x93c

000000f6 <KeyPress>:
}

AVRX_GCC_TASKDEF(KeyPress, 100, 5)
{
	MCUCR |= _BV(ISC01) | _BV(ISC00);
  f6:	85 b7       	in	r24, 0x35	; 53
  f8:	83 60       	ori	r24, 0x03	; 3
  fa:	85 bf       	out	0x35, r24	; 53
	GIFR |= _BV(INTF0);
  fc:	8a b7       	in	r24, 0x3a	; 58
  fe:	80 64       	ori	r24, 0x40	; 64
 100:	8a bf       	out	0x3a, r24	; 58
	GICR |= _BV(INT0);
 102:	8b b7       	in	r24, 0x3b	; 59
 104:	80 64       	ori	r24, 0x40	; 64
 106:	8b bf       	out	0x3b, r24	; 59
	
	while(1)
	{
		while(1)
		{
			AvrXResetSemaphore(&key_pressed);
 108:	89 ef       	ldi	r24, 0xF9	; 249
 10a:	90 e0       	ldi	r25, 0x00	; 0
 10c:	0e 94 ad 05 	call	0xb5a
			AvrXWaitSemaphore(&key_pressed);
 110:	89 ef       	ldi	r24, 0xF9	; 249
 112:	90 e0       	ldi	r25, 0x00	; 0
 114:	0e 94 3f 05 	call	0xa7e
			AvrXDelay(&delay, 20);
 118:	64 e1       	ldi	r22, 0x14	; 20
 11a:	70 e0       	ldi	r23, 0x00	; 0
 11c:	82 e8       	ldi	r24, 0x82	; 130
 11e:	91 e0       	ldi	r25, 0x01	; 1
 120:	0e 94 ba 05 	call	0xb74
			if (PIND & _BV(PD2)) break;
 124:	82 9b       	sbis	0x10, 2	; 16
 126:	f0 cf       	rjmp	.-32     	; 0x108
		}
		puts_P(PSTR("key bn中国 pool pressed!\r"));
 128:	82 e6       	ldi	r24, 0x62	; 98
 12a:	90 e0       	ldi	r25, 0x00	; 0
 12c:	0e 94 d4 02 	call	0x5a8
 130:	eb cf       	rjmp	.-42     	; 0x108

00000132 <Display>:
	}
}

AVRX_GCC_TASKDEF(Display, 100, 5)
{
	DDRB |= _BV(PB1);
 132:	b9 9a       	sbi	0x17, 1	; 23
	
	while(1)
	{
		puts_P(PSTR("0123456789中华人民共和国万岁!\r"));
 134:	8c e7       	ldi	r24, 0x7C	; 124
 136:	90 e0       	ldi	r25, 0x00	; 0
 138:	0e 94 d4 02 	call	0x5a8
		PORTB &= ~_BV(PB1);
 13c:	c1 98       	cbi	0x18, 1	; 24
		AvrXDelay(&delay, 20);
 13e:	64 e1       	ldi	r22, 0x14	; 20
 140:	70 e0       	ldi	r23, 0x00	; 0
 142:	82 e8       	ldi	r24, 0x82	; 130
 144:	91 e0       	ldi	r25, 0x01	; 1
 146:	0e 94 ba 05 	call	0xb74
		PORTB |= _BV(PB1);
 14a:	c1 9a       	sbi	0x18, 1	; 24
		AvrXDelay(&delay, 980);
 14c:	64 ed       	ldi	r22, 0xD4	; 212
 14e:	73 e0       	ldi	r23, 0x03	; 3
 150:	82 e8       	ldi	r24, 0x82	; 130
 152:	91 e0       	ldi	r25, 0x01	; 1
 154:	0e 94 ba 05 	call	0xb74
 158:	ed cf       	rjmp	.-38     	; 0x134

0000015a <main>:
	}
}

int
main(void)
{
 15a:	cf e5       	ldi	r28, 0x5F	; 95
 15c:	d4 e0       	ldi	r29, 0x04	; 4
 15e:	de bf       	out	0x3e, r29	; 62
 160:	cd bf       	out	0x3d, r28	; 61
	//OSCCAL = 0xB7;

	AvrXSetKernelStack(0);
 162:	80 e0       	ldi	r24, 0x00	; 0
 164:	90 e0       	ldi	r25, 0x00	; 0
 166:	0e 94 da 04 	call	0x9b4

	// Analog Comparator initialization
	// Analog Comparator: Off
	// Analog Comparator Input Capture by Timer/Counter 1: Off
	// Analog Comparator Output: Off
	ACSR = 0x80;
 16a:	80 e8       	ldi	r24, 0x80	; 128
 16c:	88 b9       	out	0x08, r24	; 8
	SFIOR = 0x00;
 16e:	10 be       	out	0x30, r1	; 48

	TCCR0 = _BV(CS02);//T0MC8_CK256; 	// Set up Timer0 for CLK/256 rate
 170:	84 e0       	ldi	r24, 0x04	; 4
 172:	83 bf       	out	0x33, r24	; 51
	TCNT0 = (0xFF - F_CPU / 256 / 1000);//TCNT0_INIT;
 174:	83 ee       	ldi	r24, 0xE3	; 227
 176:	82 bf       	out	0x32, r24	; 50
	TIMSK |= _BV(TOIE0);  	// Enable Timer0 overflow interrupt
 178:	89 b7       	in	r24, 0x39	; 57
 17a:	81 60       	ori	r24, 0x01	; 1
 17c:	89 bf       	out	0x39, r24	; 57

	UartInit();
 17e:	0e 94 2e 02 	call	0x45c
	
	AvrXRunTask(TCB(Display));
 182:	84 e5       	ldi	r24, 0x54	; 84
 184:	90 e0       	ldi	r25, 0x00	; 0
 186:	0e 94 e6 04 	call	0x9cc
	AvrXRunTask(TCB(KeyPress));
 18a:	8b e5       	ldi	r24, 0x5B	; 91
 18c:	90 e0       	ldi	r25, 0x00	; 0
 18e:	0e 94 e6 04 	call	0x9cc

    Epilog();                   // Switch from AvrX Stack to first task
 192:	0e 94 9e 04 	call	0x93c

	return 0;
}
 196:	80 e0       	ldi	r24, 0x00	; 0
 198:	90 e0       	ldi	r25, 0x00	; 0
 19a:	0c 94 70 06 	jmp	0xce0

0000019e <__vector_11>:
AVRX_SIGINT(SIG_UART_RECV)
{
	uint8_t status, data;
	
	IntProlog();
 19e:	0e 94 46 04 	call	0x88c
	status = UCSRA;
 1a2:	8b b1       	in	r24, 0x0b	; 11
	data = UDR;
 1a4:	2c b1       	in	r18, 0x0c	; 12
	if ((status & (_BV(FE) | _BV(PE) | _BV(DOR))) == 0)
 1a6:	99 27       	eor	r25, r25
 1a8:	8c 71       	andi	r24, 0x1C	; 28
 1aa:	90 70       	andi	r25, 0x00	; 0
 1ac:	89 2b       	or	r24, r25
 1ae:	29 f5       	brne	.+74     	; 0x1fa
	{
		rx_buffer[rx_wr] = data;
 1b0:	80 91 f4 01 	lds	r24, 0x01F4
 1b4:	e8 2f       	mov	r30, r24
 1b6:	ff 27       	eor	r31, r31
 1b8:	e1 57       	subi	r30, 0x71	; 113
 1ba:	fe 4f       	sbci	r31, 0xFE	; 254
 1bc:	20 83       	st	Z, r18
		
		if (++rx_wr == RX_BUFFER_SIZE)
 1be:	80 91 f4 01 	lds	r24, 0x01F4
 1c2:	8f 5f       	subi	r24, 0xFF	; 255
 1c4:	80 93 f4 01 	sts	0x01F4, r24
 1c8:	80 91 f4 01 	lds	r24, 0x01F4
 1cc:	82 33       	cpi	r24, 0x32	; 50
 1ce:	11 f4       	brne	.+4      	; 0x1d4
		{
			rx_wr = 0;
 1d0:	10 92 f4 01 	sts	0x01F4, r1
		}
		if (++rx_count == RX_BUFFER_SIZE)
 1d4:	80 91 f5 01 	lds	r24, 0x01F5
 1d8:	8f 5f       	subi	r24, 0xFF	; 255
 1da:	80 93 f5 01 	sts	0x01F5, r24
 1de:	80 91 f5 01 	lds	r24, 0x01F5
 1e2:	82 33       	cpi	r24, 0x32	; 50
 1e4:	31 f4       	brne	.+12     	; 0x1f2
		{
			rx_count = 0;
 1e6:	10 92 f5 01 	sts	0x01F5, r1
			rx_buffer_overflow = 1;
 1ea:	81 e0       	ldi	r24, 0x01	; 1
 1ec:	80 93 8e 01 	sts	0x018E, r24
 1f0:	04 c0       	rjmp	.+8      	; 0x1fa
		}
		else
		{
			AvrXIntSetSemaphore(&rx_rdy);
 1f2:	8b e8       	ldi	r24, 0x8B	; 139
 1f4:	91 e0       	ldi	r25, 0x01	; 1
 1f6:	0e 94 60 05 	call	0xac0
		}
	}
	Epilog();
 1fa:	0e 94 9e 04 	call	0x93c

000001fe <__vector_13>:
}

// USART Transmitter interrupt service routine
AVRX_SIGINT(SIG_UART_TRANS)
{
	IntProlog();
 1fe:	0e 94 46 04 	call	0x88c
	if (tx_count)
 202:	80 91 f6 01 	lds	r24, 0x01F6
 206:	88 23       	and	r24, r24
 208:	e1 f0       	breq	.+56     	; 0x242
	{
		UDR = tx_buffer[tx_rd];
 20a:	80 91 8a 01 	lds	r24, 0x018A
 20e:	e8 2f       	mov	r30, r24
 210:	ff 27       	eor	r31, r31
 212:	ef 53       	subi	r30, 0x3F	; 63
 214:	fe 4f       	sbci	r31, 0xFE	; 254
 216:	80 81       	ld	r24, Z
 218:	8c b9       	out	0x0c, r24	; 12
		if (++tx_rd == TX_BUFFER_SIZE) tx_rd = 0;
 21a:	80 91 8a 01 	lds	r24, 0x018A
 21e:	8f 5f       	subi	r24, 0xFF	; 255
 220:	80 93 8a 01 	sts	0x018A, r24
 224:	80 91 8a 01 	lds	r24, 0x018A
 228:	82 33       	cpi	r24, 0x32	; 50
 22a:	11 f4       	brne	.+4      	; 0x230
 22c:	10 92 8a 01 	sts	0x018A, r1
		--tx_count;
 230:	80 91 f6 01 	lds	r24, 0x01F6
 234:	81 50       	subi	r24, 0x01	; 1
 236:	80 93 f6 01 	sts	0x01F6, r24
		AvrXIntSetSemaphore(&tx_rdy);
 23a:	88 e8       	ldi	r24, 0x88	; 136
 23c:	91 e0       	ldi	r25, 0x01	; 1
 23e:	0e 94 60 05 	call	0xac0
	}
	Epilog();
 242:	0e 94 9e 04 	call	0x93c

00000246 <UartGetc>:
}

int
UartGetc(void)
{
 246:	cf 93       	push	r28
	uint8_t data;
	
	if (0 == rx_count)
 248:	80 91 f5 01 	lds	r24, 0x01F5
 24c:	88 23       	and	r24, r24
 24e:	21 f4       	brne	.+8      	; 0x258
	{
		AvrXWaitSemaphore(&rx_rdy);
 250:	8b e8       	ldi	r24, 0x8B	; 139
 252:	91 e0       	ldi	r25, 0x01	; 1
 254:	0e 94 3f 05 	call	0xa7e
	}
	data = rx_buffer[rx_rd];
 258:	80 91 8d 01 	lds	r24, 0x018D
 25c:	e8 2f       	mov	r30, r24
 25e:	ff 27       	eor	r31, r31
 260:	e1 57       	subi	r30, 0x71	; 113
 262:	fe 4f       	sbci	r31, 0xFE	; 254
 264:	c0 81       	ld	r28, Z
	if (++rx_rd == RX_BUFFER_SIZE)
 266:	8f 5f       	subi	r24, 0xFF	; 255
 268:	80 93 8d 01 	sts	0x018D, r24
 26c:	82 33       	cpi	r24, 0x32	; 50
 26e:	11 f4       	brne	.+4      	; 0x274
	{
		rx_rd = 0;
 270:	10 92 8d 01 	sts	0x018D, r1
	}
	BeginCritical();
 274:	f8 94       	cli
	if (0 == --rx_count)
 276:	80 91 f5 01 	lds	r24, 0x01F5
 27a:	81 50       	subi	r24, 0x01	; 1
 27c:	80 93 f5 01 	sts	0x01F5, r24
 280:	80 91 f5 01 	lds	r24, 0x01F5
 284:	88 23       	and	r24, r24
 286:	21 f4       	brne	.+8      	; 0x290
	{
		AvrXResetSemaphore(&rx_rdy);
 288:	8b e8       	ldi	r24, 0x8B	; 139
 28a:	91 e0       	ldi	r25, 0x01	; 1
 28c:	0e 94 ad 05 	call	0xb5a
	}
	EndCritical();
 290:	78 94       	sei
	
	return data;
}
 292:	8c 2f       	mov	r24, r28
 294:	99 27       	eor	r25, r25
 296:	cf 91       	pop	r28
 298:	08 95       	ret

0000029a <UartPutc>:

int
UartPutc(char c)
{
 29a:	cf 93       	push	r28
 29c:	c8 2f       	mov	r28, r24
	if (tx_count == TX_BUFFER_SIZE)
 29e:	80 91 f6 01 	lds	r24, 0x01F6
 2a2:	82 33       	cpi	r24, 0x32	; 50
 2a4:	21 f4       	brne	.+8      	; 0x2ae
	{
		AvrXWaitSemaphore(&tx_rdy);
 2a6:	88 e8       	ldi	r24, 0x88	; 136
 2a8:	91 e0       	ldi	r25, 0x01	; 1
 2aa:	0e 94 3f 05 	call	0xa7e
	}
	BeginCritical();
 2ae:	f8 94       	cli
	if (tx_count || bit_is_clear(UCSRA, UDRE))
 2b0:	80 91 f6 01 	lds	r24, 0x01F6
 2b4:	88 23       	and	r24, r24
 2b6:	11 f4       	brne	.+4      	; 0x2bc
 2b8:	5d 99       	sbic	0x0b, 5	; 11
 2ba:	1c c0       	rjmp	.+56     	; 0x2f4
	{
		tx_buffer[tx_wr] = c;
 2bc:	80 91 f3 01 	lds	r24, 0x01F3
 2c0:	e8 2f       	mov	r30, r24
 2c2:	ff 27       	eor	r31, r31
 2c4:	ef 53       	subi	r30, 0x3F	; 63
 2c6:	fe 4f       	sbci	r31, 0xFE	; 254
 2c8:	c0 83       	st	Z, r28
		if (++tx_wr == TX_BUFFER_SIZE)
 2ca:	8f 5f       	subi	r24, 0xFF	; 255
 2cc:	80 93 f3 01 	sts	0x01F3, r24
 2d0:	82 33       	cpi	r24, 0x32	; 50
 2d2:	11 f4       	brne	.+4      	; 0x2d8
		{
			tx_wr = 0;
 2d4:	10 92 f3 01 	sts	0x01F3, r1
		}
		if (++tx_count == TX_BUFFER_SIZE)
 2d8:	80 91 f6 01 	lds	r24, 0x01F6
 2dc:	8f 5f       	subi	r24, 0xFF	; 255
 2de:	80 93 f6 01 	sts	0x01F6, r24
 2e2:	80 91 f6 01 	lds	r24, 0x01F6
 2e6:	82 33       	cpi	r24, 0x32	; 50
 2e8:	31 f4       	brne	.+12     	; 0x2f6
		{
			AvrXResetSemaphore(&tx_rdy);
 2ea:	88 e8       	ldi	r24, 0x88	; 136
 2ec:	91 e0       	ldi	r25, 0x01	; 1
 2ee:	0e 94 ad 05 	call	0xb5a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -