Date   

How to access the child nodes in a device tree (DTS) in Zephyr using DT_FOREACH_CHILD #dts #nrf52

unsunk.ship@...
 

Hi,
I originally posted this question to stackoverflow [^] so I think its better not to duplicate the whole story here.
Supposing I have a DTS file with a content like this one below:

n: detectors {
    compatible = "foo-detectors";
        
    // Definition of first channel
    det0: det_0 {
        irq-pins = <13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
        label = "Bar detector channel 1";
    };
    // Definition of second channel
    det1: det_1 {
        irq-pins = <17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
        label = "Bar detector channel 2";
    };
};
And a structure like here below:
struct foo_detector_desc { 
    int irqpin; 
    int irqpin_flags;
}
How can I use macro DT_FOREACH_CHILD for populating an array with one item for each child of node detectors?

I tried this code below but, yet it compiled, the results where not what I wanted.

#define PIN_INFO_AND_COMMA(node_id) \
    { \
        .pin=DT_PROP_BY_IDX(node_id, irq_pins, 0),\
        .flags=DT_PROP_BY_IDX(node_id, irq_pins, 1),\
    },

const struct detector_data _det_data[] = {
    DT_FOREACH_CHILD(DT_NODELABEL(n), PIN_INFO_AND_COMMA)
};

BR.


Re: Scheduler/Thread Status #api

Andy Ross
 

Not public ones, no.  You can check kernel/include/ksched.h for the internal API for this.  I guess the immediate question has to be "what are you trying to do"?  Recognize that any decision made on the basis of this kind of stuff is going to be inherently racy without access to the scheduler's own synchronization (though on a single CPU device, just holding an interrupt lock is enough to be safe).

Also, just to clarify: k_sched_lock() doesn't mutate "scheduler" state at all, it's implemented via a trick that essentially elevates the current thread priority to a cooperative level, preventing preemption.

Andy


Scheduler/Thread Status #api

Casey Shea
 

Are there any API calls for retrieving thread and scheduler status?  I'm looking for something that would indicate the following:

  • Is the scheduler locked?
  • What is the thread status? (Ready, Waiting, Suspended)


Thanks!


Re: Implementation of Zephyr on custom board

Murphy, Lauren
 

Hi Bharath,

 

(1) I’ll look more into this and email you 1:1.

 

(2) Could you explain what you mean by “build the code without any board dependencies in West”? The module (if you’re using the module) can build for any board; see the Hello World sample. If you’re trying to use a custom board, you need definitions for the board + an overlay to make Zephyr aware of sensors you’re using.

 

Sincerely,

Lauren Murphy

 

From: users@... <users@...> On Behalf Of Bharath V
Sent: Wednesday, May 4, 2022 4:37 AM
To: users@...
Subject: [Zephyr-users] Implementation of Zephyr on custom board

 

Dear Team

 

I am currently working on implementing Zephyr RTOS with Tensorflow lite on a custom board (RISC-V based). I am facing the few issues such as

 

(i) Unable to avoid the use of standard C++ libraries.

(ii) Can we build the code without any board dependencies in west.

 

Kindly requesting for assistance.

 

Thanks and regards

Bharath V


Profiling tools

Guy Morand
 

Hi Zephyr users!

I would like to profile my application and was wondering if there are tools available such as the famous ``perf``?

I have found ``THREAD_ANALYZER`` that is very useful but I would need more information about which functions is called and how long.

Happy hacking!

Guy


Implementation of Zephyr on custom board

Bharath V <bk.fml95@...>
 

Dear Team

I am currently working on implementing Zephyr RTOS with Tensorflow lite on a custom board (RISC-V based). I am facing the few issues such as

(i) Unable to avoid the use of standard C++ libraries.
(ii) Can we build the code without any board dependencies in west.

Kindly requesting for assistance.

Thanks and regards
Bharath V


Re: designing a message "bus"

Guy Morand
 

Hi Yshragai,

Small correction on my previous statement. As stated in the documentation, broadcasting is not possible:

Each message may be received by only one thread (i.e.
point-to- multipoint and broadcast messaging is not supported).
We had a small internal discussion about a similar topic this morning and for this reason, we decided to implement our own observer pattern by sending events to a dispatcher using message queue.

Anyway, if you have a better approach, I'm eager to hear more!

Best regards,

Guy


On 5/4/22 09:31, Guy Morand via lists.zephyrproject.org wrote:
Hi Yshragai,
Have you looked at 'k_mbox' data structure? It seems you can set a destination thread or broadcast messages with 'K_ANY':
https://docs.zephyrproject.org/latest/kernel/services/data_passing/mailboxes.html Hope this helps,
regards,
Guy
On 5/3/22 23:20, yshragai.firmware@... wrote:
Hi,
I'm wanting to design a firmware, for a small low-power embedded system, with an architecture that features a "bus" over which the firmware modules communicate. I'm wondering how to design this "bus".
Basically what I'm envisioning is modules sending messages over this bus that contain an address or module ID of some sort or another; the module that matches this address or ID would pick up the message off the bus.
One brute-force way to design this is a queue (such as a FIFO) per target module. This is not the most elegant or scalable solution, but it'll work... Is there a way to design this that's more scalable, and maybe even elegant?
I wish there were a mechanism in Zephyr by which a thread could subscribe to messages in a given queue not by sender ID (as is possible with a mailbox) but by some identifying characteristic of the message (e.g., by the value in the "info" field).
Thanks!
--
bytes at work
Technoparkstrasse 7
CH-8406 Winterthur
Switzerland

phone: +41 52 213 79 79


Re: designing a message "bus"

Guy Morand
 

Hi Yshragai,

Have you looked at 'k_mbox' data structure? It seems you can set a destination thread or broadcast messages with 'K_ANY':
https://docs.zephyrproject.org/latest/kernel/services/data_passing/mailboxes.html

Hope this helps,
regards,

Guy

On 5/3/22 23:20, yshragai.firmware@... wrote:
Hi,
I'm wanting to design a firmware, for a small low-power embedded system, with an architecture that features a "bus" over which the firmware modules communicate. I'm wondering how to design this "bus".
Basically what I'm envisioning is modules sending messages over this bus that contain an address or module ID of some sort or another; the module that matches this address or ID would pick up the message off the bus.
One brute-force way to design this is a queue (such as a FIFO) per target module. This is not the most elegant or scalable solution, but it'll work... Is there a way to design this that's more scalable, and maybe even elegant?
I wish there were a mechanism in Zephyr by which a thread could subscribe to messages in a given queue not by sender ID (as is possible with a mailbox) but by some identifying characteristic of the message (e.g., by the value in the "info" field).
Thanks!
--
bytes at work
Technoparkstrasse 7
CH-8406 Winterthur
Switzerland

phone: +41 52 213 79 79


Re: designing a message "bus"

Jason Bens <jason.bens@...>
 

I’m sure you’ll get a slew of possible implementations, but have you considered implementing the observer pattern?  https://en.wikipedia.org/wiki/Observer_pattern .  If I were to implement this, I’d give each module an event queue to receive messages on, and a list containing pointers to the event queues of other interested modules (the observers).  Observers are notified by iterating over the list and sending the event to each one.  Unfortunately, the granularity of this approach is only to the module level, and so may not meet your needs as described.

 

  • Jason

 

From: users@... <users@...> On Behalf Of yshragai.firmware@...
Sent: May 3, 2022 11:20 PM
To: users@...
Subject: [Zephyr-users] designing a message "bus"

 

External Email:

Hi,

I'm wanting to design a firmware, for a small low-power embedded system, with an architecture that features a "bus" over which the firmware modules communicate. I'm wondering how to design this "bus".

 

Basically what I'm envisioning is modules sending messages over this bus that contain an address or module ID of some sort or another; the module that matches this address or ID would pick up the message off the bus.

 

One brute-force way to design this is a queue (such as a FIFO) per target module. This is not the most elegant or scalable solution, but it'll work... Is there a way to design this that's more scalable, and maybe even elegant?

 

I wish there were a mechanism in Zephyr by which a thread could subscribe to messages in a given queue not by sender ID (as is possible with a mailbox) but by some identifying characteristic of the message (e.g., by the value in the "info" field).

 

Thanks!


designing a message "bus"

yshragai.firmware@...
 

Hi,
I'm wanting to design a firmware, for a small low-power embedded system, with an architecture that features a "bus" over which the firmware modules communicate. I'm wondering how to design this "bus".
 
Basically what I'm envisioning is modules sending messages over this bus that contain an address or module ID of some sort or another; the module that matches this address or ID would pick up the message off the bus.
 
One brute-force way to design this is a queue (such as a FIFO) per target module. This is not the most elegant or scalable solution, but it'll work... Is there a way to design this that's more scalable, and maybe even elegant?
 
I wish there were a mechanism in Zephyr by which a thread could subscribe to messages in a given queue not by sender ID (as is possible with a mailbox) but by some identifying characteristic of the message (e.g., by the value in the "info" field).
 
Thanks!


Re: Connecting to a private resolvable address found using bt_le_scan_start

Chettimada, Vinayak Kariappa
 

Hi Jason,

 

Without bonding (connect, pair, encrypt and distribute keys) with the device, IRK cannot be obtained from the remove device.

 

Regards,

Vinayak

 

From: users@... <users@...> On Behalf Of Jason Bens via lists.zephyrproject.org
Sent: 02 May 2022 12:03
To: users@...
Subject: [Zephyr-users] Connecting to a private resolvable address found using bt_le_scan_start

 

Hi,

 

I’m writing some firmware for both sides of a BLE link.  I would like to scan for advertisers, filter the results to find my device, then store the address to be connected later, without necessarily connecting at the moment.  I think this is possible if I use static addresses, but I would prefer to use a private resolvable address.  What is the process to use the bt_le_address_t returned in the info struct of the .recv callback to get the IRK so I can connect to the remote device at a later time?

 

Thanks,

 

  • Jason


Connecting to a private resolvable address found using bt_le_scan_start

Jason Bens <jason.bens@...>
 

Hi,

 

I’m writing some firmware for both sides of a BLE link.  I would like to scan for advertisers, filter the results to find my device, then store the address to be connected later, without necessarily connecting at the moment.  I think this is possible if I use static addresses, but I would prefer to use a private resolvable address.  What is the process to use the bt_le_address_t returned in the info struct of the .recv callback to get the IRK so I can connect to the remote device at a later time?

 

Thanks,

 

  • Jason


STM32 VS Code

mshary@...
 

Hello, can someone describe how to create a project for stm32f407 and Zephyr os with opportunity to flash and debug in VS code


Re: west flash issue

Anis
 

you need to have JLINK folder in your PATH.

see this link for how to add something to the path https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

Anis

On 4/28/22 14:26, Yojanse Duarte wrote:

Hi,

Im trying to use zephyr os but I cant flash because im having problems with jlink, how can I solve It?

 

 

Yojanse Duarte
Ingeniero de Hardware
TripleCyber S.R.L.

RNC: 1-32-28980-3
Telefono: (829) 823-3481
yojanse.duarte@... | www.triplecyber.com

 

Visita a TripleCyber en redes sociales: 

Este correo electrónico y los archivos transmitidos con él son confidenciales y están destinados únicamente al uso de la persona o entidad a la que se dirigen. Si usted no es el destinatario previsto o la persona responsable de entregar el correo electrónico al destinatario previsto, tenga en cuenta que ha recibido este correo electrónico y cualquier archivo transmitido por error y que cualquier uso, difusión, reenvío, impresión o copia de este correo electrónico y / o dichos archivos está estrictamente prohibido. Si ha recibido este correo electrónico por error, notifique inmediatamente al remitente y destruya el mensaje original y todos los archivos adjuntos.

 


west flash issue

Yojanse Duarte <Yojanse.Duarte@...>
 

Hi,

Im trying to use zephyr os but I cant flash because im having problems with jlink, how can I solve It?

 

 

Yojanse Duarte
Ingeniero de Hardware
TripleCyber S.R.L.

RNC: 1-32-28980-3
Telefono: (829) 823-3481
yojanse.duarte@... | www.triplecyber.com

 

Visita a TripleCyber en redes sociales: 

Este correo electrónico y los archivos transmitidos con él son confidenciales y están destinados únicamente al uso de la persona o entidad a la que se dirigen. Si usted no es el destinatario previsto o la persona responsable de entregar el correo electrónico al destinatario previsto, tenga en cuenta que ha recibido este correo electrónico y cualquier archivo transmitido por error y que cualquier uso, difusión, reenvío, impresión o copia de este correo electrónico y / o dichos archivos está estrictamente prohibido. Si ha recibido este correo electrónico por error, notifique inmediatamente al remitente y destruya el mensaje original y todos los archivos adjuntos.

 


Re: Executing a Post Build Batch File using CMake

Bolivar, Marti
 

Hi Casey,

Did you have a look at the global 'extra_post_build_commands' and
'extra_post_build_byproducts' properties mentioned in
zephyr/CMakeLists.txt?

Try searching around the source tree to see how it is used and if you
can adapt it to your needs.

HTH,
Martí

On Wed, Apr 13 2022, Casey Shea via lists.zephyrproject.org wrote:
*Build Environment Details*

* Building Zephyr with CMake
* ARM Platform (Nordic nrf5340)
* Source and Build directories are out of tree.

* My build directory is ${ CMAKE_CURRENT_SOURCE_DIR }../../Executables
* My source directories are in several places, but all are in a sub-directory of ${ CMAKE_CURRENT_SOURCE_DIR }/../../../../

* CLion is my IDE of choice but I don't believe that matters for this discusson.

*What I am Trying to Achieve*
At the end of my build process, I would like to execute a batch file on the zephyr_final target that signs the final image.  This is different than the MCU Boot signature and is a custom proprietary signature.  I am unable to change the way in which this image is signed as it must be compatible with existing tools used with my product.

*Method in Which I am trying to Achieve*
Normally, I would do this using add_custom_command(TARGET target_name POST_BUILD
COMMAND "batchfile.bat" batchfile_arguments)

However, I don't believe that the final zephyr target is within the scope of the top-level CMakeLists.txt file.  That said, I do not have a lot of experience with CMake as most of my past development was within the IAR toolchain.  It's very possible that I am misinterpreting this.

Questions
1.  Will I be able to use the add_custom_command() CMake function to execute the batch file?  If so, can someone provide an example as to how I would do this and what Target I should be using.

2.  Is there a better, more appropriate method for doing this within the Zephyr environment.

Any help or guidance is much appreciated!



Re: Executing a Post Build Batch File using CMake

mlsvrts
 

Hi Casey,

I have been using `add_custom_command` to sign my generated images like this:

set(ZEPHYR_SIGNED_BIN ${ZEPHYR_BINARY_DIR}/zephyr.signed.bin)
set(MCUBOOT_SIGNING_KEY ${ZEPHYR_BASE}/../bootloader/mcuboot/root-rsa-2048.pem)
set(APP_VERSION 1.0.5+2)

add_custom_command(
    COMMAND west sign -t imgtool --
        --key ${MCUBOOT_SIGNING_KEY}
        --version ${APP_VERSION}
    OUTPUT ${ZEPHYR_SIGNED_BIN}
    DEPENDS zephyr_final
    COMMENT "Running post-build signing step..."
)

add_custom_target(
    post_bin ALL
    DEPENDS
    ${ZEPHYR_SIGNED_BIN}
)


Note that the command won't trigger without the additional `custom_target`. Also, my source directory is child of `zephyrproject/zephyr`, so I can't say for certain that this will work in your case.

- mlsvrts


Executing a Post Build Batch File using CMake

Casey Shea
 

Build Environment Details
  • Building Zephyr with CMake
  • ARM Platform (Nordic nrf5340)
  • Source and Build directories are out of tree.
    • My build directory is ${CMAKE_CURRENT_SOURCE_DIR}../../Executables
    • My source directories are in several places, but all are in a sub-directory of ${CMAKE_CURRENT_SOURCE_DIR}/../../../../
  • CLion is my IDE of choice but I don't believe that matters for this discusson.

What I am Trying to Achieve
At the end of my build process, I would like to execute a batch file on the zephyr_final target that signs the final image.  This is different than the MCU Boot signature and is a custom proprietary signature.  I am unable to change the way in which this image is signed as it must be compatible with existing tools used with my product.

Method in Which I am trying to Achieve
Normally, I would do this using add_custom_command(TARGET target_name POST_BUILD 
                                                                           COMMAND "batchfile.bat" batchfile_arguments)

However, I don't believe that the final zephyr target is within the scope of the top-level CMakeLists.txt file.  That said, I do not have a lot of experience with CMake as most of my past development was within the IAR toolchain.  It's very possible that I am misinterpreting this.  

Questions
1.  Will I be able to use the add_custom_command() CMake function to execute the batch file?  If so, can someone provide an example as to how I would do this and what Target I should be using.

2.  Is there a better, more appropriate method for doing this within the Zephyr environment.


Any help or guidance is much appreciated!  




Re: Zephyr wi-fi shell on Windows 10: sending commands?

gianluca torta
 

just in case someone will hit this issue

I solved it installing Putty terminal emulator on Windows 10

Gianluca


Zephyr wi-fi shell on Windows 10: sending commands?

gianluca torta
 

hi all,

I have added the wi-fi shell support to my Zephyr project, by adding the following options:
CONFIG_NET_L2_WIFI_SHELL=y
CONFIG_NET_SHELL=y
CONFIG_SHELL=y

I am on Windows 10 and use Tera Term as a terminal

the shell starts and prints a few lines followed by the prompt, where I can write commands such as:
wifi connect [...]
so everything looks good

unfortunately, when I hit the enter key, the command is not sent to the board

I have tried to tweak the config of Tera Term as much as I could (e.g. CR/CR-LF/LF end of lines ecc.) to no avail

does anyone have succeded sending commands through the Zephyr shell with Tera Term (or any other terminal emulator available on Windows 10)?

thanks in advance,
Gianluca


141 - 160 of 3076