Hallo Ich will eine einfache Anwendung auf meinem Ap7000 laufen lassen. Diese soll mit uboot in den SDRAM geladen werden und dann gestarted werden. Mein code: led.c
1 | #include <avr32/io.h> |
2 | |
3 | int main( void ) |
4 | {
|
5 | |
6 | |
7 | |
8 | AVR32_PIOE.per = 0x00000010; /* Set pio enable for PE04 */ |
9 | AVR32_PIOE.oer = 0x00000010; /* Define as output port */ |
10 | AVR32_PIOE.pudr =0x00000010; /* disable pull-up */ |
11 | AVR32_PIOE.idr = 0x00000010; /* Disable interrupts on this pin */ |
12 | |
13 | while(1) |
14 | {
|
15 | |
16 | AVR32_PIOE.sodr =0x00000010; /* set to high */ |
17 | |
18 | |
19 | AVR32_PIOE.codr =0x00000010; /* set to low */ |
20 | |
21 | |
22 | |
23 | } |
24 | |
25 | return 0; |
26 | } |
Port ein/aus schalten Mit AVR32 Studio compiliert: Output from the build process:
1 | **** Internal Builder is used for build **** |
2 | avr32-gcc -O0 -Wall -c -fmessage-length=0 -mpart=ap7000 -oled.o ..\led.c |
3 | avr32-gcc -T mylds.x -e _start -mpart=ap7000 -oLed.elf led.o |
4 | Build complete for project Led |
5 | Time consumed: 234 ms. |
Die mylds.x basiert auf dem avr32elf_ap7000.x linker script in dem ich folgendes noch geändert habe:
1 | FLASH (rxai) : ORIGIN = 0x10000000, LENGTH = 64M |
Die Startaddresse "FLASH" hab ich einfach auf 0x10000000 (SDRAM) geändert. So liegen jetzt alle Sachen die vorher bei 0x000 im Flash lagen im SDRAM und
1 | SECTIONS |
2 | {
|
3 | /* Read-only sections, merged into text segment: */ |
4 | PROVIDE (__executable_start = 0x10000000); . = 0x10000000; |
Und die executable start Addresse von 0x0000000 auf 0x10000000 geändert. avr32-objdump -f Led.elf sagt:
1 | Led.elf: file format elf32-avr32 |
2 | architecture: avr32, flags 0x00000113: |
3 | HAS_RELOC, EXEC_P, HAS_SYMS, D_PAGED |
4 | start address 0x10000000 |
avr32-objdump -D Led.elf sagt:
1 | Led.elf: file format elf32-avr32 |
2 | |
3 | Disassembly of section .reset: |
4 | |
5 | 10000000 <_start>: |
6 | 10000000: 48 1f lddpc pc,10000004 <_start+0x4> |
7 | 10000002: 00 00 add r0,r0 |
8 | 10000004: 10 00 add r0,r8 |
9 | 10000006: 00 24 rsub r4,r0 |
10 | Disassembly of section .got: |
11 | |
12 | 24000014 <_GLOBAL_OFFSET_TABLE_>: |
13 | 24000014: 10 00 add r0,r8 |
14 | 24000016: 0f 30 ld.ub r0,r7++ |
15 | 24000018: 10 00 add r0,r8 |
16 | 2400001a: 00 e0 st.h --r0,r0 |
17 | 2400001c: 10 00 add r0,r8 |
18 | 2400001e: 00 a8 st.w r0++,r8 |
19 | Disassembly of section .init: |
20 | |
21 | 10000008 <_init>: |
22 | 10000008: eb cd 40 40 pushm r6,lr |
23 | 1000000c: 48 26 lddpc r6,10000014 <_init+0xc> |
24 | 1000000e: 1e 26 rsub r6,pc |
25 | 10000010: c0 48 rjmp 10000018 <_init+0x10> |
26 | 10000012: 00 00 add r0,r0 |
27 | 10000014: eb ff ff fa st.bal r5[0x1fa],pc |
28 | 10000018: f0 16 00 01 mcall r6[4] |
29 | 1000001c: f0 16 00 00 mcall r6[0] |
30 | 10000020: e3 cd 80 40 ldm sp++,r6,pc |
31 | |
32 | ---entfernt---- |
33 | |
34 | |
35 | 100000fc <main>: |
36 | 100000fc: eb cd 40 80 pushm r7,lr |
37 | 10000100: 1a 97 mov r7,sp |
38 | 10000102: 49 99 lddpc r9,10000164 <main+0x68> |
39 | 10000104: 31 08 mov r8,16 |
40 | 10000106: 93 08 st.w r9[0x0],r8 |
41 | 10000108: 49 79 lddpc r9,10000164 <main+0x68> |
42 | 1000010a: 31 08 mov r8,16 |
43 | 1000010c: 93 48 st.w r9[0x10],r8 |
44 | 1000010e: 49 69 lddpc r9,10000164 <main+0x68> |
45 | 10000110: 31 08 mov r8,16 |
46 | 10000112: f3 48 00 60 st.w r9[96],r8 |
47 | 10000116: 49 49 lddpc r9,10000164 <main+0x68> |
48 | 10000118: 31 08 mov r8,16 |
49 | 1000011a: f3 48 00 44 st.w r9[68],r8 |
50 | 1000011e: 49 29 lddpc r9,10000164 <main+0x68> |
51 | 10000120: 32 08 mov r8,32 |
52 | 10000122: 93 08 st.w r9[0x0],r8 |
53 | 10000124: 49 09 lddpc r9,10000164 <main+0x68> |
54 | 10000126: 32 08 mov r8,32 |
55 | 10000128: 93 48 st.w r9[0x10],r8 |
56 | 1000012a: 48 f9 lddpc r9,10000164 <main+0x68> |
57 | 1000012c: 32 08 mov r8,32 |
58 | 1000012e: f3 48 00 60 st.w r9[96],r8 |
59 | 10000132: 48 d9 lddpc r9,10000164 <main+0x68> |
60 | 10000134: 32 08 mov r8,32 |
61 | 10000136: f3 48 00 44 st.w r9[68],r8 |
62 | 1000013a: 48 b9 lddpc r9,10000164 <main+0x68> |
63 | 1000013c: 34 08 mov r8,64 |
64 | 1000013e: 93 08 st.w r9[0x0],r8 |
65 | 10000140: 48 99 lddpc r9,10000164 <main+0x68> |
66 | 10000142: 34 08 mov r8,64 |
67 | 10000144: 93 48 st.w r9[0x10],r8 |
68 | 10000146: 48 89 lddpc r9,10000164 <main+0x68> |
69 | 10000148: 34 08 mov r8,64 |
70 | 1000014a: f3 48 00 60 st.w r9[96],r8 |
71 | 1000014e: 48 69 lddpc r9,10000164 <main+0x68> |
72 | 10000150: 34 08 mov r8,64 |
73 | 10000152: f3 48 00 44 st.w r9[68],r8 |
74 | 10000156: 48 49 lddpc r9,10000164 <main+0x68> |
75 | 10000158: 31 08 mov r8,16 |
76 | 1000015a: 93 c8 st.w r9[0x30],r8 |
77 | 1000015c: 48 29 lddpc r9,10000164 <main+0x68> |
78 | 1000015e: 31 08 mov r8,16 |
79 | 10000160: 93 d8 st.w r9[0x34],r8 |
80 | 10000162: cf ab rjmp 10000156 <main+0x5a> |
81 | 10000164: ff e0 *unknown* |
82 | 10000166: 38 00 mov r0,-128 |
83 | |
84 | ................gekürzt.... |
Nun habe ich versucht die Anwendung von uboot aus zu starten:
1 | U-Boot 1.3.4-atmel.buildroot.1 (Dec 18 2008 - 14:56:40) |
2 | |
3 | U-Boot code: 00000000 -> 00011108 data: 000179e0 -> 0004e2f8 |
4 | CPU: 140 Mhz HSB: 70 MHz PBA: 35 MHz PBB: 70 MHz |
5 | malloc: Using memory from 0x11f71000 to 0x11fb1000 |
6 | DMA: Using memory from 0x11f6d000 to 0x11f71000 |
7 | Flash: 8 MB at address 0x00000000 |
8 | DRAM Configuration: |
9 | Bank #0: 10000000 32 MB |
10 | In: serial |
11 | Out: serial |
12 | Err: serial |
13 | Net: macb0, macb1 |
14 | Press SPACE to abort autoboot in 1 seconds |
15 | U-Boot> loadb 0x10000000 |
16 | ## Ready for binary (kermit) download to 0x10000000 at 115200 bps... |
17 | ## Total Size = 0x00010e7c = 69244 Bytes |
18 | ## Start Addr = 0x10000000 |
19 | U-Boot> go 0x10000000 |
20 | ## Starting application at 0x10000000 ... |
Das Port PE0.4 sollte nun ein/aus geschaltet werden. Aber ich kann nichts auf dem Osszi sehen. Das Port bleibt einfach auf High. Was mache ich falsch? Grüße Pascal