CeDeROM wrote: > Hello world! :-) > Hi! > Is it possible to define a procedure in my openocd.cfg file and then > call this procedure when invoking openocd? In the documentation I have > found how to define a procedure, but did not find information how to > call it :-) Specifically when I call this procedure from within a file > where it is defined it works fine, but I did not find a way to run it > by passing some argument (-c ?) to the openocd executable... > What I am trying to do is a simple openocd.cfg file that will contain > all procedures for flashing, erasing and debugging my target and so I > can simply call "openocd -c erasemem" from a Makefile.
There's a quirk (bug?) in OpenOCD that requires you to give the -f option explicitly when using -c commands. So "openocd -f openocd.cfg -c erasemem" should work. Also, you have to call "init"-function first -- either on the command line, or in your openocd.cfg. For example, I'm using this openocd.cfg to program my STM32 target: set WORKAREASIZE 20000 source [find interface/jtagkey2.cfg] source [find target/stm32.cfg] proc enable_hsi { } { mww 0x40022000 0x2 # FLASH_ACR 2 waitstates mww 0x40021004 0x380402 # RCC_CFGR HSI*16 = 64 MHz mww 0x42420060 0x1 # RCC_CFGR(PLLON) Enable PLL sleep 100 jtag_khz 6000 } proc flash_image { filename } { reset init enable_hsi stm32x mass_erase 0 flash write_image $filename jtag_khz 1000 reset run shutdown } init $ openocd.exe -f "openocd.cfg" -c "flash_image debug/main.elf" best regards, -- Thomas Kindler <mail+...@t-kindler.de> _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development