Hello,
using MCUXpresso IDE v10.0.2 [Build 411] [2017-07-11] with FreeRTOS 9.0.0 on LPC1768, FreeRTOS plugin works only if code optimization on FreeRTOS sources is None (-O0).
It is a normal behaviour?
Giovanni
Hello,
just encountered the same problem. After some research it appeared that its ulTotalRunTime that is being removed and not FreeRTOSDebugConfig as was mentioned. Marking ulTotalRunTime with __attribute__((used)) in tasks.c solved the problem. In case i also marked other variables being used for runtime stats: ulTaskSwitchedInTime, ulRunTimeCounter. Hope someone will find it useful.
For the FreeRTOS thread awareness, there are as well several symbols which need to be present and not optimized. Details in Troubleshooting Tips for FreeRTOS Thread Aware Debugging in Eclipse | MCU on Eclipse
I hope this helps,
Erich
Hi Giovanni,
configRECORD_STACK_HIGH_ADDRESS only has an effect if you are using the latest V9.0.0 (patched) FreeRTOS release. You wrote above that you are using the unmodified port for CM3? In that case you would have to patch your FreeRTOS so it takes advantage of configRECORD_STACK_HIGH_ADDRESS.
I have such a FreeRTOS port here: McuOnEclipseLibrary/lib/FreeRTOS/Source at master · ErichStyger/McuOnEclipseLibrary · GitHub
I'll have a look why the runtime stats do not show up, but that might be the same problem.
I hope this helps,
Erich
Hi Erich,
I tried your workaround and error goes away. Almost everything works, this il the situation :
remains two esclamation point tooltips (see below).
If I choose optimize code O0 for FreeRTOS ...
only stack tooltip remain.
Many tanks for support, but I hope this help to make MCUXpresso more smart.
Giovanni
Hi Erich,
tank you for support.
If I include in main() reference to FreeRTOSDebugConfig as below
if (FreeRTOSDebugConfig[0]==0) //just use it, so the linker cannot remove FreeRTOSDebugConfig[]
{ // FreeRTOSDebugConfig[0] should always be non-zero, so this should never happen
for( ;; );
}
at first breakpoint or debug stop MCUXpresso display
and FreeRTOS TAD does not work.
Giovanni
Hi Giovanni,
Indeed, I was running into the same thing. But I have a workaround for you:
1.Close the IDE
2. go into <mcuxpresso>\ide\bin and rename crt_emu_cm_redlink.exe to something like crt_emu_cm_redlink_original.exe so you have a backup.
3. unzip and place the attached patched binary into the above folder.
At least on my machine (Windows 10, 64bit) this solved the issue. Can you try this on your end?
I hope this helps,
Erich
Hi Erich,
perhaps there are some others problems.
I have tried to modify declaration of FreeRTOSDebugConfig array in
const uint8_t FreeRTOSDebugConfig[] __attribute__((section(".rodata"))) __attribute__((used)) =
to inhibit linker strip, but does not work.
Any idea?
Giovanni
Hi Giovanni,
without extra attributes in the linker file, the attribute 'used' in the sources is not sufficient. The easiest way is if you reference the FreeRTOSDebugConfig from your main(), see the example code in Troubleshooting Tips for FreeRTOS Thread Aware Debugging in Eclipse | MCU on Eclipse (section "NXP (LinkServer)").
I hope this helps,
Erich
Thank you for fast response.
I use original port.c for CM3 without modification, all sources modification as described in "MCUXpresso IDE FreeRTOS Debug Guide" and below you can see my FreeRTOSConfig.h file
/*
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
All rights reservedThis file is part of the FreeRTOS distribution.FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.1 tab == 4 spaces!
*/#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H#include "LPC17xx.h"/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*----------------------------------------------------------*/#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configUSE_TICKLESS_IDLE 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) 100000000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_TASK_NOTIFICATIONS 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0
#define configQUEUE_REGISTRY_SIZE 10
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
#define configAPPLICATION_ALLOCATED_HEAP 0/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 1
#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES (2)/* Software timer related definitions. */
#define configUSE_TIMERS 0
#define configTIMER_TASK_PRIORITY 3
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE/* Interrupt nesting behaviour configuration. */
/* Use the system definition, if there is one */
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 5 /* 32 priority levels */
#endif/* The lowest priority. */
#define configKERNEL_INTERRUPT_PRIORITY ( 31 << (8 - configPRIO_BITS) )
/* Priority 5, or 160 as only the top three bits are implemented. */
/* !!!! 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 ( 5 << (8 - configPRIO_BITS) )
#define configMAX_API_CALL_INTERRUPT_PRIORITY ( 5 << (8 - configPRIO_BITS) )/* Priorities passed to NVIC_SetPriority() do not require shifting as the
function does the shifting itself. Note these priorities need to be equal to
or lower than configMAX_SYSCALL_INTERRUPT_PRIORITY - therefore the numeric
value needs to be equal to or greater than 5 (on the Cortex-M3 the lower the
numeric value the higher the interrupt priority). *//* Define to trap errors during development. */
//#define configASSERT(x) if((x) == 0) {taskDISABLE_INTERRUPTS(); for (;;);}/* FreeRTOS MPU specific definitions. */
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_xResumeFromISR 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 0
#define INCLUDE_eTaskGetState 0
#define INCLUDE_xEventGroupSetBitFromISR 1
#define INCLUDE_xTimerPendFunctionCall 0
#define INCLUDE_xTaskAbortDelay 0
#define INCLUDE_xTaskGetHandle 0
#define INCLUDE_xTaskResumeFromISR 1
#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1#define configRECORD_STACK_HIGH_ADDRESS 1/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler/*-----------------------------------------------------------
* Macros required to setup the timer for the run time stats.
*-----------------------------------------------------------*/
extern void vConfigureTimerForRunTimeStats( void );
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
#define portGET_RUN_TIME_COUNTER_VALUE() LPC_TIM0->TC#endif /* FREERTOS_CONFIG_H */
This is screen with code opt O3
This is screen with code opt O0
If you need anymore information please ask me.
Best Regards
Giovanni
Hi Giovanni,
I experimented with this a bit, and found out that the problem is caused by the linker which removes the FreeRTOSDebugConfig array.
Erich
Hi Giovanni,
thanks for the additional details. Indeed, I'm now able to reproduce this with the LPCLink2 debug connection (P&E and Segger J-Link works fine). I'll report to the engineering team so they can investigate.
thanks for reporting!
Erich
The Kernel awareness depends on a few variables and information about the kernel to properly show the information.
I don't see any issues with higher optimizations up to -O3, but this might not be the case if your FreeRTOS port does not deal with optimizations or the linker removing 'unused' variables.
Additionally, it depends on some FreeRTOS configuration macros, see Better FreeRTOS Debugging in Eclipse | MCU on Eclipse .
I have such a FreeRTOS port here: McuOnEclipseLibrary/lib/FreeRTOS/Source at master · ErichStyger/McuOnEclipseLibrary · GitHub
Make sure your port is using the McuOnEclipseLibrary/freertos_tasks_c_additions.h at master · ErichStyger/McuOnEclipseLibrary · GitHu...
as it provides a structure for the Kernel Awareness to properly locate the task information inside the TCB.
I hope this helps,
Erich