Hi to all,
I'm developing on KDS 2.0.0 on K20 with P&EMicro Multilink-Universal
When I try to put a breakpoint when my code is running:
- sometime (very rarely) the code stop on the correct code and I debug 1 or 2 or 3 instruction, after that my code stuck and it is impossible to debug (debug console return me PE-error: code execution)
- other time, the code stuck and it is impossible to debug never 1 code line!
in all case, it is impossible to restart code (with F8) but I must to stop debug session and restart debugging.
I try to delete "debug" folder and perform a "clean" (that not work because theren't file anymore, deleting debug folder)
But still not working!
I find this description on debug console:
Initializing.
Target has been RESET and is active.
Interrupt command received. Halting execution.
Preset breakpoint encountered.
Unable to go into background mode.
Error communicating to target processor - try a RESET.
PE-ERROR: TARGET IS RUNNING
when I get this error I tryied to place a breakpoint in running code.
Now the code stop in this point but when I press F6 (step over) my code stuck... and I give this error!
I have a timer and I try to disable the "run on debug" .
I'm using FreRtos but if I acrtive only 1 task I still have the some problem.
Another information: sometime, after I found this problem KDS open me the "_isr_vector.c" and NOT find it and give me on principal page "No source available for __Isr_vector".
Other time KDS open me the window called "0x530" instead "isr_vector".
what I can do?
Another Info: I'm developing on K20 vith KSDK so I have set K60 on KSDK but my uP is K20 and in debug config I set K20 (as suggest from FreeScale )
Many thanks,
Massimiliano
EDIT:
i have an update.
i try this code (without SDK):
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "FRTOS1.h"
#include "UTIL1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
/* User includes (#include below this line is not maintained by Processor Expert) */
static void vSHELLProcess ( void *pvParameters );
static void vMBPollingProcess ( void *pvParameters );
static void vSENSORSProcess ( void *pvParameters );
#define SHELLPROCESS_PROC_NAME "ShellProcess"
#define SENSORSPROCESS_PROC_NAME "SensorsProcess"
#define MB_PROC_NAME "MBPollingProcess"
#define ADCPROCESS_PROC_NAME "ADCProcess"
#define PRIORITY_WANTED(Wanted_priority) configMAX_PRIORITIES - (Wanted_priority) -2
#define SHELL_PROCESS_PRIORITY PRIORITY_WANTED( 2 )
#define SENSORS_PROCESS_PRIORITY PRIORITY_WANTED( 3 )
#define MODBUS_PROCESS_PRIORITY PRIORITY_WANTED( 4 )
#define ADC_PROCESS_PRIORITY PRIORITY_WANTED( 5 )
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
TaskHandle_t xTaskSHELLProcess;
TaskHandle_t xTaskMBSProcess;
TaskHandle_t xTaskSENSORSProcess;
xTaskCreate(vSHELLProcess, (uint8_t*)SHELLPROCESS_PROC_NAME, (configMINIMAL_STACK_SIZE), NULL, SHELL_PROCESS_PRIORITY, &xTaskSHELLProcess );
xTaskCreate(vMBPollingProcess, (uint8_t*)MB_PROC_NAME, (configMINIMAL_STACK_SIZE), NULL, MODBUS_PROCESS_PRIORITY, &xTaskMBSProcess );
xTaskCreate(vSENSORSProcess, (uint8_t*)SENSORSPROCESS_PROC_NAME, (configMINIMAL_STACK_SIZE), NULL, SENSORS_PROCESS_PRIORITY, &xTaskSENSORSProcess);
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
int s,k,v,l,m,n = 0;
static void vSHELLProcess ( void *pvParameters ){
while(1){
s++;
vTaskDelay(20);
}
}
static void vMBPollingProcess ( void *pvParameters ){
while(1){
s=k;
k--;
vTaskDelay(10);
}
}
static void vSENSORSProcess ( void *pvParameters ){
while(1){
m++;
n=s+k;
vTaskDelay(100);
}
}
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.4 [05.11]
** for the Freescale Kinetis series of microcontrollers.
**
** ###################################################################
*/
and this other code wih KSDK
/* ###################################################################
** Filename : main.c
** Project : UTe-Q
** Processor : MK64FN1M0VLL12
** Version : Driver 01.01
** Compiler : GNU C Compiler
** Date/Time : 2015-04-22, 15:52, # CodeGen: 0
** Abstract :
** Main module.
** This module contains user's application code.
** Settings :
** Contents :
** No public methods
**
** ###################################################################*/
/*!
** @file main.c
** @version 01.01
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "pin_init.h"
#include "osa1.h"
#include "FreeRTOS1.h"
#include "UTIL1.h"
#include "KSDK1.h"
#include "fsl_os_abstraction.h"
#if CPU_INIT_CONFIG
#include "Init_Config.h"
#endif
/* User includes (#include below this line is not maintained by Processor Expert) */
static void vSHELLProcess ( void *pvParameters );
static void vMBPollingProcess ( void *pvParameters );
static void vSENSORSProcess ( void *pvParameters );
#define SHELLPROCESS_PROC_NAME "ShellProcess"
#define SENSORSPROCESS_PROC_NAME "SensorsProcess"
#define MB_PROC_NAME "MBPollingProcess"
#define ADCPROCESS_PROC_NAME "ADCProcess"
#define PRIORITY_WANTED(Wanted_priority) configMAX_PRIORITIES - (Wanted_priority) -2
#define SHELL_PROCESS_PRIORITY PRIORITY_WANTED( 2 )
#define SENSORS_PROCESS_PRIORITY PRIORITY_WANTED( 3 )
#define MODBUS_PROCESS_PRIORITY PRIORITY_WANTED( 4 )
#define ADC_PROCESS_PRIORITY PRIORITY_WANTED( 5 )
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
task_handler_t xTaskSHELLProcess;
task_handler_t xTaskMBSProcess;
task_handler_t xTaskSENSORSProcess;
OSA_TaskCreate(vSHELLProcess, (uint8_t*)SHELLPROCESS_PROC_NAME, (configMINIMAL_STACK_SIZE)*sizeof(portSTACK_TYPE), (task_stack_t*)NULL, SHELL_PROCESS_PRIORITY, NULL, (bool)NULL, &xTaskSHELLProcess);
OSA_TaskCreate(vMBPollingProcess, (uint8_t*)MB_PROC_NAME, (configMINIMAL_STACK_SIZE)*sizeof(portSTACK_TYPE), (task_stack_t*)NULL, MODBUS_PROCESS_PRIORITY, NULL, (bool)NULL, &xTaskMBSProcess);
OSA_TaskCreate(vSENSORSProcess, (uint8_t*)SENSORSPROCESS_PROC_NAME, (configMINIMAL_STACK_SIZE)*sizeof(portSTACK_TYPE), (task_stack_t*)NULL, SENSORS_PROCESS_PRIORITY , NULL, (bool)NULL, &xTaskSENSORSProcess);
/* Write your code here */
/* For example: for(;;) { } */
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
int s,k,v,l,m,n = 0;
static void vSHELLProcess ( void *pvParameters ){
while(1){
s++;
OSA_TimeDelay(20);
}
}
static void vMBPollingProcess ( void *pvParameters ){
while(1){
s=k;
k--;
OSA_TimeDelay(10);
}
}
static void vSENSORSProcess ( void *pvParameters ){
while(1){
m++;
n=s+k;
OSA_TimeDelay(100);
}
}
I try with my custom HW (K20) and my demo board (FRDM-K64).
With KSDK I simulate K20 with K60
without KSDK I use K20. With setting of PEMicro I set K20DN512 and, other test, K20DN512M10 (without different on results)
What I found is that: ALWAYS I ENABLE FREERTOS on my custom HW MY PROBLEM IS PRESENT. Same code on K64 do not have problem (never).
With my custom HW, if I not use FreeRTOS I not have problem... ALWAYS I enable FreeRTOS my debug crash (sometime after few instruction, sometime after many times) with K20.
So, is this important?
thanks,
Massimliano