openocd flashing memory of ATSAM7X256 failure

Hi everybody!

I have troubles while programming the flash of the ATSAM7X256 and the use of openocd for this task.

My devBoard:

http://www.olimex.com/dev/sam7-ex256.html

I use the Yagarto Toochain:

http://www.yagarto.de

furthermore i read Lynch’s Tutorial “Using Open Source Tools for AT91SAM7S Cross Development revision 2” which describes the installation of Yagarto and the startupCode and openocd cfg files very well.

I’ve done following steps:

-) Powersupply for the Board from the USB port of my PC

-) I connected the Parallel Port Wiggler from Olimex to the parallel port of my PC (Notebook with dockingstation, if this is important)

Then i used the openocd flash script from Lynch’s tutorial, but the flashing fails. Then i used the script file from http://www2.pt.tu-clausthal.de/~alexp/arm/index.html which is adopted for the ATSAM7X256. (Lynch tutorial is for the ATSAM7S256)

this is Lynch’s openocd config file, which i’m currently using:

#define our ports
telnet_port 4444
gdb_port 3333

#commands specific to the Amontec JTAGKey
interface parport
parport_port 0x378
parport_cable wiggler
jtag_speed 0
jtag_nsrst_delay 200
jtag_ntrst_delay 200

#reset_config <signals> [combination] [trst_type] [srst_type]
reset_config srst_only srst_pulls_trst

#jtag_device <IR length> <IR capture> <IR mask> <IDCODE instruction>
jtag_device 4 0x1 0xf 0xe

#daemon_startup <'attach'|'reset'>
daemon_startup reset

#target <type> <endianess> <reset_mode> <jtag#> [variant] 
target arm7tdmi little run_and_init 0 arm7tdmi_r4
#target arm7tdmi little run_and_init 0 arm7tdmi-r4

#run_and_halt_time <target#> <time_in_ms>
run_and_halt_time 0 30

# commands below are specific to AT91sam7 Flash Programming
# ---------------------------------------------------------

#target_script specifies the flash programming script file
target_script 0 reset c:\scriptTemp\temp.ocd

#working_area <target#> <address> <size> <'backup'|'nobackup'>
working_area 0 0x40000000 0x4000 nobackup

#flash bank at91sam7 0 0 0 0 <target#>
flash bank at91sam7 0 0 0 0 0

And this is the script for flashing the Controller, from http://www2.pt.tu-clausthal.de/~alexp/arm/index.html :

halt 
sleep 10 
mww 0xfffffd44 0x00008000 
mww 0xfffffd08 0xa5000001 
mww 0xfffffc20 0x00000601 
sleep 10 
mww 0xfffffc2c 0x00481c0e  
sleep 10 
mww 0xfffffc30 0x00000007 
sleep 10  
mww 0xffffff60 0x003c0100 
arm7_9 force_hw_bkpts enable 
arm7_9 dcc_downloads enable 
sleep 10 
poll 
flash probe 0 
flash erase 0 0 15 
flash write 0 main.bin 0x0 
reset run 
sleep 10 
shutdown

And this is the output when i call openocd-pp -d -f XXX

'C:\Programme\ARM_TOOLCHAIN\openocd-2006re115\bin\'openocd-pp.exe -d -f 'C:\Programme\ARM_TOOLCHAIN\openocd-2006re115\bin\'at91sam7s256-wiggler-flash-program.cfg
Info:    openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)
Debug:   jtag.c:1210 jtag_init(): 
Debug:   parport.c:373 parport_init(): requesting privileges for parallel port 0x378...
Debug:   parport.c:383 parport_init(): ...privileges granted
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 0
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Error:   jtag.c:1149 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x00
make: *** [program] Error -1

I get the same errors if i do not power my dev-Bord, or if i do not connect the wiggler to the board → very confusing!!?

What’s about the jumpers on my board? → all JTAG jumpers are not set ( TST, JTASEL ans ERASE)

When i press the reset button on the board, the olimex application boots and shows a image on the screen. Do I have to erase this application first before i flash my new programm into the memory?

I’m very new to openocd and the ARM controllers. Any help is welcome. Thanks a lot.

rain

Hi,

Have you installed the parallel port driver before you run the OpenOCD?

and set your parapllel port mode to be EPP?

volunteer:
Hi,

Have you installed the parallel port driver before you run the OpenOCD?

and set your parapllel port mode to be EPP?

Yes i installed the parallel port driver:

\ARM_TOOLCHAIN\openocd-2006re115\driver\parport>status_giveio.bat

status of giveio:
Type:           [0x01] Kernel driver.
Start Type:     [0x02] Automatic
Error Control:  [0x01] NORMAL: Display a message box.
Binary path:    \??\C:\WINDOWS\giveio.sys
Load order grp:
Dependencies:
Start Name:
ok.

I’m not sure if my paraport is working in EPP mode? How can i check this and where can i configure it to EPP?

Thank’s a lot,

rain

Hi,

Enter CMOS setup and change the parallel port mode.

You should enter setup mode by pressing the delete key when Windows is booting up, and then select Integrated Peripherals, and then chose IO Device Configuration [Press Enter], and press enter key. Now you will find the Parallel Port Mode item and you can change its value. Do remember to save it before you quit.

By the way, my OS is windowXP.

Please also refer to Jim’s tutorial on eclipse “arm cross compiler with eclipse (version 3)” on page 124.

Regards,

Kevin

volunteer:
Hi,

Enter CMOS setup and change the parallel port mode.

You should enter setup mode by pressing the delete key when Windows is booting up, and then select Integrated Peripherals, and then chose IO Device Configuration [Press Enter], and press enter key. Now you will find the Parallel Port Mode item and you can change its value. Do remember to save it before you quit.

By the way, my OS is windowXP.

Please also refer to Jim’s tutorial on eclipse “arm cross compiler with eclipse (version 3)” on page 124.

Regards,

Kevin

Thanks a lot.

I changed my parallel port mode to ECP (because i could’nt select EPP).

Then i found out that my parallelport baseaddress is at 0x3BC instead of 0x378.

I changed the config file to

parport_port 0x3BC

and now the output of openocd is:

'C:\Programme\ARM_TOOLCHAIN\openocd-2006re115\bin\'at91sam7s256-wiggler-flash-program.cfg
Info:    openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
Info:    target.c:219 target_init_handler(): executing reset script 'c:\scriptTemp\temp.ocd'
Info:    configuration.c:50 configuration_output_handler(): requesting target halt...
Warning: arm7_9_common.c:842 arm7_9_halt(): target was already halted
Info:    configuration.c:50 configuration_output_handler(): target already halted
Info:    configuration.c:50 configuration_output_handler(): force hardware breakpoints enabled
Info:    configuration.c:50 configuration_output_handler(): dcc downloads are enabled
Info:    configuration.c:50 configuration_output_handler(): target state: halted
Info:    configuration.c:50 configuration_output_handler(): target halted in Thumb state due to debug request, current mode: System
Info:    configuration.c:50 configuration_output_handler(): cpsr: 0x200000df pc: 0x0000007e
Info:    configuration.c:50 configuration_output_handler(): flash 'at91sam7' found at 0x00100000
Error:   at91sam7.c:257 at91sam7_wait_status_busy(): status register: 0x70405
Error:   at91sam7.c:259 at91sam7_wait_status_busy(): Lock Error Bit Detected, Operation Abort
Info:    configuration.c:50 configuration_output_handler(): flash erase error
Error:   at91sam7.c:257 at91sam7_wait_status_busy(): status register: 0x70405
Error:   at91sam7.c:259 at91sam7_wait_status_busy(): Lock Error Bit Detected, Operation Abort
Info:    configuration.c:50 configuration_output_handler(): failed writing file main.bin to flash bank 0 at offset 0x00000000
Info:    configuration.c:50 configuration_output_handler(): flash program error
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
Flash Programming Finished

If i enable debug mode the output is:

'C:\Programme\ARM_TOOLCHAIN\openocd-2006re115\bin\'at91sam7s256-wiggler-flash-program.cfg
Info:    openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)
Debug:   jtag.c:1210 jtag_init(): 
Debug:   parport.c:373 parport_init(): requesting privileges for parallel port 0x3bc...
Debug:   parport.c:383 parport_init(): ...privileges granted
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 0
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   openocd.c:100 main(): jtag init complete
Debug:   arm7_9_common.c:656 arm7_9_assert_reset(): target->state: unknown
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 0
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 0
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 1
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 1
Debug:   arm7_9_common.c:722 arm7_9_deassert_reset(): target->state: reset
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 2
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 0
Debug:   openocd.c:104 main(): target init complete
Debug:   openocd.c:108 main(): flash init complete
Debug:   gdb_server.c:1347 gdb_init(): gdb service for target arm7tdmi at port 3333
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 3
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   arm7_9_common.c:838 arm7_9_halt(): target->state: running
Debug:   embeddedice.c:253 embeddedice_write_reg(): 9: 0xffffffff
Debug:   embeddedice.c:253 embeddedice_write_reg(): 11: 0xffffffff
Debug:   embeddedice.c:253 embeddedice_write_reg(): 12: 0x00000100
Debug:   embeddedice.c:253 embeddedice_write_reg(): 13: 0x000000f7
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:620 arm7_9_poll(): DBGACK set, dbg_state->value: 0x19
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   embeddedice.c:253 embeddedice_write_reg(): 12: 0x00000000
Debug:   arm7_9_common.c:936 arm7_9_debug_entry(): target entered debug from Thumb state
Debug:   arm7_9_common.c:940 arm7_9_debug_entry(): r0_thumb: 0x00001230, pc_thumb: 0x00000084
Debug:   arm7_9_common.c:976 arm7_9_debug_entry(): target entered debug state in System mode
Debug:   arm7_9_common.c:980 arm7_9_debug_entry(): thumb state, applying fixups
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r0: 0x00001230
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r1: 0x00001224
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r2: 0x00001228
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r3: 0x00200550
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r4: 0x00200550
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r5: 0x0000007c
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r6: 0x00000000
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r7: 0x000000f9
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r8: 0x00200024
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r9: 0xe8bd500e
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r10: 0xe321f092
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r11: 0xe59fe02c
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r12: 0x000000d5
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r13: 0x00200b48
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r14: 0x000000f9
Debug:   arm7_9_common.c:1005 arm7_9_debug_entry(): r15: 0x0000007e
Debug:   arm7_9_common.c:1011 arm7_9_debug_entry(): entered debug state at PC 0x7e
Debug:   target.c:442 target_call_event_callbacks(): target event 0
Info:    target.c:219 target_init_handler(): executing reset script 'c:\scriptTemp\temp.ocd'
Debug:   target.c:1254 handle_halt_command(): 
Info:    configuration.c:50 configuration_output_handler(): requesting target halt...
Debug:   arm7_9_common.c:838 arm7_9_halt(): target->state: halted
Warning: arm7_9_common.c:842 arm7_9_halt(): target was already halted
Info:    configuration.c:50 configuration_output_handler(): target already halted
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xfffffd44, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xfffffd08, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xfffffc20, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xfffffc30, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xffffff60, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Info:    configuration.c:50 configuration_output_handler(): force hardware breakpoints enabled
Info:    configuration.c:50 configuration_output_handler(): dcc downloads are enabled
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:620 arm7_9_poll(): DBGACK set, dbg_state->value: 0x9
Info:    configuration.c:50 configuration_output_handler(): target state: halted
Info:    configuration.c:50 configuration_output_handler(): target halted in Thumb state due to debug request, current mode: System
Info:    configuration.c:50 configuration_output_handler(): cpsr: 0x200000df pc: 0x0000007e
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffff240, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   at91sam7.c:331 at91sam7_read_part_info(): nvptyp: 0x002, arch: 0x0075, alt_id: 0x77c09f8e, alt_addr: 0x0000
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc24, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc30, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xffffff68, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Info:    configuration.c:50 configuration_output_handler(): flash 'at91sam7' found at 0x00100000
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc24, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc30, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   at91sam7.c:235 at91sam7_set_flash_mode(): fmcn: 82
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xffffff60, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xffffff64, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   at91sam7.c:279 at91sam7_flash_command(): Flash command: 0x5a000008, pagenumber:
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xffffff68, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   at91sam7.c:253 at91sam7_wait_status_busy(): status: 0x70405
Error:   at91sam7.c:257 at91sam7_wait_status_busy(): status register: 0x70405
Error:   at91sam7.c:259 at91sam7_wait_status_busy(): Lock Error Bit Detected, Operation Abort
Info:    configuration.c:50 configuration_output_handler(): flash erase error
Debug:   at91sam7.c:658 at91sam7_write(): first_page: 0, last_page: 8, count 1996
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc24, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc30, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   at91sam7.c:235 at91sam7_set_flash_mode(): fmcn: 82
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xffffff60, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0x00100000, size: 0x00000004, count: 0x00000040
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   arm7_9_common.c:1822 arm7_9_write_memory(): address: 0xffffff64, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000004
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   embeddedice.c:253 embeddedice_write_reg(): 0: 0x00000005
Debug:   at91sam7.c:279 at91sam7_flash_command(): Flash command: 0x5a000001, pagenumber:
Debug:   arm7_9_common.c:1676 arm7_9_read_memory(): address: 0xffffff68, size: 0x00000004, count: 0x00000001
Debug:   embeddedice.c:157 embeddedice_read_reg_w_check(): 1
Debug:   at91sam7.c:253 at91sam7_wait_status_busy(): status: 0x70405
Error:   at91sam7.c:257 at91sam7_wait_status_busy(): status register: 0x70405
Error:   at91sam7.c:259 at91sam7_wait_status_busy(): Lock Error Bit Detected, Operation Abort
Info:    configuration.c:50 configuration_output_handler(): failed writing file main.bin to flash bank 0 at offset 0x00000000
Info:    configuration.c:50 configuration_output_handler(): flash program error
Debug:   target.c:1328 handle_reset_command(): 
Debug:   arm7_9_common.c:656 arm7_9_assert_reset(): target->state: halted
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 0
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Warning: arm7_9_common.c:683 arm7_9_assert_reset(): srst resets test logic, too
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 0
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 1
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 1
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 1
Debug:   arm7_9_common.c:722 arm7_9_deassert_reset(): target->state: reset
Debug:   jtag.c:247 jtag_call_event_callbacks(): jtag event: 2
Debug:   jtag.c:1096 jtag_reset_callback(): 
Debug:   parport.c:210 parport_reset(): trst: 0, srst: 0
Flash Programming Finished.

The Errors are about the lock bits. AFAIK these lock bits must be cleared befor the bin data can be flashed. But i dont know if my settings in the Openocd scripts are correct.?! (see thread origin for my config file)

Thank’s a lot

rain

The best way to learn the correct commands is to run interactively in a telnet session.

After starting openocd open a telnet session

telnet localhost 4444

Now use the command reference on the openocd wiki and the help command.

Try:

flash info 0

flash protect 0 0 1 off

flash info 0

Regards,

Magnus

I have read the opeocd manual. I havent found any informations about the errors that are reported by openocd when i use my configfiles!!

As i described below I’m very new to openocd and the ARM controllers.

Can anybody tell me what’s wrong with my configuration files?

All kind of help is welcome.

Thank’s a lot

Thomas

Your configuration files seems OK. The error is that you have not turned off the protection bits, and the command to use is:

flash protect 0 0 1 off

This if the first two sectors 0 and 1 are protected, and the command to find out what sectors are protected is

flash info 0

Magnus

I don’t know what you are exactly meaning.

flash info 0 returns the following:

at91sam7 information: Chip is AT91SAM7X256
Info:    configuration.c:50 configuration_output_handler(): cidr: 0x275b0940, arch: 0x0075, eproc: ARM7TDMI, version:0x000,  flashsize: 0x00040000
Info:    configuration.c:50 configuration_output_handler(): master clock(estimated): 54458kHz 
Info:    configuration.c:50 configuration_output_handler(): pagesize: 256, lockbits: 16 0x0007, pages in lock region: 64 
Info:    configuration.c:50 configuration_output_handler(): securitybit: 0, nvmbits: 0x4
Info:    configuration.c:50 configuration_output_handler(): 
Info:    configuration.c:50 configuration_output_handler(): flash 'at91sam7' found at 0x00100000

Thanks a lot

rain

Info: configuration.c:50 configuration_output_handler(): pagesize: 256, lockbits: 16 0x0007, pages in lock region: 64

Ther are 16 lockregions and the value of the lockbits field is 0x0007 so the first three lockregions are protected.

If you give the commnand

flash protect 0 0 2 off

Then the lockbits field should change to 0x0000 to indicate that no flash regions are protected. Now you can both erase and write the flash.

Magnus

mlu:

Info: configuration.c:50 configuration_output_handler(): pagesize: 256, lockbits: 16 0x0007, pages in lock region: 64

Ther are 16 lockregions and the value of the lockbits field is 0x0007 so the first three lockregions are protected.

If you give the commnand

flash protect 0 0 2 off

Then the lockbits field should change to 0x0000 to indicate that no flash regions are protected. Now you can both erase and write the flash.

Magnus

THANK’s a lot

now i’m able to flash the controller. Thank you guys for your patience.

But i’m not sure what all this commands are for. Maybe i should read the openocd doku once again…

Anyhow - thanks now it works.

Greetings from Vienna

rain