2024-07-31 05:24 AM
I have a problem with CubeIde (version independent tried on both 1.13 and 1.16)
the problem is that in live expression I am using a struct to combine each task in single struct for debugging purpose
the values of the variables all shifted down
example:
var1: 0
var2: value of var1
var3: value of var2
char arr[100]: [value of var3
value of arr[0]
etc]
I am using threadx, the problem doesnot exist when working on UBUNTU while in windows is happening all time.
the other thread values are correct, it happen only on the second thread.
/* Includes ------------------------------------------------------------------*/
#include "app_threadx.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "main.h"
#ifdef ExampleProtocole
#include "ExampleCommunicationTask.h"
#endif
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
#ifndef URMETPROTOCOL
#define MAIN_THREAD_STACK_SIZE 4096
#elif defined(URMETPROTOCOL)
#define MAIN_THREAD_STACK_SIZE 4096
#define Example_COMMUNICATION_THREAD_STACK_SIZE 4096
#endif
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
uint8_t main_thread_stack[MAIN_THREAD_STACK_SIZE];
TX_THREAD mainThreadPointer;
#if defined(ExamplePROTOCOL)
uint8_t urmet_thread_stack[Example_COMMUNICATION_THREAD_STACK_SIZE];
TX_THREAD exampleCommunicationPointer;
#endif
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
static void MainThreadEntry(uint32_t initialInput);
#if defined(ExamplePROTOCOL)
static void ExampleCommunicationThreadEntry(uint32_t initialInput);
#endif
/* USER CODE END PFP */
/**
* @brief Application ThreadX Initialization.
* @PAram memory_ptr: memory pointer
* @retval int
*/
UINT App_ThreadX_Init(VOID *memory_ptr) {
UINT ret = TX_SUCCESS;
/* USER CODE BEGIN App_ThreadX_MEM_POOL */
#ifdef ExamplePROTOCOL
#endif
/* USER CODE END App_ThreadX_MEM_POOL */
/* USER CODE BEGIN App_ThreadX_Init */
if (tx_thread_create(&mainThreadPointer, (char*)"MainThread",
MainThreadEntry, 0x1234, main_thread_stack,
MAIN_THREAD_STACK_SIZE, 15, 15, 1,
TX_AUTO_START) != TX_SUCCESS) {
return TX_THREAD_ERROR;
}
#ifdef ExamplePROTOCOL
if (tx_thread_create(&exampleCommunicationPointer, (char*)"ExampleCommunicationThread",
exampleCommunicationThreadEntry, 0x1234, example_thread_stack,
Example_COMMUNICATION_THREAD_STACK_SIZE, 15, 15, 1,
TX_AUTO_START) != TX_SUCCESS) {
return TX_THREAD_ERROR;
}
#endif
/* USER CODE END App_ThreadX_Init */
return ret;
}
/**
* @brief MX_ThreadX_Init
* @PAram None
* @retval None
*/
void MX_ThreadX_Init(void) {
/* USER CODE BEGIN Before_Kernel_Start */
/* USER CODE END Before_Kernel_Start */
tx_kernel_enter();
/* USER CODE BEGIN Kernel_Start_Error */
/* USER CODE END Kernel_Start_Error */
}
/* USER CODE BEGIN 1 */
void MainThreadEntry(uint32_t initialInput) {
MainThreadFunction();
}
#ifdef ExamplePROTOCOL
void ExampleCommunicationThreadEntry(uint32_t initialInput) {
ExampleThread();
}
screenshot of the problem
where as you can see firstrun should be 1 and firstZDAGps is also 1 so we have everthing is shifted down.