Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

bootloading specific task into microcontroller

Status
Not open for further replies.

Anniyan_x

Member
can we just boatload a specific "function" of a full application code into a microcontroller ( let say its a PIC18F), so that we can update
a specific part of the firmware but not the whole firmware. for e.g

let say we have:-

// START
init_hardware();

void main (void);
{
while(1)
{
scan_input();
run_logic_program();
update_outputs():
}
}

//functions/subroutines
void scan_input ()
{
}

void run_logic_programs();
{
}

void update_output();
{
}
...........
the idea is something like this:-
so i write my logic programs function which will take the input values in and update the output values accordingly , and as per that i just wan to bootload the [run_logic_programs()] functions only,so that i can stimulate something like a simple PLC (programmable logic controller) concept,in sense that i write my run_logic_programs() as how i like it,e.g i can rewrite my run_logic_programs() functions, e.g changing the combination logic,timing and etc and then recompiled that particular function only and update it to the application firmware using bootloading method.

is it so called the RELOCATEABLE memory type of programming??? i know we can update whole firmware using the bootloader, but how about a particular code or functions?? what is the method or direction to study/follow to achieve this??? any ideas.....
 
Fairly obviously bootloaders don't have to update the entire memory, or they would overwrite themselves :D

However, your idea seems ludicrously over complicated?, if you can't fit everything in the PIC then either code it better, or move to a larger device.
 
What it sounds like is he just wants to be able to update a small part of the program with new parameters/code rather than the whole program.

Yes, it's possible, though likely easier just to load a whole new program rather than go to the trouble of updating a specific part. The flash memory is written in blocks so you would have to tell the compiler/linker to place this function at the start of a block or set of blocks and make sure no other code shares this space.

If your logic wasn't too complicated you could create scripts/p-code rather than actual machine code that would be interpreted at run time and load these into a memory space that could be swapped out.
 
Fairly obviously bootloaders don't have to update the entire memory, or they would overwrite themselves :D

However, your idea seems ludicrously over complicated?, if you can't fit everything in the PIC then either code it better, or move to a larger device.

ya but i wana stimulate something like a simple PLC, for experiment purpose :p.... my aim is just create the combinational logic + any timing then just load/insert it into the main applications code.

What it sounds like is he just wants to be able to update a small part of the program with new parameters/code rather than the whole program.

Yes, it's possible, though likely easier just to load a whole new program rather than go to the trouble of updating a specific part. The flash memory is written in blocks so you would have to tell the compiler/linker to place this function at the start of a block or set of blocks and make sure no other code shares this space.

If your logic wasn't too complicated you could create scripts/p-code rather than actual machine code that would be interpreted at run time and load these into a memory space that could be swapped out.
ya this is what i mean, just to update the specific part with new parameters (combination logic/etc), the idea is to load this specific part into a EEPROM and then make the bootloader to read from the EEPROM and then load into flash/ram or whatever place to make this specific part function together with the application's main code....

though it looks complicated way,i trying to learn something and need some basic guide on the proper method or ways that can be followed to achieve this, anyway il check out more info about your suggestions.
 
ya but i wana stimulate something like a simple PLC, for experiment purpose :p.... my aim is just create the combinational logic + any timing then just load/insert it into the main applications code.

As far as I'm aware that's not the way PLC's work?, I would expect them to be more like an 'interpreter' - with the PIC running a program that 'interprets' the data (program) that you want to run. Just as BASIC interpreters work.

You might try having a look here:

https://www.mikroe.com/picplc16/

And see what you think of that?.
 
As far as I'm aware that's not the way PLC's work?, I would expect them to be more like an 'interpreter' - with the PIC running a program that 'interprets' the data (program) that you want to run. Just as BASIC interpreters work.

You might try having a look here:

https://www.mikroe.com/picplc16/

And see what you think of that?.

i saw that before.... anyway yup basically im not exactly into PLC but something similiar. myabe i wrongly use the term PLC :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top