To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 164
163  |  165
Subject: 
Re: loading s/w
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 20 Apr 1999 14:34:12 GMT
Viewed: 
1040 times
  
"Markus L. Noga" wrote:

rom_reset() does the trick, you'll need to #include "rom/system.h". I'm
not sure wheter this is safe when multitasking.

What sort of safety are you referring to?  Motors left running?  My initial
thought was of lost memory or data structures in an indeterminate state, but
that would seem to be moot since you are restarting from the ROM, which will
have forgotten all about legOS.

However, you may be referring to the little problem of having to have the stack
in on-chip RAM.  I know that I got burned once by calling the power-down
function while multitasking.   I had to wait something like 1/2 hour until the
onboard cap(s) drained.  I don't know whether there is a similar caveat for
rom_reset() or not.  It has been awhile.


On a tangentially related note, I have learned something that (in hindsight)
should have been obvious.  Static variables, even when you initialize them to a
certain value, will not be initialized to that value at power-on; only on
initial program load (firmdl).  They retain the value that they last had before
the power was turned off.  This may seem obvious now, but it is a different
paradigm than I am used to from the world of larger operating systems, where
programs are loaded (data segment copied) every time you run them.

What this means is that if you count on static variables having certain values
at power-on, you should explicitly set them in your main() function, rather than
initializing them in your declaration.  On the other hand, this "feature" can be
used to maintain state across power cycles.  We don't want our neural nets being
erased, after all.

This might be good stuff for the HOWTO.  8)



Message has 2 Replies:
  Re: loading s/w
 
(...) Well, if rom_reset() gets invoked near the end of your time slice, ROM has no time to reset the OCIA IRQ vector before the next timer tick. I'm not certain about the order in which ROM sets up data areas and IRQ vectors. legOS freely allocates (...) (25 years ago, 20-Apr-99, to lugnet.robotics.rcx.legos)
  Re: loading s/w
 
(...) In my brief experimentation with rom_reset(), it does not actually clear the rom- rather it only starts the program over again (in main()). Is this intentional? I get this behavior when calling it from main- when calling it from within another (...) (25 years ago, 21-Apr-99, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: loading s/w
 
(...) rom_reset() does the trick, you'll need to #include "rom/system.h". I'm not sure wheter this is safe when multitasking. (25 years ago, 20-Apr-99, to lugnet.robotics.rcx.legos)

11 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR