Changeset 55 for ctrl/firmware/Main/CubeMX
- Timestamp:
- Dec 11, 2024, 8:14:20 AM (5 weeks ago)
- 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 25 25 /* USER CODE BEGIN Includes */ 26 26 27 #include <stdint.h> 28 #include <stdio.h> 29 30 #include "MainThread.h" 31 27 32 /* USER CODE END Includes */ 28 33 … … 35 40 /* USER CODE BEGIN PD */ 36 41 42 #define MEMORY_BLOCK_SIZE_BYTES (8192U) 43 #define MAIN_THREAD_STACK_SIZE_BYTES (1024U) 44 37 45 /* USER CODE END PD */ 38 46 … … 44 52 /* Private variables ---------------------------------------------------------*/ 45 53 /* 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; 46 58 47 59 /* USER CODE END PV */ … … 62 74 /* USER CODE BEGIN App_ThreadX_MEM_POOL */ 63 75 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 64 84 /* USER CODE END App_ThreadX_MEM_POOL */ 65 85 66 86 /* 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; } 67 94 68 95 /* USER CODE END App_ThreadX_Init */
Note: See TracChangeset
for help on using the changeset viewer.