diff --git a/README.md b/README.md index ea63502be..b73c995f2 100644 --- a/README.md +++ b/README.md @@ -79,17 +79,25 @@ you must do. On Ubuntu: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa - sudo apt-get update - sudo apt-get install gcc-arm-embedded + sudo apt update + sudo apt install gcc-arm-embedded On MacOS: brew tap ArmMbed/homebrew-formulae brew install arm-none-eabi-gcc + On Windows Subsystem for Linux (WSL): + + sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa + sudo apt update + sudo apt install gcc-arm-embedded + + 2. Install Nordic's [command line tools](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf5x_cltools%2FUG%2Fcltools%2Fnrf5x_installation.html) `mergehex` and `nrfjprog`. Ensure these tools are extracted and added to your path. + For WSL: install the `nrfjprog` for Windows [installed with nRF-Command-Line-Tools for Windows]([nRF-Command-Line-Tools for Windows](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF5-Command-Line-Tools/Download#infotabs)), and not for Linux. You don't need the JLink software and JLink JTAG programmer for WSL. 3. Install the JLink [software](https://www.segger.com/jlink-software.html) for your platform. You want the "Software and documentation pack". diff --git a/make/Program.mk b/make/Program.mk index d34786b23..5aa9a6b52 100644 --- a/make/Program.mk +++ b/make/Program.mk @@ -69,16 +69,26 @@ endif .PHONY: flash flash: all test_softdevice flash_mbr +ifeq ($(strip $(grep -q Microsoft /proc/version)),) + @echo Flashing: $(HEX) + nrfjprog.exe -f nrf52 --program $(HEX) --sectorerase + nrfjprog.exe -f nrf52 --reset +else ifeq ($(USE_BOOTLOADER),1) $(Q)printf "r\n" > $(BUILDDIR)flash.jlink ifdef ID $(Q)printf "w4 $(ID_FLASH_LOCATION), 0x$(ID_SECON) 0x$(ID_FIRST)\n" >> $(BUILDDIR)flash.jlink endif -ifeq ($(USE_BOOTLOADER),1) $(Q)printf "loadfile $(MERGED_HEX) \nr\ng\nexit\n" >> $(BUILDDIR)flash.jlink -else - $(Q)printf "loadfile $(HEX) \nr\ng\nexit\n" >> $(BUILDDIR)flash.jlink + $(Q)$(JLINK) $(JLINK_FLAGS) $(BUILDDIR)flash.jlink +else ifeq ($(USE_BOOTLOADER),0) + $(Q)printf "r\n" > $(BUILDDIR)flash.jlink +ifdef ID + $(Q)printf "w4 $(ID_FLASH_LOCATION), 0x$(ID_SECON) 0x$(ID_FIRST)\n" >> $(BUILDDIR)flash.jlink endif + $(Q)printf "loadfile $(HEX) \nr\ng\nexit\n" >> $(BUILDDIR)flash.jlink $(Q)$(JLINK) $(JLINK_FLAGS) $(BUILDDIR)flash.jlink +endif + .PHONY: test_softdevice test_softdevice: $(BUILDDIR) diff --git a/make/README.md b/make/README.md index b0e4853b4..06de64aec 100644 --- a/make/README.md +++ b/make/README.md @@ -5,9 +5,9 @@ This folder contains the GCC build system for the nRF5x platforms. It originally comes from [hlnd/nrf51-pure-gcc-setup](https://github.com/hlnd/nrf51-pure-gcc-setup). -We develop on Linux. Original files still exist for Windows, but have not been -tested in some time. Feel free to submit a pull request if you find something -that doesn't work. +We develop on Linux. This also works on Windows in either of the following ways: +1. Build on WSL (Windows Subsystem for Linux), and `flash` with WSL. +2. Build with SES (Segger Embedded Studio) and `flash` with WSL. Note: For this you will have to manually move the `.hex` file generated from SES to `_build/` directory. For e.g. `mv [your_application]/pca10040/s132/ses/Output/Release/Exe/[your_application.hex] [your_application]/_build/[your_application.hex]`. The currently supported SDK versions are: 9, 10, 11 @@ -17,8 +17,9 @@ Things to Install ----------------- 1. `gcc-arm-none-eabi`: https://launchpad.net/gcc-arm-embedded 2. gdb-arm-none-eabi -3. The [jlink tools](https://www.segger.com/jlink-software.html) for linux +3. The [jlink tools](https://www.segger.com/jlink-software.html) for linux / windows for WSL 4. The jlink debuger for linux +5. The [nRF-Command-Line-Tools for Windows](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF5-Command-Line-Tools/Download#infotabs) Usage -----