| %%{ |
| /* --COPYRIGHT--,ESD |
| * Copyright (c) 2008 Texas Instruments. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0 and Eclipse Distribution License |
| * v. 1.0 which accompanies this distribution. The Eclipse Public License is |
| * available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse |
| * Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Contributors: |
| * Texas Instruments - initial implementation |
| * --/COPYRIGHT--*/ |
| |
| /* |
| * ======== Startup.xdt ======== |
| */ |
| |
| var mcnt = 0; |
| var mobj = '(&xdc_runtime_Startup_Module__state__V)'; |
| |
| %%} |
| |
| % var Startup = xdc.module('xdc.runtime.Startup'); |
| % if (Startup.resetFxn != null) { |
| % var cname = Startup.resetFxn.$name; |
| % cname = cname.replace(/\./g, '_'); |
| extern Void `cname`(void); |
| % } |
| % for each (var mod in Program.targetModules()) { |
| % if (!mod.MODULE_STARTUP$) continue; |
| % if (mod.$$scope != -1) { |
| % var mn = mod.$name.replace(/\./g, '_'); |
| xdc_Bool `mn`_Module__startupDone__F(void) { |
| return `mobj`->stateTab == 0 || `mobj`->stateTab[`mcnt`] < 0; |
| } |
| % } |
| % mcnt++; |
| % } |
| |
| %if (Program.$$isrom) return; |
| % /* |
| % * reset__I and exec__I are internal entry points called by target/platform |
| % * boot code. Boot code is not brought into a partial-link assembly. So, |
| % * without this pragma, whole program optimizers would otherwise optimize-out |
| % * these functions. |
| % * |
| % * reset__I invokes the function bound to `resetFxn` if non-NULL. |
| % */ |
| #ifdef __ti__ |
| #pragma FUNC_EXT_CALLED(xdc_runtime_Startup_exec__I); |
| #pragma FUNC_EXT_CALLED(xdc_runtime_Startup_reset__I); |
| #endif |
| |
| #ifdef __GNUC__ |
| #if __GNUC__ >= 4 |
| xdc_Void xdc_runtime_Startup_exec__I(void) __attribute__ ((externally_visible)); |
| xdc_Void xdc_runtime_Startup_reset__I(void) __attribute__ ((externally_visible)); |
| #endif |
| #endif |
| |
| xdc_Void xdc_runtime_Startup_exec__I(void) |
| { |
| xdc_Int state[`mcnt + 1`]; |
| xdc_runtime_Startup_startModsFxn__C(state, `mcnt`); |
| } |
| |
| /* |
| * ======== xdc_runtime_Startup_reset__I ======== |
| * This function is called by bootstrap initialization code as early as |
| * possible in the startup process. This function simply calls any |
| * configured `Startup.resetFxn`. |
| */ |
| xdc_Void xdc_runtime_Startup_reset__I(void) |
| { |
| % if (Startup.resetFxn != null) { |
| % var cname = Startup.resetFxn.$name; |
| % cname = cname.replace(/\./g,'_'); |
| `cname`(); |
| % } |
| } |
| |
| /* |
| * ======== xdc_runtime_Startup_exec__F ======== |
| */ |
| xdc_Void xdc_runtime_Startup_exec__F() |
| { |
| if (xdc_runtime_Startup_Module__state__V.execFlag) { |
| return; |
| } |
| |
| xdc_runtime_Startup_Module__state__V.execFlag = TRUE; |
| |
| % for (var i = 0; i < Startup.firstFxns.length; i++) { |
| `Startup.firstFxns[i].$name`(); |
| % } |
| |
| % if (Startup.maxPasses > 0) { |
| (xdc_runtime_Startup_execImpl__C)(); |
| % } |
| % else { |
| % for (var i = 0; i < Startup.sfxnTab.length; i++) { |
| `Startup.sfxnTab[i].$name`(xdc_runtime_Startup_NOTDONE); |
| % } |
| % } |
| |
| % for (var i = 0; i < Startup.lastFxns.length; i++) { |
| `Startup.lastFxns[i].$name`(); |
| % } |
| } |