This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

use rtx on S310

hi. this is my code that i copied from ble_app_hrs_rtx .

osPoolDef(ble_evt_pool, 8, ble_evt_t);                                                  /**< Definition of memory pool for ble_stack_thread */
osPoolId ble_evt_pool;                                                                  /**< Memory pool for ble_stack_thread */
osMessageQDef(ble_stack_msg_box, 8, ble_evt_t);                                         /**< Definition of message box for ble_stack_thread */
osMessageQId ble_stack_msg_box;                                                         /**< Message box for ble_stack_thread */

osThreadId ble_stack_thread_id;                                                         /**< BLE Stack thread */

void ble_stack_thread(void const * arg){
	
	while(1){
		SEGGER_RTT_WriteString(0,"im in ble_stack_thread");
		osDelay(1000);
	}
}                                                
osThreadDef(ble_stack_thread, osPriorityAboveNormal, 1, 0);                             /**< Definition of BLE Stack thread */

and in main()

ble_evt_pool      = osPoolCreate(osPool(ble_evt_pool));
  ble_stack_msg_box = osMessageCreate(osMessageQ(ble_stack_msg_box), NULL);

  // Start execution.
  ble_stack_thread_id = osThreadCreate(osThread(ble_stack_thread), NULL);
  UNUSED_VARIABLE(ble_stack_thread_id);

and in while(1) of main() i put delay 1000 ms .

thread create successfully but on it get hard fault . i think after delay it get hard fault.

image description

all of my initialize is in main thread and all callback is in main() ; what is cause of hard fault?

Related