I woud start a long discussion about bootloaders and micro-programmers if you have time to listen me.(or maybe said, reading me ) 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:
---->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 ?