Ignore:
Timestamp:
Dec 11, 2024, 8:14:20 AM (5 weeks ago)
Author:
Zed
Message:

Can be compiled without errors. Fixing before changing tick rate to 1000 in CubeMX.

Location:
ctrl/firmware/Main/CubeMX
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • ctrl/firmware/Main/CubeMX/Core/Src/app_threadx.c

    r54 r55  
    2525/* USER CODE BEGIN Includes */
    2626
     27#include <stdint.h>
     28#include <stdio.h>
     29
     30#include "MainThread.h"
     31
    2732/* USER CODE END Includes */
    2833
     
    3540/* USER CODE BEGIN PD */
    3641
     42#define MEMORY_BLOCK_SIZE_BYTES                 (8192U)
     43#define MAIN_THREAD_STACK_SIZE_BYTES    (1024U)
     44
    3745/* USER CODE END PD */
    3846
     
    4452/* Private variables ---------------------------------------------------------*/
    4553/* USER CODE BEGIN PV */
     54
     55_Alignas(ULONG)   uint8_t                 memoryBlock[MEMORY_BLOCK_SIZE_BYTES];
     56                                  TX_THREAD               thread_ptr;
     57                                  TX_BYTE_POOL    byte_pool_0;
    4658
    4759/* USER CODE END PV */
     
    6274  /* USER CODE BEGIN App_ThreadX_MEM_POOL */
    6375
     76  (void)memory_ptr;
     77
     78  /* Create a byte memory pool from which to allocate the thread stacks.  */
     79  ret = tx_byte_pool_create(&byte_pool_0, "byte pool 0", memoryBlock, MEMORY_BLOCK_SIZE_BYTES);
     80  if (ret != TX_SUCCESS) { printf("Cannot create BYTE POOL 0!\n"); return ret; }
     81
     82  uint8_t* ptr = TX_NULL;
     83
    6484  /* USER CODE END App_ThreadX_MEM_POOL */
    6585
    6686  /* USER CODE BEGIN App_ThreadX_Init */
     87
     88  // Allocate the stack for main thread
     89  ret = tx_byte_allocate(&byte_pool_0, (VOID**) &ptr, MAIN_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT);
     90  if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; }
     91
     92  ret = tx_thread_create(&thread_ptr, "MainThread", MainThread, 0x0001, ptr, MAIN_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     93  if (ret != TX_SUCCESS) { printf("Cannot create MainThread!\n"); return ret; }
    6794
    6895  /* USER CODE END App_ThreadX_Init */
Note: See TracChangeset for help on using the changeset viewer.