Re: custom script for debug/flash
Thanks Marti. Will get back to you if I have any more questions.
From: Marti Bolivar [mailto:marti@...]
Sent: Tuesday, November 14, 2017 8:02 PM
To: Gundi, Rajavardhan <rajavardhan.gundi@...>
Subject: Re: custom script for debug/flash
On Tue, Nov 14, 2017 at 1:32 AM, Gundi, Rajavardhan <rajavardhan.gundi@...> wrote:
Sure thing, happy to help.
Currently, by creating a subclass of ZephyrBinaryRunner that provides a create_for_shell_script() method which claims compatibility with 'xt-gdb.sh'. (See link to documentation below and the source code for zephyr_flash_debug.py ).
The use of this method is a temporary transition so that the rest of the build system wouldn't have to change much to invoke the Python scripts as opposed to the old shell scripts. The Makefile / Makefile.inc changes in this patch hopefully make it more clear what happened:
Now that the build system has switched to CMake, it's less clear what's going on. My next goal is to change the interface to zephyr_flash_debug.py so it doesn't rely on environment variables and just takes command line arguments instead. This will allow removing the create_for_shell_script() method.
One important gotcha is that your module currently must be imported so the ZephyrBinaryRunner subclass is found. See scripts/support/runner/__init__.py for an example.
Well, I hope so, but if there's anything Zephyr-specific that's missing I hope you'll let me know, and I'll try to improve it.
Here is the main documentation for ZephyrBinaryRunner, which is the most important class:
I'll try to make time to add some of this information to Zephyr's Sphinx documentation as well.
Luckily, Python has good cross-platform support for dealing with operating system facilities like sleeping and signals. Since Zephyr is moving to Python 3 over shell scripts, some research on your part will be needed. I suggest taking a look at the Python documentation and searching around on things like StackOverflow, and looking at the existing implementations for examples.