The BOARD variable has been removed from the environment provided to
runners. It's not being used to flash the board, so just remove the
check for it to avoid an exception at runtime.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
The mimxrt1052 does not have any internal flash, therefore a reset after
load blows away the code when loaded into sram. Reverse the order of the
jlink commands such that the load follows the reset.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
The script argument isn't really a path, so stop assuming that it is
one. We still use the shell script name at this point, but there isn't
any actual shell script in the system.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Some boards define multiple configuration which all are maintained under
the same board directory. The flasher was looking for an openocd.cfg
based on the board name, which can't be found for such boards.
Use the variable BOARD_DIR provided by cmake instead of trying to
assemble the board directory location on our own.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The functionality of the shell scripts for flashing and debugging has
now been replaced by zephyr_flash_debug.py. Remove the legacy scripts
as part of transitioning all of this to Python.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Some of the flashing scripts try to be clever about picking unused
ports. That's convenient for the user, so add a helper class to
runner.core to accomplish similar ends portably.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Factor the classes which do the work into a new "runner" package. This
package has a core module where ZephyrBinaryRunner and common helpers
will live, and one file per subclass / runner front-end.
The top-level script, zephyr_flash_debug.py, still exists, but just
delegates its work to the core.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Though it isn't used by any in-tree Makefile.boards, looking at the
RIOT OS build system, this is meant to be split along lexical
boundaries defined by the shell, not just whitespace.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Several debugging scripts run setsid before executing a server
process, then run GDB with SIGINT ignored.
Relying on setsid is not portable. Add a popen_ignore_int() helper
that provides a portable alternative, and provide a generic
run_server_and_client() in ZephyrBinaryRunner which uses it to
abstract the pattern.
Subsequent patches will use this to implement the 'debug' command.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Replace the 'flash' method with a 'run' method, which takes a command
to run (flash, debug, or debugserver).
Rename the classes involved appropriately, and generalize the factory
interfaces as needed.
Add documentation and theory of ops.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Now that we have a newer version of bossa in the SDK we can use a
version where there -p option works properly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
- When flashing with dfu-util while alt is not a number, the name must
be quoted.
- Add missing commas in self.list_pattern
- Always call dfu-util with the VID/PID
Fixes: 257fa4af9 ("scripts: zephyr_flash_debug: flash like dfuutil.sh")
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
All commands need to have quotation marks stripped.
Fixes: bee6f9e73 ("scripts: zephyr_flash_debug: flash like openocd.sh")
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Add support for flashing targets compatible with esp32.sh.
Only tested by comparing commands that would be run.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Add support for flashing targets compatible with bossa-flash.sh.
This is something of a bug-for-bug reimplementation, as the existing
flashing script makes some potentially unsafe assumptions.
Only tested by comparing commands that would be run.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Add support for flashing targets compatible with pyocd.sh.
Tested on 96b_nitrogen, nrf52_blenano2, and frdm_k64f, with and
without PYOCD_BOARD_ID. Additionally, frdm_k64f was tested with
PYOCD_DAPARG_ARG='limit_packets=True'.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Zephyr board flashing and debugging is done via shell scripts. It
would improve the CMake transition to remove the shell dependency.
Add zephyr_flash_debug.py to allow phasing out the shell scripts.
This takes two arguments:
- a command (eventually flash, debug, and debugserver, but just flash
for now)
- the path to the corresponding shell script
zephyr_flash_debug.py runs the command in pure Python if it
knows how. Otherwise, it falls back on the shell script. In
this patch, it always falls back. Subsequent patches add support
for existing flash backends.
Invoke zephyr_flash_debug.py from the Makefile flash target, but only
if USE_ZEPHYR_FLASH_DEBUG_SHELL is empty. This lets users keep existing
behavior in case of issues, and can be removed later once the Python
script is more widely tested.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
pyocd occasionally throws USB timeout exceptions when running in
VirtualBox, and recently added a command-line option to limit the USB
packet count as a workaround. Introduce an environment variable
PYOCD_DAPARG so Zephyr can pass the argument to pyocd. For example:
$ make BOARD=frdm_k64f PYOCD_DAPARG='limit_packets=True' flash
This workound comes with a performance penalty when flashing and
debugging with pyocd, so it should only be used when running pyocd in
VirtualBox.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
The JLinkGDBServer was printing log messages that messed with debugging
in -tui mode. Run it in silent mode instead.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
If we have more than one board of a given type we need to be able to
specify the board_id to select which specific board that the pyocd
command should target. Introduce an environment variable PYOCD_BOARD_ID
to we can set that will get passed to the pyocd command that needs it.
Here's an example:
$ make -C samples/hello_world/ BOARD=frdm_k64f flash PYOCD_BOARD_ID=1234
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
We define a variable to pickup a default for the bossa binary, however
we weren't using it. Lets do so now.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This flashes Zephyr at 0x1000: that's where the first stage bootloader,
part of the ESP32 ROM, expects to find an "image header".
The second-stage bootloader, part of ESP-IDF, isn't used by the Zephyr
port. However, the bootloader can be used if desired; please refer to
the ESP-IDF documentation on how to set up partitions tables and use
the bootloader.
The following environment variables will affect the ESP32 flashing
process:
Variable Default value
ESP_DEVICE /dev/ttyUSB0
ESP_BAUD_RATE 921600
ESP_FLASH_SIZE detect
ESP_FLASH_FREQ 40m
ESP_FLASH_MODE dio
ESP_TOOL espidf
It's impossible to determine which serial port the ESP32 board is
connected to, as it uses a generic RS232-USB converter. The default of
/dev/ttyUSB0 is provided as that's often the assigned name on a Linux
machine without any other such converters.
The baud rate of 921600bps is recommended. If experiencing issues when
flashing, try halving the value a few times (460800, 230400, 115200,
etc). It might be necessary to change the flash frequency or the flash
mode; please refer to the esptool documentation for guidance on these
settings.
If ${ESP_TOOL} is set to "espidf", the esptool.py script found within
ESP-IDF will be used. Otherwise, this variable is handled as a path to
the tool.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>