0

I want to setup a task for a recipe (or a standalone recipe if required) that allows me to run openocd to connect to my development board.

I have an openocd-native recipe.

I create a task added to my recipe like this:

do_openocd[depends] += "openocd-native:do_populate_sysroot"
addtask openocd after do_image
do_openocd () {
  echo "The thing is ${datadir_native}/openocd"
  echo $(ls -la ${datadir_native}/openocd/scripts/interface)
  echo $(openocd -v)
  echo $(which openocd)
  openocd -f ${datadir_native}/openocd/scripts/interface/altera-usb-blaster2.cfg
}

This runs the openocd in the build system sysroot as I expect it to. However, I am unable to get my task to use the usr/share within my build system sysroot. It simply looks at /usr/share/blablabla as if a build system sysroot does not exist.

altera-usb-blaster2.cfg does not exist in usr/share/openocd/scripts/interface/, but it does exist in ./tmp/sysroots/x86_64-linux/usr/share/openocd/scripts/interface/. (relative to my build folder)

How do I setup my task to run openocd?

uglyoldbob
  • 143
  • 1
  • 1
  • 9

1 Answers1

0

I found a solution.

I created a python task within my openocd-native recipe. For my particular board I created a modified file in the scripts/target folder.

addtask openocd after do_install
python do_openocd () {
  pathdir = d.getVar("datadir", True)
  comand="openocd -f %s/openocd/scripts/interface/altera-usb-blaster2.cfg -f 
%s/openocd/scripts/target/cyclone.cfg" % (pathdir, pathdir)
  oe_terminal("${SHELL} -c \"%s; if [ \$? -ne 0 ]; then echo 'Command failed.'; 
printf 'Press any key to continue... '; read r; fi\"" % comand, 'Running openocd', d)
}
uglyoldbob
  • 143
  • 1
  • 1
  • 9