Add DRS switch
This commit is contained in:
		@ -56,11 +56,10 @@
 | 
			
		||||
#if (USE_STATIC_ALLOCATION == 1)
 | 
			
		||||
/* USER CODE BEGIN TX_Pool_Buffer */
 | 
			
		||||
/* USER CODE END TX_Pool_Buffer */
 | 
			
		||||
#if defined(__ICCARM__)
 | 
			
		||||
#pragma data_alignment = 4
 | 
			
		||||
#if defined ( __ICCARM__ )
 | 
			
		||||
#pragma data_alignment=4
 | 
			
		||||
#endif
 | 
			
		||||
__ALIGN_BEGIN static UCHAR
 | 
			
		||||
    tx_byte_pool_buffer[TX_APP_MEM_POOL_SIZE] __ALIGN_END;
 | 
			
		||||
__ALIGN_BEGIN static UCHAR tx_byte_pool_buffer[TX_APP_MEM_POOL_SIZE] __ALIGN_END;
 | 
			
		||||
static TX_BYTE_POOL tx_app_byte_pool;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
@ -80,11 +79,12 @@ TX_EVENT_FLAGS_GROUP gui_update_events;
 | 
			
		||||
/* USER CODE END PFP */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief  Define the initial system.
 | 
			
		||||
 * @param  first_unused_memory : Pointer to the first unused memory
 | 
			
		||||
 * @retval None
 | 
			
		||||
 */
 | 
			
		||||
VOID tx_application_define(VOID *first_unused_memory) {
 | 
			
		||||
  * @brief  Define the initial system.
 | 
			
		||||
  * @param  first_unused_memory : Pointer to the first unused memory
 | 
			
		||||
  * @retval None
 | 
			
		||||
  */
 | 
			
		||||
VOID tx_application_define(VOID *first_unused_memory)
 | 
			
		||||
{
 | 
			
		||||
  /* USER CODE BEGIN  tx_application_define_1*/
 | 
			
		||||
 | 
			
		||||
  /* USER CODE END  tx_application_define_1 */
 | 
			
		||||
@ -92,20 +92,22 @@ VOID tx_application_define(VOID *first_unused_memory) {
 | 
			
		||||
  UINT status = TX_SUCCESS;
 | 
			
		||||
  VOID *memory_ptr;
 | 
			
		||||
 | 
			
		||||
  if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool",
 | 
			
		||||
                          tx_byte_pool_buffer,
 | 
			
		||||
                          TX_APP_MEM_POOL_SIZE) != TX_SUCCESS) {
 | 
			
		||||
  if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) != TX_SUCCESS)
 | 
			
		||||
  {
 | 
			
		||||
    /* USER CODE BEGIN TX_Byte_Pool_Error */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE END TX_Byte_Pool_Error */
 | 
			
		||||
  } else {
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    /* USER CODE BEGIN TX_Byte_Pool_Success */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE END TX_Byte_Pool_Success */
 | 
			
		||||
 | 
			
		||||
    memory_ptr = (VOID *)&tx_app_byte_pool;
 | 
			
		||||
    status = App_ThreadX_Init(memory_ptr);
 | 
			
		||||
    if (status != TX_SUCCESS) {
 | 
			
		||||
    if (status != TX_SUCCESS)
 | 
			
		||||
    {
 | 
			
		||||
      /* USER CODE BEGIN  App_ThreadX_Init_Error */
 | 
			
		||||
      while (1) {
 | 
			
		||||
      }
 | 
			
		||||
@ -115,22 +117,21 @@ VOID tx_application_define(VOID *first_unused_memory) {
 | 
			
		||||
    /* USER CODE BEGIN  App_ThreadX_Init_Success */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE END  App_ThreadX_Init_Success */
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
  /*
 | 
			
		||||
   * Using dynamic memory allocation requires to apply some changes to the
 | 
			
		||||
   linker file.
 | 
			
		||||
   * ThreadX needs to pass a pointer to the first free memory location in RAM to
 | 
			
		||||
   the tx_application_define() function,
 | 
			
		||||
   * Using dynamic memory allocation requires to apply some changes to the linker file.
 | 
			
		||||
   * ThreadX needs to pass a pointer to the first free memory location in RAM to the tx_application_define() function,
 | 
			
		||||
   * using the "first_unused_memory" argument.
 | 
			
		||||
   * This require changes in the linker files to expose this memory location.
 | 
			
		||||
   * For EWARM add the following section into the .icf file:
 | 
			
		||||
       place in RAM_region    { last section FREE_MEM };
 | 
			
		||||
   * For MDK-ARM
 | 
			
		||||
       - either define the RW_IRAM1 region in the ".sct" file
 | 
			
		||||
       - or modify the line below in "tx_initialize_low_level.S to match the
 | 
			
		||||
   memory region being used LDR r1, =|Image$$RW_IRAM1$$ZI$$Limit|
 | 
			
		||||
       - or modify the line below in "tx_initialize_low_level.S to match the memory region being used
 | 
			
		||||
          LDR r1, =|Image$$RW_IRAM1$$ZI$$Limit|
 | 
			
		||||
 | 
			
		||||
   * For STM32CubeIDE add the following section into the .ld file:
 | 
			
		||||
       ._threadx_heap :
 | 
			
		||||
@ -140,17 +141,13 @@ VOID tx_application_define(VOID *first_unused_memory) {
 | 
			
		||||
            . = . + 64K;
 | 
			
		||||
            . = ALIGN(8);
 | 
			
		||||
          } >RAM_D1 AT> RAM_D1
 | 
			
		||||
      * The simplest way to provide memory for ThreadX is to define a new
 | 
			
		||||
   section, see ._threadx_heap above.
 | 
			
		||||
      * The simplest way to provide memory for ThreadX is to define a new section, see ._threadx_heap above.
 | 
			
		||||
      * In the example above the ThreadX heap size is set to 64KBytes.
 | 
			
		||||
      * The ._threadx_heap must be located between the .bss and the
 | 
			
		||||
   ._user_heap_stack sections in the linker script.
 | 
			
		||||
      * Caution: Make sure that ThreadX does not need more than the provided
 | 
			
		||||
   heap memory (64KBytes in this example).
 | 
			
		||||
      * The ._threadx_heap must be located between the .bss and the ._user_heap_stack sections in the linker script.
 | 
			
		||||
      * Caution: Make sure that ThreadX does not need more than the provided heap memory (64KBytes in this example).
 | 
			
		||||
      * Read more in STM32CubeIDE User Guide, chapter: "Linker script".
 | 
			
		||||
 | 
			
		||||
   * The "tx_initialize_low_level.S" should be also modified to enable the
 | 
			
		||||
   "USE_DYNAMIC_MEMORY_ALLOCATION" flag.
 | 
			
		||||
   * The "tx_initialize_low_level.S" should be also modified to enable the "USE_DYNAMIC_MEMORY_ALLOCATION" flag.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  /* USER CODE BEGIN DYNAMIC_MEM_ALLOC */
 | 
			
		||||
@ -218,4 +215,5 @@ VOID tx_application_define(VOID *first_unused_memory) {
 | 
			
		||||
  mem += 4096;
 | 
			
		||||
  /* USER CODE END DYNAMIC_MEM_ALLOC */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user