Hello,
I woud start a long discussion about bootloaders and micro-programmers if you have time to listen me.(or maybe said, reading me :smileyhappy:) I would really appreciate.
I want to start a project using one of the ARM-Cortex-M0 plus microcontrollers, more exactly MKL46Z. The aim of the project is to familiarize myseft with the these technologies.
Let's say i want to develop an application which is mapped as follows:
1.One section in which will reside the bootloader (system initialization, and other processor dependent stuffs)
2.One section in which will reside a micro-programmer (able to load itself in RAM and erase/program the entire flash memory)
3.One section meant for parameters of the application ( in other words, calibration)
4.The last section , the application itself.
I want to be able to erase/program entire flash using the UART module.
Now, I would expose my knowledge about this type of application and then I would ask you to say what I missed.
So, in order to have these sections , I would start to define them in the Linker Script.
Then, I would write the routines able to gratify the needs of the application.
My concern is about that micro-programmer, which should be able to load itself (or by other program) in RAM and starting to execute from there.
I will present a scenario:
1.Reset ----->Bootloader
---->Wait two seconds (or less) and check for a programming request
----->If yes, load the micro-programmer in RAM and start erasing/programming
----->If no, jump to application.
How can I move that micro-programmer from FLASH to RAM ?. I know about _ram_func directive but i do not know how exactly does it work. If I declare a function with this directive, is it automaticaly uploaded in RAM during startup? (if yes, i do not want it) or it makes space for future relocation ?
Thank you,
Best Regards,
Hi
Beware of erasing all memory with code running in RAM since in case or a problem (reset, power-loss) the processor will be left in a secured state and needs to be unsecured and reprogrammed using a programmer. This is something that can never be allowed to happen in products that are used by customers (and not tests just restricted to a developer's environment).
If you are experimenting with loaders, file systems and parameter systems in the K46 you can analyse the solution at
http://www.utasker.com/kinetis/FRDM-KL46Z.html
http://www.utasker.com/kinetis/TWR-KL46Z48M.html
which includes all of these (including projects for KDS, CW, S32, IAR, Keil, Atollic, Green Hills, Rowley Crossworks, CooCox, GCC, VisualStudio) allowing UART, USB, SD card, memory stick loading as well as some other points that you haven't listed:
- authentication, security and protection of code
These can be tested on KL46 hardware or run in the uTasker KL46 simulator for (approx.) real-time operation and full code analysis in Visual Studio.
They have been used in industrial products/environment for a number of years and are thus proven to be robust and secure.
Regards
Mark
Hello,
Thanks for your reply.
I need deeper information about that type of application.
I would like to know, in case the micro-programmer resides in section of FLASH, do I need to make room in RAM before starting to transfer that region ?
Thank you.
Best Regards,
Hi
Here are some documents that may help you:
- http://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF
- http://www.utasker.com/docs/uTasker/uTasker_BM_Loader.pdf
- http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF
Generally there is no need to copy anything into RAM.
Regards
Mark