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:58 UTC
[1/4] incubator-mynewt-newt git commit: Backwards compatibility
allowing newt to debug/download images in master branch.
Repository: incubator-mynewt-newt
Updated Branches:
refs/heads/develop 657ff8d1f -> 904f79b15
Backwards compatibility allowing newt to debug/download images in
master branch.
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/904f79b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/904f79b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/904f79b1
Branch: refs/heads/develop
Commit: 904f79b15feeefe76a9e4ecc139c56fd54aa4412
Parents: 682c0a2
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Sep 8 21:36:14 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Sep 9 09:19:04 2016 -0700
----------------------------------------------------------------------
newt/builder/load.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/904f79b1/newt/builder/load.go
----------------------------------------------------------------------
diff --git a/newt/builder/load.go b/newt/builder/load.go
index 8cbf78e..0c1a85b 100644
--- a/newt/builder/load.go
+++ b/newt/builder/load.go
@@ -82,7 +82,10 @@ func (b *Builder) Load(image_slot int, extraJtagCmd string) error {
if extraJtagCmd != "" {
envSettings += fmt.Sprintf("EXTRA_JTAG_CMD=\"%s\" ", extraJtagCmd)
}
- downloadCmd := fmt.Sprintf("%s %s", envSettings, downloadScript)
+
+ // bspPath, binBaseName are passed in command line for backwards compatibility
+ downloadCmd := fmt.Sprintf("%s %s %s %s", envSettings, downloadScript, bspPath,
+ binBaseName)
features := b.Features(nil)
@@ -160,7 +163,8 @@ func (b *Builder) Debug(extraJtagCmd string, reset bool) error {
os.Chdir(project.GetProject().Path())
- cmdLine := []string{debugScript}
+ // bspPath, binBaseName are passed in command line for backwards compatibility
+ cmdLine := []string{debugScript, bspPath, binBaseName}
fmt.Printf("%s\n", cmdLine)
return util.ShellInteractiveCommand(cmdLine, envSettings)
[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.
Posted by ma...@apache.org.
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")
}
[3/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 parameters.
Posted by ma...@apache.org.
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 parameters.
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/682c0a2c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/682c0a2c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/682c0a2c
Branch: refs/heads/develop
Commit: 682c0a2c4fa55062f7f0321bc7a8350c90177538
Parents: 1a644f6
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Sep 8 19:50:47 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Sep 9 09:19:04 2016 -0700
----------------------------------------------------------------------
util/util.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/682c0a2c/util/util.go
----------------------------------------------------------------------
diff --git a/util/util.go b/util/util.go
index 75fc5f0..27b407c 100644
--- a/util/util.go
+++ b/util/util.go
@@ -293,7 +293,7 @@ func ShellCommand(cmdStr string) ([]byte, error) {
}
// Run interactive shell command
-func ShellInteractiveCommand(cmdStr []string) error {
+func ShellInteractiveCommand(cmdStr []string, env []string) error {
log.Print("[VERBOSE] " + cmdStr[0])
//
@@ -307,9 +307,12 @@ func ShellInteractiveCommand(cmdStr []string) error {
<-c
}()
+ env = append(env, os.Environ()...)
// Transfer stdin, stdout, and stderr to the new process
// and also set target directory for the shell to start in.
+ // and set the additional environment variables
pa := os.ProcAttr{
+ Env: env,
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
}
[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.
Posted by ma...@apache.org.
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
}