Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I know conceptually how to build a bootloader. Like I know there are 2 versions of code, one is bootloader code and application code. I should program in such a way that if I press a push button, my bootloader code in the flash should get loaded and executed. If the key is not pressed the application code has to be executed. I have gone through the tutorial videos in Beningo.com for building a bootloader from scratch for micro-controllers, which gave me conceptually how a bootloader has to be built. Since I am still in under graduation and with no previous practical experience with embedded systems except for the exam in the previous semester, When I sit to write the code I get stuck at start itself. I need some motivation technically.
What I have is
1. A customized board with MKE02Z64VLD2 controller fitted. The board is not the one available in the market such as freedom boards etc. It is an oven controller board designed by a company for which am doing this project.
2. A Segger Jlink which puts the code into the Microcontroller whatever I write on Kinetis Design Studio IDE.
3. I have the entire information related to schematics, pin details about he board.
I have already written a code for blinking of an LED in the Flash memory and successfully executed it.

What I have tried:

I was going through this link suggested by people from CODEPROJECT :
http://mcuoneclipse.com/2013/04/28/serial-bootloader-for-the-freedom-board-with-processor-expert/
1. In that blog he is building a serial bootloader for a kinetis L series microcontroller through Codewarrior IDE.
2. My task is to build a bootloader for a kinetis E series controller through Kinetis Design Studio IDE.
3. Codewarrior and Kinetis Design studio are more than 95% same in its features and working. I don't have a problem in correlating between Kinetis L and Kinetis E series controller too.
I was sincerely following his step by step procedure and I got stuck in the third step
where he uses a terminal program. I dont have a com port in my pc to follow that step.
See as I said already, I connected the J link to my board and the computer and I successfully executed that blinking of LED code.
Now my doubt is, Cant I send a bootloader code to the microcontroller in the same way?
Say for instance I write a very basic " Hello world" bootloader code in my KDS IDE and if I dump it to my microcontroller through my J link Wont it work ?
What is this "SERIAL BOOTLOADER" ?
Is that terminal program required, only if you are writing something called a " SERIAL BOOTLOADER" ?
He has also mentioned about using shell program. I would like to know what is the role of shell to the present scenario ?
Posted
Updated 7-Mar-16 21:17pm

1 solution

The boot loader code itself is written to the board like any other code using the provided interface (J link in your case). Boot loaders are commmonly used to allow updating application code later without using the board specific programming interface. So a user might install an update using a normal PC with a serial interface.

For PCs without serial interfaces, an USB to serial converter can be used.

A serial boot loader is one that uses a serial interface for communication. Once activated (via hardware event like a button press and/or checking an input pin upon every reset), it will wait for commands send on the serial line and allows writing to the flash memory.

A possible implementation for a button activation may be:

  • A flag in memory cleared upon power on indicating that the loader should be executed.
  • Upon reset (software or hardware like power on), the flag is checked. If set, the boot loader is started. Otherwise the application code is started.
  • Using an interrupt handler for the button to set the flag and perform a software reset.
  • The boot loader code checking the flag is located at the reset address.
  • The application code is located at a fixed address behind the boot loader.

A simpler implementation may use an input pin with a jumper that must be set to activate the programming mode upon reset.

When you want to write a boot loader you should know before what it should do (e.g. allow updating of application code and perform additional tasks). Once you know that you should define some kind of protocol to use (the commands and syntax). A comfortable boot loader might provide a simple interactive interface like a command shell.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900