How to run the application file in the Freescale Universal boot loader ?

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

How to run the application file in the Freescale Universal boot loader ?

Jump to solution
2,738 Views
ganeshramachand
Contributor IV

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

150310_150310.jpgBL erase.jpg

Memory is programmed

150311_150311.jpgBL Program.jpg

But the LED is not blinking.

What is the problem ?

OR

I have to do something else to run the application file ?

Labels (1)
1 Solution
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
15 Replies
1,956 Views
ganeshramachand
Contributor IV

Because it threw me these errors. Can you help me fixing it ?

alicejumpuserapp.jpg

Thanks

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,956 Views
ganeshramachand
Contributor IV

It throws me this error. Error: instruction not supported in Thumb16 mode -- `adds r0,r0,#0x04'

Aliceerror.jpg

What should be done ?
Thanks

0 Kudos
1,957 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,956 Views
huyrua291996
Contributor I

Hi Alice,

I run this code in my project but when i debug it show this error

No source available for "0xB2D2687A (0xB2D2687A)() "

Can you help me

2017-09-14.png

0 Kudos
1,956 Views
ganeshramachand
Contributor IV

Thanks a lot Alice. No errors now.

Best wishes.

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 Kudos
1,956 Views
ganeshramachand
Contributor IV

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

  1. common.h
  2. Events.c
  3. Events.h
  4. FC_protocol.c
  5. FC_protocol.h
  6. flash.c
  7. flash.h
  8. main.c (which is Bootloader_sci in AN 4767 SW folder)
  9. uart.c
  10. uart.h

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...

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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

1,956 Views
ganeshramachand
Contributor IV

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

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

OK. i have send to you .

BR

ALice

0 Kudos
1,956 Views
ganeshramachand
Contributor IV

Thanks a lot I mailed you.

Yours truly

Ganesh

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,956 Views
ganeshramachand
Contributor IV

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

0 Kudos
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

OH, why the application of "JumpToUserApplication" is empty :

pastedImage_0.png

0 Kudos