Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: Использование Trace Hook Macros
Форум разработчиков электроники ELECTRONIX.ru > Cистемный уровень проектирования > Операционные системы > FreeRTOS
Lyrri
Здравствуйте.

Для логгирования событий FreeRTOS попробовал подключить Trace Hook Macros (Чип STM32F2xx, компилятор IAR, FreeRTOS v8.2.2)

Возникла проблема с местом определения этих макросов. Наткнулся на рекомендацию от Ричарда, где он пишет: "The best place to define hook macros, such as traceTASK_SWITCHED_OUT(), is in FreeRTOSConfig.h. That way the order in which macros are defined is guaranteed to be correct. If you are going to write complex macros then you can put them in their own header file, and include that header file from FreeRTOSConfig.h"

Попробовал подключить свой хедер в FreeRTOSConfig.h. Хедер выглядит следующим образом
Код
#ifndef LOGGER_H_
#define LOGGER_H_

#include <stdint.h>


void logger_init();
void logger_createtask(uint32_t addrname, uint32_t prio, uint32_t stacksize);


#define traceSTART                  logger_init();
#define traceTASK_CREATE(xTask) \
logger_createtask((uint32_t)&xTask->pcTaskName, xTask->uxPriority, \
                    (xTask->pxTopOfStack-xTask->pxStack));

#endif /* LOGGER_H_ */


Но возникла проблема. FreeRTOSConfig.h также включается в portasm.s и компилятор выдает ошибку при попытке скомпилировать проект.
Кто нибудь использовал эти макросы? Где их лучше/правильнее всего разместить?
den_po
В совете же говорится только о макросах, вот и оставляйте в файле только макросы
Lyrri
Действительно ))) Спасибо. Я чего-то решил, что компилятор будет ругаться на то, что функция не была объявлена заранее.
alexp74
Цитата(Lyrri @ Oct 16 2015, 15:45) *
Действительно ))) Спасибо. Я чего-то решил, что компилятор будет ругаться на то, что функция не была объявлена заранее.

Also depending on the port and development environment it may be necessary to use the pre-processor to prevent the configuration file from being included from assembly files. For example, in IAR this can be done as follows...

Код
/* The IAR C compiler automatically defines __ICCARM__. */
#ifdef __ICCARM__
    #include "trcKernelPortFreeRTOS.h"
#endif

Preventing the RTOS trace header file from being included from assembly files when using the IAR compiler


http://www.freertos.org/FreeRTOS-Plus/Free...tructions.shtml
Lyrri
Цитата
alexp74
Also depending on the port and development environment it may be necessary to use the pre-processor to prevent the configuration file from being included from assembly files. For example, in IAR this can be done as follows...


alexp74, спасибо. Помогло.
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.