Can anyone help with my LPC-P2378 OpenOCD setup?

Hi all,

Well, I still cannot get my lpc-p2378 to flash!

This is the error I get:

Info: openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)

Error: lpc2000.c:381 lpc2000_flash_bank_command(): unknown LPC2000 variant

Error: flash.c:156 handle_flash_bank_command(): ‘lpc2000’ driver rejected flash bank at 0x00000000

Error: armv4_5.c:186 armv4_5_mode_to_number(): invalid mode value encountered

Error: arm7_9_common.c:972 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure

Error: target.c:1054 handle_target(): couldn’t poll target, exiting

I got the scripts from the LED demo that is on the Olimexs site for the LPC-P2378 page

Here are my scripts

lpc…cfg

#daemon configuration

telnet_port 4444

gdb_port 3333

#commands specific to the Amontec JTAGKey

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG A”

ft2232_layout “olimex-jtag”

ft2232_vid_pid 0x15BA 0x0003

jtag_speed 2

#use combined on interfaces or targets that can’t set TRST/SRST separately

#reset_config srst_only srst_pulls_trst

reset_config trst_and_srst separate

#jtag scan chain

#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)

jtag_device 4 0x1 0xf 0xe

#target configuration

daemon_startup reset

#target

#target arm7tdmi

target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4

run_and_halt_time 0 30

target_script 0 reset openocd.ocd

working_area 0 0x40000000 0x7fff nobackup

#flash configuration

#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14746 calc_checksum

#flash bank cfi 0x80000000 0x800000 2 2 0

flash bank lpc2000 0x0 0x80000 0 0 0 lpc2000_v2 12000 calc_checksum

and openocd.ocd

halt

wait_halt

#mww 0xE01FC080 0x00000000 # PLLCON = 0

#mww 0xE01FC08C 0x000000AA # PLLFEED = 0xAA

#mww 0xE01FC08C 0x00000055 # PLLFEED = 0x55

#sleep 100

#mww 0xE01FC1A0 0x00000020 # OSCEN

#sleep 100

#mww 0xE01FC10C 0x00000001 # clock-source ext.

#sleep 100

#mww 0xE01FC000 0x00000000 # MAMCR

#mww 0xE01FC004 0x00000007 # MAMTIM

#mww 0xE01FC000 0x00000002 # MAMCR

#mww 0xE01FC040 0x00000001 # MEMMAP

#mdw 0x00000000

#sleep 100

flash probe 0

arm7_9 dcc_downloads enable

erase complete flash:

flash erase 0 0 26

just erase the 6 first sectors of bank 0

#flash erase 0 0 5

sleep 100

flash write 0 main.bin 0x0

sleep 100

reset run

sleep 100

shutdown

I am NOT married to these files! So if anyone has some that can replace these, cool!

Please please please, any suggestions would be greatly appriciated!

All the hardware works as I can flash mt at91-sam7 just fine…

~Kam (^8*

Hi Kam.

The OpenOCD command “flash write” has been removed.

You are now supposed to use the new command “flash write binary” or “flash write image”.

The Martin Thomas winarm web site has a write-up on the ARM Cortex that has a short download which includes the very latest OpenOCD User Manual; here’s the link:

http://www.siwawi.arubi.uni-kl.de/avr_p … 080409.zip

Switch to the new command and let everybody know how you are doing.

Cheers,

Jim Lynch

Hi Jim,

Hope all is well with you.

Well, I updated to the latest OCD r657 and updated the deprecated tags and tried ( :frowning: ) to run my old SAM7 scripts…and this is what I got

Flash Programming with OpenOCD…

‘C:\openocd-r657\bin’\openocd-ftd2xx.exe -f \code\ARM\master\at91sam7s256-armusbocd-flash-program.cfg

Open On-Chip Debugger (2008-05-16 20:15) svn: 657

URL: http://svn.berlios.de/svnroot/repos/openocd/trunk

Info: options.c:50 configuration_output_handler(): jtag_speed: 0, 0

Info: options.c:50 configuration_output_handler(): Open On-Chip Debugger (2008-05-16 20:15) svn: 657

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

Info: jtag.c:1376 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)

Info: target.c:237 target_init_handler(): executing reset script ‘c:\code\ARM\master\script.ocd’

Info: options.c:50 configuration_output_handler(): core state: ARM

and so on and so on…

So I cannot get to my real issue of the LPC-P2378 flashing!

Here are my scripts for the SAM7 (or should I say yours… :smiley: )

program.cfg

interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
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

#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:\code\ARM\master\script.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 script.ocd

#flash info 0					# get info
#at91sam7 gpnvm 0 2 set 			# set to boot from flash
wait_halt					# halt the processor and wait
armv4_5 core_state arm				# select the core state
mww 0xffffff60 0x00320100			# set flash wait state (AT91C_MC_FMR)
mww 0xfffffd44 0xa0008000			# watchdog disable (AT91C_WDTC_WDMR)
mww 0xfffffc20 0xa0000601			# enable main oscillator (AT91C_PMC_MOR)
wait 100  					# wait 100 ms
mww 0xfffffc2c 0x00480a0e			# set PLL register (AT91C_PMC_PLLR)
wait 200					# wait 200 ms
mww 0xfffffc30 0x7     				# set master clock to PLL (AT91C_PMC_MCKR)
wait 100	   				# wait 100 ms
mww 0xfffffd08 0xa5000401			# enable user reset AT91C_RSTC_RMR
flash write_bank 0 main.bin 0x0			# program the onchip flash
reset		   				# reset processor
shutdown	   				# stop OpenOCD

Any advice on this before I ask about the LPC!

Thanks!

~Kam (^8*

Okay! I got the SAM7 flashing again

My changes where in the script.ocd file

#flash info 0					# get info
#at91sam7 gpnvm 0 2 set 			# set to boot from flash
wait_halt					# halt the processor and wait
armv4_5 core_state arm				# select the core state
mww 0xffffff60 0x00320100			# set flash wait state (AT91C_MC_FMR)
mww 0xfffffd44 0xa0008000			# watchdog disable (AT91C_WDTC_WDMR)
mww 0xfffffc20 0xa0000601			# enable main oscillator (AT91C_PMC_MOR)
wait 100  					# wait 100 ms
mww 0xfffffc2c 0x00480a0e			# set PLL register (AT91C_PMC_PLLR)
wait 200					# wait 200 ms
mww 0xfffffc30 0x7     				# set master clock to PLL (AT91C_PMC_MCKR)
wait 100	   				# wait 100 ms
mww 0xfffffd08 0xa5000401			# enable user reset AT91C_RSTC_RMR
flash write_bank 0 main.bin 0x0			# program the onchip flash
reset run	   				# reset processor
shutdown	   				# stop OpenOCD

Changed “flash write” to “flash write_binary”, and changed “reset” to “reset run”

Now I can flash the sam7…back to figuring out my issues with the lpc-p2378!

~Kam (^8*