I use the following "monkey trap" routine for stack space
control: asm{move SP,i}; if (i>STACK_LIMIT)asm(debug); //monkey trap Actually the #define of STACK limit depends on your linker.cmd file, you should check what "normal" and "out of control values are. Georg Bende Softwareentwickler Abteilung Elektronik Dr. Fritz Faulhaber GmbH & Co KG Daimlerstr. 23 71101 Schaich Tel: +49 7031 638294 > -----Ursprgliche Nachricht----- > Von: Bruno Tremblay [mailto:] > Gesendet: Freitag, 16. Januar 2004 20:18 > An: > Cc: Rajarama Puranika; > Betreff: RE: AW: [motoroladsp] Programming Data Flash on a F805 > > I've done some tests with Jacob Christ routine for > programming flash. So for > now, I don't use the SDK drivers. For what I can tell, the flash erase > routine work fine. > > void dflash_erase (UInt16 addr) > { > UInt16 readsyscntl; > ArchIO.DataFlash.IntSourceReg = 0; > > ArchIO.DataFlash.ProgramReg = 0; > ArchIO.DataFlash.EraseReg = 0; > ArchIO.DataFlash.ControlReg = 0; > > while ((readsyscntl = ArchIO.DataFlash.ControlReg) & 0x8000 ); > ArchIO.DataFlash.EraseReg = 0x4000 + ( ( addr >> 8) & 0x007f); > *(UInt16 *) addr = 0; > while ((readsyscntl = ArchIO.DataFlash.ControlReg) & 0x8000 ); > ArchIO.DataFlash.EraseReg = 0; > ArchIO.DataFlash.ControlReg = 0; > } > > But the software hang on the flash program routine. > > void dflash_program (UInt16 addr, UInt16 data) > { > UInt16 readsyscntl; > ArchIO.DataFlash.IntSourceReg = 0; > ArchIO.DataFlash.ProgramReg = 0; > ArchIO.DataFlash.EraseReg = 0; > ArchIO.DataFlash.ControlReg = 0; > while ((readsyscntl = ArchIO.DataFlash.ControlReg) & 0x8000 ); > ArchIO.DataFlash.ProgramReg = 0x4000 + (( addr >> 5) & 0x03ff); > *(UInt16 *) addr = data; > while ((readsyscntl = ArchIO.DataFlash.ControlReg) & 0x8000 ); > ArchIO.DataFlash.ProgramReg = 0; > } > > For my tests, I tried to erase the first page of dataflash. I placed a > breakpoint just after dflash_erase (0x1000) to verify. At > that point it > worked fine. All the data were 0xFFFF. But it went to an > unhanded interrupt > when I tried to program the first word of flash with the > dflash_program > (0x1000, Calib[0]). I thought that by using archDisableInt(), it was > disabling all interrupts and getting rid of the interrupt problem. > > static void ProgFlash(void) > { > archDisableInt(); > > dflash_erase (0x1000); > > dflash_program (0x1000, Calib[0]); > > archEnableInt(); > } > > When rechecking the archive, I found message 1793 (sep 30, > 2003 7:06 am) > where Jacob Christ spoke about being out of stack space. Can > some one put a > bit of light on this? If it's the stack space, how can I change it? > > Thanks > > Bruno > -----Message d'origine----- > De : Rajarama Puranika [mailto:] > Envoy: 15 janvier, 2004 22:18 > : Bende Georg > Cc : ; > Objet : Re: AW: [motoroladsp] Programming Data Flash on a F805 > Even I had the same problem, when I tried to write the > first 1k of data flash. The processor may store > constant data, in first 1k of data flash. So it may > convert the segment into read only memory and when you > try to write, it may generate an interrupt which is > unhandled. > So just avoid writing into first 1k segment.Start from > next segment it may work fine. And also you need to > block all the interrupts while writing into dataflash > ,and should be the highest priority task. > > Thanks, > Rajaram > --- Bende Georg <> wrote: > > I don't know that the SDK solution is, but I do it > > as it is described in the user's manual from page > > 161 through 164. You have to erase one page of the > > data flash, then write that part. You have to know > > EXACTLY which page contains your data. I created an > > array of 256 values which is put in the beginning of > > dFlash for this purpose. > > Your application cannot access the data flash > > during erase/write operations, this means you cannot > > access your data constants and variables that were > > stored there. > > Problem might be this in your case. If it is badly > > needed, store your constant table in the program > > flash. (or if you aren't using it, boot flash) > > Interrupt activation and deactivation goes through > > setting/clearing the SR bits I0 and I1 (p139-140 in > > the manual) > > > > Georg Bende > > Softwareentwickler > > Abteilung Elektronik > > Dr. Fritz Faulhaber GmbH & Co KG > > Daimlerstr. 23 > > 71101 Schaich > > Tel: +49 7031 638294 > > > > > > > -----Ursprgliche Nachricht----- > > > Von: Bruno Tremblay [mailto:] > > > Gesendet: Mittwoch, 14. Januar 2004 20:03 > > > An: > > > Betreff: [motoroladsp] Programming Data Flash on a > > F805 > > > > > > > > > > > > Hi, > > > I know that is a old subject on this group but I > > did't found > > > the answers to > > > my questions in the archive. I'm trying to > > programm data > > > flash on a F805 to > > > save some calibration variables. I'm using the SDK > > Flash > > > drivres. For now, I > > > can read what's in the data flash but when I try > > to write in > > > it, the DSP > > > hang. From what I read and understand, I must not > > de access from an > > > interrupt while erasing or writing. But does it > > mean that I should > > > deactivate all the interrupts (PWM, Quad Timers > > and SCI) > > > during writing? If > > > yes, how can the interrupts be reactivate > > automaticaly after > > > the write. > > > > > > Beside The SDK, is there a easy way to use the > > data flash to > > > save about 30 > > > words of data? > > > > > > Bruno > > _____________________________________ > Note: If you do a simple "reply" with your email client, only > the author of this message will receive your answer. You > need to do a "reply all" if you want your answer to be > distributed to the entire group. > > _____________________________________ > About this discussion group: > > To Join: > > To Post: > > To Leave: > > Archives: http://www.yahoogroups.com/group/motoroladsp > > More Groups: http://www.dsprelated.com/groups.php3 > |