Altera_Forum
Honored Contributor
19 years agoDynamically modify NIOS code.
Hi all,
I believe I may have an interesting topic for discussion here. I've been working heavily with NIOSII processors for over a year now. We are now using them quite a bit in our systems. The particular system in question has 5 NIOS processors running in it. One of those processors acts as a master which handles all communications with a host PC over a USB 2.0 connection. The other four processors are slaves which receive commands from the master processor. Their purpose is irrelavant to the conversation and for discussion purposes it might as well just be 1 slave processor. What I would like to do is modify the code of the slave processors while they are running. I have no problem accessing and overwriting their memory. My question is more software based as I have limited experience with the gnu-tools and specifically the linker. I have thought of a few ways to do this. The simplest is to take advantage of the new reset feature provided with NIOS II 6.0. I can simply have the master processor hold the slave processors in reset while their code is reloaded. This is not my ideal solution. It's not very clean and I don't really want the slave processors to go through their "boot up" sequence everytime. The second is what I'd like to do but I'm not sure how or if it's possible. Their is really only one function that I need to overwrite. I would like to dedicate a chunk of memory to each processor just to store the code of this function. What I'd like to do is use the nios2-gcc tool suite to generate just the memory contents of this piece of memory (which would be the function in question). Then I can upload the new memory contents, tell the slave processors to flush their instruction caches, execute the function, then do it all over again. So any experience with the NIOS IDE and the gnu tools that might prove useful here would be very much appreciated. Again, the hardware is no problem at all, just how to generate the desired memory contents. Thanks, Jake