generated from chipsalliance/chisel-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-add-support-for-openFPGAloader.patch
79 lines (76 loc) · 2.23 KB
/
0001-add-support-for-openFPGAloader.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From 0added52344f42c1865f16ce5131204a63f51d4e Mon Sep 17 00:00:00 2001
From: YuLong Yao <[email protected]>
Date: Fri, 3 Feb 2023 06:09:36 +0800
Subject: [PATCH] add support for openFPGAloader
Signed-off-by: YuLong Yao <[email protected]>
---
scripts/west_commands/runners/__init__.py | 1 +
.../west_commands/runners/openFPGALoader.py | 46 +++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 scripts/west_commands/runners/openFPGALoader.py
diff --git a/scripts/west_commands/runners/__init__.py b/scripts/west_commands/runners/__init__.py
index 90eefcadff..c5ffc75722 100644
--- a/scripts/west_commands/runners/__init__.py
+++ b/scripts/west_commands/runners/__init__.py
@@ -42,6 +42,7 @@ _names = [
'nios2',
'nrfjprog',
'nsim',
+ 'openFPGALoader',
'openocd',
'pyocd',
'qemu',
diff --git a/scripts/west_commands/runners/openFPGALoader.py b/scripts/west_commands/runners/openFPGALoader.py
new file mode 100644
index 0000000000..b81d59abb7
--- /dev/null
+++ b/scripts/west_commands/runners/openFPGALoader.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2023 YuLong Yao <[email protected]>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+'''openFPGAloader for flash FPGAs.'''
+
+from os import path
+
+from runners.core import ZephyrBinaryRunner, RunnerCaps
+
+
+class OFLBinaryRunner(ZephyrBinaryRunner):
+ '''Runner front-end for openFPGAloader.'''
+
+ def __init__(self, cfg, logic):
+ super().__init__(cfg)
+
+ self.ofl = 'openFPGALoader'
+ self.logic = logic
+
+ @classmethod
+ def name(cls):
+ return 'openFPGALoader'
+
+ @classmethod
+ def capabilities(cls):
+ return RunnerCaps(commands={'flash'})
+
+ @classmethod
+ def do_add_parser(cls, parser):
+ parser.add_argument('--logic', required=True,
+ help='program logic')
+ pass
+
+ @classmethod
+ def do_create(cls, cfg, args):
+ return OFLBinaryRunner(cfg, args.logic)
+
+ def do_run(self, command, **kwargs):
+ gdb_cmd = [self.ofl,
+ '-f',
+ self.logic,
+ '--mcufw', self.cfg.bin_file]
+ # self.require(gdb_cmd[0])
+ self.check_call(gdb_cmd)
+ pass
--
2.39.1