-
Notifications
You must be signed in to change notification settings - Fork 1
toolkit: Support a custom global-cfg.db. #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Damien George <[email protected]>
@@ -687,7 +687,7 @@ def main(): | |||
parser.add_argument( | |||
"--config-dir", | |||
type=str, | |||
default=Path(os.path.dirname(__file__)) / "build/config", | |||
default=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: the default is unchanged, it's just configured in paths.py
now.
I'm yet to wrap my mind around the maze of paths :) but I don't pass any config dirs when calling the tools because I use the default |
Yes, but then how will you specify this file? |
In the end I will add targets to the Makefile like |
# Use Toolkit directory as the default. | ||
CONFIG_INPUT_DIR = TOOLKIT_DIR / "build/config" | ||
else: | ||
CONFIG_INPUT_DIR = Path(config_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this force us to provide the app-device-config-aex.json
file in the same directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But isn't that what you want, all the relevant config files in the one location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but there's no way to specify which global-cfg.db
to use, so we'd have to provide our own config dir with duplicated files if we want to use something other than AE7 in global-cfg.db
. Alternatively, we could keep the file where it was, /utils/global-cfg.db
, and add files for AE3, AE7 and an arg to specify which one to use?
EDIT: I realized the default global-cfg.db is also set for AE7, which we don't use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also provide these as args via board.mk
files with default for Interface
and jtag-adater
? As they should have been done in the first place. Though, I'm not sure about that long device part name.
DEVICE_PART_NUMBER = cfg["DEVICE"]["Part#"]
DEVICE_REVISION = cfg["DEVICE"]["Revision"]
MRAM_BURN_INTERFACE = cfg["MRAM-BURNER"]["Interface"]
JTAG_ADAPTER = cfg["MRAM-BURNER"]["Jtag-adapter"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So each part has a unique number, I don't see any reason for the long part description string. We could just pass the part number, and revision, as args, and find the rest of the features from the DB.
Available options:
1 - E7 (AE722F80F55D5LS) - 5.5 MRAM / 13.5 SRAM (default)
2 - E7 (AE722F80F55D5AS) - 5.5 MRAM / 13.5 SRAM
3 - E5 (AE512F80F55D5LS) - 5.5 MRAM / 13.5 SRAM
4 - E5 (AE512F80F5582AS) - 5.5 MRAM / 8.25 SRAM
5 - E5 (AE512F80F55D5AS) - 5.5 MRAM / 13.5 SRAM
6 - E5 (AE512F80F5582LS) - 5.5 MRAM / 8.25 SRAM
7 - E3 (AE302F80F55D5LE) - 5.5 MRAM / 13.5 SRAM
8 - E3 (AE302F80F5582LE) - 5.5 MRAM / 8.25 SRAM
9 - E3 (AE302F80F55D5AE) - 5.5 MRAM / 13.5 SRAM
10 - E3 (AE302F80F5582AE) - 5.5 MRAM / 8.25 SRAM
11 - E3 (AE302F80C1557LE) - 1.5 MRAM / 5.75 SRAM
12 - E3 (AE302F40C1537LE) - 1.5 MRAM / 3.75 SRAM
13 - E1 (AE101F4071542LH) - 1.5 MRAM / 4.5 SRAM
14 - E1C (AE1C1F4051920PH) - 1.86 MRAM / 2.0 SRAM
15 - E1C (AE1C1F4051920HH) - 1.86 MRAM / 2.0 SRAM
16 - E1C (AE1C1F40319205H) - 1.86 MRAM / 2.0 SRAM
17 - E1C (AE1C1F1041010PH) - 1.0 MRAM / 1.0 SRAM
18 - E1C (AE1C1F1041010HH) - 1.0 MRAM / 1.0 SRAM
19 - E1C (AE1C1F10410105H) - 1.0 MRAM / 1.0 SRAM
20 - E1C (AE1C1F1040505PH) - 0.5 MRAM / 0.5 SRAM
21 - E1C (AE1C1F1040505HH) - 0.5 MRAM / 0.5 SRAM
22 - E1C (AE1C1F10405055H) - 0.5 MRAM / 0.5 SRAM
How about this? It was actually easier than I thought. diff --git a/toolkit/updateSystemPackage.py b/toolkit/updateSystemPackage.py
index a6287b8..d607364 100755
--- a/toolkit/updateSystemPackage.py
+++ b/toolkit/updateSystemPackage.py
@@ -112,6 +112,8 @@ def main():
parser.add_argument(
"-V", "--version", help="Display Version Number", action="store_true"
)
+ parser.add_argument("--part", type=str, help="Part Number")
+ parser.add_argument("--rev", type=str, help="Part Revision")
parser.add_argument("-v", "--verbose", help="verbosity mode", action="store_true")
args = parser.parse_args() def load_global_config(part_num=None, part_rev=None):
global DEVICE_PART_NUMBER
global DEVICE_REVISION
global MRAM_BURN_INTERFACE
global JTAG_ADAPTER
global HASHES_DB
if part_num and part_rev:
DEVICE_PART_NUMBER = getPartDescription(part_num)
DEVICE_REVISION = part_rev
MRAM_BURN_INTERFACE = "isp"
JTAG_ADAPTER = "J-Link"
else:
# load from config file.
cfg = read_global_config(CONFIG_FILE)
# validate configuration parameters
# check parameter is configured...
checkAttribute(cfg["DEVICE"], "Revision")
DEVICE_PART_NUMBER = cfg["DEVICE"]["Part#"]
DEVICE_REVISION = cfg["DEVICE"]["Revision"]
# retrieve DEV Environments
HASHES_DB = hashes
# set MRAM BURNER Access Interface
MRAM_BURN_INTERFACE = cfg["MRAM-BURNER"]["Interface"]
# set JTAG Adapter
JTAG_ADAPTER = cfg["MRAM-BURNER"]["Jtag-adapter"]
# read hashes DB
hashes = read_global_config(HASHES_DB_FILE)
# load rest of config params
load_device_config(DEVICE_PART_NUMBER, DEVICE_REVISION) Invoked like: python updateSystemPackage.py --port /dev/ttyUSB0 --part AE302F80F55D5AE --rev B4
Burning: System Package in MRAM
Selected Device:
Part# E3 (AE302F80F55D5AE) - 5.5 MRAM / 13.5 SRAM - Rev: B4
Connecting to the target device...
[INFO] baud rate 55000
[INFO] dynamic baud rate change Enabled
[INFO] /dev/ttyUSB0 open Serial port success
Bootloader stage: SERAM
[INFO] Detected Device:
Part# AE302F80F55D5AE - Rev: B4
- MRAM Base Address: 0x80580000
Maintenance Mode = Enabled
Authenticate Image: True
Verify Certificate
Signature File: alif/SP-AE302F80F55D5AE-rev-b4.bin.sign
Download Image
alif/SP-AE302F80F55D5AE-rev-b4.bin[####################]100%: 270368/270368 bytes
Verify Image
Done |
Closing in favour of #6. |
This change makes it so
global-cfg.db
is loaded from the user config dir, specified by--config-dir <dir>
. That means each board needs to provide a copy of this, tailored to that board. It's a pretty small file so that should be OK.Fixes #3.