Skip to content

Commit

Permalink
Ampere: feature patch directory with README
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Goehring <[email protected]>
Change-Id: I331dd4eaf17e56088ff340bf1704707b181d98c8
  • Loading branch information
dgoehring-ampere committed Sep 8, 2023
1 parent a58c8e4 commit 17b9b26
Show file tree
Hide file tree
Showing 35 changed files with 8,129 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
From f9fb5ceec66e76bd233f7e1b6012a447afab26b1 Mon Sep 17 00:00:00 2001
From: Daniel Goehring <[email protected]>
Date: Fri, 7 May 2021 15:27:35 -0400
Subject: [PATCH 01/34] build: add Dockerfile and Ampere README files [DO NOT
UPSTREAM]

Change-Id: Ia9ae4963bdb6fc50939461753c5133a152aa93e2
Signed-off-by: Daniel Goehring <[email protected]>
---
Dockerfile | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
README.AMPERE | 26 +++++++++++++++++++++++
2 files changed, 85 insertions(+)
create mode 100644 Dockerfile
create mode 100644 README.AMPERE

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..e737c9859
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2021-2022, Ampere Computing LLC
+
+FROM docker.io/ubuntu:18.04
+
+RUN apt-get update -q && \
+ apt-get install -y --no-install-recommends sudo
+RUN adduser --disabled-password --gecos '' openocd && \
+ adduser openocd sudo && \
+ echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+USER openocd
+RUN sudo apt-get update -q && \
+ sudo apt-get install -y --no-install-recommends \
+ libftdi-dev \
+ git \
+ libtool \
+ automake \
+ texinfo \
+ pkg-config \
+ libusb-1.0.0-dev \
+ vim \
+ net-tools \
+ usbutils \
+ libpython2.7 \
+ python2.7-minimal \
+ gdb \
+ ddd \
+ telnet \
+ libcapstone-dev \
+ ca-certificates
+
+COPY gcc-arm*/bin/aarch64-none-elf-gdb /usr/bin/
+COPY gcc-arm*/bin/aarch64-none-elf-gdb-add-index /usr/bin/
+
+COPY gcc-arm*/bin/aarch64-none-linux-gnu-gdb /usr/bin/
+COPY gcc-arm*/bin/aarch64-none-linux-gnu-gdb-add-index /usr/bin/
+
+COPY gcc-arm*/bin/arm-none-eabi-gdb /usr/bin/
+COPY gcc-arm*/bin/arm-none-eabi-gdb-add-index /usr/bin/
+
+COPY gcc-arm*/bin/arm-none-linux-gnueabihf-gdb /usr/bin/
+COPY gcc-arm*/bin/arm-none-linux-gnueabihf-gdb-add-index /usr/bin/
+
+COPY gcc-arm*/include/gdb /usr/include/gdb/
+COPY gcc-arm*/share/doc/gdb /usr/share/doc/gdb/
+COPY gcc-arm*/share/gdb /usr/share/gdb/
+COPY gcc-arm*/share/info/gdb.info /usr/share/info/
+
+COPY --chown=openocd:openocd openocd /home/openocd/openocd
+WORKDIR /home/openocd/openocd
+RUN mv README.AMPERE .. 2>/dev/null || true
+RUN ./bootstrap
+RUN ./configure --enable-vdebug --enable-jtag_dpi --enable-ftdi --enable-ft2232_ftd2xx --with-capstone
+RUN make
+RUN sudo make install
+RUN rm -rf .git
+WORKDIR /home/openocd
+
+EXPOSE 3333 3334 3335 3336 3337 3338 4444 4445 5555 5556 6666
diff --git a/README.AMPERE b/README.AMPERE
new file mode 100644
index 000000000..7db9ad8ae
--- /dev/null
+++ b/README.AMPERE
@@ -0,0 +1,26 @@
+This Docker container was built by Ampere Computing using an internal and
+proprietary build process. This container was built using sources from open source
+as well as closed source projects.
+
+The base layer of this container was built using the Ubuntu 18.04 image
+as hosted by DockerHub.
+
+A number of packages were installed using the standard apt package manager. These
+can be discovered using the ```sudo apt list --installed``` command (or equivalent).
+
+In addition to packages installed via the standard Ubuntu package repository,
+the following projects were directly added to this container:
+
+ - OpenOCD With Ampere Patches
+ Placed at location: /home/openocd/openocd/, /home/openocd/openocd/patches/
+
+ - Ampere OpenOCD Dockerfile
+ Placed at location: /home/openocd/openocd/Dockerfile
+ This file is distributed under the BSD-3-Clause license. Full license text for the
+ BSD-3-Clause license can be found at /home/openocd/openocd/LICENSES/preferred/BSD-3-Clause
+
+ - Arm GNU Toolchain
+ Placed at locations: /usr/bin, /usr/include/gdb, /usr/share/, /usr/share/gdb/,
+ /usr/share/doc/gdb/, /usr/share/info/
+ This toolchain is included without modifications and as distributed by Arm at
+ this page: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/10-3-2021-07
--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 5b51178e3c7577543d85cb85e032fcd60d410a22 Mon Sep 17 00:00:00 2001
From: Daniel Goehring <[email protected]>
Date: Mon, 23 May 2022 19:07:51 -0400
Subject: [PATCH 02/34] Cadence vdebug interface updates [DO NOT UPSTREAM]

Change-Id: I968c005e524b40b9642d03f27fb900304c639e28
Signed-off-by: Daniel Goehring <[email protected]>
---
src/jtag/drivers/vdebug.c | 2 +-
tcl/interface/vdebug.cfg | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/jtag/drivers/vdebug.c b/src/jtag/drivers/vdebug.c
index f6d99c6c1..18a96876d 100644
--- a/src/jtag/drivers/vdebug.c
+++ b/src/jtag/drivers/vdebug.c
@@ -53,7 +53,7 @@
#include "helper/log.h"
#include "helper/list.h"

-#define VD_VERSION 46
+#define VD_VERSION 42
#define VD_BUFFER_LEN 4024
#define VD_CHEADER_LEN 24
#define VD_SHEADER_LEN 16
diff --git a/tcl/interface/vdebug.cfg b/tcl/interface/vdebug.cfg
index 7350bb9a9..9faa5bd11 100644
--- a/tcl/interface/vdebug.cfg
+++ b/tcl/interface/vdebug.cfg
@@ -21,10 +21,10 @@ vdebug server $_VDEBUGHOST:$_VDEBUGPORT
#log_output vd_ocd.log

# example config listen on all interfaces, disable tcl/telnet server
-bindto 0.0.0.0
+#bindto 0.0.0.0
#gdb_port 3333
#telnet_port disabled
-tcl_port disabled
+#tcl_port disabled

# transaction batching: 0 - no batching, 1 - (default) wr, 2 - rw
vdebug batching 1
--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
From c8bd0ce3d6edbdbf1e4520f982d852ad3411b0fe Mon Sep 17 00:00:00 2001
From: Daniel Goehring <[email protected]>
Date: Thu, 25 Apr 2019 11:38:04 -0400
Subject: [PATCH 03/34] gdb_server: remove 'fake_thread' workaround for OS
threads. [DO NOT UPSTREAM]

The 'fake_thread' workaround resolves an issue with respect to
GDB debugging multiple OS threads which is outside the scope
of OpenOCD. The workaround breaks HW CPU thread support.
Since OpenOCD only supports debugging from a CPU core
perspective and not OS Threads, it is unnecessary to include
this workaround. My recommendation is to remove the workaround
since it isn't needed and breaks HW CPU thread functionality.

Tested on an Ampere eMAG8180 and Quicksilver silicon.

Change-Id: I7b09d56727a860fb86652bb3ff1e9c2f8cf6fb7b
Signed-off-by: Daniel Goehring <[email protected]>
---
src/server/gdb_server.c | 31 -------------------------------
1 file changed, 31 deletions(-)

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 4a4ea53dc..792266de0 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3015,7 +3015,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
/* single-step or step-over-breakpoint */
if (parse[0] == 's') {
gdb_running_type = 's';
- bool fake_step = false;

struct target *ct = target;
int current_pc = 1;
@@ -3037,13 +3036,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
rtos_update_threads(target);

target->rtos->gdb_target_for_threadid(connection, thread_id, &ct);
-
- /*
- * check if the thread to be stepped is the current rtos thread
- * if not, we must fake the step
- */
- if (target->rtos->current_thread != thread_id)
- fake_step = true;
}

if (parse[0] == ';') {
@@ -3080,29 +3072,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
gdb_connection->output_flag = GDB_OUTPUT_ALL;
target_call_event_callbacks(ct, TARGET_EVENT_GDB_START);

- /*
- * work around an annoying gdb behaviour: when the current thread
- * is changed in gdb, it assumes that the target can follow and also
- * make the thread current. This is an assumption that cannot hold
- * for a real target running a multi-threading OS. We just fake
- * the step to not trigger an internal error in gdb. See
- * https://sourceware.org/bugzilla/show_bug.cgi?id=22925 for details
- */
- if (fake_step) {
- int sig_reply_len;
- char sig_reply[128];
-
- LOG_DEBUG("fake step thread %"PRIx64, thread_id);
-
- sig_reply_len = snprintf(sig_reply, sizeof(sig_reply),
- "T05thread:%016"PRIx64";", thread_id);
-
- gdb_put_packet(connection, sig_reply, sig_reply_len);
- gdb_connection->output_flag = GDB_OUTPUT_NO;
-
- return true;
- }
-
/* support for gdb_sync command */
if (gdb_connection->sync) {
gdb_connection->sync = false;
--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From f3bed6defd9dab312182f3daab13b79f945a8829 Mon Sep 17 00:00:00 2001
From: Daniel Goehring <[email protected]>
Date: Thu, 25 Apr 2019 11:38:04 -0400
Subject: [PATCH 04/34] gdb_server: fix CPU status reporting for 'step' command

The call to 'rtos_update_threads()' should be after the call
to 'target_step()' and not before. With the update, 'info threads'
reports the current hardware thread state.

Tested on an Ampere eMAG8180 and Quicksilver silicon

Change-Id: I2168d3f965a4d7cceac40bc3dcf198e413ee4fe6
Signed-off-by: Daniel Goehring <[email protected]>
---
src/server/gdb_server.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 792266de0..2bdbbd146 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -3032,9 +3032,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
}

if (target->rtos) {
- /* FIXME: why is this necessary? rtos state should be up-to-date here already! */
- rtos_update_threads(target);
-
target->rtos->gdb_target_for_threadid(connection, thread_id, &ct);
}

@@ -3089,6 +3086,11 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
if (retval == ERROR_TARGET_NOT_HALTED)
LOG_INFO("target %s was not halted when step was requested", target_name(ct));

+ if (target->rtos) {
+ /* After executing the 'step' command, update the rtos threads */
+ rtos_update_threads(target);
+ }
+
/* if step was successful send a reply back to gdb */
if (retval == ERROR_OK) {
retval = target_poll(ct);
--
2.25.1

Loading

0 comments on commit 17b9b26

Please sign in to comment.