Forum: Mikrocontroller und Digitale Elektronik OpenOCD AT91SAM7X256


von mfd (Gast)


Lesenswert?

Hallo,

ich habe ein Problem mit OpenOCD, Eclipse und dem EVA-Board mit dem 
AT91SAM7X256 von diesem Shop.
Gegooglet und in vielen Foren gesucht habe ich schon wie verrückt und 
ich würde mich auch nicht melden, wenn ich nicht mehr weiter wüsste:

Mein Programm bekomme ich wunderbar mit der Beispielsoftware und dem 
Tutorial von yagarto.de auf den RAM des AT91. Nur nicht in den Flash.

JTAG = ARM JTAG (parallelport) vom Shop

Meine Schritte sind so:

Konsole:
openocd-pp -f .\openocd_flash.cfg
1
#daemon configuration
2
telnet_port 4444
3
gdb_port 3333
4
daemon_startup reset
5
6
#interface
7
interface parport
8
parport_port /dev/parport0
9
parport_cable wiggler
10
jtag_speed 0
11
#reset_config trst_and_srst|trst_only|srst_only srst_pulls_trst|trst_pulls_srst|combined
12
reset_config srst_only
13
14
#jtag scan chain
15
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
16
jtag_device 4 0x1 0xf 0xe
17
18
#target configuration
19
#target <type> <endianness> <startup mode> <chainpos> <variant>
20
target arm7tdmi little run_and_init 0 
21
run_and_halt_time 0 30
22
23
#working_area 0 0x208000 0x4000 nobackup
24
flash bank at91sam7 0 0 0 0 0
25
target_script 0 reset /etc/openocd_at91sam7_flash.script

nachdem das in der Konsole läuft, das projekt compiliert habe, starte 
ich debug. In der Debug Command steht mein script:
1
# 
2
# The following commands will be executed on
3
# reset (because of run_and_init in the config-file)
4
# - halt target
5
# - init ecr
6
# - flash content of file main.bin into target-memory
7
# - shutdown openocd
8
#
9
# created by Martin Thomas 
10
# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
11
# based on information from Dominic Rath 
12
#
13
14
halt
15
sleep 10
16
17
# Init - taken form the script openocd_at91sam7_ecr.script 
18
mww 0xfffffd44 0x00008000  # disable watchdog
19
mww 0xfffffd08 0xa5000001  # enable user reset
20
mww 0xfffffc20 0x00000601  # CKGR_MOR : enable the main oscillator
21
sleep 10
22
mww 0xfffffc2c 0x00481c0e   # CKGR_PLLR: 96.1097 MHz
23
sleep 10
24
mww 0xfffffc30 0x00000007  # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz
25
sleep 10
26
mww 0xffffff60 0x003c0100  # MC_FMR: flash mode (FWS=1,FMCN=60)
27
# arm7_9 force_hw_bkpts enable  # program resides in flash
28
29
# AT91SAM7 flash command-"batch"
30
# adapted by Martin Thomas based on information from Dominic Rath - Thanks
31
arm7_9 dcc_downloads enable
32
sleep 10
33
poll
34
flash probe 0
35
flash write 0 test.bin 0x0
36
reset run
37
sleep 10
38
shutdown

Ich weis nicht mehr weiter und meine Hoffnung klammert sich an euch!

Greez
mfd

von Dominic R. (dominic)


Lesenswert?

Naja, die Frage ist, was passiert, nachdem du das gemacht hast - 
Garnichts? Fehlermeldung? Rauchzeichen?

Eventuell sind die protection bits gesetzt - auf der Seite von Martin 
Thomas steht dann auch, wie man die löscht (flash protect 0 0 N off, mit 
N = Anzahl Protection-Bits - 1).

Gruß,

Dominic


von Martin T. (mthomas) (Moderator) Benutzerseite


Lesenswert?

Bei SAM7X auch Bit 2 im non-volatile-memory beachten. Damit wird 
selektiert, ob der Controller den "boot-mode" oder die Anwendung 
startet.

von mfd (Gast)


Lesenswert?

Danke für die Antworten!

Das Problem ist, das er mir beim debuggen einfach nur im debug-fenster 
embedded GDB ... suspended sagt.
klicke ich darauf, drücke den start button, sagt er "don't know how to 
run. try "help target"."
in der console erscheint nichts.

dann habe ich die von euch beschriebenen sachen so reingesetzt:
1
# 
2
# The following commands will be executed on
3
# reset (because of run_and_init in the config-file)
4
# - halt target
5
# - init ecr
6
# - flash content of file main.bin into target-memory
7
# - shutdown openocd
8
#
9
# created by Martin Thomas 
10
# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects
11
# based on information from Dominic Rath 
12
#
13
14
halt
15
sleep 10
16
at91sam7 gpnvm
17
flash protect 0 0 7 off
18
19
# Init - taken form the script openocd_at91sam7_ecr.script 
20
mww 0xfffffd44 0x00008000  # disable watchdog
21
mww 0xfffffd08 0xa5000001  # enable user reset
22
mww 0xfffffc20 0x00000601  # CKGR_MOR : enable the main oscillator
23
sleep 10
24
mww 0xfffffc2c 0x00481c0e   # CKGR_PLLR: 96.1097 MHz
25
sleep 10
26
mww 0xfffffc30 0x00000007  # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz
27
sleep 10
28
mww 0xffffff60 0x003c0100  # MC_FMR: flash mode (FWS=1,FMCN=60)
29
# arm7_9 force_hw_bkpts enable  # program resides in flash
30
31
# AT91SAM7 flash command-"batch"
32
# adapted by Martin Thomas based on information from Dominic Rath - Thanks
33
arm7_9 dcc_downloads enable
34
sleep 10
35
poll
36
flash probe 0
37
flash write 0 test.bin 0x0
38
reset run
39
sleep 10
40
shutdown

erst das "at91sam7 gpnvm", als das nicht ging, habe ich das "flash 
protect 0 0 7 off" angefühgt.
ändert sich leider nichts.

bei weiterer suche habe ich in einem forum eine script datei gefunden, 
die so aussieht:
1
target remote localhost:3333
2
monitor soft_reset_halt
3
monitor mww 0xFFFFFF00 0x01 <----- corrected line
4
monitor reg pc 0x00000000 <----- corrected line
5
monitor ARM7_9 sw_bkpts enable <----- corrected line
6
break main
7
load
8
continue

verwende ich die, dauert das zwar lange, bis er was macht, aber er 
scheint nach ca. 3-5 min das programm dann auf den uc drauf zu haben. 
leider nicht nach einem reset. übrigens den erase habe ich bisher noch 
nicht verwendet. das debuggen geht dann auch. nur es ist irgendwie doch 
nicht im flash und er es dauert ewig, das man denkt der pc ist 
abgestürzt.

leider bin ich auch nicht in der materie so drin, das ich all die 
befehle kenne. und offen gesagt auch nicht durch jeden befehl in der 
script richtig durchsteige. wobei ich durch die cfg noch gut 
durchsteige. auch habe ich dazu nirgends ein tutorial oder in einem 
forum die nötigen denkanstöße gefunden.

in voller hoffnung

mfd

von mfd (Gast)


Angehängte Dateien:

Lesenswert?

So sieht nach dem start die windows-knosole aus.

von mfd (Gast)


Angehängte Dateien:

Lesenswert?

Das ist das debugfenster nach den beschriebenen ausführungen

von mfd (Gast)


Lesenswert?

Hey Leutz,

hat nicht einer eine Lösung für mein Problem?
wäre echt super ...

Greez
mfd

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
Noch kein Account? Hier anmelden.