Date   

use esp32 can't build project

zhichunlee <zhichunlee@...>
 

Hi

I used ESP32 and setup the build environment acording to the docs
as https://docs.zephyrproject.org/latest/boards/xtensa/esp32/doc/index.html.

The mainly environment are as follows:
Linux: Ubuntu18
CMake: 3.22.0
Python: 3.6.9
Devicetree compiler: 1.4.5 (Not 1.4.6, how to  install it?)
zephyr sdk: 0.13.2
ESP32 toolchain: esp-2021r2-8.4.0

The ESP32 toolchain is work using "idf.py build".
But when built the project using west, error occured as follows:



It seems can't import "kconfiglib" but has installed it using "pip3 install".

Please help to see where there are problems and give suggestions.
Thanks very much!

zhichun lee



CoAP client observer

Alessio
 

Dear Sirs,
can anyone point me to some docs to read, some code examples or some tutorial about CoAP observer?

Starting from CoAP client example, I'm stuck in a point where I, from a client, can ask to a server to observe a topic but I never get notified about changes. Data packages are sent from the server (I can see that with wireshark) but seems that the callback is never called. Maybe I'm missing something...

Best

Alessio Galliazzo

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
    - Brian W. Kernighan


Re: Configuration?

Anders
 

Thank you all for sharing useful information!

/Anders


Re: Zephyr support for USB-host and USB-OTG

Dave Nadler
 

Thanks Carles, its a blocking issue for many of us.
Have a great Thanksgiving (if you're in USA),
Best Regards, Dave

On 11/24/2021 11:54 AM, Carles Cufi via lists.zephyrproject.org wrote:

> PS: Now about Zephyr support for USB-host and USB-OTG...

 

We do not have a timeframe for this, but it will certainly come sooner or later.

 

Carles


-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


Re: newlib Configuration?

Carles Cufi
 

> PS: Now about Zephyr support for USB-host and USB-OTG...

 

We do not have a timeframe for this, but it will certainly come sooner or later.

 

Carles

 

From: Dave Nadler <drn@...>
Sent: 24 November 2021 17:44
To: Cufi, Carles <Carles.Cufi@...>; Anders <anders.thernstrom@...>; users@...
Subject: Re: [Zephyr-users] newlib Configuration?

 

That's great to hear Carles!
Thanks for letting us know,
Best Regards, Dave

 

PS: Now about Zephyr support for USB-host and USB-OTG...

 

On 11/24/2021 11:20 AM, Carles Cufi via lists.zephyrproject.org wrote:

Hi Dave,

 

Thread safety for newlib was implemented in Zephyr recently, there should not be any issues left with it. If there are, please open a GitHub issue:

 

https://github.com/zephyrproject-rtos/zephyr/pull/36201

https://github.com/zephyrproject-rtos/zephyr/pull/35227

 

Thanks,

Carles

 

 

From: users@... <users@...> On Behalf Of Dave Nadler via lists.zephyrproject.org
Sent: 24 November 2021 17:13
To: Anders <anders.thernstrom@...>; users@...
Subject: Re: [Zephyr-users] Configuration?

 

Careful Anders! Last I looked, newlib was not really supported properly in Zephyr.
Internally newlib sometimes uses free storage, and the OS needs to implement some hooks for thread-safety.
See for example FreeRTOS issues with the same:
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

Hope that helps,
Best Regards, Dave

 

PS: Picolib is striving to avoid internal malloc-etc use.

 

On 11/24/2021 4:24 AM, Anders wrote:

Hi,
 
I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.
 
After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
to make things work as expected.
 
Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?
 
Thx in advance,
Anders
 
 

 

-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1

 

-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


Re: newlib Configuration?

Dave Nadler
 

That's great to hear Carles!
Thanks for letting us know,
Best Regards, Dave

PS: Now about Zephyr support for USB-host and USB-OTG...

On 11/24/2021 11:20 AM, Carles Cufi via lists.zephyrproject.org wrote:

Hi Dave,

 

Thread safety for newlib was implemented in Zephyr recently, there should not be any issues left with it. If there are, please open a GitHub issue:

 

https://github.com/zephyrproject-rtos/zephyr/pull/36201

https://github.com/zephyrproject-rtos/zephyr/pull/35227

 

Thanks,

Carles

 

 

From: users@... <users@...> On Behalf Of Dave Nadler via lists.zephyrproject.org
Sent: 24 November 2021 17:13
To: Anders <anders.thernstrom@...>; users@...
Subject: Re: [Zephyr-users] Configuration?

 

Careful Anders! Last I looked, newlib was not really supported properly in Zephyr.
Internally newlib sometimes uses free storage, and the OS needs to implement some hooks for thread-safety.
See for example FreeRTOS issues with the same:
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

Hope that helps,
Best Regards, Dave

 

PS: Picolib is striving to avoid internal malloc-etc use.

 

On 11/24/2021 4:24 AM, Anders wrote:

Hi,
 
I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.
 
After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
to make things work as expected.
 
Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?
 
Thx in advance,
Anders
 
 

 

-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


Re: Configuration?

Stephanos Ioannidis
 

Hi,

After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y to make things work as expected.
There are multiple "backends" for the [s]printf function in the Zephyr:

* minimal libc (cbprintf)
* newlib

In case of newlib, you need to enable CONFIG_NEWLIB_LIBC_FLOAT_PRINTF as you mentioned above.
In case of the minimal libc (cbprintf), you need to set CONFIG_CBPRINTF_FP_SUPPORT.

Please note that the newlib is not a prerequisite for making printf work with floats.

Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?
Usually, Kconfig is a good source of information for such dependencies (e.g. search for "float printf" in the menuconfig).

There is also a more comprehensive documentation about the formatted output support in general (though, it does not mention the newlib-related details):
https://docs.zephyrproject.org/latest/reference/misc/formatted_output.html

Regards,

Stephanos

-----Original Message-----
From: users@... <users@...> On Behalf Of Anders via lists.zephyrproject.org
Sent: Wednesday, November 24, 2021 6:24 PM
To: users@...
Subject: [Zephyr-users] Configuration?

Hi,

I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.

After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y to make things work as expected.

Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?

Thx in advance,
Anders


Re: Configuration?

Carles Cufi
 

Hi Dave,

 

Thread safety for newlib was implemented in Zephyr recently, there should not be any issues left with it. If there are, please open a GitHub issue:

 

https://github.com/zephyrproject-rtos/zephyr/pull/36201

https://github.com/zephyrproject-rtos/zephyr/pull/35227

 

Thanks,

 

Carles

 

 

From: users@... <users@...> On Behalf Of Dave Nadler via lists.zephyrproject.org
Sent: 24 November 2021 17:13
To: Anders <anders.thernstrom@...>; users@...
Subject: Re: [Zephyr-users] Configuration?

 

Careful Anders! Last I looked, newlib was not really supported properly in Zephyr.
Internally newlib sometimes uses free storage, and the OS needs to implement some hooks for thread-safety.
See for example FreeRTOS issues with the same:
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

Hope that helps,
Best Regards, Dave

 

PS: Picolib is striving to avoid internal malloc-etc use.

 

On 11/24/2021 4:24 AM, Anders wrote:

Hi,
 
I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.
 
After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
to make things work as expected.
 
Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?
 
Thx in advance,
Anders
 
 

 

-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


Re: Configuration?

Dave Nadler
 

Careful Anders! Last I looked, newlib was not really supported properly in Zephyr.
Internally newlib sometimes uses free storage, and the OS needs to implement some hooks for thread-safety.
See for example FreeRTOS issues with the same:
https://nadler.com/embedded/NXP_newlibAndFreeRTOS.html

Hope that helps,
Best Regards, Dave

PS: Picolib is striving to avoid internal malloc-etc use.

On 11/24/2021 4:24 AM, Anders wrote:
Hi,

I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.

After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
to make things work as expected.

Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?

Thx in advance,
Anders



-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@..., Skype 
 Dave.Nadler1


Configuration?

Anders
 

Hi,

I have just started working with Zephyr and struggled the other day with getting sprintf working for floats.

After searching the internet I found out that when using CONFIG_NEWLIB_LIBC=y I also have to add CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
to make things work as expected.

Where can I find this kind of information, e.g. dependencies, to avoid having to search the internet for answers in the future?

Thx in advance,
Anders


Hawkbit sample - Gateway Security Token Authentication

Brenton Chetty
 

Hi, I am attempting to use the Hawkbit sample to connect to an online hawkbit server. I am using the nrf5340dk with a gsm modem. The board has internet connectivity, i.e. I tested the board by connecting it to an online MQTT server.

I have browsed through the code, and I could not figure out how to utilize Gateway Security Token Authentication for this application.

If you have any suggestions for the following questions, I would truly appreciate it.
     1. How do I enable "Gateway Security Token Authentication" for this application.
     2. How do I enable "Target Security Token Authentication" for this application.
     3. Is there any way for me to enable a debug log for this application, i.e. when I run the         
         sample,  the log outputs "Hawkbit sample app started", however it gives no information   
         about  the connection including connection issues.
     4. How do I enter user authentication credentials? i.e. username and password

Once again, any advice would be truly appreciated. I have been stuck on this issue for a while.

With thanks
Brenton



DNS resolve issues using GSM/LTE

markus.prager@...
 
Edited

Hi, I am trying to set up a working Internet access via a SIM7000e GSM/LTE module. The LTE connection itself I got working using the GSM sample application. A ping for example is working perfectly (as long as I am addressing an IP directly).

Now I wanted to get the HTTP GET example working. For this however, I need a working DNS. I tried to use the DNS resolve example to figure out how this all works, but sadly it is not working correctly for me for some reason I do not fully  understand.

If I understand the feedback I am getting from my program correctly, my DNS requests are being sent out without a problem, but the reply does not seem to be working correctly or not to be interpreted correctly. I am seeing some sort of reply for my requests, but the reply is not attributed to the right request and is also cut short.

The part about not being attributed to the right request may be because of the delay that LTE has. The ping usually gets ~600ms. That might be a problem? I set DNS_TIMEOUT to SYS_FOREVER_MS to accommodate for this. The bigger problem however seems to be the fact, that the response packets are being cut short by something.

Here are three example HEX dumps from packets that I was able to get from the log: 

ff 03 00 21 45 00 00 48 ee 08 00 00 36 11 b1 01 08 08 08 08 64 6e 71 1d 00 35 de 03 00 34 62 4e d8 16 81 80 00 01 00 01 00 00 00 00 06 67 6f 6f
ff 03 00 21 45 00 00 48 73 47 00 00 76 11 45 56 08 08 08 08 64 71 17 87 00 35 e8 65 00 34 42 7c a9 bc 81 80 00 01 00 01 00 00 00 00 06 67 6f 6f 67 6c 65
ff 03 00 21 45 00 00 48 a5 e1 00 00 75 11 5c 76 08 08 08 08 64 6c ce d1 00 35 9a 41 00 34 24 b4 fb cc 81 80 00 01 00 01 00 00 00 00 06 67 6f 6f 67 6c 65 03

As you can see, they are always cut short at different parts of the frame. All of them are rightly getting an "Invalid FCS" error because of this. I would guess that is also the reason the callback function from the DNS resolve example is not getting called at all (because the response packets are broken). I just do not understand why they are broken and why they always seem to get broken at different points (or rather cut off at different points of the frame).

for reference: here is a healthy frame from another system:
2c b8 ed 61 29 40 cc 48 3a a7 ff 73 08 00 45 00 00 38 f0 a1 00 00 40 11 b2 89 c0 a8 06 d2 08 08 08 08 9f f7 00 35 00 24 d7 bf 66 91 01 00 00 01 00 00 00 00 00 00 06 67 6f 6f 67 6c 65 03 63 6f 6d 00 00 01 00 01

As far as I can see, there is only one function that is cutting away parts of the frame, and that is in </drivers/net/ppp.c>, the function <ppp_process_msg>. It is cutting away the ethernet part of the frame. However, this should not lead to the frame being cut as far as it is being cut (as shown above) and also not lead to it being cut away at randomly different parts of the frame.

Thanks in advance for any help!

Cheers,
Markus


Using flash_read_jedec_id flash API call on ST Nucleo H743ZI dev board

BDesterBEC
 

Hello, first time poster here!

I am attempting to use the flash_read_jedec_id API call with my ST Nucleo H743zi development board, however while building I am receiving a linker error about an undefined reference to z_impl_flash_read_jedec_id, even after including CONFIG_FLASH_JESD216_API in my prj.conf file. I am aware of the devicetree compatible setting for jedec,spi-nor only being included in some of the pre-defined boards, but I am wondering if there is some configuration I can do to allow the API to work with this board so I can access the flash size via the JEDEC ID. I have not done any devicetree configuration for my SPI yet, which is where the answer to this problem lies but I wanted to be sure that it was possible to even configure with the board in the first place.

Thanks,
Brandon


Bluetooth IPSP Sample - Nordic nRF52840 Dongle

Matthew Larkin <larkym@...>
 

Hello,

I cannot get the Bluetooth IPSP sample working on the Nordic nRF52840 Dongle.

Below is the debug output. I am brand new to zephyr. I started looking at source code and saw where these come from in the source, but unsure why. The directions for this sample imply it should work out of the box. Bluetooth: IPSP Sample — Zephyr Project Documentation

I have an Ubuntu 20.04 Dell workstation attached to it as the host.

[00:00:30.333,831] <inf> ipsp: Starting to wait
*** Booting Zephyr OS build v2.7.99-1576-gdb030c24b3a8  ***
[00:00:00.329,589] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.329,589] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.329,620] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 2.7 Build 99
[00:00:00.330,383] <inf> bt_hci_core: Identity: D4:5A:7E:9B:68:AC (random)
[00:00:00.330,383] <inf> bt_hci_core: HCI: version 5.3 (0x0c) revision 0x0000, manufacturer 0x05f1
[00:00:00.330,413] <inf> bt_hci_core: LMP: version 5.3 (0x0c) subver 0xffff
[00:00:00.330,932] <inf> net_config: Initializing network
[00:00:00.331,054] <inf> net_config: Waiting interface 1 (0x20000fac) to be up...
[00:00:30.331,695] <err> net_config: Timeout while waiting network interface
[00:00:30.331,695] <err> net_config: Network initialization failed (-115)
[00:00:30.331,726] <inf> ipsp: Run IPSP sample
[00:00:30.332,000] <wrn> net_if: iface 0x20000fac is down
[00:00:30.332,061] <err> net_if: Cannot join all nodes address ff02::1 (-1)
[00:00:30.332,275] <wrn> net_if: iface 0x20000fac is down
[00:00:30.332,336] <err> net_if: Cannot join solicit node address ff02::1:ff00:1 (-1)
[00:00:30.332,885] <inf> ipsp: Starting to wait

Regards,
- Matthew


Golioth, the Zephyr-enabled cloud, is generally available and offers a free tier

Jonathan Beri
 

Hello! 

We're excited to announce that Golioth is now generally available and includes a free tier! We believe that Golioth is the easiest way to connect Zephyr-based devices to the cloud and we'd love for the Zephyr community to try it out.

This means anyone can get started with Golioth immediately, for free. Pick from 100s of boards, grab our open source SDK, check out our docs, and sign up at console.golioth.io.

P.S. we're also on Discord, come hang out! https://discord.gg/shmgwqZuqM

~Jonathan Beri, CEO at Golioth


STM32G0B0 unable to enumerate USB device #usb

arve@...
 

Hi!

I'm currently trying to get USB on a STM32G0B0 running. While booting i get the following error on the Linux Workstation:

[  691.189913] usb 1-5.2: new full-speed USB device number 15 using xhci_hcd
[  691.277922] usb 1-5.2: device descriptor read/64, error -32
[  691.469995] usb 1-5.2: device descriptor read/64, error -32
[  691.661146] usb 1-5.2: new full-speed USB device number 16 using xhci_hcd
[  691.737987] usb 1-5.2: device descriptor read/64, error -32
[  691.929996] usb 1-5.2: device descriptor read/64, error -32
[  692.042587] usb 1-5-port2: attempt power cycle
[  692.661884] usb 1-5.2: new full-speed USB device number 17 using xhci_hcd
[  692.662050] usb 1-5.2: Device not responding to setup address.
[  692.870040] usb 1-5.2: Device not responding to setup address.
[  693.077908] usb 1-5.2: device not accepting address 17, error -71
[  693.157913] usb 1-5.2: new full-speed USB device number 18 using xhci_hcd
[  693.158048] usb 1-5.2: Device not responding to setup address.
[  693.366043] usb 1-5.2: Device not responding to setup address.
[  693.573869] usb 1-5.2: device not accepting address 18, error -71
[  693.574633] usb 1-5-port2: unable to enumerate USB device

I use the following dev tree clock config:
/* clock config for external 8 MHz crystal and 48 MHz system clock for USB */

&clk_hse {
    status = "okay";
    clock-frequency = <DT_FREQ_M(8)>;
};


&pll {
    div-m = <1>;
    mul-n = <12>;
    div-p = <2>;
    div-q = <2>;
    div-r = <2>;
    clocks = <&clk_hse>;
    status = "okay";
};

&rcc {
    clocks = <&pll>;
    clock-frequency = <DT_FREQ_M(48)>;
    ahb-prescaler = <1>;
    apb1-prescaler = <1>;
};

/ {
    chosen {
        zephyr,console = &cdc_acm_uart0;
    };
};

with the following app overlay:

&zephyr_udc0 {
    cdc_acm_uart0: cdc_acm_uart0 {
        compatible = "zephyr,cdc-acm-uart";
        label = "CDC_ACM_0";
    };
};

the following def and project configuration is applied:

# Zephyr Kernel Configuration
CONFIG_SOC_SERIES_STM32G0X=y
CONFIG_SOC_STM32G0B0XX=y

# Enable MPU
CONFIG_ARM_MPU=y

# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Pinmux Driver
CONFIG_PINMUX=y

# GPIO Controller
CONFIG_GPIO=y

# Enable Clocks
CONFIG_CLOCK_CONTROL=y

# 48 MHz system clock (48 MHz is max for USB)
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000


# config peripherals
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_SPI=n
CONFIG_I2C=n

# configs for USB console
# CONFIG_USB=y
CONFIG_USB_DEVICE_DRIVER=y
CONFIG_USB_DC_STM32=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="#arve USB console"
CONFIG_USB_CDC_ACM=y
CONFIG_USB_UART_CONSOLE=y
CONFIG_USB_CDC_ACM_LOG_LEVEL_ERR=y

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
#CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM"


CONFIG_USB_COMPOSITE_DEVICE=n
CONFIG_USB_MASS_STORAGE=n


# config logging
CONFIG_LOG=y
CONFIG_PRINTK=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_BUFFER_SIZE=2048


The application is a simple blinky with usb console which works perfectly on an STM32H743vi.
The STM32G0B0 is on a custom boad which seems to work perfectly with internal and external clock.

Many thanks for your help in advance!
BR
Thomas


I2c_api #i2c

Makavaz
 

Please help. I cannot get the I2c-api in the folder "tests/drivers" to work.
When I compile it tells me the error: #error "Please set the correct I2C device".
I am using the nrf52840dk_nrf52840

What configuration value should I change to allow the i2c driver to work on this device.


Zephyr SDK 0.13.2 Release

Stephanos Ioannidis
 

Hi,

 

Zephyr SDK 0.13.2 has been released.

 

https://github.com/zephyrproject-rtos/sdk-ng/releases/tag/v0.13.2

 

This release contains several bug fixes and enhancements:

 

  • gcc:
    • Added multilibs for the RISC-V RV32E targets.
    • Disabled MIPS GP register optimisation, which is not supported by the
      Zephyr MIPS architecture port.
  • newlib:
    • Enabled C99 format specifier support for newlib full variant.
  • qemu:
    • Added MIPS little endian emulation
    • Update xilinx qemu to 5.1.0
    • Added Xilinx MicroBlaze little endian emulation
  • openocd:
    • Fixed missing DBG clock on STM32G0/L0.
    • Fixed image verification for ARC.

 

Please try it out and report if you find any issues.

 

Thanks to everyone who contributed to this SDK release.

 

Regards,

 

Stephanos

 


Hawkbit sample functionality #networking #mcuboot #mcumgr

Brenton Chetty
 

Hi, I am trying to learn how to perform an OTA update for my nrf5340dk. I was initially planning to use the "big_http_download" sample to download the update file, and then flash that image into slot1 using MCUBoot and MCUMgr flash commands. I managed to get the NRF5340dk to download the update file by integrating the "gsm_modem" sample with my Ublox Lara-R211 modem.

But then I came across the hawkbit sample, however I am not sure how to use it.
I changed the "CONFIG_HAWKBIT_SERVER" variable in the prj.conf to match my online hawkbit server's address
And I changed the "config HAWKBIT_PORT" variable from the Kconfig file in "zephyr/subsys/mgmt/hawkbit" to match my port for the server

But for some reason I cannot connect to my online kapua server (the hawkbit server is hosted online and not local). Does anyone have any suggestions on any possible steps I could have missed?
My board has internet connectivity.

Regards
Brenton


Re: Zephyr escaping its virtual environment

Jason Bens
 

Hey Marti, thanks for the advice.

In this case specifically, I tracked it down to a pretty silly mistake. I was using the nRF extension for VS Code, but also had the CMake extension installed. I had been hitting the CMake extension's build button, not the nRF extension's, without realizing it was bypassing west. So, an easy enough fix once I realized it.

- Jason

-----Original Message-----
From: Bolivar, Marti <Marti.Bolivar@...>
Sent: Friday, November 12, 2021 6:53 PM
To: Jason Bens <Jason.Bens@...>; users@...
Subject: RE: [Zephyr-users] Zephyr escaping its virtual environment

External Email:

Hi,

It's hard to diagnose issues like this remotely, and especially with so few details.

If you are looking for general advice:

- check your PATH for where west is installed
- check things like 'py -3 -m pip freeze' inside and outside
your virtual environment to check what is installed where
- uninstall any pythons on your system, making sure you do not have
'west' on your PATH, then reinstalling them

Using Zephyr with a python virtual environment is supported, does work, and is my strong personal recommendation. Unfortunately, if you have been inconsistent about using venvs, it can leave your system in a mixed state that you will need to untangle.

I have been pushing for virtual environments to be the default recommendation in the getting started guide for years, but other maintainers have disagreed with me, and it hasn't happened. Sorry for any inconvenience.

Marti

On Fri, Nov 12 2021, Jason Bens wrote:
Hey Marti,

As far as I can tell, I don't have west currently installed outside of the virtual environment. This project I'm trying to get going predates a tonne of build environment issues I've been fixing for the past couple weeks, though. When I first started, there was no venv, and python was on the normal windows path. Could it be that the original path has been stored somewhere and survived the purge?

Jason


-----Original Message-----
From: Bolivar, Marti <Marti.Bolivar@...>
Sent: Thursday, November 11, 2021 6:40 PM
To: Jason Bens <Jason.Bens@...>; users@...
Subject: Re: [Zephyr-users] Zephyr escaping its virtual environment

External Email:

Hi, I use zephyr exclusively within virtual environments.

Did you install west outside of the venv? If you build with west, Zephyr tries to use the same python from the build system that you used for running west.

On Thu, Nov 11 2021, Jason Bens via lists zephyrproject org wrote:
Hi.

I’m trying to build zephyr inside a python virtual environment. It looks like it’s somehow pulling in the base python interpreter, rather than the fake one provided in the virtual environment. This manifests as zephyr\scripts\dts\python-devicetree\src\devicetree\edtlib.py failing to import yaml (my base python environment is pretty barebones). It looks like the python path is picked up in python.cmake:

foreach(PYTHON_PREFER ${PYTHON_PREFER} ${WEST_PYTHON} "python" "python3")
find_program(PYTHON_PREFER_EXECUTABLE ${PYTHON_PREFER})
if(PYTHON_PREFER_EXECUTABLE) <…snip>

I haven’t defined PYTHON_PREFER or WEST_PYTHON, and don’t see any documentation suggesting I ought to. I don’t fully understand how find_program is finding the executable, but had assumed it would check my path at some point. I’ve confirmed that .venv\Scripts is the first entry in my path. `where python´ from my virtual environment returns the following:

C:\Users\<name>\Projects\<project_name>\.venv\Scripts\python.exe
C:\Users\<name>\AppData\Local\Programs\Python\Python39\python.exe

I’m working with version 2.6.99. Before I file it as an issue, is this something that is fixed in 2.7.99? Is there some known configuration stuff I’m failing to do?

Thanks,


* Jason


181 - 200 of 2965