AnsweredAssumed Answered

These errors keep bugging. How to rectify it permanently ?

Question asked by Ganesh Ramachandran on May 5, 2016
Latest reply on May 5, 2016 by Alice_Yang

First of all my sincere apologies , because this is going to be the biggest question in this forum

I am working on MKE02Z64VLD2 in Kinetis Design Studio Version 2.0.

I am trying to design a boot loader for MKE02Z64VLD2 controller fitted to my customized board. I have configured a switch to be Boot Loader button, if the switch is turned ON, it will enter Boot loader mode. If the switch/button is in OFF state, it will erase the flash blocks and will wait for an application file to be loaded serially through a Terminal Application (Terminal). After fixing all the errors which I faced while building the code, I tried to test it in my hardware. Before testing the code, I just tried to run a simple "LED Blinking code" which serves as my application code in the boot loader. It worked fine. The LED blinked. Then I flashed (using 'flash from file' option of KDS) the Boot loader code into my board. The most famous trace message popped up , "Semihosting process monitor job. java.lang.IllegalThreadStateException" . To verify that nothing had happened to my board, I again tried to debug that "LED Blinking code" in my board. This time it didn't blink and it threw some trace messages, which I have explained in my last part of this question.

Then I did some searching in the internet to fix this semihosting problem.

I found this, https://mcuoneclipse.com/2014/06/06/semihosting-with-kinetis-design-studio/#comment-82475. As quoted in this article I increased my Stack size to 0x400 and Heap size to 0xAA0.

I optimized the code length also with the help of this article, https://mcuoneclipse.com/2012/11/11/optimizing-the-kinetis-gcc-startup/ . Code size got reduced from 5900 to 3616.

Next day, I planned to test my code after doing the above said changes. I powered on the device and connected the J-Link. Suddenly a dialog box appeared. " You are connecting a debugger, which will work only if you unsecure the device. If you click yes, it may perform mass erase of the flash blocks and unsecure the device." I clicked YES. Then I tried to run the "LED Blinking Code" in my board. This time It Successfully Blinked. Then I flashed the boot loader code in to my board. This time it didn't throw any trace messages with respect to SEMIHOSTING. Once I flashed the code, It looked like this.

after flash.jpg

I thought my code had flashed successfully into board. So I tried to load the application file via terminal application which I use. But it was unresponsive. When I sent an "Erase" command, the display should say " Erasing Flash blocks" instead the display said "<0><0><0><0><0><0>" .

erase doubt.jpg

Then I tried to load the Application file itself to check what message comes in Display. But nothing came in the display, it was blank all the time.

load s19 doubt.jpg

AGAIN,

To verify that nothing had happened to my board, I again tried to debug that "LED Blinking code" in my board. This time it threw the same trace messages which I fixed earlier.

These are those Trace messages.

NXP ledblink1.jpg

To resolve this PE_DEBUGHALT problem, I searched the Internet and found this. https://mcuoneclipse.com/2012/02/20/oh-my-an-interrupt/

This is how it looks inside vectors.c.

    /* ISR name                             No. Address      Pri Name                          Description */

    &__SP_INIT,                        /* 0x00  0x00000000   -   ivINT_Initial_Stack_Pointer   used by PE */

    {

    (tIsrFunc)&__thumb_startup,        /* 0x01  0x00000004   -   ivINT_Initial_Program_Counter used by PE */

    (tIsrFunc)&Cpu_INT_NMIInterrupt,   /* 0x02  0x00000008   -2   ivINT_NMI                     used by PE */

    (tIsrFunc)&Cpu_ivINT_Hard_Fault,   /* 0x03  0x0000000C   -1   ivINT_Hard_Fault              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved4,    /* 0x04  0x00000010   -   ivINT_Reserved4               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved5,    /* 0x05  0x00000014   -   ivINT_Reserved5               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved6,    /* 0x06  0x00000018   -   ivINT_Reserved6               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved7,    /* 0x07  0x0000001C   -   ivINT_Reserved7               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved8,    /* 0x08  0x00000020   -   ivINT_Reserved8               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved9,    /* 0x09  0x00000024   -   ivINT_Reserved9               unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved10,   /* 0x0A  0x00000028   -   ivINT_Reserved10              unused by PE */

    (tIsrFunc)&Cpu_ivINT_SVCall,       /* 0x0B  0x0000002C   -   ivINT_SVCall                  unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved12,   /* 0x0C  0x00000030   -   ivINT_Reserved12              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved13,   /* 0x0D  0x00000034   -   ivINT_Reserved13              unused by PE */

    (tIsrFunc)&Cpu_ivINT_PendableSrvReq, /* 0x0E  0x00000038   -   ivINT_PendableSrvReq          unused by PE */

    (tIsrFunc)&Cpu_ivINT_SysTick,      /* 0x0F  0x0000003C   -   ivINT_SysTick                 unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved16,   /* 0x10  0x00000040   -   ivINT_Reserved16              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved17,   /* 0x11  0x00000044   -   ivINT_Reserved17              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved18,   /* 0x12  0x00000048   -   ivINT_Reserved18              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved19,   /* 0x13  0x0000004C   -   ivINT_Reserved19              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved20,   /* 0x14  0x00000050   -   ivINT_Reserved20              unused by PE */

    (tIsrFunc)&Cpu_ivINT_FTMRH,        /* 0x15  0x00000054   -   ivINT_FTMRH                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_LVD_LVW,      /* 0x16  0x00000058   -   ivINT_LVD_LVW                 unused by PE */

    (tIsrFunc)&Cpu_ivINT_IRQ,          /* 0x17  0x0000005C   -   ivINT_IRQ                     unused by PE */

    (tIsrFunc)&Cpu_ivINT_I2C0,         /* 0x18  0x00000060   -   ivINT_I2C0                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved25,   /* 0x19  0x00000064   -   ivINT_Reserved25              unused by PE */

    (tIsrFunc)&Cpu_ivINT_SPI0,         /* 0x1A  0x00000068   -   ivINT_SPI0                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_SPI1,         /* 0x1B  0x0000006C   -   ivINT_SPI1                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_UART0,        /* 0x1C  0x00000070   -   ivINT_UART0                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_UART1,        /* 0x1D  0x00000074   -   ivINT_UART1                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_UART2,        /* 0x1E  0x00000078   -   ivINT_UART2                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_ADC0,         /* 0x1F  0x0000007C   -   ivINT_ADC0                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_ACMP0,        /* 0x20  0x00000080   -   ivINT_ACMP0                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_FTM0,         /* 0x21  0x00000084   -   ivINT_FTM0                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_FTM1,         /* 0x22  0x00000088   -   ivINT_FTM1                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_FTM2,         /* 0x23  0x0000008C   -   ivINT_FTM2                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_RTC,          /* 0x24  0x00000090   -   ivINT_RTC                     unused by PE */

    (tIsrFunc)&Cpu_ivINT_ACMP1,        /* 0x25  0x00000094   -   ivINT_ACMP1                   unused by PE */

    (tIsrFunc)&Cpu_ivINT_PIT_CH0,      /* 0x26  0x00000098   -   ivINT_PIT_CH0                 unused by PE */

    (tIsrFunc)&Cpu_ivINT_PIT_CH1,      /* 0x27  0x0000009C   -   ivINT_PIT_CH1                 unused by PE */

    (tIsrFunc)&Cpu_ivINT_KBI0,         /* 0x28  0x000000A0   -   ivINT_KBI0                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_KBI1,         /* 0x29  0x000000A4   -   ivINT_KBI1                    unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved42,   /* 0x2A  0x000000A8   -   ivINT_Reserved42              unused by PE */

    (tIsrFunc)&Cpu_ivINT_ICS,          /* 0x2B  0x000000AC   -   ivINT_ICS                     unused by PE */

    (tIsrFunc)&Cpu_ivINT_Watchdog,     /* 0x2C  0x000000B0   -   ivINT_Watchdog                unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved45,   /* 0x2D  0x000000B4   -   ivINT_Reserved45              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved46,   /* 0x2E  0x000000B8   -   ivINT_Reserved46              unused by PE */

    (tIsrFunc)&Cpu_ivINT_Reserved47    /* 0x2F  0x000000BC   -   ivINT_Reserved47              unused by PE */

And this is how my KDS screen looked when I pressed the debug button.

doubttonxp.jpg

Now how to find out which Interrupt is causing the problem from both the figures and how to fix it ?

I even tried to debug a dummy project with nothing written inside main.c. Still I cannot successfully debug. This is how my screen looks when I tried to debug an empty project.

NXP dummy1.jpgo

NXP dummy2.jpg

  • I don't know where is the mistake.
  • Whether my code is properly flashed ?
  • I am not getting output for any code, is it because the previously flashed file is still inside my controller ?
  • If it is so, then how to erase the code which is flashed into my controller ?
  • If the flashed code is somehow erased from my controller, will my codes which were working before will work correctly now ?

 

I have attached the LED Blinking code . If required I'll attach my Boot loader code too..

Thanks

 

Original Attachment has been moved to: Led_blink.zip

Outcomes