реклама на сайте
подробности

 
 
> зацикливается freertos
jeka
сообщение Jun 24 2018, 12:47
Сообщение #1


Administrator
***

Группа: Свой
Сообщений: 400
Регистрация: 10-05-04
Пользователь №: 1



Пробую freertos в действии. Простейшая задача - прерывание таймера (10 кГц) асинхронно периодически толкает процесс. stm32f205.
от 0.1 до 2-3 секунд работает, далее зацикливается в недрах RTOS на функции vListInsert (которой передается управления при вызове ulTaskNotifyTake), на этой строчке:
Код
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */


было подозрение на порчу памяти, но после перемещения памяти rtos в другие адреса эффект не изменился.
Не пойму, что за чудеса такие. Переполнение буферов? race condition? Копать глубже исходники rtos?

Функция ожидания, вызываемая процессом в цикле:
Код
void wait_tick() {
  rmotion_go=2;// включение долбилки из ISR
wt=1;// для отслеживания входа в notifytake. при зацикливании равен единице.
  int id=ulTaskNotifyTake( pdTRUE, 2 );
wt=0;
  }



ISR (10 кГц):
Код
  if (rmotion_go==2) {
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;
    vTaskNotifyGiveFromISR(Motion_task_handle, &xHigherPriorityTaskWoken );
//    xTaskNotifyFromISR( Motion_task_handle, 2, eNoAction/*eSetValueWithoutOverwrite*/, &xHigherPriorityTaskWoken );
//    portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );// need realtime process
    }

соответственно, ISR долбит notify постоянно после того как процесс включит долбёжку (т.е. долбёжка не останавливается). Приоритет ISR таймера 7, приоритет супервизора 15 (судя по конфигу).
Замена vTaskNotifyGiveFromISR на xTaskNotifyFromISR с опцией eSetValueWithoutOverwrite ничего не меняет.




call stack:
Код
vListInsert
prvAddCurrentTaskToDelayedList
ulTaskNotifyTake
wait_tick


Конфиг:
CODE
FreeRTOS Kernel V10.0.1

#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) 120000000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 512 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1

/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */


/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15


#define xPortSysTickHandler SysTick_Handler
#define xPortPendSVHandler PendSV_Handler
#define vPortSVCHandler SVC_Handler
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 18th July 2025 - 07:47
Рейтинг@Mail.ru


Страница сгенерированна за 0.01367 секунд с 7
ELECTRONIX ©2004-2016