Skip to content

Commit

Permalink
Updated openocd patch and added stlink compile flag. Fixes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
esden committed Jan 7, 2013
1 parent 101d7af commit 50d44ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
46 changes: 20 additions & 26 deletions patches/patch-openocd-arm7m-registers.diff
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff --git a/Makefile.am b/Makefile.am
index 0d20233..00774fc 100644
--- a/Makefile.am
+++ b/Makefile.am
diff -Nur openocd-0.6.1.orig/Makefile.am openocd-0.6.1/Makefile.am
--- openocd-0.6.1.orig/Makefile.am 2012-10-07 01:15:36.000000000 -0700
+++ openocd-0.6.1/Makefile.am 2013-01-06 17:23:41.000000000 -0800
@@ -2,6 +2,8 @@
# have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = gnu 1.6
Expand All @@ -11,20 +10,19 @@ index 0d20233..00774fc 100644
# make sure we pass the correct jimtcl flags to distcheck
DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim

diff --git a/configure.ac b/configure.ac
index d0386bc..7308edb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,8 @@ AC_INIT([openocd], [0.6.0-dev],
diff -Nur openocd-0.6.1.orig/configure.ac openocd-0.6.1/configure.ac
--- openocd-0.6.1.orig/configure.ac 2012-10-07 01:17:22.000000000 -0700
+++ openocd-0.6.1/configure.ac 2013-01-06 17:36:17.000000000 -0800
@@ -3,6 +3,8 @@
[OpenOCD Mailing List <[email protected]>])
AC_CONFIG_SRCDIR([src/openocd.c])

+AC_CONFIG_MACRO_DIR([m4])
+
m4_include(config_subdir.m4)dnl
m4_include([config_subdir.m4])dnl

AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip])
@@ -18,7 +20,7 @@ AC_LANG_C
@@ -19,7 +21,7 @@
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
Expand All @@ -33,11 +31,10 @@ index d0386bc..7308edb 100644

dnl disable checks for C++, Fortran and GNU Java Compiler
m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
diff --git a/src/target/armv7m.c b/src/target/armv7m.c
index d9e63d7..6a68942 100644
--- a/src/target/armv7m.c
+++ b/src/target/armv7m.c
@@ -245,16 +245,13 @@ static int armv7m_write_core_reg(struct target *target, unsigned num)
diff -Nur openocd-0.6.1.orig/src/target/armv7m.c openocd-0.6.1/src/target/armv7m.c
--- openocd-0.6.1.orig/src/target/armv7m.c 2012-10-07 01:15:36.000000000 -0700
+++ openocd-0.6.1/src/target/armv7m.c 2013-01-06 17:28:58.000000000 -0800
@@ -258,16 +258,13 @@

/**
* Returns generic ARM userspace registers to GDB.
Expand All @@ -52,18 +49,16 @@ index d9e63d7..6a68942 100644

- *reg_list_size = 26;
+ *reg_list_size = 17;
*reg_list = malloc(sizeof(struct reg*) * (*reg_list_size));
*reg_list = malloc(sizeof(struct reg *) * (*reg_list_size));

/*
@@ -264,26 +261,11 @@ int armv7m_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int
@@ -277,24 +274,9 @@
* - (obsolete) FPA status
* - CPSR
*/
- for (i = 0; i < 16; i++)
+ for (i = 0; i < 17; i++)
{
(*reg_list)[i] = &armv7m->core_cache->reg_list[i];
}

- for (i = 16; i < 24; i++)
- (*reg_list)[i] = &arm_gdb_dummy_fp_reg;
Expand All @@ -75,19 +70,18 @@ index d9e63d7..6a68942 100644
-
- /* ARMV7M is always in thumb mode, try to make GDB understand this
- * if it does not support this arch */
- *((char*)armv7m->arm.pc->value) |= 1;
- *((char *)armv7m->arm.pc->value) |= 1;
-#else
- (*reg_list)[25] = &armv7m->core_cache->reg_list[ARMV7M_xPSR];
-#endif
-
return ERROR_OK;
}

diff --git a/src/target/armv7m.h b/src/target/armv7m.h
index ca92146..c26915e 100644
--- a/src/target/armv7m.h
+++ b/src/target/armv7m.h
@@ -30,7 +30,7 @@
diff -Nur openocd-0.6.1.orig/src/target/armv7m.h openocd-0.6.1/src/target/armv7m.h
--- openocd-0.6.1.orig/src/target/armv7m.h 2012-10-07 01:15:36.000000000 -0700
+++ openocd-0.6.1/src/target/armv7m.h 2013-01-06 17:23:41.000000000 -0800
@@ -31,7 +31,7 @@
#include "arm.h"

/* define for enabling armv7 gdb workarounds */
Expand Down
11 changes: 6 additions & 5 deletions summon-arm-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ fi
if [ ${OOCD_EN} != 0 ]; then
if [ ! -e ${STAMPS}/${OOCD}.build ]; then
unpack ${OOCD}
#log "Patching openocd to support arm7m registers"
#cd ${OOCD}
#patch -p1 -i ../patches/patch-openocd-arm7m-registers.diff
#cd ..
log "Patching openocd to support arm7m registers"
cd ${OOCD}
patch -p1 -i ../patches/patch-openocd-arm7m-registers.diff
cd ..
cd build
log "Configuring openocd-${OOCD}"
CFLAGS="${CFLAGS} ${OOCD_CFLAGS}" \
Expand All @@ -516,7 +516,8 @@ if [ ! -e ${STAMPS}/${OOCD}.build ]; then
--enable-jlink \
--enable-vsllink \
--enable-rlink \
--enable-arm-jtag-ew
--enable-arm-jtag-ew \
--enable-stlink
log "Building ${OOCD}"
make ${MAKEFLAGS}
install ${OOCD} install
Expand Down

0 comments on commit 50d44ae

Please sign in to comment.