Forum: Mikrocontroller und Digitale Elektronik Lock Bit bei AT91SAM7 mit OpenOCD löschen


von Johannes (Gast)


Lesenswert?

Hallo,

ich habe folgendes Problem.
Ich möchte mit OpenOCD einen AT91SAM7S64 programmieren.
Da aber davor SAM-BA auf dem uC drauf war, ist ein Lock-Bit gesetzt. 
Deswegen habe ich versucht, dieses Bit zu löschen. Mit diesem .cfg-File 
habe ich versucht den Befehl flash protect 0 0 15 off auszuführen. Dabei 
kam aber die Meldung, dass er protect nicht kennt. Was mache ich da 
falsch.

.cfg-File
1
#daemon configuration
2
telnet_port 4444
3
gdb_port 3333
4
5
#interface
6
interface parport
7
parport_port 0x378
8
parport_cable wiggler
9
jtag_speed 0
10
11
12
#use combined on interfaces or targets that can't set TRST/SRST separately
13
reset_config srst_only srst_pulls_trst
14
15
#jtag scan chain
16
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
17
jtag_device 4 0x1 0xf 0xe
18
19
#target configuration
20
daemon_startup reset
21
22
#target <type> <startup mode>
23
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
24
target arm7tdmi little run_and_init 0 arm7tdmi
25
run_and_halt_time 0 30
26
27
# flash-options AT91
28
target_script 0 reset openocd_at91sam7s_flash.script
29
working_area 0 0x00200000 0x4000 nobackup
30
flash bank at91sam7 0 0 0 0 0
31
32
33
# Information: 
34
# erase command (telnet-interface) for complete flash:
35
# flash erase <num> 0 numlockbits-1 (can be seen from output of flash info 0)
36
# SAM7S64 with 16 lockbits and bank 0: flash erase 0 0 15
37
# set/clear NVM-Bits:
38
# at91sam7 gpnvm <num> <bit> <set|clear>
39
# disable locking from SAM-BA
40
flash protect 0 0 15 off
41
# at91sam7 gpnvm 0 0 1

Folgende Fehlermeldung wurde ausgegeben:
1
Programming with OPENOCD
2
openocd_go_flash.cmd
3
Info:    openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)
4
Info:    configuration.c:50 configuration_output_handler(): Command protect not found
5
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
6
Info:    target.c:219 target_init_handler(): executing reset script 'openocd_at91sam7s_flash.script'
7
Info:    configuration.c:50 configuration_output_handler(): requesting target halt...
8
Warning: arm7_9_common.c:842 arm7_9_halt(): target was already halted
9
Info:    configuration.c:50 configuration_output_handler(): target already halted
10
Info:    configuration.c:50 configuration_output_handler(): waiting for target halted...
11
Info:    configuration.c:50 configuration_output_handler(): target halted
12
Info:    configuration.c:50 configuration_output_handler(): dcc downloads are enabled
13
Info:    configuration.c:50 configuration_output_handler(): flash 'at91sam7' found at 0x00100000
14
Error:   at91sam7.c:257 at91sam7_wait_status_busy(): status register: 0x30005
15
Error:   at91sam7.c:259 at91sam7_wait_status_busy(): Lock Error Bit Detected, Operation Abort
16
Info:    configuration.c:50 configuration_output_handler(): failed writing file main.bin to flash bank 0 at offset 0x00000000
17
Info:    configuration.c:50 configuration_output_handler(): flash program error
18
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too

Kann mir da jemand helfen?

Servus,
Johannes

von gerhard (Gast)


Lesenswert?

hallo,
du hast offensichtlich eine sehr alte openocd version im einsatz.
auf www.yagarto.de findest du aktuelle binaries, versuchs mal mit denen.

gruss
gerhard

von Johannes (Gast)


Lesenswert?

Hallo Gerhard,

es liegt leider nicht am alten OpenOCD. Beim neuen kommt die gleiche 
Fehlermeldung:
"Command protect not found".
Wie kann man denn per Hand das Lock-Bit löschen? Da muss man doch eine 
Telnet-Verbindung aufbauen, usw. Gibt es dafür eine Anleitung für einen 
Anfänger wie mich? Wenn ich telnet in der Konsole starte und den Port 
4444 öffnen möchte, geht es nicht.

Schönen Gruß,
Johannes

von gerhard (Gast)


Lesenswert?

hallo,
deine .cfg datei ruft ein script auf (openocd_at91sam7s_flash.script) in 
welchem die programmierung erfolgen wird (vermute ich mal). du hast aber 
danach noch commands stehen (flash protect 0 0 15 off). das sollte 
eigentlich im script stehen.

wie sieht denn das script aus?

gruss
gerhard

von Johannes (Gast)


Lesenswert?

Danke, das ist die Lösung.

Jetzt kann ich den Kontroller endlich mit JTAG programmieren.

Schönen Gruß,
Johannes

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.