-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ampere: feature patch directory with README
Change-Id: I84d87d6509021d9817b1fe58b07d5b7c4fba62be Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
- Loading branch information
1 parent
1812635
commit 2e53779
Showing
34 changed files
with
7,747 additions
and
0 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
patches/0001-build-add-Dockerfile-and-Ampere-README-files-DO-NOT-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
From 7fca1818005b46910c1bebafef722dcc94df9c0c Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
Date: Fri, 7 May 2021 15:27:35 -0400 | ||
Subject: [PATCH 01/33] build: add Dockerfile and Ampere README files [DO NOT | ||
UPSTREAM] | ||
|
||
Change-Id: Ia9ae4963bdb6fc50939461753c5133a152aa93e2 | ||
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
--- | ||
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 | ||
|
45 changes: 45 additions & 0 deletions
45
patches/0002-Cadence-vdebug-interface-updates-DO-NOT-UPSTREAM.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 3cb20349f461b252cca55c2522febc61ec2ece39 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
Date: Mon, 23 May 2022 19:07:51 -0400 | ||
Subject: [PATCH 02/33] Cadence vdebug interface updates [DO NOT UPSTREAM] | ||
|
||
Change-Id: I968c005e524b40b9642d03f27fb900304c639e28 | ||
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
--- | ||
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 6d9016e9c..408bf53b2 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 48 | ||
+#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 | ||
|
81 changes: 81 additions & 0 deletions
81
patches/0003-gdb_server-remove-fake_thread-workaround-for-OS-thre.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
From 9194dd7d0b5b7cc842d273bee5d922ca55bdfffe Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
Date: Thu, 25 Apr 2019 11:38:04 -0400 | ||
Subject: [PATCH 03/33] 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 <dgoehrin@os.amperecomputing.com> | ||
--- | ||
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 d1bcfb540..4dec48382 100644 | ||
--- a/src/server/gdb_server.c | ||
+++ b/src/server/gdb_server.c | ||
@@ -3033,7 +3033,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; | ||
@@ -3055,13 +3054,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] == ';') { | ||
@@ -3098,29 +3090,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 | ||
|
46 changes: 46 additions & 0 deletions
46
patches/0004-gdb_server-fix-CPU-status-reporting-for-step-command.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From 780d4f25e04be8e2fdf09c33f85d1d1cf0269794 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <dgoehrin@os.amperecomputing.com> | ||
Date: Thu, 25 Apr 2019 11:38:04 -0400 | ||
Subject: [PATCH 04/33] 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 <dgoehrin@os.amperecomputing.com> | ||
--- | ||
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 4dec48382..20346f14f 100644 | ||
--- a/src/server/gdb_server.c | ||
+++ b/src/server/gdb_server.c | ||
@@ -3050,9 +3050,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); | ||
} | ||
|
||
@@ -3107,6 +3104,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 | ||
|
Oops, something went wrong.