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

📄 main.lss

📁 AVR单片机 读写SD/MMC卡 带文件系统 FAT16 源码
💻 LSS
📖 第 1 页 / 共 3 页
字号:

main.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00001716  00000000  00000000  00000094  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         000000d4  00800060  00001716  000017aa  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000011  00800134  00800134  0000187e  2**0
                  ALLOC
  3 .noinit       00000000  00800145  00800145  0000187e  2**0
                  CONTENTS
  4 .eeprom       00000000  00810000  00810000  0000187e  2**0
                  CONTENTS
  5 .debug_aranges 0000003c  00000000  00000000  0000187e  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_pubnames 000001e9  00000000  00000000  000018ba  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_info   00000d3a  00000000  00000000  00001aa3  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_abbrev 000003b2  00000000  00000000  000027dd  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_line   000008d4  00000000  00000000  00002b8f  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_str    00000422  00000000  00000000  00003463  2**0
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_ranges 00000018  00001716  00001716  00003885  2**0
                  CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:

00000000 <__vectors>:
       0:	0c 94 2a 00 	jmp	0x54
       4:	0c 94 45 00 	jmp	0x8a
       8:	0c 94 45 00 	jmp	0x8a
       c:	0c 94 45 00 	jmp	0x8a
      10:	0c 94 45 00 	jmp	0x8a
      14:	0c 94 45 00 	jmp	0x8a
      18:	0c 94 45 00 	jmp	0x8a
      1c:	0c 94 45 00 	jmp	0x8a
      20:	0c 94 45 00 	jmp	0x8a
      24:	0c 94 45 00 	jmp	0x8a
      28:	0c 94 45 00 	jmp	0x8a
      2c:	0c 94 45 00 	jmp	0x8a
      30:	0c 94 45 00 	jmp	0x8a
      34:	0c 94 45 00 	jmp	0x8a
      38:	0c 94 45 00 	jmp	0x8a
      3c:	0c 94 45 00 	jmp	0x8a
      40:	0c 94 45 00 	jmp	0x8a
      44:	0c 94 45 00 	jmp	0x8a
      48:	0c 94 45 00 	jmp	0x8a
      4c:	0c 94 45 00 	jmp	0x8a
      50:	0c 94 45 00 	jmp	0x8a

00000054 <__ctors_end>:
      54:	11 24       	eor	r1, r1
      56:	1f be       	out	0x3f, r1	; 63
      58:	cf e5       	ldi	r28, 0x5F	; 95
      5a:	d8 e0       	ldi	r29, 0x08	; 8
      5c:	de bf       	out	0x3e, r29	; 62
      5e:	cd bf       	out	0x3d, r28	; 61

00000060 <__do_copy_data>:
      60:	11 e0       	ldi	r17, 0x01	; 1
      62:	a0 e6       	ldi	r26, 0x60	; 96
      64:	b0 e0       	ldi	r27, 0x00	; 0
      66:	e6 e1       	ldi	r30, 0x16	; 22
      68:	f7 e1       	ldi	r31, 0x17	; 23
      6a:	02 c0       	rjmp	.+4      	; 0x70

0000006c <.do_copy_data_loop>:
      6c:	05 90       	lpm	r0, Z+
      6e:	0d 92       	st	X+, r0

00000070 <.do_copy_data_start>:
      70:	a4 33       	cpi	r26, 0x34	; 52
      72:	b1 07       	cpc	r27, r17
      74:	d9 f7       	brne	.-10     	; 0x6c

00000076 <__do_clear_bss>:
      76:	11 e0       	ldi	r17, 0x01	; 1
      78:	a4 e3       	ldi	r26, 0x34	; 52
      7a:	b1 e0       	ldi	r27, 0x01	; 1
      7c:	01 c0       	rjmp	.+2      	; 0x80

0000007e <.do_clear_bss_loop>:
      7e:	1d 92       	st	X+, r1

00000080 <.do_clear_bss_start>:
      80:	a5 34       	cpi	r26, 0x45	; 69
      82:	b1 07       	cpc	r27, r17
      84:	e1 f7       	brne	.-8      	; 0x7e
      86:	0c 94 5a 00 	jmp	0xb4

0000008a <__bad_interrupt>:
      8a:	0c 94 00 00 	jmp	0x0

0000008e <IOInit>:
//Installation der Seriellen Schnittstelle
void IOInit (void)
{
	//Enable TXEN im Register UCR TX-Data Enable
	UCR=(1 << TXEN);
      8e:	88 e0       	ldi	r24, 0x08	; 8
      90:	8a b9       	out	0x0a, r24	; 10
	//Teiler wird gesetzt 
	UBRR=(SYSCLK / (BAUD_RATE * 16L) - 1);
      92:	87 e4       	ldi	r24, 0x47	; 71
      94:	89 b9       	out	0x09, r24	; 9
      96:	08 95       	ret

00000098 <uart_putchar>:
}


//Routine f黵 printf
int uart_putchar (char c)
{
      98:	cf 93       	push	r28
      9a:	c8 2f       	mov	r28, r24
	if (c == '\n')
      9c:	8a 30       	cpi	r24, 0x0A	; 10
      9e:	19 f4       	brne	.+6      	; 0xa6
		uart_putchar('\r');
      a0:	8d e0       	ldi	r24, 0x0D	; 13
      a2:	0e 94 4c 00 	call	0x98
	//Warten solange bis Zeichen gesendet wurde
	loop_until_bit_is_set(USR, UDRE);
      a6:	5d 9b       	sbis	0x0b, 5	; 11
      a8:	fe cf       	rjmp	.-4      	; 0xa6
	UDR = c;
      aa:	cc b9       	out	0x0c, r28	; 12
	return (0);
}
      ac:	80 e0       	ldi	r24, 0x00	; 0
      ae:	90 e0       	ldi	r25, 0x00	; 0
      b0:	cf 91       	pop	r28
      b2:	08 95       	ret

000000b4 <main>:

//Hauptprogramm
int main (void)
{
      b4:	c8 e5       	ldi	r28, 0x58	; 88
      b6:	d6 e0       	ldi	r29, 0x06	; 6
      b8:	de bf       	out	0x3e, r29	; 62
      ba:	cd bf       	out	0x3d, r28	; 61
	//Initzialisierung der seriellen Schnittstelle
	IOInit();
      bc:	0e 94 47 00 	call	0x8e
	
	//鰂fnet einen kanal f黵 printf
	fdevopen (uart_putchar, NULL, 0);
      c0:	40 e0       	ldi	r20, 0x00	; 0
      c2:	50 e0       	ldi	r21, 0x00	; 0
      c4:	ba 01       	movw	r22, r20
      c6:	8c e4       	ldi	r24, 0x4C	; 76
      c8:	90 e0       	ldi	r25, 0x00	; 0
      ca:	0e 94 18 06 	call	0xc30

	//Initialisierung der MMC/SD-Karte
	printf ("System OK\n\n");	
      ce:	80 e6       	ldi	r24, 0x60	; 96
      d0:	90 e0       	ldi	r25, 0x00	; 0
      d2:	02 c0       	rjmp	.+4      	; 0xd8
	while ( mmc_init() !=0) //ist der R點kgabewert ungleich NULL ist ein Fehler aufgetreten
		{
		printf("** Keine MMC/SD Karte gefunden!! **\n");	
      d4:	8b e6       	ldi	r24, 0x6B	; 107
      d6:	90 e0       	ldi	r25, 0x00	; 0
      d8:	0e 94 7d 06 	call	0xcfa
      dc:	0e 94 69 01 	call	0x2d2
      e0:	88 23       	and	r24, r24
      e2:	c1 f7       	brne	.-16     	; 0xd4
		}
	printf("Karte gefunden!!\n");
      e4:	8f e8       	ldi	r24, 0x8F	; 143
      e6:	90 e0       	ldi	r25, 0x00	; 0
      e8:	0e 94 7d 06 	call	0xcfa
	
	fat_cluster_data_store();//laden Cluster OFFSET und Size ins EEPROM
      ec:	0e 94 84 04 	call	0x908
	//Initialisierung der MMC/SD-Karte ENDE!

	unsigned char Buffer[512];
	unsigned int tmp;
	
	mmc_read_csd (Buffer);
      f0:	ce 01       	movw	r24, r28
      f2:	01 96       	adiw	r24, 0x01	; 1
      f4:	0e 94 f1 02 	call	0x5e2
	
	for (tmp = 0;tmp<16;tmp++)
      f8:	00 e0       	ldi	r16, 0x00	; 0
      fa:	10 e0       	ldi	r17, 0x00	; 0
		{
		printf("%x ",Buffer[tmp]);
      fc:	3e 01       	movw	r6, r28
      fe:	08 94       	sec
     100:	61 1c       	adc	r6, r1
     102:	71 1c       	adc	r7, r1
     104:	f8 01       	movw	r30, r16
     106:	e6 0d       	add	r30, r6
     108:	f7 1d       	adc	r31, r7
     10a:	80 81       	ld	r24, Z
     10c:	99 27       	eor	r25, r25
     10e:	9f 93       	push	r25
     110:	8f 93       	push	r24
     112:	80 ea       	ldi	r24, 0xA0	; 160
     114:	90 e0       	ldi	r25, 0x00	; 0
     116:	9f 93       	push	r25
     118:	8f 93       	push	r24
     11a:	0e 94 61 06 	call	0xcc2
     11e:	0f 90       	pop	r0
     120:	0f 90       	pop	r0
     122:	0f 90       	pop	r0
     124:	0f 90       	pop	r0
     126:	0f 5f       	subi	r16, 0xFF	; 255
     128:	1f 4f       	sbci	r17, 0xFF	; 255
     12a:	00 31       	cpi	r16, 0x10	; 16
     12c:	11 05       	cpc	r17, r1
     12e:	30 f3       	brcs	.-52     	; 0xfc
		};


	//Ausgabe des Root Directory
	unsigned int Clustervar;
	unsigned char Dir_Attrib = 0;
     130:	51 e0       	ldi	r21, 0x01	; 1
     132:	85 2e       	mov	r8, r21
     134:	52 e0       	ldi	r21, 0x02	; 2
     136:	95 2e       	mov	r9, r21
     138:	8c 0e       	add	r8, r28
     13a:	9d 1e       	adc	r9, r29
     13c:	f4 01       	movw	r30, r8
     13e:	10 82       	st	Z, r1
	unsigned long Size = 0;
     140:	42 e0       	ldi	r20, 0x02	; 2
     142:	a4 2e       	mov	r10, r20
     144:	b4 2e       	mov	r11, r20
     146:	ac 0e       	add	r10, r28
     148:	bd 1e       	adc	r11, r29
     14a:	f5 01       	movw	r30, r10
     14c:	10 82       	st	Z, r1
     14e:	11 82       	std	Z+1, r1	; 0x01
     150:	12 82       	std	Z+2, r1	; 0x02
     152:	13 82       	std	Z+3, r1	; 0x03
	printf("\nDirectory\n\n");
     154:	84 ea       	ldi	r24, 0xA4	; 164
     156:	90 e0       	ldi	r25, 0x00	; 0
     158:	0e 94 7d 06 	call	0xcfa
	for (char a = 1;a < 240;a++)
     15c:	31 e0       	ldi	r19, 0x01	; 1
     15e:	d3 2e       	mov	r13, r19
	{
		Clustervar = fat_read_dir_ent(0,a,&Size,&Dir_Attrib,Buffer);
     160:	8e 01       	movw	r16, r28
     162:	0f 5f       	subi	r16, 0xFF	; 255
     164:	1f 4f       	sbci	r17, 0xFF	; 255
     166:	9e 01       	movw	r18, r28
     168:	2f 5f       	subi	r18, 0xFF	; 255
     16a:	3d 4f       	sbci	r19, 0xFD	; 253
     16c:	ae 01       	movw	r20, r28
     16e:	4e 5f       	subi	r20, 0xFE	; 254
     170:	5d 4f       	sbci	r21, 0xFD	; 253
     172:	6d 2d       	mov	r22, r13
     174:	80 e0       	ldi	r24, 0x00	; 0
     176:	90 e0       	ldi	r25, 0x00	; 0
     178:	0e 94 ce 03 	call	0x79c
     17c:	26 e0       	ldi	r18, 0x06	; 6
     17e:	e2 2e       	mov	r14, r18
     180:	22 e0       	ldi	r18, 0x02	; 2
     182:	f2 2e       	mov	r15, r18
     184:	ec 0e       	add	r14, r28
     186:	fd 1e       	adc	r15, r29
     188:	f7 01       	movw	r30, r14
     18a:	80 83       	st	Z, r24
     18c:	91 83       	std	Z+1, r25	; 0x01
			if (Clustervar == 0xffff)
     18e:	8f 5f       	subi	r24, 0xFF	; 255
     190:	9f 4f       	sbci	r25, 0xFF	; 255
     192:	51 f1       	breq	.+84     	; 0x1e8
			{
				break;
			}
		tmp = (Size & 0x0000FFFF);
     194:	f5 01       	movw	r30, r10
     196:	00 81       	ld	r16, Z
     198:	11 81       	ldd	r17, Z+1	; 0x01
		printf("Cluster = %4x DirA = %2x Size= %8d FileName = ",Clustervar,Dir_Attrib,tmp);
     19a:	1f 93       	push	r17
     19c:	0f 93       	push	r16
     19e:	f4 01       	movw	r30, r8
     1a0:	80 81       	ld	r24, Z
     1a2:	99 27       	eor	r25, r25
     1a4:	9f 93       	push	r25
     1a6:	8f 93       	push	r24
     1a8:	f7 01       	movw	r30, r14
     1aa:	80 81       	ld	r24, Z
     1ac:	91 81       	ldd	r25, Z+1	; 0x01
     1ae:	9f 93       	push	r25
     1b0:	8f 93       	push	r24
     1b2:	80 eb       	ldi	r24, 0xB0	; 176
     1b4:	90 e0       	ldi	r25, 0x00	; 0
     1b6:	9f 93       	push	r25
     1b8:	8f 93       	push	r24
     1ba:	0e 94 61 06 	call	0xcc2
		printf(Buffer);
     1be:	7f 92       	push	r7
     1c0:	6f 92       	push	r6
     1c2:	0e 94 61 06 	call	0xcc2
		printf("\n");
     1c6:	8a e0       	ldi	r24, 0x0A	; 10
     1c8:	90 e0       	ldi	r25, 0x00	; 0
     1ca:	0e 94 76 06 	call	0xcec
     1ce:	8d b7       	in	r24, 0x3d	; 61
     1d0:	9e b7       	in	r25, 0x3e	; 62
     1d2:	0a 96       	adiw	r24, 0x0a	; 10
     1d4:	0f b6       	in	r0, 0x3f	; 63
     1d6:	f8 94       	cli
     1d8:	9e bf       	out	0x3e, r25	; 62
     1da:	0f be       	out	0x3f, r0	; 63
     1dc:	8d bf       	out	0x3d, r24	; 61
     1de:	d3 94       	inc	r13
     1e0:	9f ee       	ldi	r25, 0xEF	; 239
     1e2:	9d 15       	cp	r25, r13
     1e4:	08 f0       	brcs	.+2      	; 0x1e8
     1e6:	bc cf       	rjmp	.-136    	; 0x160
	}
	printf("\nDirectory Ende\n\n");
     1e8:	8f ed       	ldi	r24, 0xDF	; 223
     1ea:	90 e0       	ldi	r25, 0x00	; 0
     1ec:	0e 94 7d 06 	call	0xcfa

	//Lade Cluster f黵 das index.htm File in den Speicher 
	Clustervar = 0;//suche im Root Verzeichnis
     1f0:	67 01       	movw	r12, r14
     1f2:	f7 01       	movw	r30, r14
     1f4:	10 82       	st	Z, r1
     1f6:	11 82       	std	Z+1, r1	; 0x01
	if (fat_search_file("mmc.txt",&Clustervar,&Size,&Dir_Attrib,Buffer) == 1)
     1f8:	8e 01       	movw	r16, r28
     1fa:	0f 5f       	subi	r16, 0xFF	; 255
     1fc:	1f 4f       	sbci	r17, 0xFF	; 255
     1fe:	9e 01       	movw	r18, r28
     200:	2f 5f       	subi	r18, 0xFF	; 255
     202:	3d 4f       	sbci	r19, 0xFD	; 253
     204:	ae 01       	movw	r20, r28
     206:	4e 5f       	subi	r20, 0xFE	; 254
     208:	5d 4f       	sbci	r21, 0xFD	; 253
     20a:	b7 01       	movw	r22, r14
     20c:	80 ef       	ldi	r24, 0xF0	; 240
     20e:	90 e0       	ldi	r25, 0x00	; 0
     210:	0e 94 d1 05 	call	0xba2
     214:	81 30       	cpi	r24, 0x01	; 1
     216:	59 f5       	brne	.+86     	; 0x26e
		{
		printf("\nFile Found!!\n\n");
     218:	88 ef       	ldi	r24, 0xF8	; 248
     21a:	90 e0       	ldi	r25, 0x00	; 0
     21c:	0e 94 7d 06 	call	0xcfa
		//Lese File und gibt es auf der seriellen Schnittstelle aus
		for (int b = 0;b<52;b++)
     220:	ee 24       	eor	r14, r14
     222:	ff 24       	eor	r15, r15
			{
			fat_read_file (Clustervar,Buffer,b);
     224:	c7 01       	movw	r24, r14
     226:	aa 27       	eor	r26, r26
     228:	97 fd       	sbrc	r25, 7
     22a:	a0 95       	com	r26
     22c:	ba 2f       	mov	r27, r26
     22e:	9c 01       	movw	r18, r24
     230:	ad 01       	movw	r20, r26
     232:	be 01       	movw	r22, r28
     234:	6f 5f       	subi	r22, 0xFF	; 255
     236:	7f 4f       	sbci	r23, 0xFF	; 255
     238:	f6 01       	movw	r30, r12
     23a:	80 81       	ld	r24, Z
     23c:	91 81       	ldd	r25, Z+1	; 0x01
     23e:	0e 94 cf 04 	call	0x99e
			for (int a = 0;a<512;a++)
     242:	00 e0       	ldi	r16, 0x00	; 0
     244:	10 e0       	ldi	r17, 0x00	; 0
				{
				printf ("%c",Buffer[a]);
     246:	fe 01       	movw	r30, r28
     248:	e0 0f       	add	r30, r16
     24a:	f1 1f       	adc	r31, r17
     24c:	81 81       	ldd	r24, Z+1	; 0x01
     24e:	99 27       	eor	r25, r25
     250:	0e 94 76 06 	call	0xcec
     254:	0f 5f       	subi	r16, 0xFF	; 255
     256:	1f 4f       	sbci	r17, 0xFF	; 255
     258:	f2 e0       	ldi	r31, 0x02	; 2
     25a:	00 30       	cpi	r16, 0x00	; 0
     25c:	1f 07       	cpc	r17, r31
     25e:	9c f3       	brlt	.-26     	; 0x246
     260:	08 94       	sec
     262:	e1 1c       	adc	r14, r1
     264:	f1 1c       	adc	r15, r1
     266:	24 e3       	ldi	r18, 0x34	; 52
     268:	e2 16       	cp	r14, r18
     26a:	f1 04       	cpc	r15, r1
     26c:	dc f2       	brlt	.-74     	; 0x224
				}
			}
		}

	printf("FERTIG!!\n");
     26e:	87 e0       	ldi	r24, 0x07	; 7
     270:	91 e0       	ldi	r25, 0x01	; 1
     272:	0e 94 7d 06 	call	0xcfa
	//Hauptprogramm l鋟ft st鋘dig in einer schleife und macht nichts
	while (1)
     276:	ff cf       	rjmp	.-2      	; 0x276

00000278 <mmc_write_byte>:
inline void mmc_write_byte (U08 Byte)
//############################################################################
{
#if SPI_Mode		//Routine f黵 Hardware SPI

⌨️ 快捷键说明

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