📄 main.lss
字号:
printf("* *\n\r");
1e8: e59f40e0 ldr r4, [pc, #224] ; 2d0 <.text+0x2d0>
1ec: e1a00004 mov r0, r4
1f0: eb000352 bl f40 <_printf_P>
printf("* ARM Linux MMC Boot Loader *\n\r");
1f4: e59f00d8 ldr r0, [pc, #216] ; 2d4 <.text+0x2d4>
1f8: eb000350 bl f40 <_printf_P>
printf("* *\n\r");
1fc: e1a00004 mov r0, r4
200: eb00034e bl f40 <_printf_P>
printf("* Copyright (C) 2005 by Ulrich Radig *\n\r");
204: e59f00cc ldr r0, [pc, #204] ; 2d8 <.text+0x2d8>
208: eb00034c bl f40 <_printf_P>
printf("* *\n\r");
20c: e1a00004 mov r0, r4
210: eb00034a bl f40 <_printf_P>
printf("*******************************************\n\n\r");
214: e59f00c0 ldr r0, [pc, #192] ; 2dc <.text+0x2dc>
218: eb000348 bl f40 <_printf_P>
21c: ea000001 b 228 <main+0x9c>
while (mmc_init() != 0) //setup the MMC Card
{
printf("**MMC/SD - Card not found! **\r");
220: e59f00b8 ldr r0, [pc, #184] ; 2e0 <.text+0x2e0>
224: eb000345 bl f40 <_printf_P>
228: eb0000e7 bl 5cc <mmc_init>
22c: e3500000 cmp r0, #0 ; 0x0
230: 1afffffa bne 220 <main+0x94>
}
//Speichern der Cluster Size und Cluster Offset (Anfang Datenbereich)
Cluster_Data_Store();
234: eb0002af bl cf8 <Cluster_Data_Store>
//Initialisierung der MMC/SD-Karte ENDE!
load_file (FILE1,(int*)KERNEL_START);
238: e3a04481 mov r4, #-2130706432 ; 0x81000000
23c: e2845902 add r5, r4, #32768 ; 0x8000
240: e59f009c ldr r0, [pc, #156] ; 2e4 <.text+0x2e4>
244: e1a01005 mov r1, r5
248: eb000542 bl 1758 <load_file>
//verify_file (FILE1,(int*)KERNEL_START);
//load_file (FILE2,(int*)BOOTIMG_ADDR);
printf("\n\n\rLinux wird gestartet!\n\n\r");
24c: e59f0094 ldr r0, [pc, #148] ; 2e8 <.text+0x2e8>
250: eb00033a bl f40 <_printf_P>
PCB_PINSEL0 = 0x80000005;
254: e3a0220e mov r2, #-536870912 ; 0xe0000000
258: e282290b add r2, r2, #180224 ; 0x2c000
25c: e3a03116 mov r3, #-2147483643 ; 0x80000005
260: e5823000 str r3, [r2]
PCB_PINSEL2 = 0x0F814924;
264: e3a0353e mov r3, #260046848 ; 0xf800000
268: e2833b52 add r3, r3, #83968 ; 0x14800
26c: e2833f49 add r3, r3, #292 ; 0x124
270: e5823014 str r3, [r2, #20]
BCFG0 = 0x2000FFEF;
274: e3a02eff mov r2, #4080 ; 0xff0
278: e282200f add r2, r2, #15 ; 0xf
27c: e1822a82 orr r2, r2, r2, lsl #21
280: e3a01202 mov r1, #536870912 ; 0x20000000
284: e2813cff add r3, r1, #65280 ; 0xff00
288: e28330ef add r3, r3, #239 ; 0xef
28c: e5023fff str r3, [r2, #-4095]
BCFG1 = 0x20000440;
290: e2811d11 add r1, r1, #1088 ; 0x440
294: e5021ffb str r1, [r2, #-4091]
BCFG2 = 0x0000FFEF;
298: e3a03801 mov r3, #65536 ; 0x10000
29c: e2433011 sub r3, r3, #17 ; 0x11
2a0: e5023ff7 str r3, [r2, #-4087]
BCFG3 = 0x0000FFEF;
2a4: e5023ff3 str r3, [r2, #-4083]
VICDefVectAddr = 0x81000018;
2a8: e2844018 add r4, r4, #24 ; 0x18
2ac: e3e03000 mvn r3, #0 ; 0x0
2b0: e5034fcb str r4, [r3, #-4043]
kernelstart = (void (*)(void))KERNEL_START;//KERNEL_START;
(*kernelstart)();
2b4: e1a0e00f mov lr, pc
2b8: e12fff15 bx r5
printf("Never reached this!!");
2bc: e59f0028 ldr r0, [pc, #40] ; 2ec <.text+0x2ec>
2c0: eb00031e bl f40 <_printf_P>
2c4: eafffffe b 2c4 <main+0x138>
2c8: 00001cf4 streqd r1, [r0], -r4
2cc: 00001bcc andeq r1, r0, ip, asr #23
2d0: 00001bfc streqd r1, [r0], -ip
2d4: 00001c2c andeq r1, r0, ip, lsr #24
2d8: 00001c5c andeq r1, r0, ip, asr ip
2dc: 00001c8c andeq r1, r0, ip, lsl #25
2e0: 00001cbc streqh r1, [r0], -ip
2e4: 00001b88 andeq r1, r0, r8, lsl #23
2e8: 00001cdc ldreqd r1, [r0], -ip
2ec: 00001cf8 streqd r1, [r0], -r8
000002f0 <Write_Command_MMC>:
//############################################################################
//Sendet ein Commando an die MMC/SD-Karte
unsigned char Write_Command_MMC (unsigned char *CMD)
//############################################################################
{
2f0: e52de004 str lr, [sp, #-4]!
unsigned char tmp = 0xff;
unsigned short int Timeout = 0;
//set MMC_Chip_Select to high (MMC/SD-Karte Inaktiv)
MMC_Disable();
2f4: e3a0220e mov r2, #-536870912 ; 0xe0000000
2f8: e282190a add r1, r2, #163840 ; 0x28000
2fc: e5913000 ldr r3, [r1]
300: e3833b01 orr r3, r3, #1024 ; 0x400
304: e5813000 str r3, [r1]
//sendet 8 Clock Impulse
Write_Byte_MMC(0xFF);
//set MMC_Chip_Select to low (MMC/SD-Karte Aktiv)
MMC_Enable();
//sendet 6 Byte Commando
for (unsigned char a = 0;a<0x06;a++) //sendet 6 Byte Commando zur MMC/SD-Karte
{
Write_Byte_MMC(*CMD++);
}
//Wartet auf ein g黮tige Antwort von der MMC/SD-Karte
while (tmp == 0xff)
{
tmp = Read_Byte_MMC();
if (Timeout++ > 500)
{
break; //Abbruch da die MMC/SD-Karte nicht Antwortet
}
}
// printf("#R: %02X #\n\r",tmp);
return(tmp);
}
//############################################################################
//Routine zum Empfangen eines Bytes von der MMC-Karte
inline unsigned char Read_Byte_MMC (void)
//############################################################################
{
unsigned char Byte = 0;
SPI0_SPDR = 0xff;
while(!(SPI0_SPSR & (1<<SPIF))){};
Byte = SPI0_SPDR;
return (Byte);
}
//############################################################################
//Routine zum Senden eines Bytes zur MMC-Karte
inline void Write_Byte_MMC (unsigned char Byte)
//############################################################################
{
SPI0_SPDR = Byte; //Sendet ein Byte
308: e2822802 add r2, r2, #131072 ; 0x20000
30c: e3a030ff mov r3, #255 ; 0xff
310: e5823008 str r3, [r2, #8]
while(!(SPI0_SPSR & (1<<SPIF))){}; //Wartet bis Byte gesendet wurde
314: e5923004 ldr r3, [r2, #4]
318: e3130080 tst r3, #128 ; 0x80
31c: 0afffffc beq 314 <Write_Command_MMC+0x24>
320: e3a0320e mov r3, #-536870912 ; 0xe0000000
324: e283390a add r3, r3, #163840 ; 0x28000
328: e5932000 ldr r2, [r3]
32c: e3c22b01 bic r2, r2, #1024 ; 0x400
330: e5832000 str r2, [r3]
334: e3a01000 mov r1, #0 ; 0x0
338: e243390a sub r3, r3, #163840 ; 0x28000
33c: e2832802 add r2, r3, #131072 ; 0x20000
340: e4d03001 ldrb r3, [r0], #1
344: e5823008 str r3, [r2, #8]
348: e5923004 ldr r3, [r2, #4]
34c: e3130080 tst r3, #128 ; 0x80
350: 0afffffc beq 348 <Write_Command_MMC+0x58>
354: e2813001 add r3, r1, #1 ; 0x1
358: e20310ff and r1, r3, #255 ; 0xff
35c: e3510006 cmp r1, #6 ; 0x6
360: 1afffff6 bne 340 <Write_Command_MMC+0x50>
364: e2411006 sub r1, r1, #6 ; 0x6
368: e3a0320e mov r3, #-536870912 ; 0xe0000000
36c: e2832802 add r2, r3, #131072 ; 0x20000
370: e3a0e0ff mov lr, #255 ; 0xff
374: e3a03f7d mov r3, #500 ; 0x1f4
378: e283c001 add ip, r3, #1 ; 0x1
37c: e582e008 str lr, [r2, #8]
380: e5923004 ldr r3, [r2, #4]
384: e3130080 tst r3, #128 ; 0x80
388: 0afffffc beq 380 <Write_Command_MMC+0x90>
38c: e5923008 ldr r3, [r2, #8]
390: e20300ff and r0, r3, #255 ; 0xff
394: e151000c cmp r1, ip
398: 049df004 ldreq pc, [sp], #4
39c: e35000ff cmp r0, #255 ; 0xff
3a0: 149df004 ldrne pc, [sp], #4
3a4: e2813001 add r3, r1, #1 ; 0x1
3a8: e1a03803 mov r3, r3, lsl #16
3ac: e1a01823 mov r1, r3, lsr #16
3b0: eafffff1 b 37c <Write_Command_MMC+0x8c>
000003b4 <Read_Byte_MMC>:
3b4: e3a030ff mov r3, #255 ; 0xff
3b8: e3a0220e mov r2, #-536870912 ; 0xe0000000
3bc: e2822802 add r2, r2, #131072 ; 0x20000
3c0: e5823008 str r3, [r2, #8]
3c4: e5923004 ldr r3, [r2, #4]
3c8: e3130080 tst r3, #128 ; 0x80
3cc: 0afffffc beq 3c4 <Read_Byte_MMC+0x10>
3d0: e5920008 ldr r0, [r2, #8]
3d4: e20000ff and r0, r0, #255 ; 0xff
3d8: e12fff1e bx lr
000003dc <Write_Byte_MMC>:
3dc: e20000ff and r0, r0, #255 ; 0xff
3e0: e3a0320e mov r3, #-536870912 ; 0xe0000000
3e4: e2833802 add r3, r3, #131072 ; 0x20000
3e8: e5830008 str r0, [r3, #8]
3ec: e2433802 sub r3, r3, #131072 ; 0x20000
3f0: e2832802 add r2, r3, #131072 ; 0x20000
3f4: e5923004 ldr r3, [r2, #4]
3f8: e3130080 tst r3, #128 ; 0x80
3fc: 0afffffc beq 3f4 <Write_Byte_MMC+0x18>
}
400: e12fff1e bx lr
00000404 <MMC_Read_Block>:
//############################################################################
//Routine zum schreiben eines Blocks(512Byte) auf die MMC/SD-Karte
unsigned char mmc_write_sector (unsigned long addr,unsigned char *Buffer)
//############################################################################
{
unsigned char tmp;
//Commando 24 zum schreiben eines Blocks auf die MMC/SD - Karte
unsigned char CMD[] = {0x58,0x00,0x00,0x00,0x00,0xFF};
/*Die Adressierung der MMC/SD-Karte wird in Bytes angegeben,
addr wird von Blocks zu Bytes umgerechnet danach werden
diese in das Commando eingef黦t*/
//addr = addr << 9; //addr = addr * 512
CMD[1] = ((addr & 0xFF000000) >>24 );
CMD[2] = ((addr & 0x00FF0000) >>16 );
CMD[3] = ((addr & 0x0000FF00) >>8 );
//Sendet Commando CMD24 an MMC/SD-Karte (Write 1 Block/512 Bytes)
tmp = Write_Command_MMC (CMD);
if (tmp != 0)
{
return(tmp);
}
//Wartet einen Moment und sendet einen Clock an die MMC/SD-Karte
for (unsigned char a=0;a<100;a++)
{
Read_Byte_MMC();
}
//Sendet Start Byte an MMC/SD-Karte
Write_Byte_MMC(0xFE);
//Schreiben des Bolcks (512Bytes) auf MMC/SD-Karte
for (unsigned short int a=0;a<512;a++)
{
Write_Byte_MMC(*Buffer++);
}
//CRC-Byte schreiben
Write_Byte_MMC(0xFF); //Schreibt Dummy CRC
Write_Byte_MMC(0xFF); //CRC Code wird nicht benutzt
//Wartet auf MMC/SD-Karte Bussy
while (Read_Byte_MMC() != 0xff){};
//set MMC_Chip_Select to high (MMC/SD-Karte Inaktiv)
MMC_Disable();
return(0);
}
//############################################################################
//Routine zum lesen des CID Registers von der MMC/SD-Karte (16Bytes)
void MMC_Read_Block(unsigned char *CMD,unsigned char *Buffer,unsigned short int Bytes)
//############################################################################
{
404: e92d4030 stmdb sp!, {r4, r5, lr}
408: e1a04001 mov r4, r1
40c: e1a02802 mov r2, r2, lsl #16
410: e1a05822 mov r5, r2, lsr #16
//Sendet Commando CMD an MMC/SD-Karte
if (Write_Command_MMC (CMD) != 0)
414: ebffffb5 bl 2f0 <Write_Command_MMC>
418: e3500000 cmp r0, #0 ; 0x0
41c: 18bd8030 ldmneia sp!, {r4, r5, pc}
420: e3a0320e mov r3, #-536870912 ; 0xe0000000
424: e2832802 add r2, r3, #131072 ; 0x20000
428: e3a010ff mov r1, #255 ; 0xff
42c: e5821008 str r1, [r2, #8]
430: e5923004 ldr r3, [r2, #4]
434: e3130080 tst r3, #128 ; 0x80
438: 0afffffc beq 430 <MMC_Read_Block+0x2c>
43c: e5923008 ldr r3, [r2, #8]
{
return;
}
//Wartet auf Start Byte von der MMC/SD-Karte (FEh/Start Byte)
while (Read_Byte_MMC() != 0xfe){};
440: e20330ff and r3, r3, #255 ; 0xff
444: e35300fe cmp r3, #254 ; 0xfe
448: 1afffff7 bne 42c <MMC_Read_Block+0x28>
//Lesen des Bolcks (normal 512Bytes) von MMC/SD-Karte
for (unsigned short int a=0;a<Bytes;a++)
44c: e3550000 cmp r5, #0 ; 0x0
450: 0a00000f beq 494 <MMC_Read_Block+0x90>
454: e3a01000 mov r1, #0 ; 0x0
458: e3a0320e mov r3, #-536870912 ; 0xe0000000
45c: e2832802 add r2, r3, #131072 ; 0x20000
460: e3a000ff mov r0, #255 ; 0xff
464: e5820008 str r0, [r2, #8]
468: e5923004 ldr r3, [r2, #4]
46c: e3130080 tst r3, #128 ; 0x80
470: 0afffffc beq 468 <MMC_Read_Block+0x64>
474: e5923008 ldr r3, [r2, #8]
{
*Buffer++ = Read_Byte_MMC();
478: e5c43000 strb r3, [r4]
47c: e2813001 add r3, r1, #1 ; 0x1
480: e1a03803 mov r3, r3, lsl #16
484: e1a01823 mov r1, r3, lsr #16
488: e1550001 cmp r5, r1
48c: 12844001 addne r4, r4, #1 ; 0x1
490: 1afffff3 bne 464 <MMC_Read_Block+0x60>
494: e3a030ff mov r3, #255 ; 0xff
498: e3a0220e mov r2, #-536870912 ; 0xe0000000
49c: e2822802 add r2, r2, #131072 ; 0x20000
4a0: e5823008 str r3, [r2, #8]
4a4: e5923004 ldr r3, [r2, #4]
4a8: e3130080 tst r3, #128 ; 0x80
4ac: 0afffffc beq 4a4 <MMC_Read_Block+0xa0>
4b0: e5923008 ldr r3, [r2, #8]
4b4: e3a030ff mov r3, #255 ; 0xff
4b8: e5823008 str r3, [r2, #8]
4bc: e3a0320e mov r3, #-536870912 ; 0xe0000000
4c0: e2832802 add r2, r3, #131072 ; 0x20000
4c4: e5923004 ldr r3, [r2, #4]
4c8: e3130080 tst r3, #128 ; 0x80
4cc: 0afffffc beq 4c4 <MMC_Read_Block+0xc0>
4d0: e5923008 ldr r3, [r2, #8]
}
//CRC-Byte auslesen
Read_Byte_MMC();//CRC - Byte wird nicht ausgewertet
Read_Byte_MMC();//CRC - Byte wird nicht ausgewertet
//set MMC_Chip_Select to high (MMC/SD-Karte Inaktiv)
MMC_Disable();
4d4: e3a0220e mov r2, #-536870912 ; 0xe0000000
4d8: e282290a add r2, r2, #163840 ; 0x28000
4dc: e5923000 ldr r3, [r2]
4e0: e3833b01 orr r3, r3, #1024 ; 0x400
4e4: e5823000 str r3, [r2]
4e8: e8bd8030 ldmia sp!, {r4, r5, pc}
000004ec <mmc_read_sector>:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -