Skip to main content
Visitor II
May 28, 2024
Question

STM32F401RE threads on bare metal

  • May 28, 2024
  • 1 reply
  • 798 views

I need to make a "multi threaded" application, my mentor told me this, and I quote 
"

you should create a thread by yourself
use any system timer, e.g. simple tick timer
"
I do not really understand this, but he gave me some example pseudocode, hopefully someone can decipher what he meant.

 

int main(void){

 uint8_t done{0};
 while (1) 
 {
 thread_Xms(&done);
 
 if(done & 1)
 {// exactly 1 ms loop
 
 function_LED_1ms(); //< no any delay sould be contains!!!
 
 function_Input_1ms();//< no any delay sould be contains!!!
 
 function_ETC_1ms(); //< no any delay sould be contains!!!
 
 } 
 if(done & 0x80)
 {// exactly 1 sec loop for example
 // TODO something every 1 sec
 } 
 
 
 }
}
​

 

    This topic has been closed for replies.

    1 reply

    Super User
    May 28, 2024

    >I do not really understand this

    Better ask him, to avoid "broken phone" situation. People that teach software in various schools often have peculiar ideas about software, different from what professional developers can suggest.

    Just note that he prefers C++, because of syntax in line 3.