Copied from https://github.com/gnu-mcu-eclipse/openocd Change-Id: Ia0b3e192ca8b3bae6035623d605c9980e9bccd2c