Add openocd with patch for STM32L4+

This commit is contained in:
Martchus 2018-10-09 18:00:12 +02:00
parent 633bec4cad
commit 4ce144d67f
4 changed files with 238 additions and 0 deletions

View File

@ -0,0 +1,45 @@
From 829e7d9eaca3f47f32b184e3479c066e05f8554b Mon Sep 17 00:00:00 2001
From: Elrond <elrond+openocd.org@samba-tng.org>
Date: Mon, 5 Mar 2018 13:20:28 +0100
Subject: [PATCH] Add STM32L4+ flash/dev_id
According to RM0432 chapter 51.6.1 the DBGMCU_IDCODE is
0x470.
Tested on NUCLEO-STM32L4R5ZI with a similiar change to
openocd 0.10.0-4 in Debian.
Signed-off-by: Elrond <elrond+openocd.org@samba-tng.org>
Change-Id: I9b57013ef23fa963abfecddb728e4a6fadd1f8a1
---
src/flash/nor/stm32l4x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c
index 6a1fa07..dcb7a92 100644
--- a/src/flash/nor/stm32l4x.c
+++ b/src/flash/nor/stm32l4x.c
@@ -618,6 +618,9 @@ static int stm32l4_probe(struct flash_bank *bank)
/* set max flash size depending on family */
switch (device_id & 0xfff) {
+ case 0x470:
+ max_flash_size_in_kb = 2048;
+ break;
case 0x461:
case 0x415:
max_flash_size_in_kb = 1024;
@@ -743,6 +746,10 @@ static int get_stm32l4_info(struct flash_bank *bank, char *buf, int buf_size)
device_str = "STM32L43x/44x";
break;
+ case 0x470:
+ device_str = "STM32L4Rxxx/4Sxxx";
+ break;
+
default:
snprintf(buf, buf_size, "Cannot identify target as a STM32L4\n");
return ERROR_FAIL;
--
1.9.1

44
openocd/default/PKGBUILD Normal file
View File

@ -0,0 +1,44 @@
# $Id: PKGBUILD 266875 2017-11-15 14:29:11Z foutrelis $
# Maintainer: Sergej Pupykin <arch+pub@sergej.pp.ru>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Matthias Bauch <matthias.bauch@gmail.com>
# Contributor: Laszlo Papp <djszapi2 at gmail com>
# Contributor: Samuel Tardieu <sam@rfc1149.net>
pkgname=openocd
pkgver=0.10.0
epoch=1
pkgrel=2
pkgdesc='Debugging, in-system programming and boundary-scan testing for embedded target devices'
arch=('x86_64')
url='http://openocd.org/'
license=('GPL')
depends=('libftdi' 'libftdi-compat' 'libusb' 'libusb-compat' 'hidapi')
options=(!strip)
_features=(amtjtagaccel armjtagew buspirate ftdi gw16012 jlink oocd_trace
opendous osbdm parport presto_libftdi remote-bitbang rlink stlink ti-icdi ulink usbprog vsllink
aice cmsis-dap dummy jtag_vpi openjtag_ftdi usb-blaster-2 usb_blaster_libftdi)
source=("https://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-${pkgver/_/-}.tar.bz2"
'Add-STM32L4-Plus-Dev-ID.patch')
sha256sums=('7312e7d680752ac088b8b8f2b5ba3ff0d30e0a78139531847be4b75c101316ae'
'a3c4e15d8ee6fa63f668b363a96652db923c7da84fc9ffcf39448e2983da2994')
prepare() {
cd $pkgname-${pkgver/_/-}
sed -i 's|ftdi_new();|(void*)12345;|g' configure{,.ac}
patch -p1 -i '../Add-STM32L4-Plus-Dev-ID.patch' # doesn't apply yet
}
build() {
cd $pkgname-${pkgver/_/-}
libtoolize
autoreconf
./configure --prefix=/usr ${_features[@]/#/--enable-} --disable-werror
make
}
package() {
cd $pkgname-${pkgver/_/-}
make DESTDIR="$pkgdir" install
(cd "$pkgdir"/usr/share/openocd/scripts/target && mv 1986*.cfg 1986be1t.cfg)
}

View File

@ -0,0 +1,45 @@
From 829e7d9eaca3f47f32b184e3479c066e05f8554b Mon Sep 17 00:00:00 2001
From: Elrond <elrond+openocd.org@samba-tng.org>
Date: Mon, 5 Mar 2018 13:20:28 +0100
Subject: [PATCH] Add STM32L4+ flash/dev_id
According to RM0432 chapter 51.6.1 the DBGMCU_IDCODE is
0x470.
Tested on NUCLEO-STM32L4R5ZI with a similiar change to
openocd 0.10.0-4 in Debian.
Signed-off-by: Elrond <elrond+openocd.org@samba-tng.org>
Change-Id: I9b57013ef23fa963abfecddb728e4a6fadd1f8a1
---
src/flash/nor/stm32l4x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c
index 6a1fa07..dcb7a92 100644
--- a/src/flash/nor/stm32l4x.c
+++ b/src/flash/nor/stm32l4x.c
@@ -618,6 +618,9 @@ static int stm32l4_probe(struct flash_bank *bank)
/* set max flash size depending on family */
switch (device_id & 0xfff) {
+ case 0x470:
+ max_flash_size_in_kb = 2048;
+ break;
case 0x461:
case 0x415:
max_flash_size_in_kb = 1024;
@@ -743,6 +746,10 @@ static int get_stm32l4_info(struct flash_bank *bank, char *buf, int buf_size)
device_str = "STM32L43x/44x";
break;
+ case 0x470:
+ device_str = "STM32L4Rxxx/4Sxxx";
+ break;
+
default:
snprintf(buf, buf_size, "Cannot identify target as a STM32L4\n");
return ERROR_FAIL;
--
1.9.1

104
openocd/git/PKGBUILD Normal file
View File

@ -0,0 +1,104 @@
# ex: ts=2 sts=2 sw=2 et
# Maintainer: yhfudev <yhfudev ta gmail dot com>
# Contributor: veox <veox ta wemakethings dot net>
# Contributor: Nick Østergaard <oe.nick at gmail dot com>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Matthias Bauch <matthias.bauch@gmail.com>
# Contributor: Laszlo Papp <djszapi2 at gmail com>
# Contributor: Samuel Tardieu <sam@rfc1149.net>
_pkgbase=openocd
pkgname=openocd-git
pkgver=0.10.0.r523.g2a3b709aa
pkgrel=1
pkgdesc="Debugging, in-system programming and boundary-scan testing for embedded target devices (git version)"
arch=('i686' 'x86_64' 'arm')
url="http://openocd.org"
license=('GPL')
depends=('libftdi' 'libftdi-compat' 'libusb' 'libusb-compat' 'hidapi' )
makedepends=('git' 'automake>=1.11' 'autoconf' 'libtool' 'tcl')
options=(!strip)
provides=('openocd')
conflicts=('openocd')
source=(
"${pkgname}::git+http://repo.or.cz/openocd.git"
'Add-STM32L4-Plus-Dev-ID.patch'
)
# "git+http://repo.or.cz/r/git2cl.git"
# "git+http://repo.or.cz/r/jimtcl.git"
# "git+http://repo.or.cz/r/libjaylink.git"
sha256sums=('SKIP'
'a3c4e15d8ee6fa63f668b363a96652db923c7da84fc9ffcf39448e2983da2994')
# Specify desired features and device support here. A list can be
# obtained by running ./configure in the source directory.
_features=(
aice
amtjtagaccel
armjtagew
at91rm9200
bcm2835gpio
buspirate
cmsis-dap
dummy
ep93xx
ftdi
gw16012
ioutil
jlink
jtag_vpi
legacy-ft2232_libftdi
oocd_trace
opendous
openjtag_ftdi
osbdm
parport
presto_libftdi
remote-bitbang
rlink
stlink
sysfsgpio
ti-icdi
ulink
usb-blaster-2
usb_blaster_libftdi
usbprog
vsllink
#parport-giveio
#zy1000
#zy1000-master
)
pkgver() {
cd "${srcdir}/${pkgname}"
git describe --tags --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir/${pkgname}"
patch -p1 -i '../Add-STM32L4-Plus-Dev-ID.patch'
}
build() {
cd "$srcdir/${pkgname}"
./bootstrap
./configure --prefix=/usr \
--enable-maintainer-mode \
--disable-werror \
${_features[@]/#/--enable-}
#make clean
make
}
package() {
cd "$srcdir/${pkgname}"
make "DESTDIR=${pkgdir}" install
rm -rf ${srcdir}/$pkgname-build
rm -rf "$pkgdir/usr/share/info/dir"
mkdir -p "$pkgdir/usr/lib/udev/rules.d"
mv "$pkgdir/usr/share/$_pkgbase/contrib/60-openocd.rules" "$pkgdir/usr/lib/udev/rules.d"
}