You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/09/09 16:21:01 UTC
[4/4] incubator-mynewt-newt git commit: MYNEWT-241;
allow user to pass additional commands to JTAG adapter SW. These can
be used to select a specific target.
MYNEWT-241; allow user to pass additional commands to JTAG adapter SW.
These can be used to select a specific target.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/448b4c9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/448b4c9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/448b4c9c
Branch: refs/heads/develop
Commit: 448b4c9c26a5ae6c40ed2cc674847831a54ba546
Parents: 657ff8d
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Sep 8 15:43:45 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Sep 9 09:19:04 2016 -0700
----------------------------------------------------------------------
newt/builder/load.go | 20 +++++++++++++-------
newt/cli/build_cmds.go | 7 ++++++-
newt/cli/run_cmds.go | 5 ++++-
3 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/448b4c9c/newt/builder/load.go
----------------------------------------------------------------------
diff --git a/newt/builder/load.go b/newt/builder/load.go
index 7c92400..d0fa84b 100644
--- a/newt/builder/load.go
+++ b/newt/builder/load.go
@@ -28,7 +28,7 @@ import (
"mynewt.apache.org/newt/util"
)
-func (t *TargetBuilder) Load() error {
+func (t *TargetBuilder) Load(extraJtagCmd string) error {
err := t.PrepBuild()
@@ -37,18 +37,18 @@ func (t *TargetBuilder) Load() error {
}
if t.Loader != nil {
- err = t.App.Load(1)
+ err = t.App.Load(1, extraJtagCmd)
if err == nil {
- err = t.Loader.Load(0)
+ err = t.Loader.Load(0, extraJtagCmd)
}
} else {
- err = t.App.Load(0)
+ err = t.App.Load(0, extraJtagCmd)
}
return err
}
-func (b *Builder) Load(image_slot int) error {
+func (b *Builder) Load(image_slot int, extraJtagCmd string) error {
if b.appPkg == nil {
return util.NewNewtError("app package not specified")
}
@@ -75,8 +75,14 @@ func (b *Builder) Load(image_slot int) error {
binBaseName := b.AppBinBasePath()
featureString := b.FeatureString()
- downloadCmd := fmt.Sprintf("%s %s %s %d %s",
- downloadScript, bspPath, binBaseName, image_slot, featureString)
+ envSettings := fmt.Sprintf("BSP_PATH=%s ", bspPath)
+ envSettings += fmt.Sprintf("BIN_BASENAME=%s ", binBaseName)
+ envSettings += fmt.Sprintf("IMAGE_SLOT=%d ", image_slot)
+ envSettings += fmt.Sprintf("FEATURES=\"%s\" ", featureString)
+ if extraJtagCmd != "" {
+ envSettings += fmt.Sprintf("EXTRA_JTAG_CMD=\"%s\" ", extraJtagCmd)
+ }
+ downloadCmd := fmt.Sprintf("%s %s", envSettings, downloadScript)
features := b.Features(nil)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/448b4c9c/newt/cli/build_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go
index d6d7034..5d328a7 100644
--- a/newt/cli/build_cmds.go
+++ b/newt/cli/build_cmds.go
@@ -33,6 +33,8 @@ import (
const TARGET_TEST_NAME = "unittest"
+var extraJtagCmd string
+
func pkgIsTestable(pack *pkg.LocalPackage) bool {
return util.NodeExist(pack.BasePath() + "/src/test")
}
@@ -248,7 +250,7 @@ func loadRunCmd(cmd *cobra.Command, args []string) {
NewtUsage(cmd, err)
}
- err = b.Load()
+ err = b.Load(extraJtagCmd)
if err != nil {
NewtUsage(cmd, err)
}
@@ -341,6 +343,9 @@ func AddBuildCommands(cmd *cobra.Command) {
loadCmd.ValidArgs = targetList()
cmd.AddCommand(loadCmd)
+ loadCmd.PersistentFlags().StringVarP(&extraJtagCmd, "extrajtagcmd", "j", "",
+ "extra commands to send to JTAG software")
+
debugHelpText := "Open debugger session for <target-name>."
debugCmd := &cobra.Command{
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/448b4c9c/newt/cli/run_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/run_cmds.go b/newt/cli/run_cmds.go
index 401563d..e0e7cd6 100644
--- a/newt/cli/run_cmds.go
+++ b/newt/cli/run_cmds.go
@@ -93,7 +93,7 @@ func runRunCmd(cmd *cobra.Command, args []string) {
}
}
- err = b.Load()
+ err = b.Load(extraJtagCmd)
if err != nil {
NewtUsage(cmd, err)
}
@@ -121,4 +121,7 @@ func AddRunCommands(cmd *cobra.Command) {
}
runCmd.ValidArgs = targetList()
cmd.AddCommand(runCmd)
+
+ runCmd.PersistentFlags().StringVarP(&extraJtagCmd, "extrajtagcmd", "j", "",
+ "extra commands to send to JTAG software")
}