Hola Pregunta sobre como crear un Bootloader. Hi, I'm wondering if somebody Could help me to make a Bootloader

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

Hola Pregunta sobre como crear un Bootloader. Hi, I'm wondering if somebody Could help me to make a Bootloader

1,007 Views
oscarniño
Contributor III

Hola que tal, saludos a todos en la comunidad. Soy nuevo aqui, me pregunto si alguien me puediera ayudar con un proyecto que tengo. Se trata de crear un bootloader para un microcontrolador; en especifico para la familia HCS08 ya que la la informacion que he encontrado creo que me es un poco confusa, he checado que hay que repamear las direcciones para el inicio del codigo de usuario y que existen las instrucciones para leer, escribir, borrar, borrar un campo, etc y que existen modos de iniciar de manera que si se cumple cierta condicion el programa entra al modo bootloader, y que si en cierto tiempo(no mas alla de un par de segundos) no ocurre tal suceso el programa entra al codigo de usuario. Asi mismo que hay que proteger estas localidades de memoria de sobreescritura accidental o intecional. En algunos foros vi que algunos utilizan las primera localidades de memoria pero en otros documentos he leido que utilizan las ultimas localidades de memoria. Mi pregunta en especifico es que no se como implementar todo esto en C ya que los recursos que he encontrado contienen demasiados archivos ligados y es aqui donde me pierdo. Lo que busco en especifico es que instrucciones debo utilizar en C para hacer esto y como se traducen las instrucciones de el protocolo FC en C mi intencion es hacer el bootloader para actualizar el codigo de usuario por UART desde otro Microcontrolador. Cualquier ayuda que me puedan proporcionar les estare muy agradecido.

 

Atentamente:

Oscar Israel Niño Garcia

 

Hi, I'm new here. I'm wondering if somebody of you could help me. I'm making a project that consist in create a bootloader for a MCU which belong to HCS08 family. I've been searching and I've found out some examples for this but this information is a little confused to me, because the examples that I've downloaded have a many files linked each others and I don't find out how to follow the instructions. For example I've read about the instructions Read, Erase, Write, etc or that the bootloader can start in diferent ways like a high level on pin or a caracter on time lap, if nothing happens the user's code starts. I've read that is important to protect the address on is the bootloader and somebody use the first address and some documents indicate the last ones. My question is how can I use all of this, what specific instructions I have to use for each command in C compiler. I want use the UART to make updates to my device but from other device. If somebody could help me, I'll appreciate your help so much.

 

 

 

Regards

Oscar Israel Niño Garcia

Labels (1)
0 Kudos
4 Replies

552 Views
Leojunin
Contributor III

Hola oscar!
mira esto:

community.freescale.com/docs/DOC-238265

El protocolo FC es lindo y bueno, pero hacé un bootloader a velocidad fija, es mas facil. Yo hacía FOTA en el año 98 a velocidad fija. Sabiendo lo que vas a enviar no necesitas ese " ponerse de acuerdo" ya que sos el que hace el bootloader y el firm. Yo programo en ASM, se poco de C, pero es mas potente ASM. NO pude enviarte msg. Hablamos.

Completa tu perfil... de donde sos?

0 Kudos

552 Views
tonyp
Senior Contributor II

BTW, for which MCU variant is this? (If it so happens to be one of those I use I may have a bootloader ready for you.)

I have been using my own (proprietary) bootloader for years with perfect results.  It uses standard RS232 terminal connection with no special client-software.  It accepts S19 text files directly.  (You can load new firmware from any RS232-capable device regardless of OS because no application needs to run on the client.)

This is my approach in general:

  • Treat the bootloader as a completely independent application maintained separately from whatever apps may use it.  (You can always combine the final S19 files of the bootloader and your app to a single S19 file if you want to burn them both in one step.)
  • Treat your main app(s) the same (as completely independent and bootloader agnostic) with the exception of the ending ROM address being modified to stop before the bootloader app begins.  This should be a trivial modification of your normal setup.
  • (Optional) On POR startup, the bootloader checks app's CRC and, if not valid, goes into boot menu.
  • The bootloader checks the IRQ pin during startup and, if low, goes into boot menu.
  • SCI boot menu offers just two choices: (L)oad, and (Esc)ape.  (L)oad erases current app, and waits for a new file in S19 format.  (Esc)ape simple resets the controller.  (On assembly of the bootloader, you can choose to erase all Flash, or app portion only keeping user data intact.)
  • Before jumping to the application, the bootloader restores all modified registers (e.g., SCI and IRQ related) to their default state for the app to find them as if running stand-alone.
  • You can jump to the actual reset address (address in $FFFE vector) from your app at any time if you want to soft-enter the bootloader.  In this case the normal startup checks (e.g., CRC, and IRQ pin status) are skipped.  You simply end up in the boot menu.  In case of mistake, pressing (Esc)ape in the bootloader resets the MCU and you're back into your app.
  • For those MCU's that support vector redirection, it is used.  For those that do not, the bootloader does the redirection 'manually'.  In either case, the app is written as if vector redirection is available.
  • Always use the internal oscillator even if the app is using external clocks.  This allows to load new (modified to deal with the problem) app even if the external oscillator has failed.

Hope this helps.

0 Kudos

552 Views
david_diaz
NXP Employee
NXP Employee

Hello Oscar,

In this case I would like to recommend the Application Note AN2295.

This application note is for embedded-software developers interested in alternative reprogramming tools. Because of its ability to modify MCU memory in-circuit, the serial bootloader is a utility that may be useful in developing applications.

Please find the documentation and the software package at:

Hope this information will be useful for you.

Have a great day.

David

0 Kudos

552 Views
oscarniño
Contributor III

Thanks for reaply, I have read this document.

0 Kudos