Simple ThreadX program stops working after modifying tx_port.h for BSD demo program

Sulav Lal Shrestha 361 Reputation points
2021-09-28T16:18:13.483+00:00

I am building an application for ATSAME70 microcontroller. I am trying out ThreadX with NetXDuo. I compile the ThreadX related libs separately from my actual application, and then copy the libs, .c and .h files from threadX folder to my application directory. I wanted to try out the demo BSD program but after making the changes suggested in https://learn.microsoft.com/en-us/azure/rtos/netx-duo/netx-duo-bsd/chapter2, the test LED blinking program stops working that was working before making the changes stops working.

Steps:

  1. Compile ThreadX with FileX and NetXDuo without modifying tx_port.h file.
  2. Copy the libs and relevant .c and .h files for threadX, fileX and netXDuo to the application directory.
  3. Build application.
  4. LED blinking program works.
  5. Compile ThreadX with FileX and NetXDuo after modifying tx_port.h file. Do not copy the modified tx_port.h file in the application directory yet.
  6. Copy the libs for threadX, fileX and netXDuo to the application directory.
  7. Build application.
  8. LED blinking program still works. At this point, I have not included the BSD related code in the main application. I have just updated the threadx libraries.
  9. Copy the modified tx_port.h file in application directory.
  10. Build application.
  11. LED blinking program stops working. The program is stuck in tx_kernel_enter().

The change I made in tx_port.h is redefine TX_THREAD_EXTENSION_3:

#define TX_THREAD_EXTENSION_3 int bsd_errno;  

Can anyone tell me where I am going wrong?

For compiling netxduo libraries with threadx, I simply copy the filex and netxduo inside the threadx folder and add "add_subdirectory" commands in CMakeLists of threadx. For BSD addon, I simply update the tx_port.h file. Do I need to incorporate nxd_bsd.h and nxd_bsd.c files as well while generating libraries for threadx and netxduo? Currently I am not using the nxd_bsd files for generating the libraries. I am using them just in the main application.

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
324 questions
0 comments No comments
{count} vote

Accepted answer
  1. Sulav Lal Shrestha 361 Reputation points
    2021-10-02T00:38:03.223+00:00

    My build process when the issue was happening:

    1. Build the threadx related libraries in Ubuntu.
    2. Copy the libraries to Microchip studio project.
    3. Build the Microchip studio project.

    I was not getting debug info of interest when using this build process as the threadx related source files were in there in the project. So, to get debug info, I decided to move the entire build process to Microchip Studio. I added all the threadx related source files to Microchip Studio project and build the application along with threadx in Microchip Studio itself. After doing this, the issue described above was solved. I encountered other issues but I resolved them as well.

    So, I feel the issue described in the question was due to some difference in build process (not sure exactly what that difference is).

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Scott Larson 451 Reputation points
    2021-09-28T19:31:36.367+00:00

    It sounds like you are doing everything correctly.

    You do not need to build the nxd_bsd.c file in the library, you can build that with your application.

    Are you able to use a debugger to step through the tx_kernel_enter function to find exactly where it's getting stuck? That would be helpful to know.

    0 comments No comments