Jump to content

    
Sign in to follow this  
Lyrri

Использование Trace Hook Macros

Recommended Posts

Здравствуйте.

 

Для логгирования событий 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 и компилятор выдает ошибку при попытке скомпилировать проект.

Кто нибудь использовал эти макросы? Где их лучше/правильнее всего разместить?

Share this post


Link to post
Share on other sites
Действительно ))) Спасибо. Я чего-то решил, что компилятор будет ругаться на то, что функция не была объявлена заранее.

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

Share this post


Link to post
Share on other sites
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, спасибо. Помогло.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this