Skip to content
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

Allow partition build config to be embedded #2404

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sming/Components/IFS
7 changes: 5 additions & 2 deletions Sming/Components/Storage/Tools/hwconfig/hwconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Sming hardware configuration tool
#

import common, argparse, os, partition
import common, argparse, os, partition, json
from common import *
from config import Config
from config import schema as config_schema
Expand Down Expand Up @@ -64,7 +64,10 @@ def handle_partgen(args, config, part):

def handle_expr(args, config, part):
# Evaluate expression against configuration data
return str(eval(args.expr)).encode()
res = eval(args.expr)
if isinstance(res, dict):
return json.dumps(res).encode()
return str(res).encode()


def main():
Expand Down
4 changes: 4 additions & 0 deletions samples/Basic_Templates/app/CsvTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ class CsvTemplate : public SectionTemplate
{
}

// Return true if we have a new valid record, false if not
bool nextRecord() override
{
// Content section we fetch the next data record, if there is one
if(sectionIndex() == 1) {
return csv.next();
}

// This code emits the header and footer sections exactly once
// `recordIndex` starts at -1 (before first record)
return recordIndex() < 0;
}

Expand Down
7 changes: 6 additions & 1 deletion samples/Basic_Templates/basic_templates.hw
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"filename": "out/fwfs1.bin",
"build": {
"target": "fwfs-build",
"config": "fsimage.fwfs"
"config": {
"name": "Basic Templates demo volume",
"source": {
"/": "files"
}
}
},
"readonly": true,
"encrypted": false
Expand Down
6 changes: 0 additions & 6 deletions samples/Basic_Templates/fsimage.fwfs

This file was deleted.