STMicroelectronics / x-cube-azrtos-h7

X-CUBE-AZRTOS-H7 (Azure RTOS Software Expansion for STM32Cube) provides a full integration of Microsoft Azure RTOS in the STM32Cube environment for the STM32H7 series of microcontrollers.

Home Page:https://www.st.com/en/embedded-software/x-cube-azrtos-h7.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use Threadx

zsjlovestudy opened this issue · comments

Environment:
STM32CubeIDE 1.8.0
STM32CubeMX 6.4.0
x-cube-azrtos-h7 2.0.0

I only initialized the RCC clock and an LED IO port,then i choose threadx core in software pack of x-cube-azrtos-h7.
After I added an LED flashing thread, but it didn't run
image

You need to allocate memory before calling tx_thread_create, e.g.

CHAR *pointer;

ret = tx_byte_allocate(byte_pool, (VOID **) &pointer, DEFAULT_STACK_SIZE, TX_NO_WAIT);

ret = tx_thread_create(&my_thread, "My Thread", my_thread_entry, 0, pointer, DEFAULT_STACK_SIZE, DEFAULT_THREAD_PRIO,
                  DEFAULT_PREEMPTION_THRESHOLD, TX_NO_TIME_SLICE, TX_AUTO_START);

You might want to check the value of ret after each call

CHAR *pointer;

ret = tx_byte_allocate(byte_pool, (VOID **) &pointer, DEFAULT_STACK_SIZE, TX_NO_WAIT);

thank you very much! I was careless and tried Azure for the first time.

You need to allocate memory before calling tx_thread_create, e.g.

CHAR *pointer;

ret = tx_byte_allocate(byte_pool, (VOID **) &pointer, DEFAULT_STACK_SIZE, TX_NO_WAIT);

ret = tx_thread_create(&my_thread, "My Thread", my_thread_entry, 0, pointer, DEFAULT_STACK_SIZE, DEFAULT_THREAD_PRIO,
                  DEFAULT_PREEMPTION_THRESHOLD, TX_NO_TIME_SLICE, TX_AUTO_START);

You might want to check the value of ret after each call

May I ask you another question, if I choose dynamic memory allocation, how should I allocate for it?

image
image

Hi @zsjlovestudy,

Your questions are more than welcome. However, the right channel to ask for support about such aspects is the ST Community via a post on the Azure RTOS dedicated section.

This channel is rather dedicated to report bugs or enhancements related to the firmware published within this repo.

Please allow me to close this issue. Thank you for your comprehension.

With regards,