Hallo, Nach dem Schreiben des Programms in den Flash läuft das Prg. beim Debuggen. Aber alleine auf dem Rechner läuft es nicht. Software: Eclipse Hardware: Olimex-USB-Tiny u. Olimex-Entwicklungsboard für AT91SAM7S64. Compiler: arm-elf-gcc Muss man eventuell irgendwo den Debugger am Compiler abschalten? Gruss nik
Nein, offensichtlich hat keiner eine Idee, was du überhaupt meinst.
ok, dann nochmal. 1. Ich schreibe das Programm in den Flash. Keine Fehlermeldung. Aber trotz Reset blinken die LED's nicht. 2. Ich debugge das Programm, das schon im Flash liegt und es läuft. LED's blinken. Jetzt die Frage: Muss beim compilieren oder flashen irgendein Hebelchen betätigt werden?
Also Software gibst du Eclipse an. Das ist "nur" eine IDE, meine Glaskugel sagt, dass du den arm-elf-gcc verwendest. Schon mal Linkerscript und makefile überprüft? Nicht, dass du noch fürs RAM linkst und es nur nicht merkst.
Linkerscript:
1 | /* identify the Entry Point (_vec_reset is defined in file crt.s) */
|
2 | ENTRY(_vec_reset) |
3 | |
4 | /* specify the AT91SAM7S64 memory areas */
|
5 | MEMORY
|
6 | {
|
7 | flash : ORIGIN = 0x00000000, LENGTH = 64K /* FLASH EPROM */ |
8 | ram : ORIGIN = 0x00200000, LENGTH = 16K /* static RAM area */ |
9 | }
|
10 | |
11 | |
12 | /* define a global symbol _stack_end (see analysis in annotation above) */
|
13 | _stack_end = 0x00203FFC; |
14 | |
15 | /* now define the output sections */
|
16 | SECTIONS
|
17 | {
|
18 | . = 0; /* set location counter to address zero */ |
19 | |
20 | .text : /* collect all sections that should go into FLASH after startup */ |
21 | {
|
22 | *(.text) /* all .text sections (code) */ |
23 | *(.rodata) /* all .rodata sections (constants, strings, etc.) */ |
24 | *(.rodata*) /* all .rodata* sections (constants, strings, etc.) */ |
25 | *(.glue_7) /* all .glue_7 sections (no idea what these are) */ |
26 | *(.glue_7t) /* all .glue_7t sections (no idea what these are) */ |
27 | _etext = .; /* define a global symbol _etext just after the last code byte */ |
28 | } >flash /* put all the above into FLASH */ |
29 | |
30 | .data : /* collect all initialized .data sections that go into RAM */ |
31 | {
|
32 | _data = .; /* create a global symbol marking the start of the .data section */ |
33 | *(.data) /* all .data sections */ |
34 | _edata = .; /* define a global symbol marking the end of the .data section */ |
35 | } >ram AT >flash /* put all the above into RAM (but load the LMA initializer copy into FLASH) */ |
36 | |
37 | .bss : /* collect all uninitialized .bss sections that go into RAM */ |
38 | {
|
39 | _bss_start = .; /* define a global symbol marking the start of the .bss section */ |
40 | *(.bss) /* all .bss sections */ |
41 | } >ram /* put all the above in RAM (it will be cleared in the startup code */ |
42 | |
43 | . = ALIGN(4); /* advance location counter to the next 32-bit boundary */ |
44 | _bss_end = . ; /* define a global symbol marking the end of the .bss section */ |
45 | }
|
46 | _end = .; /* define a global symbol marking the end of application RAM */ |
und hier das makefile:
1 | NAME= hello_world_flash |
2 | |
3 | # Abkürzungen, die anstatt der hinteren Befehle genommen werden
|
4 | CC = arm-elf-gcc #GNU-Compiler |
5 | LD = arm-elf-ld -v #GNU-Linker |
6 | AR = arm-elf-ar # |
7 | AS = arm-elf-as #GNU-Assembler |
8 | CP = arm-elf-objcopy #GNU Object utility Binary File erzeugen |
9 | OD = arm-elf-objdump # |
10 | |
11 | # Optionen mit denen der Compiler, Linker, assembler gestartet werden
|
12 | # arm-elf-...
|
13 | #-O3 Codeoptimierung
|
14 | CFLAGS = -I./ -c -fno-common -O0 -g |
15 | AFLAGS = -ahls -mapcs-32 -o crt.o |
16 | LFLAGS = -Map main.map -T hello_world_linker_flash.cmd |
17 | CPFLAGS = --output-target=binary |
18 | ODFLAGS = -x --syms |
19 | |
20 | #Objekte, Libraries
|
21 | #Reihenfolge beachten, den in dieser wird in den Speicher geschrieben.
|
22 | |
23 | OBJECTS = crt.o main.o system.o |
24 | |
25 | |
26 | # alle mit make erzeugten Files löschen (Project -> Clean)
|
27 | clean: |
28 | @ echo --------------------------------------- |
29 | @ echo Vorher erzeugte Dateien werden gelöscht |
30 | @ echo --------------------------------------- |
31 | #das Minuszeichen vor rm unterdrückt Fehlermeldungen
|
32 | -rm $(OBJECTS) main.lst system.lst \ |
33 | main.out main.bin main.hex \ |
34 | main.map main.dmp crt.lst |
35 | @ echo --------------------------------------- |
36 | @ echo Vorher erzeugte Dateien wurden gelöscht |
37 | @ echo --------------------------------------- |
38 | |
39 | # Zieldateien erzeugen, verlinken (Project -> Build Project)
|
40 | all: main.out |
41 | @ echo "...copying" #erscheint in der Konsole |
42 | $(CP) $(CPFLAGS) main.out main.bin |
43 | $(OD) $(ODFLAGS) main.out >main.dmp |
44 | |
45 | # Libraries einbinden
|
46 | main.out: $(OBJECTS) hello_world_linker_flash.cmd |
47 | |
48 | @ echo --------------------------------------- |
49 | @ echo *.o werden verlinkt |
50 | @ echo --------------------------------------- |
51 | |
52 | $(LD) $(LFLAGS) -o main.out $(OBJECTS) libc.a libm.a libgcc.a |
53 | |
54 | @ echo --------------------------------------- |
55 | @ echo *.o wurden verlinkt |
56 | @ echo --------------------------------------- |
57 | |
58 | |
59 | crt.o: crt.s |
60 | @ echo ".assembling" |
61 | $(AS) $(AFLAGS) crt.s > crt.lst |
62 | |
63 | # Programmteile compilieren
|
64 | @ echo --------------------------------------- |
65 | @ echo *.c werden compiliert |
66 | @ echo --------------------------------------- |
67 | main.o: main.c |
68 | @ echo ".compiling" |
69 | $(CC) $(CFLAGS) main.c |
70 | |
71 | system.o: system.c |
72 | @ echo ".compiling" |
73 | $(CC) $(CFLAGS) system.c |
74 | @ echo --------------------------------------- |
75 | @ echo *.c wurden compiliert |
76 | @ echo --------------------------------------- |
77 | |
78 | # **********************************************************************************************
|
79 | # FLASH PROGRAMMING
|
80 | #
|
81 | # Alternate make target for flash programming only
|
82 | #
|
83 | # You must create a special Eclipse make target (program) to run this part of the makefile
|
84 | # (Project -> Create Make Target... then set the Target Name and Make Target to "program")
|
85 | #
|
86 | # OpenOCD is run in "batch" mode with a special configuration file and a script file containing
|
87 | # the flash commands. When flash programming completes, OpenOCD terminates.
|
88 | #
|
89 | # Note that the script file of flash commands (script.ocd) is part of the project
|
90 | #
|
91 | # Programmers: Martin Thomas, Joseph M Dupre, James P Lynch
|
92 | # **********************************************************************************************
|
93 | |
94 | # specify output filename here (must be *.bin file)
|
95 | TARGET = main.bin |
96 | |
97 | # specify the directory where openocd executable and configuration files reside (note: use forward slashes /)
|
98 | OPENOCD_DIR = 'd:/Programme/openocd-2007re204/bin/' |
99 | |
100 | # specify OpenOCD executable (pp is for the wiggler, ftd2xx is for the USB debuggers)
|
101 | #OPENOCD = $(OPENOCD_DIR)openocd-pp.exe
|
102 | OPENOCD = $(OPENOCD_DIR)openocd-ftd2xx.exe |
103 | |
104 | # specify OpenOCD configuration file (pick the one for your device)
|
105 | #OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-wiggler-flash-program.cfg
|
106 | #OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-jtagkey-flash-program.cfg
|
107 | #OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s256-armusbocd-flash-program.cfg
|
108 | OPENOCD_CFG = $(OPENOCD_DIR)at91sam7s64-armusbocd.cfg |
109 | |
110 | # program the AT91SAM7S256 internal flash memory
|
111 | program: $(TARGET) |
112 | @echo "Flash Programming with OpenOCD..." # display a message on the console |
113 | $(OPENOCD) -f $(OPENOCD_CFG) # program the onchip FLASH here |
114 | @echo "Flash Programming Finished." # display a message on the console |
Zitat:"Nicht, dass du noch fürs RAM linkst und es nur nicht merkst." Nachdem ich den uC abgeschaltet habe und danach wieder debugge ohne erneut zu flashen funktionierts noch immer. Also bin ich doch im Flash?
Könnte es sein, dass es etwas mit dem NVM-Bit zu tun hat. Wenn ja, wie und wo müsste ich es setzen?
Leider funktioniert das Prg im flash noch immer nicht. was es nicht ist: -das Lockbit (Auslesen telnet 4444 (openocd)
1 | Open On-Chip Debugger |
2 | > flash info 0 |
3 | #0: at91sam7 at 0x00000000, size 0x00000000, buswidth 0, chipwidth 0 |
4 | |
5 | at91sam7 information: Chip is AT91SAM7S64 |
6 | cidr: 0x27090540, arch: 0x0070, eproc: ARM7TDMI, version:0x000, flashsize: 0x00 |
7 | 010000 |
8 | master clock(estimated): 80425kHz |
9 | pagesize: 128, lockbits: 16 0x0000, pages in lock region: 32 |
10 | securitybit: 0, nvmbits: 0x0 |
11 | |
12 | > |
-der Code liegt im flash: make program
1 | Flash Programming with OpenOCD... |
2 | d:/Programme/openocd-2007re204/bin/openocd-ftd2xx.exe -f d:/Programme/openocd-2007re204/bin/at91sam7s64-armusbocd.cfg # program the onchip FLASH here |
3 | Info: openocd.c:93 main(): Open On-Chip Debugger (2007-09-05 09:00 CEST) |
4 | Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too |
5 | Info: target.c:232 target_init_handler(): executing reset script 'script.ocd' |
6 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
7 | Info: configuration.c:50 configuration_output_handler(): target halted |
8 | Info: configuration.c:50 configuration_output_handler(): core state: ARM |
9 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
10 | Info: configuration.c:50 configuration_output_handler(): target halted |
11 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
12 | Info: configuration.c:50 configuration_output_handler(): target halted |
13 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
14 | Info: configuration.c:50 configuration_output_handler(): target halted |
15 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
16 | Info: configuration.c:50 configuration_output_handler(): target halted |
17 | Info: configuration.c:50 configuration_output_handler(): flash 'at91sam7' found at 0x00100000 |
18 | Info: configuration.c:50 configuration_output_handler(): wrote 2676 byte from file main.bin to flash bank 0 at offset 0x00000000 in 0s 531250us (4.919118 kb/s) |
19 | Info: configuration.c:50 configuration_output_handler(): waiting for target halted... |
20 | Info: configuration.c:50 configuration_output_handler(): target halted |
21 | Info: configuration.c:50 configuration_output_handler(): core state: ARM |
22 | Info: configuration.c:50 configuration_output_handler(): target state: halted |
23 | Info: configuration.c:50 configuration_output_handler(): target halted in ARM state due to debug request, current mode: Abort |
24 | Info: configuration.c:50 configuration_output_handler(): cpsr: 0x20000097 pc: 0x000007c8 |
25 | Warning: arm7_9_common.c:734 arm7_9_assert_reset(): srst resets test logic, too |
26 | Flash Programming Finished. |
Dominik Gaeta wrote: > master clock(estimated): 80425kHz > pagesize: 128, lockbits: 16 0x0000, pages in lock region: 32 Wenn die Taktschätzung auch nur etwa stimmt, dann läuft der SAM7 etwa 25 Mhz über seiner Spezifiaktion. Dreh mal den Takt runter und schaue ob das Programm läuft. Gruß Jörn
Vielen Dank Jörn, der Takt war zu hoch, das habe ich jetzt geändert. Telnet localhost 4444 zeigt jetzt folgendes an:
1 | Open On-Chip Debugger |
2 | > flash info 0 |
3 | #0: at91sam7 at 0x00100000, size 0x00010000, buswidth 4, chipwidth 0 |
4 | #0: 0x00000000 (0x10000kB) erase state unknown, protection state unknown |
5 | |
6 | at91sam7 information: Chip is AT91SAM7S64 |
7 | cidr: 0x27090540, arch: 0x0070, eproc: ARM7TDMI, version:0x000, flashsize: 0x00010000 |
8 | master clock(estimated): 50297kHz |
9 | pagesize: 128, lockbits: 16 0x0000, pages in lock region: 32 |
10 | securitybit: 0, nvmbits: 0x0 |
11 | > |
50Mhz, dass ist doch schon mal gut. Aber nicht gut genug, denn das Prg. läuft noch immer nicht. nik
Super, das PRG läuft. Es lag am zu hohen Takt. Bei zu hohem Takt ging nichts mehr. Dieser wurde vermutlich durch die Datenübertragungen beim Debuggen herabgesetzt und so lief das Prg dann nur beim Debuggen. Vielen Dank nochmal nik
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.