Lyrri 0 October 16, 2015 Posted October 16, 2015 · Report post Здравствуйте. Для логгирования событий 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 и компилятор выдает ошибку при попытке скомпилировать проект. Кто нибудь использовал эти макросы? Где их лучше/правильнее всего разместить? Quote Share this post Link to post Share on other sites More sharing options...
den_po 0 October 16, 2015 Posted October 16, 2015 · Report post В совете же говорится только о макросах, вот и оставляйте в файле только макросы Quote Share this post Link to post Share on other sites More sharing options...
Lyrri 0 October 16, 2015 Posted October 16, 2015 · Report post Действительно ))) Спасибо. Я чего-то решил, что компилятор будет ругаться на то, что функция не была объявлена заранее. Quote Share this post Link to post Share on other sites More sharing options...
alexp74 0 October 16, 2015 Posted October 16, 2015 · Report post Действительно ))) Спасибо. Я чего-то решил, что компилятор будет ругаться на то, что функция не была объявлена заранее. 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 Quote Share this post Link to post Share on other sites More sharing options...
Lyrri 0 October 20, 2015 Posted October 20, 2015 · Report post 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, спасибо. Помогло. Quote Share this post Link to post Share on other sites More sharing options...