08-19-2008 08:44 AM
Hi,
I'm running a Spartan 3E with a Microblaze and xilkernel. I'm compiling under EDK version 10.1.2. The way my system works is that on boot up a bootloader copies the code from flash to SRAM and then jumps to SRAM for execution. This all works fine. The problem occurs when I do a warm reboot by toggling the reset line on the Spartan 3E. This reset does not invoke the bootloader but instead restarts the software already loaded in SRAM. What happens intermittently in thus instance is that when the Microblaze and xilkernel boot and my two static threads begin, the code jumps back to the start of SRAM and reboots again. This will happen over and over very quickly. Sometimes the scenario will be preceded by the task scheduler going into overdrive and running really fast. For example, a sleep call set for 100ms may execute in 10ms. I've stripped my code down so it just reboots waits a 15 seconds and then reboots and this still occurs. The only way to stop this crash is a powercyle which reloads the code from flash. This problem has occurred in code complied under both EDK 9.1 and now 10.1. The weakest link in my system right now is that I'm still running Microblaze 4.0. At this point I still don't know if this is a hardware or a software problem. Any ideas would be appreciated.
Steve
08-20-2008 12:25 AM
Hallo Steve,
do you have any static variables with an initial value that control part of your code? Something like:
static int initialized=0;
Before a warm reboot occurs, this variable might have been changed by your program, leading to an unwanted behaviour after a reboot. I once had this problem.
Greetings
Stefan
08-20-2008 12:25 AM
Hallo Steve,
do you have any static variables with an initial value that control part of your code? Something like:
static int initialized=0;
Before a warm reboot occurs, this variable might have been changed by your program, leading to an unwanted behaviour after a reboot. I once had this problem.
Greetings
Stefan
08-20-2008 04:59 AM
Hi,
If your program don't initialize everything before using it, you might get different result after a warm reset.
On a warm reset, MicroBlaze will not initialize the register values in the registerfile.
This is different from a power reset where the registers will be set to 0x0000_0000
Göran
08-20-2008 06:54 AM
Hi Goran,
I think both you and Stefan are on to something here. How is program variable initialization different between a warm reset and a cold reset?
Regarding the register initialization on a warm reset, I have suspected that this might be the case. I do not manually write to any of the 32 general purpose registers or the special purpose registers in the Microblaze register file. Can you give me any additional guidance here such as which registers should be cleared or should I just clear all the general purpose? Do I clear the special purpose registers too? Do you know of any examples? Thanks
Steve
08-20-2008 10:04 AM
swally wrote:Hi Goran,
I think both you and Stefan are on to something here. How is program variable initialization different between a warm reset and a cold reset?
Regarding the register initialization on a warm reset, I have suspected that this might be the case. I do not manually write to any of the 32 general purpose registers or the special purpose registers in the Microblaze register file. Can you give me any additional guidance here such as which registers should be cleared or should I just clear all the general purpose? Do I clear the special purpose registers too? Do you know of any examples? Thanks
Steve
I think what the others are saying is that you have to initialize all of your variables at the start of your program. Some of those variables are on the heap, some are in registers, depending on what the compiler decided to do. So you can't depend on any initializers other than the ones you do.
-a