in my project I have remote sensors - they are based on ATMega328p as brains and nRF24L01+ for RF link. Since the signal range is marginal and there is no single channel that works all the time I use a frequency hopping to find the frequency that is currently working. The protocol is quite complicated with clock synchronization etc. I would like to add self-programming functionality for the ATMega to update the functions that collect data. In would like to divide the program in ATMega into two parts:
Part 1 will take care about the communication, send data if they are ready and receive and upload a new Part 2 if said to do so.
Part 2 will collect data, prepare them to be send and signal to Part 1 when they are ready.
I don't know how to do this. I can compile the two parts together. But how to tell the Atmel Studio Part 1 code should stay on the same position in the flash and variables accessed by it on the same position in the RAM?
Or I can compile the Part 2 alone. But how to tell Atmel Studio not to use parts of flash and RAM used by Part 1 and how to access common parts of RAM (such as buffer where data to be send are prepared)?