Are the modules initialised in the order as listed in the ".map" file?
Background: I want to "intercept" the reset process at some point. Upon run-errors or some MCU faults, my process scheduler can reset and restart a single process and continue, as an attempt to keep the (unsupervised) program going. If the problem persists, and the faulty process is not essential, it can be shut down. Otherwise, at some point, I want to reset the whole program by resetting the processor, again, attempting to keep it going, in parallel to issuing an alarm (as with a watchdog reset). This can lead to repeated resets, obviously, which I need to detect, and stop, resulting in the final screeching halt.
Hence, I am now figuring out where to put this repeated-reset detection in the startup sequence. I think I can safely put it in Main.mod. Or do I miss something regarding the startup code here?
Startup Sequence
-
- Site Admin
- Posts: 525
- Joined: Fri Dec 31, 2010 12:30 pm
- Contact:
Re: Startup Sequence
Yes. The initialisation section (i.e. any code between BEGIN and END at the end of a module) of each Module is executed in turn in the order as listed in the map file. The initialisation section of the main module of the application (the one that imports Main) is the last to be executed. This usually contains a call to a procedure that starts the actual application e.g. in the Info example, this procedure is called Run.