You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "Marko Kiiskila (JIRA)" <ji...@apache.org> on 2017/02/28 05:04:45 UTC

[jira] [Resolved] (MYNEWT-527) newt - Run bsp scripts on Windows

     [ https://issues.apache.org/jira/browse/MYNEWT-527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marko Kiiskila resolved MYNEWT-527.
-----------------------------------
    Resolution: Fixed

Added cmd wrappers for windows use. Filing tickets for other issues encountered.

> newt - Run bsp scripts on Windows
> ---------------------------------
>
>                 Key: MYNEWT-527
>                 URL: https://issues.apache.org/jira/browse/MYNEWT-527
>             Project: Mynewt
>          Issue Type: Bug
>          Components: Newt
>    Affects Versions: v1_0_0_beta1
>         Environment: Windows 10, WSL, MSYS2
>            Reporter: Simon Ratner
>            Assignee: Marko Kiiskila
>             Fix For: v1_0_0_rel
>
>
> Now that the `newt` tool no longer runs commands through a shell, it is not able to execute bsp scripts (`_download.sh` / `_debug.sh`) on Windows, where `CreateProcess` can't run shell scripts natively.
> A solution that works pretty well is to create parallel `_download.cmd` / `_debug.cmd` scripts with just the following:
> {noformat}
> @rem Execute a shell with a script of the same name and .sh extension
> @sh "%~dp0%~n0.sh"
> {noformat}
> And modify bsp.yml to use those instead, for example for `nrf51dk`:
> {noformat}
> diff --git a/hw/bsp/nrf51dk/bsp.yml b/hw/bsp/nrf51dk/bsp.yml
> index 5e78d60..95b57f6 100644
> --- a/hw/bsp/nrf51dk/bsp.yml
> +++ b/hw/bsp/nrf51dk/bsp.yml
> @@ -26,8 +26,8 @@ bsp.linkerscript.BOOT_LOADER.OVERWRITE:
>      - "hw/bsp/nrf51dk/boot-nrf51xxac.ld"
>      - "hw/mcu/nordic/nrf51xxx/nrf51.ld"
>  bsp.part2linkerscript: "hw/bsp/nrf51dk/split-nrf51dk.ld"
> -bsp.downloadscript: "hw/bsp/nrf51dk/nrf51dk_download.sh"
> -bsp.debugscript: "hw/bsp/nrf51dk/nrf51dk_debug.sh"
> +bsp.downloadscript: "hw/bsp/nrf51dk/nrf51dk_download.cmd"
> +bsp.debugscript: "hw/bsp/nrf51dk/nrf51dk_debug.cmd"
>  bsp.flash_map:
>      areas:
> diff --git a/hw/bsp/nrf51dk/nrf51dk_debug.cmd b/hw/bsp/nrf51dk/nrf51dk_debug.cmd
> new file mode 100644
> index 0000000..354743d
> --- /dev/null
> +++ b/hw/bsp/nrf51dk/nrf51dk_debug.cmd
> @@ -0,0 +1,2 @@
> +@rem Execute a shell with a script of the same name and .sh extension
> +@sh "%~dp0%~n0.sh"
> diff --git a/hw/bsp/nrf51dk/nrf51dk_download.cmd b/hw/bsp/nrf51dk/nrf51dk_download.cmd
> new file mode 100644
> index 0000000..354743d
> --- /dev/null
> +++ b/hw/bsp/nrf51dk/nrf51dk_download.cmd
> @@ -0,0 +1,2 @@
> +@rem Execute a shell with a script of the same name and .sh extension
> +@sh "%~dp0%~n0.sh"
> {noformat}
> At the very least, adding these scripts to the repo will allow devs to use `newt load` and `newt debug` on Windows with minimal effort (in combination with https://github.com/apache/incubator-mynewt-newt/pull/29 and https://github.com/apache/incubator-mynewt-core/pull/150).
> How to best automate this is a question to the devs; perhaps platform overrides in `bsp.yml` to specify platform-specific scripts?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)