Debug FreeRTOS with LinkServer Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debug FreeRTOS with LinkServer Problem

1,672 Views
ypkdani
Contributor III

Hello, i have to debug a freeRTOS with my LinkServer. 

I have follow th guide http://www.nxp.com/docs/en/quick-reference-guide/MCUXpresso_IDE_FreeRTOS_Debug_Guide.pdf  at point 2 but i have a problem when i set the 

configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H to 1

in the file freertos_tasks_c_additions.h i have 

/*
* CopyLEFT 2017 NXP
* All LEFTs reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyLEFT notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyLEFT notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyLEFT holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYLEFT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYLEFT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* freertos_tasks_c_additions.h Rev. 1.2 */
// freertos_tasks_c_additions.h Rev. 1.2
//
#include <stdint.h>
#include <FreeRTOSConfig.h>


#if (configUSE_TRACE_FACILITY == 0)
#error "configUSE_TRACE_FACILITY must be enabled"
#endif
#define FREERTOS_DEBUG_CONFIG_MAJOR_VERSION 1
#define FREERTOS_DEBUG_CONFIG_MINOR_VERSION 1
// NOTE!!
// Default to a FreeRTOS version which didn't include these macros. FreeRTOS
// v7.5.3 is used here.
#ifndef tskKERNEL_VERSION_BUILD
#define tskKERNEL_VERSION_BUILD 3
#endif
#ifndef tskKERNEL_VERSION_MINOR
#define tskKERNEL_VERSION_MINOR 5
#endif
#ifndef tskKERNEL_VERSION_MAJOR
#define tskKERNEL_VERSION_MAJOR 7
#endif
// NOTE!!
// The configFRTOS_MEMORY_SCHEME macro describes the heap scheme using a value
// 1 - 5 which corresponds to the following schemes:
//
// heap_1 - the very simplest, does not permit memory to be freed
// heap_2 - permits memory to be freed, but not does coalescence adjacent free
// blocks.
// heap_3 - simply wraps the standard malloc() and free() for thread safety
// heap_4 - coalesces adjacent free blocks to avoid fragmentation. Includes
// absolute address placement option
// heap_5 - as per heap_4, with the ability to span the heap across
// multiple non-adjacent memory areas
#ifndef configFRTOS_MEMORY_SCHEME
#define configFRTOS_MEMORY_SCHEME 3 // thread safe malloc
#endif
#if ((configFRTOS_MEMORY_SCHEME > 5) || (configFRTOS_MEMORY_SCHEME < 1))
#error "Invalid configFRTOS_MEMORY_SCHEME setting!"
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern const uint8_t FreeRTOSDebugConfig[];
// NOTES!!
// IAR documentation is confusing. It suggests the data must be statically
// linked, and the #pragma placed immediately before the symbol definition.
// The IAR supplied examples violate both "rules", so this is a best guess.
//
#if defined(__GNUC__)
const uint8_t FreeRTOSDebugConfig[] __attribute__((section(".rodata"))) =
#elif defined(__CC_ARM)
const uint8_t FreeRTOSDebugConfig[] __attribute__((used)) =
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma required=FreeRTOSDebugConfig
const uint8_t FreeRTOSDebugConfig[] =
#endif
{
FREERTOS_DEBUG_CONFIG_MAJOR_VERSION,
FREERTOS_DEBUG_CONFIG_MINOR_VERSION,
tskKERNEL_VERSION_MAJOR,
tskKERNEL_VERSION_MINOR,
tskKERNEL_VERSION_BUILD,
configFRTOS_MEMORY_SCHEME,
offsetof(struct tskTaskControlBlock, pxTopOfStack),
# if (tskKERNEL_VERSION_MAJOR > 8)
offsetof(struct tskTaskControlBlock, xStateListItem),
# else
offsetof(struct tskTaskControlBlock, xGenericListItem),
# endif
offsetof(struct tskTaskControlBlock, xEventListItem),
offsetof(struct tskTaskControlBlock, pxStack),
offsetof(struct tskTaskControlBlock, pcTaskName),
offsetof(struct tskTaskControlBlock, uxTCBNumber),
offsetof(struct tskTaskControlBlock, uxTaskNumber),
configMAX_TASK_NAME_LEN,
configMAX_PRIORITIES,
0 // pad to 32-bit boundary
};
#ifdef __cplusplus
}
#endif
// end freertos_tasks_c_additions.h

#ifdef __cplusplus
}
#endif

#endif // FREERTOS_TASKS_C_ADDITIONS_H

but an error is present 

pastedImage_3.png

the struct is defined in task.c....

how to solve this problem?

Thanks

0 Kudos
7 Replies

1,320 Views
BlackNight
NXP Employee
NXP Employee

These error markers come from the Eclipse internal source file parser. The reasons for these errors is because you have that header file open, but that file is used in a very special way: it is included at the end of the RTOS tasks.c file.

Just in that header file, not all data structures are present/visible/included, and the Eclipse parser flags this as an error. That would be correct for a normal header file. But as this file is included in a special way, you simply can ignore these error markers. The file will compile just fine.

I hope this helps,

Erich

1,320 Views
ypkdani
Contributor III

Hello, thanks for the reply.

Ok but how i can ignore these error? there is some setting in eclipse? The compiled file is not generated now

Thanks

0 Kudos

1,320 Views
BlackNight
NXP Employee
NXP Employee

Hi Daniele,

I think you have made some mistakes somehow. I suggest you try one of the SDK projects (e.g. FRDM-K22F SDK v2.2) as these new SDKs already include the updated FreeRTOS with a working free_rtos_task_c_additions.h (attached to this reply too). I guess if you have copied text from a PDF then you might have copied some non-printable characters.

I hope this helps,

Erich

0 Kudos

1,320 Views
ypkdani
Contributor III

Hello,

i have restore the original file but nothing. Same error.

pastedImage_1.png

My file are attached.

0 Kudos

1,320 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Daniele,

Which MCU and example project are you using? As Erich said, it would be good if you could try one of the freertos examples that come with the latest SDK package.


Hope it helps!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

1,320 Views
ypkdani
Contributor III

Hello, my project start from the usb_device_msc_sdcard example for the twrk21f120m_. I'm using the MK22FX512

0 Kudos

1,320 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Daniele,

 

Please try using the usb_device_msc_sdcard freertos example from the  twrk21f120m MCUXpresso SDK 2.2 package.


Hope it helps!

 

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos