threadx | Azure RTOS ThreadX | Azure library
kandi X-RAY | threadx Summary
kandi X-RAY | threadx Summary
This advanced real-time operating system (RTOS) is designed specifically for deeply embedded applications. Among the multiple benefits it provides are advanced scheduling facilities, message passing, interrupt management, and messaging services. Azure RTOS ThreadX has many advanced features, including picokernel architecture, preemption threshold, event chaining, and a rich set of system services.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of threadx
threadx Key Features
threadx Examples and Code Snippets
Community Discussions
Trending Discussions on threadx
QUESTION
Calling the tx_events_flags_get() function with the "requested_flags" parameter equal to 0UL seems to result in infinite wait. Logically, it is pointless to wait for no flags to be raised; it should return immediately. Yet with this input the function never exits. Is this a bug in the function or am I missing something?
Here's the code I've written:
...ANSWER
Answered 2022-Mar-29 at 16:22You are not missing anything. This is a bug. We will fix this in the next release, aiming for the end of April, 2022. In the future, it might be easier to post on github issues: https://github.com/azure-rtos/threadx/issues
QUESTION
I have generated a ThreadX project using CubeMX, which has provided me with both .s and .S files. When building using make I get the 'No rule to make target' for the .S files, but not for the .s file (the object file is created successfully)... What is the difference between these types of files, and is there an extra step one must take for building .S files into object files? I have understood that this error mainly occurs when the compiler does not find the file, but I have verified the path several times.
...ANSWER
Answered 2022-Mar-01 at 10:41No, there's no difference in how you should build them, gcc -c
works on either to produce a .o
.
GCC handles the difference in pre-processing them or not.
Obviously your Makefile needs to have a rule to build a .o
from a .s
or .S
. At the simplest, just duplicate the pattern rule for %.o: %.S
, since it seems to be surprisingly inconvenient to define a case-insensitive pattern rule or simply list two possible patterns for one rule in the general case.
QUESTION
I am looking at one of the simplest examples I found and started to reason about SO
(synchronization order) or more precise, lack of it. Consider the example below:
ANSWER
Answered 2021-Sep-23 at 06:26The lock coarsening (and reordering) is allowed because the synchronized readers either get ordered before or after the coarsened lock. They will never be able to see what is happening while the coarsened lock is held and hence can't observe any reordering inside the locked code.
For more information see: https://shipilev.net/blog/2016/close-encounters-of-jmm-kind/#myth-barriers-are-sane
Nice question btw. I was struggling with this particular example as well some time ago :)
QUESTION
I see that when loading threadx module, the data section is allocated in run time from byte pool (at _txm_module_manager_internal_load).
Is there a way to define in advance (in the module preamble or such) the place where the module data will be located?
How dose the module code knows where its globals are located? the compiler can't know their addresses because the place of the data is determined at run time (I suppose somewhere in the assembly porting there is some relative address to the data section that changes for each module that the globals are accessed through it, but I am not so familiar with arm assembly to find it by myself).
ANSWER
Answered 2020-Oct-15 at 08:10The location of data for each module is determined at run-time. This is to allow loading the same module more than once, each instance having separate data, in different locations.
Globals are located in the data area. The modules are compiled as position independent code and position independent data. While loading the module the module startup code is provided with the load address of the data. The specifics of how this is achieved are different for each architecture and compiler.
QUESTION
I'm writing a script to run with a GUI.
There are two input fields and two buttonsץ I'm using threading
so I can start and stop a loop with the buttons without having it freeze.
The inputs are necessary for some operations within the loop, I will simplify them as it's a very long if
statement.
I've never done threading, the app worked before I tried to implement it.
The main question is how do I pass on the input from the GUI, to the thread?
It kept giving me argument not defined
error.
Here's the code, any help is greatly appreciated:
...ANSWER
Answered 2020-Sep-20 at 05:54Better create another function to create the Thread
instance and start it:
QUESTION
I have been playing around with azure-rtos (THREADX) and trying to port the OS for the cortex R5 based system. After looking at the port files, it seems that OS runs the threads in Supervisor (SVC) mode.
For example, in the function _tx_thread_stack_build
, while building the stack for threads, initialization value for the CPSR
is such that mode bits correspond to SVC mode. This initialization value is later used to initialize the CPSR before jumping to the thread entry function.
Following is the snippet of the function _tx_thread_stack_build
storing initialization value of CPSR on the stack of a thread. For your reference see file tx_thread_stack_build.S.
ANSWER
Answered 2020-Aug-25 at 16:07This is by design, ThreadX is a small monolithic kernel, where application code is tightly integrated with the kernel and lives in the same address space and mode. This allows for greater performance and lower footprint. You can also use ThreadX Modules, where the available MPU or MMU is used to separate kernel and user code into different modes and provide additional protection, but this incurs a small performance and footprint penalty.
QUESTION
I'm interested in looking into the ThreadX RTOS and was wondering if anyone knew if there was an adb type equivalent in ThreadX. I'm imagining using a device with ThreadX and using some adb-like tool to view hte file system or push files to the device.
Is this possible?
Thanks!
...ANSWER
Answered 2020-Jul-11 at 12:53ThreadX is intended for devices much smaller than anything that runs Android; you must give up on the idea that there will be any debug facility incorporated in your target. With embedded devices, your debug capabilities are in the development tools which run on a Windows PC (and yes, most embedded tools only run on Windows) attached to the target. That said, there are excellent debug tools built into any embedded IDEs these days.
If you are interested in ThreadX, get a development board from Renesas that incorporates a debugger link. These are typically available for less than $50 USD. The Renesas IDE, E2Studio, has great support for ThreadX. I also understand that the watch from Pine64 runs ThreadX but I am awaiting that device's arrival and have not used the Nordic tools before so I can't say how well ThreadX is integrated into that.
Finally, and I have no vested interest in this, if you are starting in embedded code you might want to check out FreeRTOS instead of ThreadX. I can't say it is superior in any technical way; but, if you search here you'll see there is a much bigger community of FreeRTOS users than ThreadX. To me, they both work fine, its easier to find help with FreeRTOS as a quick search will reveal 10x the postings for FreeRTOS vs ThreadX.
QUESTION
I see at the porting of threadx that in the top of each thread stack there are reserved uninitialized bytes, and then 16 zero bytes and just then the stack really begins.
The zero bytes called there backtrace. At the arm ports it is 4 bytes uninitialized and 4 zero (here for example), and at ARC porting both are 16 bytes sizes (here for example).
One more important thing is that the uninitialized bytes are initialized to 0xef if TX_DISABLE_STACK_FILLING isn't defined.
My questions are:
- Why there is a difference between ARC porting and ARM porting?
- Why those bytes exist? Is there is a trace tool or somthing in the algorithm that uses those bytes, or they are just for seeing in the memory 'by hands' that this memory didn't changed?
ANSWER
Answered 2020-Jul-20 at 19:50Yes, the ARM and ARC ports are very different, i.e., different assembly code, pragmas, intrinsics, etc. It’s also noteworthy that different development tools are in play as well. For example, the main development tool for ARC is MetaWare (compiler/debugger), while on ARM there is IAR, ARM, GCC, etc.
As for stack backtrace, this is typically setup such that the debugger can create a call tree when there is a halt of execution or breakpoint in the current thread’s code. The backtrace byte pattern effectively represents the top of the stack and signals the debugger to stop building the call tree. Of course, this is every specific to the debugger and in this example the difference between the MetaWare debugger and the ARM tool debuggers. As for the 0xEF patter on the stack, this is useful for visual inspection by the developer. The pattern is also used by the run-time stack checking feature in ThreadX (please refer to the ThreadX User Guide documentation). Also, the IAR and MetaWare debuggers are able to calculate stack usage via examination of 0xEF pattern erosion in each thread’s stack and present that very useful information to the developer.
QUESTION
I have an existing embedded stand-alone main program and am trying to add Azure RTOS THREADX to it. Does Azure RTOS require a bootloader? Is it bootloader agnostic?
...ANSWER
Answered 2020-May-02 at 13:05Azure RTOS THREADX does not require a bootloader itself and is in general bootloader agnostic. A typical use of Azure RTOS THREADX is to be linked and located as part of the application program in a device’s flash memory, where the entry point is tied to the reset vector. However, there are some applications that do require a bootloader. In such applications, Azure RTOS THREADX simply looks like the application code image so nothing special is required in THREADX. In either case, Azure RTOS THREADX doesn’t know or really care how it was loaded and thus stays out of the way of the application’s particular boot sequence needs.
QUESTION
I am exploring a problem which is likely a special case of a problem class, but I don't know the problem class nor the appropriate terminology, so I have to resort to desribing the problem using ad-hoc vocabulary. I'll rephrase once I know the right terminology.
I have a bunch of singletons A
, B
, C
. The singletons are:
- Unrelated. There are no constraints like "you must access B before you can do X with C" or similar.
- Not thread-safe.
The system accepts tasks to be processed in parallel as far as possible.
Each task consists of a sequence of actions, each action to be executed using one of the singletons. Different tasks may access different singleton in different order, and tasks may contain loops of actions.
Pseudocode:
...ANSWER
Answered 2020-Apr-23 at 11:43I don't know the problem class nor the appropriate terminology
I'd probably just refer to the problem class as concurrent task orchestration.
There's a lot of things to consider when identifying the right approach. If you provide some more details, I'll try to update my answer with more color.
There are no constraints like "you must access B before you can do X with C" or similar.
This is generally a good thing. A very common cause of deadlocks is different threads acquiring the same locks in differing orders. E.g., thread 1 locks A then B while thread 2 owns the lock B and is waiting to acquire A. Designing the solution such that this situation does not occur is very important.
I couldn't find anything like
SettableFuture
in the JDK
Take a look at java.util.concurrent.CompletableFuture
- this is probably what you want here. It exposes a blocking get()
as well as a number of asynchronous completion callbacks such as thenAccept(Consumer)
.
invokeAndWait
is generally considered prone to deadlock
It depends. If your calling thread isn't holding any locks that are going to be necessary for the execution of the Runnable
you're submitting, you're probably okay. That said, if you can base your orchestration on asynchronous callbacks, you can instead use SwingUtilities.invokeLater(Runnable)
- this will submit the execution of your Runnable
on the Swing event loop without blocking the calling thread.
I would probably avoid creating a thread per singleton. Each running thread contributes some overhead and it's better to decouple the number of threads from your business logic. This will allow you to tune the software to different physical machines based on the number of cores, for example.
It sounds like you need each runWithX(...)
method to be atomic. In other words, once one thread has begun accessing X, another thread cannot do so until the first thread is finished with its task step. If this is the case, then creating a lock object per singleton and insuring serial (rather than parallel) access is the right way to go. You can achieve this by wrapping the execution of closures that get submitted in your runWithX(...)
methods in a synchronized
Java code block. The code within the block is also referred to as the critical section or monitor region.
Another thing to consider is thread contention and order of execution. If two tasks both require access to X and task 1 gets submitted before task 2, is it a requirement that task 1's access to X occurs before task 2's? A requirement like that can complicate the design quite a bit and I would probably recommend a different approach than outlined above.
Is there a superior approach that I didn't consider?
These days there are frameworks out there for solving these types of problems. I'm specifically thinking of reactive streams and RxJava. While it is a very powerful framework, it also comes with a very steep learning curve. A lot of analysis and consideration should be done before adopting such a technology within an organization.
Update:
Based on your feedback, I think a CompletableFuture
-based approach probably makes the most sense.
I'd create a helper class to orchestrate task step execution:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install threadx
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page