Hardfault with Threadx inter-thread messages in Debug build

Jean LAUNOIS 5 Reputation points
2023-02-22T11:18:43.1933333+00:00

Hello,

I am encountering an hardfault when sending a message from one thread to another. With a debugger I could point the hardfault to the following instruction in the tx_queue_send function. The hardfault occurs upon reaching the instruction and the following ones in the function itself are not executed.

_tx_thread_system_resume(thread_ptr);

However, the only happens when compiling in Debug. Release builds work fine, with no hardfault at that point.

Is there any known errors in Threadx that could lead to such an HardFault ?

I am using a LPC55S69 microcontroller.

Thank you in advance

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
331 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Scott Azure RTOS 4,051 Reputation points
    2023-02-23T04:37:03.0733333+00:00

    Strange! Can you single step into the function and let me know what assembly instruction is causing the fault?

    I assume you are using the default security settings (ThreadX and your app are running in Non-Secure mode).

    0 comments No comments

  2. AshokPeddakotla-MSFT 33,026 Reputation points
    2023-03-01T12:53:38.5633333+00:00

    Jean LAUNOIS Did you get a chance to see suggestions from Scott?

    In addition to the above suggestions, you can try to check the following and see if it helps.

    • Make sure that the thread_ptr variable is not null or corrupted.
    • Check the stack and heap memory usage to make sure that they are not overflowing.
    • Check the interrupt handling and make sure that the interrupts are not interfering with the thread execution.

    These are some possible causes of your hardfault when sending a message from one thread to another in ThreadX. You should try to isolate the issue by debugging the code and looking for any memory access issues, timing issues, or thread priority issues that may be causing the hardfault.

    If you need further help in this matter, please comment in the below section and we are happy to discuss!


    If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.


Your answer

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