-
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: I104df4f7140d73ffb563215c3f896468ef7dff9a Signed-off-by: Daniel Goehring <[email protected]>
- Loading branch information
1 parent
0c90478
commit 0dfa5aa
Showing
34 changed files
with
7,632 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 116a719efc52f2687d2593059bf6d88cc43a13a3 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <[email protected]> | ||
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 <[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..69adde4aa | ||
--- /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 \ | ||
+ libpython3.8 \ | ||
+ python3.8-minimal \ | ||
+ gdb \ | ||
+ ddd \ | ||
+ telnet \ | ||
+ libcapstone-dev \ | ||
+ ca-certificates | ||
+ | ||
+COPY arm-gnu-toolchain*/bin/aarch64-none-elf-gdb /usr/bin/ | ||
+COPY arm-gnu-toolchain*/bin/aarch64-none-elf-gdb-add-index /usr/bin/ | ||
+ | ||
+COPY arm-gnu-toolchain*/bin/aarch64-none-linux-gnu-gdb /usr/bin/ | ||
+COPY arm-gnu-toolchain*/bin/aarch64-none-linux-gnu-gdb-add-index /usr/bin/ | ||
+ | ||
+COPY arm-gnu-toolchain*/bin/arm-none-eabi-gdb /usr/bin/ | ||
+COPY arm-gnu-toolchain*/bin/arm-none-eabi-gdb-add-index /usr/bin/ | ||
+ | ||
+COPY arm-gnu-toolchain*/bin/arm-none-linux-gnueabihf-gdb /usr/bin/ | ||
+COPY arm-gnu-toolchain*/bin/arm-none-linux-gnueabihf-gdb-add-index /usr/bin/ | ||
+ | ||
+COPY arm-gnu-toolchain*/include/gdb /usr/include/gdb/ | ||
+COPY arm-gnu-toolchain*/share/doc/gdb /usr/share/doc/gdb/ | ||
+COPY arm-gnu-toolchain*/share/gdb /usr/share/gdb/ | ||
+COPY arm-gnu-toolchain*/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 2a061ff66c005b9f950608f7f4b8073a09e327d8 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <[email protected]> | ||
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 <[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 691e576e5..813253e14 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 9097c33da..af71a9043 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 6808c5365408fa8d164a1fb086df4fe2f56278f8 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <[email protected]> | ||
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 <[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 2db3123a0..d70b8499c 100644 | ||
--- a/src/server/gdb_server.c | ||
+++ b/src/server/gdb_server.c | ||
@@ -3037,7 +3037,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; | ||
@@ -3059,13 +3058,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] == ';') { | ||
@@ -3102,29 +3094,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 79b5887e59c4feefdafe172d3b95065f8029fa79 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Goehring <[email protected]> | ||
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 <[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 d70b8499c..68852a1eb 100644 | ||
--- a/src/server/gdb_server.c | ||
+++ b/src/server/gdb_server.c | ||
@@ -3054,9 +3054,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); | ||
} | ||
|
||
@@ -3111,6 +3108,11 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p | ||
if (retval == ERROR_TARGET_NOT_HALTED) | ||
LOG_TARGET_INFO(ct, "target was not halted when step was requested"); | ||
|
||
+ 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.