Hi I am using MKE02Z64VLD2 microcontroller in KDS 2.0 IDE.. For me memory is getting Erased and Programmed perfectly.
My application code name is TestBeta which is a simple code to blink LED. I converted this Application file into S19 file and I included it under s19 file section.
Memory is Erased
Memory is programmed
But the LED is not blinking.
What is the problem ?
OR
I have to do something else to run the application file ?
已解决! 转到解答。
Hi Ganesh,
Please try this :
void JumpToUserApplication(uint32_t userStartup)
{
__asm("ldr r1, [r0,#0]"); //get the stack pointer value from the program's reset vector
__asm("mov sp, r1"); //copy the value to the stack pointer
__asm("ldr r0, [r0,#4]"); //get the program counter value from the program's reset vector
__asm("blx r0"); //jump to the start address
}
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi
Please change to this :
void JumpToUserApplication(uint32_t userStartup)
{
// set up stack pointer
__asm("LDR r1, [r0]");
__asm("mov r13, r1");
/* jump to application reset vector */
__asm("ADDS r0,r0,#0x04 ");
__asm("LDR r0, [r0]");
__asm("BX r0");
}
This is the jump function , it can not jump to your APP without these code .
If there is anything else you also mask , please tell me our change it by yourself .
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ganesh,
Please try this :
void JumpToUserApplication(uint32_t userStartup)
{
__asm("ldr r1, [r0,#0]"); //get the stack pointer value from the program's reset vector
__asm("mov sp, r1"); //copy the value to the stack pointer
__asm("ldr r0, [r0,#4]"); //get the program counter value from the program's reset vector
__asm("blx r0"); //jump to the start address
}
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Ganesh,
How about press the reset button on board ?
If still can not working , please check whether change the linker file vector start address to 0x4000?
Which bootloader do you used ? Under the bootlaoder, it should have application demo code , i
recommend you first flash the demo application to have a try .
Hope it helps
Alice
Hi Alice,
1. I am not using Freedom Board. I am using a customized board. So I guess Reset button option would be invalid here. (or if I have to configure any button as RESET Button please help me how to do it)
2. My Application Code's Linker File settings:
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00004000, LENGTH = 0x000000C0
m_text (RX) : ORIGIN = 0x00004410, LENGTH = 0x0000FBF0
m_data (RW) : ORIGIN = 0x1FFFFC00, LENGTH = 0x00001000
m_cfmprotrom (RX) : ORIGIN = 0x00004400, LENGTH = 0x00000010
}
I have also attached the APPLICATION CODE project.
3. I am using UART Boot loader -- AN 4767.
4. Should I flash the Application code ? I have doubts in using the Universal Boot loader GUI.
Ill tell you what all I did step by step.
Step 1: I included the following files from the AN 4767 SW file
Step 2: I made changes in the code to suit my board specifications. For instance: My serial connection is half duplex and there is no RTS CTS support in MKE02Z64VLD2. The Tx and Rx are connected to PIN 21 of my controller so I need to toggle it every time I Transmit and Receive. So in the Uart.c and Uart.h files I included this piece of code.
For RX
GPIO_PDD_ClearPortDataOutputMask(GPIOA_BASE_PTR, GPIO_PDD_PIN_21);
For TX
GPIO_PDD_SetPortDataOutputMask(GPIOA_BASE_PTR, GPIO_PDD_PIN_21);
I made other necessary changes required for successful compilation of the code.
Step 3: I wrote a simple Application code for blinking of led, which works well if I debug it. I have attached it here.
Step 4: I removed the s9 record line statement from the application_code.srec (actually I tried both. I tried to run the application file which has s9 record and I tried to run the application file which do not have s 9 record.. Both didn't work)
Step 5: In the Boot loader GUI, I loaded the S record format application file by clicking the Open s19 button.
Step 6: I debugged the Boot loader code and connected the Boot loader GUI to it by pressing the Connect button.
Step 7: I pressed the Erase button then I pressed the Program button as shown in the screenshots above (in my question).
Step 8: What should I do to make the APPLICATION CODE run ?
I am stuck at this step...
Hello Ganesh,
- Only through your said there is no error . Please debug to find the problem :
put one point after program code ,then step by step to check where it to run;
And please check the bootlaoder code flow , when start up , whether it can
jump to the application code .
- You can also send your bootloader to me , while i have not your chip, i only have the
frdm-ke02 board , while i think i can test it on this board , to debug and check .
Hope it helps
Alice
Hey Alice.
I don't think I can attach the code here. Can I mail you the code ? Can you share me your mail ID ?
This is my mail id. ganeshramachandranece@gmail.com Can you drop me an empty mail to this mail id ? So that I can reply you with my code.
Thanks
Hello Ganesh,
In you bootlader code, the RELOCATION_VERTOR_ADDR is 0x1000,
while in the application project ,the start address is 0x4000, so it can not jump to the right place ,
then the application can not work well .
Please change RELOCATION_VERTOR_ADDR to 0x4000.
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Mam,
Thanks for the Help. I changed it and I am getting the same problem. I mailed you the code again. Please help me with this. And If possible can you send me the screenshots of how to run the application code in the Boot loader GUI ?
When I press the Program button in Boot loader GUI, the application code should run right ? in my case, when I press the Program button, the LED should blink right ?
Thanks