Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ you must do.
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-get update
sudo apt-get 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, and not for Linux.

3. Install the JLink [software](https://www.segger.com/jlink-software.html)
for your platform. You want the "Software and documentation pack".
Expand Down
19 changes: 16 additions & 3 deletions make/Program.mk
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,25 @@ flash: all test_softdevice flash_mbr
ifdef ID
$(Q)printf "w4 $(ID_FLASH_LOCATION), 0x$(ID_SECON) 0x$(ID_FIRST)\n" >> $(BUILDDIR)flash.jlink
endif
ifeq ($(USE_BOOTLOADER),1)
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 "loadfile $(MERGED_HEX) \nr\ng\nexit\n" >> $(BUILDDIR)flash.jlink
else
$(Q)$(JLINK) $(JLINK_FLAGS) $(BUILDDIR)flash.jlink
else ifeq ($(USE_BOOTLOADER),0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also want to leave this line as just an else with no check. USE_BOOTLOADER may not be defined at all, in which case it won't be equal to zero.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, the better design might just be to leave the logic that creates the flash.jlink file alone. It shouldn't hurt anything to create that file on windows even if you don't use it. Then you can create one if check that decides if you're windows and uses nrfjprog or else falls back on the existing JLINK infrastructure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, ifeq ($(USE_BOOTLOADER),) will evaluate to true if the variable is undefined

$(Q)printf "loadfile $(HEX) \nr\ng\nexit\n" >> $(BUILDDIR)flash.jlink
endif
$(Q)$(JLINK) $(JLINK_FLAGS) $(BUILDDIR)flash.jlink
endif


flashWSL: all test_softdevice flash_mbr
@echo Flashing: $(OUTPUT_DIRECTORY)/toxophilite.hex
$(nrfjprog.exe) -f nrf52 --program $(OUTPUT_DIRECTORY)/toxophilite.hex --sectorerase
$(NRFPROG) -f nrf52 --reset



.PHONY: test_softdevice
test_softdevice: $(BUILDDIR)
Expand Down
10 changes: 5 additions & 5 deletions make/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 blinky/pca10040/s132/ses/Output/Release/Exe/blinky_pca10040_s132.hex blinky/_build/blink_sdk16_blank.hex`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is blinky? It would be better to give instructions for an application in the apps/basic/ directory.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the nrf52x-base/apps/basic/blink it works as is. You just have to make flash.
The second option is if you are using SES from the SDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regardless "blinky" isn't an application we have in the repo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Is there really any reason to list the SES option at all? It doesn't really let you build nrf52x-base applications, just apps in the SDK, which aren't our purview.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is value to provide minimal support to SES.
@nealjack Good point. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there isn't really support for SES. To support SES would mean taking an application from the apps/ folder, compiling it with SES, and then flashing it. But that is not going to work.


The currently supported SDK versions are: 9, 10, 11

Expand All @@ -17,8 +17,8 @@ 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
4. The jlink debuger for linux
3. The [jlink tools](https://www.segger.com/jlink-software.html) for linux / windows for WSL
4. The jlink debuger for linux [OR] jlink debuger for Windows for WSL/SES

Usage
-----
Expand Down