All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Wojciech Zmuda" <zmuda.w@gmail.com>
To: "Saini, Naveen Kumar" <naveen.kumar.saini@intel.com>
Cc: "yocto@lists.yoctoproject.org" <yocto@lists.yoctoproject.org>
Subject: Re: [yocto] [meta-zephyr][PATCH 5/5] zephyr-flash-pyocd.bbclass: support for flashing via pyocd
Date: Wed, 9 Dec 2020 16:07:22 +0100	[thread overview]
Message-ID: <CAL0FYXYP3+jXEVnYS1KaMVOQ5OPGWJh4Jo=zJgXUG-CNQEfnAA@mail.gmail.com> (raw)
In-Reply-To: <7c9d12e428954c44964906065281af1e@intel.com>

[-- Attachment #1: Type: text/plain, Size: 7294 bytes --]

Hi Naveen,

I fixed the missing .hex issue and I'm ready to send v3.

I also experimented with your last suggestion, i.e. building test cases
with MACHINE=96b-nitrogen and I observed the following:

It is possible to build when I provide IMGDEPLOYDIR variable somewhere,
e.g. in 96b-nitrogen.conf. However, for other platforms, this variable is
provided only in classes/zephyr-qemuboot.bbclass. I've also tried to build
test cases for arduino-101-ble and it failed with the following reason:

    Error, the PACKAGE_ARCHS variable (all any noarch
${PACKAGE_EXTRA_ARCHS_tune-armv6m} cortexm0-vfp arduino_101_ble) for
DEFAULTTUNE (cortexm0) does not contain TUNE_PKGARCH (cortexm0t2-vfp).

Additionally, when I provided IMGDEPLOYDIR in 96b-nitrogen.conf, I tried to
execute test cases with -c testimage. It failed on running qemu.

According to my observations, my understanding is that the test cases are
currently designed for being verified on qemu. Do you expect the
96b-nitrogen support to contain automatic test cases execution on the
hardware, or just the possibility of building? If it just the matter of
building the .elf files (you can flash them manually), then I can push v3
today.

Best regards,
Wojciech


On Tue, 8 Dec 2020 at 02:47, Saini, Naveen Kumar <
naveen.kumar.saini@intel.com> wrote:

> You have missed few of my comments in v2 !
>
> Regards,
> Naveen
>
> -----Original Message-----
> From: Saini, Naveen Kumar
> Sent: Monday, December 7, 2020 8:06 PM
> To: 'Wojciech Zmuda' <zmuda.w@gmail.com>; yocto@lists.yoctoproject.org
> Cc: davide.ricci@huawei.com; zbigniew.bodek@huawei.com;
> jaroslaw.marek@huawei.com; robert.drab@huawei.com; Wojciech Zmuda <
> wojciech.zmuda@huawei.com>
> Subject: RE: [yocto] [meta-zephyr][PATCH 5/5] zephyr-flash-pyocd.bbclass:
> support for flashing via pyocd
>
> Thanks for the patches.  Please find my comments below.
>
> -----Original Message-----
> From: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org> On
> Behalf Of Wojciech Zmuda
> Sent: Monday, December 7, 2020 4:15 AM
> To: yocto@lists.yoctoproject.org
> Cc: davide.ricci@huawei.com; zbigniew.bodek@huawei.com;
> jaroslaw.marek@huawei.com; robert.drab@huawei.com; Wojciech Zmuda <
> wojciech.zmuda@huawei.com>
> Subject: [yocto] [meta-zephyr][PATCH 5/5] zephyr-flash-pyocd.bbclass:
> support for flashing via pyocd
>
> Flash boards supported via pyocd:
>
>     MACHINE=xxx bitbake yyy -c flash_usb
>
> The only supported board for now is 96Boards Nitrogen. Modify its config
> accordingly.
>
> Modify helloworld and philosopers samples with adidtional .hex output file
> deployment, as this format is required by pyocd.
>
> Describe the feature in README.
>
> Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
> ---
>  README.txt                                    | 23 +++++++++++++++++++
>  classes/zephyr-flash-pyocd.bbclass            | 17 ++++++++++++++
>  conf/machine/96b-nitrogen.conf                |  1 +
>  .../zephyr-kernel/zephyr-helloworld.bb        |  1 +
>  .../zephyr-kernel/zephyr-philosophers.bb      |  1 +
>  5 files changed, 43 insertions(+)
>  create mode 100644 classes/zephyr-flash-pyocd.bbclass
>
> diff --git a/README.txt b/README.txt
> index 6463339..4366764 100644
> --- a/README.txt
> +++ b/README.txt
> @@ -43,6 +43,29 @@ The same sample, for Nios2 image:
>      $ MACHINE=qemu-nios2 bitbake zephyr-philosophers
>      $ runqemu qemu-nios2
>
> +Flashing
> +=================================
> +
> +You can flash Zephyr samples to boards. Currently, the following
> +MACHINEs are supported:
> + * DFU:
> +  - arduino_101_sss
> +  - arduino_101
> +  - arduino_101_ble
> + * pyocd:
> +  - 96b_nitrogen
> +
> +To flash the example you built with command e.g.
> +
> +    $ MACHINE=96b_nitrogen bitbake zephyr-philosophers
> [Naveen Saini] Typo here, MACHINE=96b-nitrogen
> +
> +call similar command with explicit flash_usb command:
> +
> +    $ MACHINE=96b_nitrogen bitbake zephyr-philosophers -c flash_usb
> [Naveen Saini]  Same as above
>
> +
> +dfu-util and/or pyocd need to be installed in your system. If you
> +observe permission errors or the flashing process seem to hang, follow
> those instructions:
> +https://github.com/pyocd/pyOCD/tree/master/udev
>
>  Building and Running Zephyr Tests
>  =================================
> diff --git a/classes/zephyr-flash-pyocd.bbclass
> b/classes/zephyr-flash-pyocd.bbclass
> new file mode 100644
> index 0000000..aafe9e7
> --- /dev/null
> +++ b/classes/zephyr-flash-pyocd.bbclass
> @@ -0,0 +1,17 @@
> +
> +python do_flash_usb() {
> +    from pyocd.core.helpers import ConnectHelper
> +    from pyocd.flash.file_programmer import FileProgrammer
> +
> +    image = f"{d.getVar('DEPLOY_DIR_IMAGE')}/{d.getVar('PN')}.hex"
> +    bb.plain(f"Attempting to flash {image} to board
> + {d.getVar('BOARD')}")
> +
> +    with ConnectHelper.session_with_chosen_probe() as session:
> +        FileProgrammer(session).program(image)
> +        session.board.target.reset()
> +}
> +
> +addtask do_flash_usb
> +
> +do_flash_usb[nostamp] = "1"
> +do_flash_usb[vardepsexclude] = "BB_ORIGENV"
> diff --git a/conf/machine/96b-nitrogen.conf
> b/conf/machine/96b-nitrogen.conf index d1905f2..998db4c 100644
> --- a/conf/machine/96b-nitrogen.conf
> +++ b/conf/machine/96b-nitrogen.conf
> @@ -4,4 +4,5 @@
>  #@DESCRIPTION: Machine configuration for 96Boards Nitrogen Board.
>
>  require conf/machine/include/nrf52832.inc
> +ZEPHYR_INHERIT_CLASSES += "zephyr-flash-pyocd"
>  ARCH_96b-nitrogen = "arm"
> diff --git a/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
> b/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
> index 1400e72..9b77975 100644
> --- a/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
> +++ b/recipes-kernel/zephyr-kernel/zephyr-helloworld.bb
> @@ -8,6 +8,7 @@ OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
>
>  do_deploy () {
>      install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT}.elf
> ${DEPLOYDIR}/${PN}.elf
> +    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT}.hex
> + ${DEPLOYDIR}/${PN}.hex
>  }
> [Naveen Saini]  No *.hex file while building for MACHINE=qemu-x86  Error
> log:  ...build/zephyr/zephyr.hex': No such file or directory
>
>
>  addtask deploy after do_compile
> diff --git a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
> b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
> index 5f7fbcb..f720999 100644
> --- a/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
> +++ b/recipes-kernel/zephyr-kernel/zephyr-philosophers.bb
> @@ -8,6 +8,7 @@ OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
>
>  do_deploy () {
>      install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT}.elf
> ${DEPLOYDIR}/${PN}.elf
> +    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT}.hex
> + ${DEPLOYDIR}/${PN}.hex
>  }
>
> [Naveen Saini]  No *.hex file while building for MACHINE=qemu-x86  Error
> log:  ...build/zephyr/zephyr.hex': No such file or directory
>
> Could you also try to build testcases !!
> $ MACHINE=96b-nitrogen bitbake zephyr-kernel-test-all
>
> Build breaks with error: ......build/zephyr/zephyr.elf.elf': No such file
> or directory
>
>  addtask deploy after do_compile
> --
> 2.25.1
>
>

[-- Attachment #2: Type: text/html, Size: 10155 bytes --]

  parent reply	other threads:[~2020-12-09 15:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 20:15 [meta-zephyr][PATCH 0/5] Add 96Boards Nitrogen support zmuda.w
2020-12-06 20:15 ` [meta-zephyr][PATCH 1/5] zephyr-kernel: clone Nordic HAL Wojciech Zmuda
2020-12-06 20:15 ` [meta-zephyr][PATCH 2/5] conf: machine: add support for Nordic nRF52832 Cortex-M4 chip Wojciech Zmuda
2020-12-06 20:15 ` [meta-zephyr][PATCH 3/5] conf: machine: add 96boards Nitrogen support Wojciech Zmuda
2020-12-06 20:15 ` [meta-zephyr][PATCH 4/5] zephyr-kernel: don't limit deploy to .elf file Wojciech Zmuda
2020-12-06 20:15 ` [meta-zephyr][PATCH 5/5] zephyr-flash-pyocd.bbclass: support for flashing via pyocd Wojciech Zmuda
2020-12-07 12:06   ` [yocto] " Naveen Saini
2020-12-08  1:47     ` Naveen Saini
2020-12-08 10:16       ` Wojciech Zmuda
2020-12-09 15:07       ` Wojciech Zmuda [this message]
     [not found]         ` <0637042547e547ffb5f8f351afe5aeba@intel.com>
2020-12-10 16:09           ` Wojciech Zmuda
2020-12-14  0:12             ` Naveen Saini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL0FYXYP3+jXEVnYS1KaMVOQ5OPGWJh4Jo=zJgXUG-CNQEfnAA@mail.gmail.com' \
    --to=zmuda.w@gmail.com \
    --cc=naveen.kumar.saini@intel.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.