Re: Custom per project flash runner

Roman Tataurov

26.03.2018, 01:27, "Marti Bolivar" <marti@...>:
Hi Roman,
You can specify a flash and debug runner without touching any board files by setting BOARD_FLASH_RUNNER and/or BOARD_DEBUG_RUNNER in the CMake command line when generating a build system.
Damn ... of course. So easy. Feel stupid :(
Thank you Marti! It is really a solution.
Here is an example branch, in which I have created a "dummy" runner:
Here is the commit which adds the extra runner, which just prints the command instead of acting on hardware:
Here is an example shell session where the flash and debug runners are set at CMake time and then used later using "ninja flash", "ninja debug", and "ninja debugserver". I have used the nrf52_pca10040 board, but it should work with any board.
plop: ~/src/zephyr/samples/hello_world/build (set-runner) mbolivar
$ cmake -GNinja -DBOARD=nrf52_pca10040 -DBOARD_FLASH_RUNNER=dummy -DBOARD_DEBUG_RUNNER=dummy ..
CMake Deprecation Warning at /home/mbolivar/src/zephyr/cmake/app/boilerplate.cmake:38 (cmake_policy):
  The OLD behavior for policy CMP0000 will be removed from a future version
  of CMake.
  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.3", minimum required is "3.4") 
-- Selected BOARD nrf52_pca10040
Zephyr version: 1.11.99
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mbolivar/src/zephyr/samples/hello_world/build
plop: ~/src/zephyr/samples/hello_world/build (set-runner) mbolivar
$ ninja
[1/118] Generating always_rebuild
Building for board nrf52_pca10040
[113/118] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       44732 B       512 KB      8.53%
            SRAM:       11388 B        64 KB     17.38%
        IDT_LIST:         132 B         2 KB      6.45%
[118/118] Linking C executable zephyr/zephyr.elf
plop: ~/src/zephyr/samples/hello_world/build (set-runner) mbolivar
$ ninja flash
[1/89] Generating always_rebuild
Building for board nrf52_pca10040
[1/2] Flashing nrf52_pca10040
command: flash
plop: ~/src/zephyr/samples/hello_world/build (set-runner) mbolivar
$ ninja debug
[1/89] Generating always_rebuild
Building for board nrf52_pca10040
[1/2] Debugging nrf52_pca10040
command: debug
plop: ~/src/zephyr/samples/hello_world/build (set-runner) mbolivar
$ ninja debugserver
[1/89] Generating always_rebuild
Building for board nrf52_pca10040
[1/2] Debugging nrf52_pca10040
command: debugserver
Hope this helps. Please let me know if you still have problems.
On Sun, Mar 25, 2018, 3:48 PM Roman Tataurov <diytronic@...> wrote:

I there some way to specify custom flash runner command instead of default one used for board.
For example I have a flasher what work with my board, but does not specified with board configuration.
Tried to play with set(BOARD_FLASH_RUNNER - it work if change it inside board config, but found no way to overwrite it in project files, not touching board files.

Roman Tataurov

Zephyr-users mailing list
Roman Tataurov

Join to automatically receive all group messages.