Share via

Can ThreadX Module export queue?

HugPeter-9392 246 Reputation points
2023-01-25T06:52:57.6066667+00:00

Hello

I wonder if it is a good idea or design when a ThreadX module creates a queue and then exports this queue to the residential application. E.g. by use of txm_module_application_request service and passing a pointer to the queue. The residential application uses this queue to send messages to the ThreadX module. Our software runs on cortex-m33, maybe also on cortex-m4.

Which is the recommended memory from which the queue (TX_QUEUE) and the queues buffer gets allocated? Why?

Makes it a difference when TrustZone is enabled?

Makes it a difference when the queue gets forwarded to another ThreadX module 2. Then the module 2 would send messages directly to module 1.

Thanks for support.

Peter

Azure Internet of Things
Eclipse ThreadX
Eclipse ThreadX

An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.


Answer accepted by question author

Scott Azure RTOS 4,051 Reputation points
2023-01-25T21:39:12.0166667+00:00

Hi @HugPeter-9392 That is the preferred way to do it - have the module create a queue and share a pointer to that queue with the resident application. Any object (e.g. a queue) that a module creates will be allocated from the pool created by txm_module_manager_object_pool_create. Modules must use txm_module_object_allocate((void*)&queue_0, sizeof(TX_QUEUE)); to allocate the queue object. The queue buffer also needs to reside either in the module's data region or in a shared memory region, otherwise ThreadX will return an error. Alternatively, the resident application can create a queue and the module can use txm_module_object_pointer_get_extended to get a pointer to the queue for sending and receiving messages. This also applies to your last question about inter-module communication, one module can create a queue and the other can use txm_module_object_pointer_get_extended to get a pointer to that queue. See attachment for a module-module example. demo_module1.txt

Regarding TrustZone, ARM and Microsoft recommend running the RTOS and user application in non-secure space. Queues and their buffers would need to be created in non-secure space.

Was this answer helpful?

2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.