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:20:59 UTC
[2/4] incubator-mynewt-newt git commit: MYNEWT-363;
newt run resets the target, newt debug does not. Also changed
parameters to debug script to be environment variables instead of command
line.
MYNEWT-363; newt run resets the target, newt debug does not.
Also changed parameters to debug script to be environment
variables instead of command line.
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/1a644f62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/1a644f62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/1a644f62
Branch: refs/heads/develop
Commit: 1a644f623c4102dadeb7c6a2d7633668079d9549
Parents: 448b4c9
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Sep 8 19:14:42 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Sep 9 09:19:04 2016 -0700
----------------------------------------------------------------------
newt/builder/load.go | 29 +++++++++++++++++++++--------
newt/cli/build_cmds.go | 5 +++--
newt/cli/run_cmds.go | 2 +-
newt/downloader/downloader.go | 2 +-
4 files changed, 26 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1a644f62/newt/builder/load.go
----------------------------------------------------------------------
diff --git a/newt/builder/load.go b/newt/builder/load.go
index d0fa84b..8cbf78e 100644
--- a/newt/builder/load.go
+++ b/newt/builder/load.go
@@ -106,7 +106,7 @@ func (b *Builder) Load(image_slot int, extraJtagCmd string) error {
return nil
}
-func (t *TargetBuilder) Debug() error {
+func (t *TargetBuilder) Debug(extraJtagCmd string, reset bool) error {
//var additional_libs []string
err := t.PrepBuild()
@@ -122,12 +122,12 @@ func (t *TargetBuilder) Debug() error {
// return t.App.Debug(additional_libs)
if t.Loader == nil {
- return t.App.Debug(nil)
+ return t.App.Debug(extraJtagCmd, reset)
}
- return t.Loader.Debug(nil)
+ return t.Loader.Debug(extraJtagCmd, reset)
}
-func (b *Builder) Debug(addlibs []string) error {
+func (b *Builder) Debug(extraJtagCmd string, reset bool) error {
if b.appPkg == nil {
return util.NewNewtError("app package not specified")
}
@@ -141,14 +141,27 @@ func (b *Builder) Debug(addlibs []string) error {
}
bspPath := b.target.Bsp.BasePath()
- debugScript := filepath.Join(bspPath, b.target.Bsp.DebugScript)
binBaseName := b.AppBinBasePath()
+ featureString := b.FeatureString()
+
+ envSettings := []string{
+ fmt.Sprintf("BSP_PATH=%s", bspPath),
+ fmt.Sprintf("BIN_BASENAME=%s", binBaseName),
+ fmt.Sprintf("FEATURES=\"%s\"", featureString),
+ }
+ if extraJtagCmd != "" {
+ envSettings = append(envSettings,
+ fmt.Sprintf("EXTRA_JTAG_CMD=%s", extraJtagCmd))
+ }
+ if reset == true {
+ envSettings = append(envSettings, fmt.Sprintf("RESET=true"))
+ }
+ debugScript := filepath.Join(bspPath, b.target.Bsp.DebugScript)
os.Chdir(project.GetProject().Path())
- cmdLine := []string{debugScript, bspPath, binBaseName}
- cmdLine = append(cmdLine, addlibs...)
+ cmdLine := []string{debugScript}
fmt.Printf("%s\n", cmdLine)
- return util.ShellInteractiveCommand(cmdLine)
+ return util.ShellInteractiveCommand(cmdLine, envSettings)
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1a644f62/newt/cli/build_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go
index 5d328a7..bc19cf5 100644
--- a/newt/cli/build_cmds.go
+++ b/newt/cli/build_cmds.go
@@ -274,7 +274,7 @@ func debugRunCmd(cmd *cobra.Command, args []string) {
NewtUsage(cmd, err)
}
- err = b.Debug()
+ err = b.Debug(extraJtagCmd, false)
if err != nil {
NewtUsage(cmd, err)
}
@@ -342,7 +342,6 @@ func AddBuildCommands(cmd *cobra.Command) {
loadCmd.ValidArgs = targetList()
cmd.AddCommand(loadCmd)
-
loadCmd.PersistentFlags().StringVarP(&extraJtagCmd, "extrajtagcmd", "j", "",
"extra commands to send to JTAG software")
@@ -357,6 +356,8 @@ func AddBuildCommands(cmd *cobra.Command) {
debugCmd.ValidArgs = targetList()
cmd.AddCommand(debugCmd)
+ debugCmd.PersistentFlags().StringVarP(&extraJtagCmd, "extrajtagcmd", "j", "",
+ "extra commands to send to JTAG software")
sizeHelpText := "Calculate the size of target components specified by " +
"<target-name>."
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1a644f62/newt/cli/run_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/run_cmds.go b/newt/cli/run_cmds.go
index e0e7cd6..9d2d2bf 100644
--- a/newt/cli/run_cmds.go
+++ b/newt/cli/run_cmds.go
@@ -97,7 +97,7 @@ func runRunCmd(cmd *cobra.Command, args []string) {
if err != nil {
NewtUsage(cmd, err)
}
- err = b.Debug()
+ err = b.Debug(extraJtagCmd, true)
if err != nil {
NewtUsage(cmd, err)
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1a644f62/newt/downloader/downloader.go
----------------------------------------------------------------------
diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 71b21c7..df18968 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -131,7 +131,7 @@ func (gd *GithubDownloader) DownloadRepo(commit string) (string, error) {
}
if util.Verbosity >= util.VERBOSITY_VERBOSE {
- if err := util.ShellInteractiveCommand(cmds); err != nil {
+ if err := util.ShellInteractiveCommand(cmds, nil); err != nil {
os.RemoveAll(tmpdir)
return "", err
}