Startup Sequence

General discussions about working with the Astrobe IDE and programming ARM Cortex-M0, M3, M4 and M7 microcontrollers.
Post Reply
gray
Posts: 109
Joined: Tue Feb 12, 2019 2:59 am
Location: Mauritius

Startup Sequence

Post by gray » Fri Jun 07, 2019 3:31 am

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?

cfbsoftware
Site Admin
Posts: 493
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Startup Sequence

Post by cfbsoftware » Fri Jun 07, 2019 12:46 pm

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.

Post Reply