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 / 170
169  |  171
Subject: 
Re: loading s/w
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 20 Apr 1999 21:23:10 GMT
Viewed: 
1013 times
  
Lou Sortman 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.

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 nearly all ROM data areas, so task code
might be overwritten and then switched to. Higher-priority tasks might
stop the reset code from ever continuing. Messy subject.

A safe reset from multitasking would look like this:
disable_interrupts();
set_stack_to_on_chip_area();   // if ROM doesn't do this itself
rom_reset();


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.

Oops, I thought this pecularity was well-known? If pre-initialized data
segments are typically small, a future task loader might cache a copy.
Otherwise, this issue will probably remain.

--
Markus L. Noga noga@inrialpes.fr
Check out legOS! http://www.multimania.com/legos/
"Quand on n'a pas de caractere, il faut bien se donner une methode."
-Camus on Software Engineering



Message has 1 Reply:
  Re: loading s/w
 
(...) The first instruction (at 03ae) places the stack in on-chip memory, assuming RAME bit of SYSCR is at its initial value of 1. Why not make rom_reset() disable interrupts, then do its thing? That would be the safest thing to do. -Kekoa (25 years ago, 21-Apr-99, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: loading s/w
 
(...) 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 (...) (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