Does the boot loader code should be in a separate source file or it should be part of the main.c itself ?

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

Does the boot loader code should be in a separate source file or it should be part of the main.c itself ?

Jump to solution
1,225 Views
ganeshramachand
Contributor IV

Hi I want to design my own boot loader for KE-02Z controller.

Should I write my boot loader code inside main.c or should I create a Separate Boot loader.c source file and then write the code in it ?

Since, all my processor expert generated code's header files will be included in main.c. If I have to write a separate boot loader code, then I still have to keep the empty main.c file in my project ?

Thanks

Labels (1)
0 Kudos
1 Solution
816 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

I think you still have not know the bootlaoder clearly.

In the main() function , you should writhe when re-flash the application code ,

and when jump to the application, for example , when press one button .

These all refer to your demand , i still strongly recommend you refer to this DOC:

Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+

especially the bootloader flowchart, this flowchart is consider overall, of course you

can not consider so much , for example , you can only check whether the SW1 button

pressed .

pastedImage_0.png

YOu can also refer to  the bootlaoder project of KE02 i have send to you .

Hope it hleps


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
6 Replies
816 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Gnesh,

I think both are OK, what's the question with you when write to the main.c ?

BR

Alice

0 Kudos
816 Views
ganeshramachand
Contributor IV

Oh thanks.
My question with respect to main.c is

Even though I create a separate source file (say Boot loader.c) and write the entire Boot loader code in it, when I generate Processor Expert code all the included component's header files will be inside main.c() file right ? like this

mainDoubtnxp.jpg

That was my doubt. I write a separate Boot loader.c source file which contains my boot loader code and the main.c source file will be empty with just the included header files. Is this correct way or should I write my boot loader code (which I wrote in Boot loader.c) inside main.c ??

0 Kudos
816 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

- The header files will be included automatic when generate code,

we needn't care it .

- If you write nothing on the main(), how do you start run your project ?

BR

Alice

0 Kudos
816 Views
ganeshramachand
Contributor IV

Hey Alice,

That is exactly my question. When my entire boot loader code is in a separate source file, what should I put in the main.c file ?
I have done this to make this program run before the main gets executed. Include before PE.jpg

Include Header.jpg

included cpu.jpg

Am I wrong ?

0 Kudos
817 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

I think you still have not know the bootlaoder clearly.

In the main() function , you should writhe when re-flash the application code ,

and when jump to the application, for example , when press one button .

These all refer to your demand , i still strongly recommend you refer to this DOC:

Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+

especially the bootloader flowchart, this flowchart is consider overall, of course you

can not consider so much , for example , you can only check whether the SW1 button

pressed .

pastedImage_0.png

YOu can also refer to  the bootlaoder project of KE02 i have send to you .

Hope it hleps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
816 Views
ganeshramachand
Contributor IV

Hey Alice,

In the link that you sent, there are example codes only KL26 and K22 controllers. I ll look into the logic of the KL26 boot loader as KE-02Z controllers are Cortex M0+ controllers. Thanks will get back to you when I face any issue after reading your article.

Thanks

0 Kudos