Shop OBEX P1 Docs P2 Docs Learn Events
Assigning locally declared int values to global int values — Parallax Forums

Assigning locally declared int values to global int values

pmrobertpmrobert Posts: 673
edited 2014-07-19 08:55 in Propeller 1
For cog profiling purposes I'm just trying to capture the number of CNTs elapsed in each pass through a loop. Nothing tricky, just "start_cnt = CNT;" at the beginning of the loop and "end_cnt = CNT; calc_loops = end_cnt - start_cnt;" at the end. If I declare all variables globally and volatile, it works fine. If I try and make end_cnt and start_cnt variables local to the cog I'm profiling, the global volatile int "calc_loops" does not get assigned the value of "end_cnt - start_cnt" - it's always 0. what am I missing? I know this is minor but this is a rather large, time sensitive program and every byte counts and keeping the global volatiles down to a minimum helps size and speed. Oh, they're all declared as
volatile uint_fast32_t calc_loops = 0;
volatile uint_fast32_t start_cnt = 0;
volatile uint_fast32_t end_cnt = 0;
in the working version and the volatile start_cnt and end_cnt declarations are commented out and placed in the local cog code without the volatile designation in the nonworking version. The compiler complains of nothing in either case. I'm using LMM and the pruning commands in the batch file that compiles this as follows:
del %1\%3\%2.elf
propeller-elf-gcc.exe -I . -L . -I %1/SimpleLibraries/Utility/libsimpletools -L %1/SimpleLibraries/Utility/libsimpletools/%3/ -I %1/SimpleLibraries/TextDevices/libsimpletext -L %1/SimpleLibraries/TextDevices/libsimpletext/%3/ -I %1/SimpleLibraries/Protocol/libsimplei2c -L %1/SimpleLibraries/Protocol/libsimplei2c/%3/ -I %1/SimpleLibraries/TextDevices/libfdserial -L %1/SimpleLibraries/TextDevices/libfdserial/%3/ -o %3/%2.elf -O2 -m%3 -Wall -m32bit-doubles -fno-exceptions -std=c99 -ffunction-sections -fdata-sections -Wl,--gc-sections %2.c -lsimpletools -lsimpletext -lsimplei2c -lfdserial -lsimpletools -lsimpletext -lsimplei2c -lsimpletools -lsimpletext -lsimpletools
if %errorlevel% equ 0 goto success
pause
exit
:success
propeller-load -q -b c3 -e -r %1\%3\%2.elf
exit

Any hints or comments would be greatly appreciated. As I've said, I can use the working version but I'd like to know what I'm doing or assuming that's breaking the second case.
Thanks in advance!

-Mike

Comments

  • jazzedjazzed Posts: 11,803
    edited 2014-07-16 10:11
    Hi,

    Can you provide minimal example code that illustrates your problem?

    Describing what you're doing is not enough detail (for me at least).
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 10:28
    #include "simpletools.h"    // Include simpletools library
    #include "fdserial.h"       // Include Full Duplex Serial library
    
    
    #define CALC_STACK_SIZE 256
    static int calc_stack[CALC_STACK_SIZE];
    
    // Function prototype and stack guards for calc cog
    void calc(void *par);
    
    volatile uint_fast32_t calc_loops = 0;
    
    // Case 1 - works fine
    volatile uint_fast32_t start_cnt = 0;	//  <=== This works
    volatile uint_fast32_t end_cnt = 0;		//  <=== This works
    // End Case 1
    
    
    int main()
        {
        cogstart(&calc, NULL, calc_stack, sizeof(calc_stack)); // Start calc cog
        while(1)
            {
            /* Supervisory loop, handles I/O via serial port to PC application,
            this is where the value calc_loops can be requested by the PC app.
            */
    
            }
        }
    
    
    void calc()
        {
    // Case 2 - calc_loops always is 0.		
        uint_fast32_t start_cnt = 0;	//<=== This doesn't work
        uint_fast32_t end_cnt = 0;		//<=== This doesn't work
    // End Case 2
        while(1)
            {
            start_cnt = CNT;
    
            /*   Loop stuff */
    
            end_cnt = CNT;
            calc_loops = end_cnt - start_cnt;
    
            }
        }
    

    The appropriate lines are commented out as regards Case 1 or Case 2. Thanks for looking at it.
  • jazzedjazzed Posts: 11,803
    edited 2014-07-16 11:15
    I had to add code for your program to compile. You fixed the stack on post-edit ... thanks. The other issue was the calc(void *ptr) function mismatch. Boy, this forum editor inserting blank lines just makes me crazy ....

    The code below works for me in all cases.

    CMM or LMM, -O2 or -O3, with or without pruning, with or without USEGLOB
    /*
      Blank Simple Project.c
      http://learn.parallax.com/propeller-c-tutorials 
    */
    #include "simpletools.h"    // Include simpletools library
    #include "fdserial.h"       // Include Full Duplex Serial library
    
    #define CALC_STACK_SIZE 256
    
    // Function prototype and stack guards for calc cog
    void calc(void *par);
    
    volatile uint_fast32_t calc_loops = 0;
    
    //
    #define USEGLOB
    
    // Case 1 - works fine
    #ifdef USEGLOB
    volatile uint_fast32_t start_cnt = 0;    //  <=== This works
    volatile uint_fast32_t end_cnt = 0;    //  <=== This works
    #endif
    // End Case 1
    
    int calc_stack[CALC_STACK_SIZE];
    
    volatile *fdx;
             
    int main()
    {
        simpleterm_close();
        fdx = fdserial_open(31,30,0,115200);
        
        cogstart(&calc, NULL, calc_stack, sizeof(calc_stack)); // Start calc cog
        while(1)
        {
            /* Supervisory loop, handles I/O via serial port to PC application,
            this is where the value calc_loops can be requested by the PC app.
            */
        }
    }
    
    
    void calc(void *par)
    {
    // Case 2 - calc_loops always is 0.        
    #ifndef USEGLOB
        uint_fast32_t start_cnt = 0;    //<=== This doesn't work
        uint_fast32_t end_cnt = 0;    //<=== This doesn't work
        // works fine for me.
    #endif
    // End Case 2
    
        while(1)
        {
            start_cnt = CNT;
    
            /*   Loop stuff */
            waitcnt(CLKFREQ/4+CNT);
            
            end_cnt = CNT;
            
            calc_loops = end_cnt - start_cnt;
            dprinti(fdx,"calc_loops %d\n", calc_loops);
        }
    }
    
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 11:21
    Please disregard - I pared everything down to the very simplest running program and it works both ways. There's obviously some conflict in the project I'm working on that is causing this behavior. I'll keep beating on it until I figure it out. Thanks for looking at it - the main project exhibiting the problem does have and has had the stack dec and calc function properly defined - that's what I get for typing off the type off my head. I'll try similar real simple code in another test cog with the main project to further diagnose my problem. I do have stack guarding and stack measurement code and I have plenty of stack for each cog.

    Here's the cut of what I thought wasn't working (and isn't - in the much larger project I'm working on).
    #include "simpletools.h"    // Include simpletools library
    #include "fdserial.h"       // Include Full Duplex Serial library
    
    
    #define CALC_STACK_SIZE 256
    static int calc_stack[CALC_STACK_SIZE];
    
    // Function prototype and stack guards for calc cog
    void calc(void *par);
    
    volatile uint_fast32_t calc_loops = 0;
    
    // Case 1 - works fine
    //volatile uint_fast32_t start_cnt = 0;	//  <=== This works
    //volatile uint_fast32_t end_cnt = 0;		//  <=== This works
    // End Case 1
    
    
    int main()
        {
        cogstart(&calc, NULL, calc_stack, sizeof(calc_stack)); // Start calc cog
        while(1)
            {
            /* Supervisory loop, handles I/O via serial port to PC application,
            this is where the value calc_loops can be requested by the PC app.
            */
              putDec(calc_loops);
              putChar(10);
              putChar(13);  
              pause(1000);
            }
        }
    
    
    void calc(void *par)
        {
    // Case 2 - calc_loops always is 0.		
        uint_fast32_t start_cnt = 0;	// Never mind - this does work
        uint_fast32_t end_cnt = 0;	// " "
    // End Case 2
        while(1)
            {
            start_cnt = CNT;
    
            /*   Loop stuff */
            pause(500);
            end_cnt = CNT;
            calc_loops = end_cnt - start_cnt;
    
            }
        }
    
  • jazzedjazzed Posts: 11,803
    edited 2014-07-16 11:31
    Thanks for following through.

    One thing to remember is that simpleterm functions are single cog only. If you need multiple cog printing, use fdserial like I did.

    Are you using GCC developer's indent style? Just curious.
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 13:06
    I was only using the simpleterm functions to create a simple model that would compile and display output in SimpleIDE. I'm using fdserial to send/receive cksummed packets to/from a PC app and the main supervisory cog. Thanks for the reminder - I've stubbed my toes a lot but not very often lately. I'm using astyle with option -A5, whitesmith as the formatter. Close to GNU but not quite. Funny thing - the problem I had was apparently due to my having the
    end_cnt = CNT;
            calc_loops = end_cnt - start_cnt;
    
    statements on the wrong side of a brace - there's a fair amount of nesting in that area of code with a fair amount of integer math going on - it should have worked anyway but it acted strange as I described and now I can't replicate it. I'm just going to chalk it up to me breaking things and a certain subset of conditions lined up so it worked by accident with the global decs. I don't know, I'll try to replicate it when my headache goes away...
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 14:26
    Disregard my disregard - I can replicate the problem. In the code window below, there are two functions, calc and test, each started in their own cogs and reporting back through another cog running a loop sending serial data offchip as requested. If I #define USEGLOB , all is great, everything works. If I don't define it, the test function runs perfectly, reporting the proper counts per loop iteration. The calc function, on the other hand, sends the actual CNT value back to the global variable cnts_per_calc_loop if, and only if I include the long equation just before it. If I comment that out, cnts_per_calc_loop returns sane numbers. Anyway:
    void calc(void *par)
        {
        int ix,jx;
    	uint_fast32_t interp1, interp2, interp3;
        //long interp1, interp2, interp3;
        int adcloopcnt[8],loop;
    #ifndef USEGLOB
        uint_fast32_t calc_start_cnt = 0;
        uint_fast32_t calc_end_cnt = 0;
    #endif
    
        while(1)
            {
            while (lock == 1); // Wait for lock to open
                {
                lock = 1;      // Set lock
                calc_start_cnt = CNT;
    
    
                for (loop = 0; loop<9 ; loop++ )
                    {
                    if ((adcloopcnt[loop] == ADCChanPri[loop]))
                        {
                        //adcval[loop] = readADCAverage(loop,2,3,4,5);
                        adcloopcnt[loop] = 0;
                        }
                    else
                        {
                        adcloopcnt[loop]++;
                        }
                    }
    
    
    
    
    
                if(rpm > FuelBaseTable[0][20])
                    {
                    rpm = FuelBaseTable[0][20];
                    }
                else if(rpm < FuelBaseTable[0][1])
                    {
                    rpm = FuelBaseTable[0][1];
                    }
                if(map > FuelBaseTable[20][0])
                    {
                    map = FuelBaseTable[20][0];
                    }
                else if(map < FuelBaseTable[1][0])
                    {
                    map = FuelBaseTable[1][0];
                    }
                for (ix = 20-2; ix>-1; ix--)
                    {
                    if (map>FuelBaseTable[ix][0])
                        {
                        break;
                        }
                    }
    
                if(ix < 0)ix = 0;
    
                for (jx = 20-2; jx > -1; jx--)
                    {
                    if (rpm>FuelBaseTable[0][jx])
                        {
                        break;
                        }
                    }
    
                if(jx < 0)jx = 0;
    
                interp1 = FuelBaseTable[ix + 1][0] - FuelBaseTable[ix][0];
                if(interp1 != 0)
                    {
                    interp3 = (map - FuelBaseTable[ix][0]);
                    interp3 = (100 * interp3);
                    interp1 = interp3 / interp1;
                    }
    
                interp2 =	FuelBaseTable[0][jx + 1] - FuelBaseTable[0][jx];
                if(interp2 != 0)
                    {
                    interp3 = (rpm - FuelBaseTable[0][jx]);
                    interp3 = (100 * interp3);
                    interp2 = interp3 / interp2;
                    }
    
                fuelresult = ((((100 - interp1) * (100 - interp2) * FuelBaseTable[ix][jx]
                                + interp1 * (100 - interp2) * FuelBaseTable[ix+1][jx]
                                + interp2 * (100 - interp1) * FuelBaseTable[ix][jx+1]
                                + interp1 * interp2 * FuelBaseTable[ix+1][jx+1]) / 10000));
    
    
                calc_end_cnt = CNT;
                cnts_per_calc_loop = calc_end_cnt - calc_start_cnt;
    
                lock = 0;
                }
            }
        }
    
    
    void test(void *par)
        {
    #ifndef USEGLOB
        uint_fast32_t test_start_cnt = 0;
        uint_fast32_t test_end_cnt = 0;
    #endif
        while(1)
            {
            while (lock == 1); // Wait for lock to open
                {
                lock = 1;
                test_start_cnt = CNT;
                //pause(2);
                test_end_cnt = CNT;
                cnts_per_test_loop = test_end_cnt - test_start_cnt;
                //pause(1);
                lock = 0;
                }
    
            }
        }
    
    This equation
    fuelresult = ((((100 - interp1) * (100 - interp2) * FuelBaseTable[ix][jx]
                                + interp1 * (100 - interp2) * FuelBaseTable[ix+1][jx]
                                + interp2 * (100 - interp1) * FuelBaseTable[ix][jx+1]
                                + interp1 * interp2 * FuelBaseTable[ix+1][jx+1]) / 10000));
    
    in the calc function, if included, correlates with the wonky behavior noted prior. Is this equation too complex? Do I need to break it up? The compiler has no issue with it, the actual results produced are fine and the assembler doesn't look horrible to my novice asm eye. Back to the chase!

    -Mike, TIA!
  • jazzedjazzed Posts: 11,803
    edited 2014-07-16 17:28
    HI.

    I plugged calc() and test() into the old program, and am getting build errors.

    Please post your entire file if possible.
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 19:10
    jazzed wrote: »
    HI.

    I plugged calc() and test() into the old program, and am getting build errors.

    Please post your entire file if possible.

    Here's everything I could think of, .map and .asm to follow. This version code (USEGLOB is not defined) exhibits the problem. If USEGLOB is defined cnts_per_calc_loop is reported properly, without USEGLOB cnts_per_calc_loop returns what looks like the actual CNT. Many, many items are stubs but the parts referenced by the questionable code are intact. It will read data from the upper 32K of a 64K EEPROM so the tables will be a bunch of junk or all 0s. I ripped out a bunch of perfectly functioning code but this did not help anything at all. The only condition that makes it act weird is if, and only if, that "fuellresult = ..." section is active, i.e., not commented out. I tried CMM, LMM, pruning enabled/disabled, optimizations enabled/disabled, etc. That longish equation seems to be what makes it malfunction.
    #include "simpletools.h"    // Include simpletools library
    #include "fdserial.h"       // Include Full Duplex Serial library
    
    #define Reboot() __builtin_propeller_clkset(0x80)
    
    volatile char lock;
    
    #define CALC_STACK_SIZE 64
    #define INJ1_STACK_SIZE	64
    
    //#define USEGLOB
    
    // Function prototype and stack guards for calc cog
    void calc(void *par);
    static int calc_stack_guard1 = 0xDEADBEEF;	// Unique value placed in mem location just before stack
    static int calc_stack[CALC_STACK_SIZE];		//
    static int calc_stack_guard2 = 0xDEADBEEF;	// Unique value placed in mem location just after stack
    
    // Function prototype and stack guards for inj1 cog
    void inj1(void *par);
    static int inj1_stack_guard1 = 0xDEADBEEF;
    static int inj1_stack[INJ1_STACK_SIZE];
    static int inj1_stack_guard2 = 0xDEADBEEF;
    
    // function prototype for test cog
    void test(void *par);
    static int test_stack[64];
    
    // ADCChanPri - sets priority for each ADC channel.
    // Use: ADCChanPri[x] = y;
    // Ex: ADCChanPri[6] = 500;
    // Channel 6 will be read every 500 loops of the calc cog code.
    volatile int ADCChanPri[8] = {1,2,4,8,16,32,64,128};
    
    volatile int adcval[8]; // Contains most recent adc values
    
    
    
    
    
    /* EEPROM / Hub Memory Structures */
    
    /* 16 bit variables are good compromise between granularity, space and speed. */
    
    
    volatile int_fast16_t FuelBaseTable[21][21]; // 882 bytes
    volatile uint_fast16_t FuelBaseTable_org = 32768;
    // Occupies 32768 to 33649
    
    
    volatile int_fast16_t IgnBaseTable[21][21];  //882 bytes
    volatile uint_fast16_t IgnBaseTable_org = 33650;
    // Occupies 33650 to 34531
    
    
    // CLT_COMP
    
    volatile int_fast16_t CLTCompTable[13][13]; //338 bytes
    volatile uint_fast16_t CLTCompTable_org = 34532;
    // Occupies 34532 to 34869
    
    // MAT_COMP
    
    volatile int_fast16_t MATCompTable[13][13];  //338 bytes
    volatile uint_fast16_t MATCompTable_org = 34870;
    // Occupies 34870 to 35207
    
    
    // Channel Enable
    volatile char Chan_Enab[24];    // 24 bytes
    volatile uint_fast16_t Chan_Enab_org = 35208;
    // Occupies 35208 to 35231
    
    // Primary injector static flow rates
    volatile int_fast16_t Inj_Flow_Pri; // 2 bytes
    volatile uint_fast16_t Inj_Flow_Pri_org = 35232;
    // Occupies 35232 to 35233
    
    // Secondary injector static flow rates
    volatile int_fast16_t Inj_Flow_Sec; // 2 bytes
    volatile uint_fast16_t Inj_Flow_Sec_org = 35234;
    // Occupies 35234 to 35235
    
    // AFR Target Table
    volatile int_fast16_t AFRTable[21][21]; // 882 bytes
    volatile uint_fast16_t AFRTable_org = 35236;
    // Occupies 35236 to 36118
    
    
    // Total in-hub table usage = 36118 - 32768 = 3350 bytes.
    
    volatile uint_fast16_t RTV[24];      // 24 channels of RT Var Values
    
    
    
    
    
    
    // Pin definitions
    volatile uint_fast16_t CEL = 16;
    //volatile int p17 = 17;
    volatile int p1 = 1;
    
    
    volatile uint_fast16_t x1,x2,y1,y2,r,r2,r3;
    volatile uint_fast32_t cnts_per_calc_loop = 0,cnts_per_test_loop = 0;
    
    #ifdef USEGLOB
    volatile uint_fast32_t calc_start_cnt = 0;
    volatile uint_fast32_t calc_end_cnt = 0;
    volatile uint_fast32_t test_start_cnt = 0;
    volatile uint_fast32_t test_end_cnt = 0;
    #endif
    
    volatile uint_fast16_t rpm = 2500;
    volatile uint_fast32_t map = 50, baro = 0, mat = 0, batt = 0, clt = 0;
    volatile uint_fast32_t fuelresult,et,st,ft;
    volatile uint_fast16_t rpm_y;
    
    volatile uint_fast16_t yl,ul,ur,ll,lr,hx,hy,lx,ly;
    
    
    
    
    
    
    
    /*
    				SYSTEM SUPERVISOR
    				-----------------
    	A) This code is the boot code. It's loaded into Cog 0 and ...
    
    		1) Defines and initializes global variables.
    
    		2) Starts the serial port driver, fdserial (Full Duplex Serial) running in it's own cog.
    
    		3) At boot, copies various data structures from nonvolatile storage (the upper 32K of EEPROM) into hub memory locations for use by the rest of the code.
    
    		4) Provides read/write access between the PC based tuning application and the hub memory to facilitate editing of live data structures. This provides realtime tuning capability.
    
    		5) Commands are provided to store live data to nonvolatile storage, the EEPROM.
    
    		6) Provides for streaming of tuning app selectable Run Time Variables such as RPM,MAP, etc. up to 24 channels of data for logging and/or real time observation of these values.
    
    	B) Starts and/or stops the other cogs and tasks as needed. Cog use is:
    
    		0)	Supervisory functions as described above.
    
    		1)	Full Duplex Serial Driver.
    
    		2)	Free running loop that performs table lookup duties and ...
    			ADC value acquisition of all analog values; averaging and smoothing to be done as
    			each value requires. Each ADC channel can have it's priority changed.
    			Averaging and smoothing parameters to be exposed to PC based
    			Tuning Application.
    			Bilinear interpolation routines.
    			Base timing and ign values and all ADC values are exposed globally for further
    			processing before implementation into commanded actions.
    
    		3)  Angle clock. Hopefully this code can fit into cog memory though LMM code should suffice.
    
    		5)	TBD
    
    		6)	TBD
    
    		7)  TBD
    
    
    
    */
    
    
    
    
    
    
    int main()
        {
        int_fast16_t i,i2;
        uint_fast32_t temp1;
        char b,b1,b2,c,rcv_c;
        //char cksum;
        int_fast16_t si1,si_accum;
        //int ta_str_org = 34712; // EEPROM addr of 24x12 chars - RTV names for PA App
    
        fdserial *serial = fdserial_open(31,30,0,350000);  // Fire up serial port interface
    
    
    //------------------------------ calc cog startup
        memset(calc_stack, 0xA5, sizeof(calc_stack));	// Fill stack w/ unique value to detect amt used
        // See testcase();
        cogstart(&calc, NULL, calc_stack, sizeof(calc_stack)); // Start calc cog
    
    
    //------------------------------ test cog startup
        cogstart(&test, NULL, test_stack, sizeof(test_stack)); // Start test cog
    
    //------------------------------ inj1 cog startup
        memset(inj1_stack, 0xA5, sizeof(inj1_stack));	// Fill stack w/ unique value to detect amt used
        // See testcase();
        cogstart(&inj1, NULL, inj1_stack, sizeof(inj1_stack));	// Start inj1 cog - does nothing
        // currently.
    
    
    
        /* %%%%%%%%%%%%%%% FuelBaseTable Routines %%%%%%%%%%%%%%%*/
    
        void FuelBaseTable_EE2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 =0; i2 < 21; i2++ )
                    {
                    b1=ee_getByte(FuelBaseTable_org+(i*42)+(i2*2));
                    b2=ee_getByte(FuelBaseTable_org+(i*42)+(i2*2)+1);
                    FuelBaseTable[i2][i] = (b1<<8)+b2;
                    }
                }
            }
    
    
        void FuelBaseTable_Mem2EE()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    b1=FuelBaseTable[i2][i]>>8;
                    b2=FuelBaseTable[i2][i];
                    ee_putByte(b1,FuelBaseTable_org+(i*42)+(i2*2));
                    ee_putByte(b2,FuelBaseTable_org+(i*42)+(i2*2)+1);
                    }
                }
            }
    
        void FuelBaseTable_Mem2App()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si1 = FuelBaseTable[i][i2];
                    b = si1>>8;
                    fdserial_txChar(serial,b);
                    b = si1;
                    fdserial_txChar(serial,b);
                    pause(1);
                    }
                }
            }
    
        void FuelBaseTable_App2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si_accum = 0;
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = (rcv_c << 8);
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = si_accum + (rcv_c);
                    FuelBaseTable[i][i2] = si_accum;
                    }
                }
            }
    
    
        /* %%%%%%%%%%%%%%% IgnBaseTable Routines %%%%%%%%%%%%%%%*/
    
        void IgnBaseTable_EE2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 =0; i2 < 21; i2++ )
                    {
                    b1=ee_getByte(IgnBaseTable_org+(i*42)+(i2*2));
                    b2=ee_getByte(IgnBaseTable_org+(i*42)+(i2*2)+1);
                    IgnBaseTable[i][i2] = (b1<<8)+b2;
                    }
                }
            }
    
    
        void IgnBaseTable_Mem2EE()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    b1=IgnBaseTable[i][i2]>>8;
                    b2=IgnBaseTable[i][i2];
                    ee_putByte(b1,IgnBaseTable_org+(i*42)+(i2*2));
                    ee_putByte(b2,IgnBaseTable_org+(i*42)+(i2*2)+1);
                    }
                }
            }
    
        void IgnBaseTable_Mem2App()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si1 = IgnBaseTable[i][i2];
                    b = si1>>8;
                    fdserial_txChar(serial,b);
                    b = si1;
                    fdserial_txChar(serial,b);
                    pause(1);
                    }
                }
            }
    
    
    
    
    
    
        void IgnBaseTable_App2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si_accum = 0;
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = (rcv_c << 8);
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = si_accum + (rcv_c);
                    IgnBaseTable[i][i2] = si_accum;
                    }
                }
            }
    
    
        /* %%%%%%%%%%%%%%% AFRTable Routines %%%%%%%%%%%%%%%*/
    
        void AFRTable_EE2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 =0; i2 < 21; i2++ )
                    {
                    b1=ee_getByte(AFRTable_org+(i*42)+(i2*2));
                    b2=ee_getByte(AFRTable_org+(i*42)+(i2*2)+1);
                    AFRTable[i][i2] = (b1<<8)+b2;
                    }
                }
            }
    
    
        void AFRTable_Mem2EE()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    b1=AFRTable[i][i2]>>8;
                    b2=AFRTable[i][i2];
                    ee_putByte(b1,AFRTable_org+(i*42)+(i2*2));
                    ee_putByte(b2,AFRTable_org+(i*42)+(i2*2)+1);
                    }
                }
            }
    
        void AFRTable_Mem2App()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si1 = AFRTable[i][i2];
                    b = si1>>8;
                    fdserial_txChar(serial,b);
                    b = si1;
                    fdserial_txChar(serial,b);
                    pause(1);
                    }
                }
            }
    
        void AFRTable_App2Mem()
            {
            for (i = 0; i < 21; i++ )
                {
                for (i2 = 0; i2 < 21; i2++ )
                    {
                    si_accum = 0;
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = (rcv_c << 8);
                    rcv_c = fdserial_rxChar(serial);
                    si_accum = si_accum + (rcv_c);
                    AFRTable[i][i2] = si_accum;
                    }
                }
            }
    
    
        /* %%%%%%%%%%%%%%% CLTCompTable Routines %%%%%%%%%%%%%%%*/
    
        void CLTCompTable_EE2Mem()
            {
            for (i = 0; i < 13; i++ )
                {
                for (i2 =0; i2 < 13; i2++ )
                    {
                    b1=ee_getByte(CLTCompTable_org+(i*26)+(i2*2));
                    b2=ee_getByte(CLTCompTable_org+(i*26)+(i2*2)+1);
                    CLTCompTable[i][i2] = (b1<<8)+b2;
                    }
                }
            }
    
        void CLTCompTable_Mem2EE()
            {
            for (i = 0; i < 13; i++ )
                {
                for (i2 = 0; i2 < 13; i2++ )
                    {
                    b1=CLTCompTable[i][i2]>>8;
                    b2=CLTCompTable[i][i2];
                    ee_putByte(b1,CLTCompTable_org+(i*26)+(i2*2));
                    ee_putByte(b2,CLTCompTable_org+(i*26)+(i2*2)+1);
                    }
                }
            }
    
    
        void CLTCompTable_Mem2App()
            {
            }
    
        void CLTCompTable_App2Mem()
            {
            }
    
        /* %%%%%%%%%%%%%%% MATCompTable Routines %%%%%%%%%%%%%%%*/
    
        void MATCompTable_EE2Mem()
            {
            for (i = 0; i < 13; i++ )
                {
                for (i2 =0; i2 < 13; i2++ )
                    {
                    b1=ee_getByte(MATCompTable_org+(i*26)+(i2*2));
                    b2=ee_getByte(MATCompTable_org+(i*26)+(i2*2)+1);
                    MATCompTable[i][i2] = (b1<<8)+b2;
                    }
                }
            }
    
        void MATCompTable_Mem2EE()
            {
            for (i = 0; i < 13; i++ )
                {
                for (i2 = 0; i2 < 13; i2++ )
                    {
                    b1=MATCompTable[i][i2]>>8;
                    b2=MATCompTable[i][i2];
                    ee_putByte(b1,MATCompTable_org+(i*26)+(i2*2));
                    ee_putByte(b2,MATCompTable_org+(i*26)+(i2*2)+1);
                    }
                }
            }
    
    
        void MATCompTable_Mem2App()
            {
            }
    
        void MATCompTable_App2Mem()
            {
            }
    
    
    
        /* %%%%%%%%%%%%%%% Chan_Enable Routines %%%%%%%%%%%%%%%*/
    
    
    
        void Chan_Enab_EE2Mem()
            {
            for (i =0; i < 24; i++ )
                {
                Chan_Enab[i] = ee_getByte(Chan_Enab_org+i);
                }
            }
    
    
    
        void Chan_Enab_Mem2EE()
            {
            for (i = 0; i < 24; i++ )
                {
                ee_putByte(Chan_Enab[i],Chan_Enab_org+i);
                }
    
            }
    
        void Chan_Enab_Mem2App()
            {
            }
    
        void Chan_Enab_App2Mem()
            {
            }
    
    
    
        /* %%%%%%%%%%%%%%% Inj_Flow Routines %%%%%%%%%%%%%%%*/
    
        void Inj_Flow_EE2Mem()
            {
            b1 = ee_getByte(Inj_Flow_Pri_org);
            b2 = ee_getByte(Inj_Flow_Pri_org+1);
            Inj_Flow_Pri = (b1<<8)+b2;
            b1 = ee_getByte(Inj_Flow_Sec_org);
            b2 = ee_getByte(Inj_Flow_Sec_org+1);
            Inj_Flow_Sec = (b1<<8)+b2;
            }
    
        void Inj_Flow_Mem2EE()
            {
            b1 = Inj_Flow_Pri>>8;
            b2 = Inj_Flow_Pri;
            ee_putByte(b1,Inj_Flow_Pri_org);
            ee_putByte(b2,Inj_Flow_Pri_org+1);
            b1 = Inj_Flow_Sec>>8;
            b2 = Inj_Flow_Sec;
            ee_putByte(b1,Inj_Flow_Sec_org);
            ee_putByte(b2,Inj_Flow_Sec_org+1);
            }
    
        void Inj_Flow_Mem2App()
            {
            }
    
        void Inj_Flow_App2Mem()
            {
            }
    
    
        /*
        void CntReport()
        			{
        				li = 0;
        				PHSA = 0;
    
        				// Init CTRA
        				CTRA = (0b00001<<26);
        				FRQA = 10;
        				pause(4);
        				//li = CNT;
        				li = PHSA;
        				b = li>>24;
        				fdserial_txChar(serial,b);
        				b = li>>16;
        				fdserial_txChar(serial,b);
        				b = li>>8;
        				fdserial_txChar(serial,b);
        				b = li;
        				fdserial_txChar(serial,b);
        				pause(1);
        				CTRA = (0b00000<<26);
        			}
        */
    
    // Debugging stuff
    
        void sendint(int x)
            {
            b = x>>24;
            fdserial_txChar(serial,b);
            b = x>>16;
            fdserial_txChar(serial,b);
            b = x>>8;
            fdserial_txChar(serial,b);
            b = x;
            fdserial_txChar(serial,b);
            }
    
        void sendshortint(int x)
            {
            b = x>>8;
            fdserial_txChar(serial,b);
            b = x;
            fdserial_txChar(serial,b);
            }
    
        void ECUStats()
            {
            while (lock == 1); // Wait for lock to open
                {
                lock = 1;      // Set lock
                pause(5);
                sendshortint(rpm);
                sendshortint(map);
                sendint(fuelresult);
                //sendint(interp_loops);
                //temp1 = 100000000/cnts_per_calc_loop;
                sendint(cnts_per_calc_loop);
    			//temp1 = 100000000/cnts_per_test_loop;
                sendint(cnts_per_test_loop);
    
                int j,k;
                for (j = 0;  j < CALC_STACK_SIZE; j++)
                    if (calc_stack[j] != 0xA5A5A5A5)
                        break;
                k = CALC_STACK_SIZE - j;
                sendint(k);
                k=0;
                if (calc_stack_guard1 != 0xDEADBEEF)
                    k=1;
                if (calc_stack_guard2 != 0xDEADBEEF)
                    k=k+2;
                sendint(k);
                sendint(CALC_STACK_SIZE);
    
                for (j = 0;  j < INJ1_STACK_SIZE; j++)
                    if (inj1_stack[j] != 0xA5A5A5A5)
                        break;
                k = INJ1_STACK_SIZE - j;
                sendint(k);
                k=0;
                if (inj1_stack_guard1 != 0xDEADBEEF)
                    k=1;
                if (inj1_stack_guard2 != 0xDEADBEEF)
                    k=k+2;
                sendint(k);
                sendint(INJ1_STACK_SIZE);
    
                lock = 0;   // Clear lock
                }
            }
    
        /* === Copy EEPROM locations into hub memory === */
    
        FuelBaseTable_EE2Mem();
        IgnBaseTable_EE2Mem();
    //clttemp_2hub();
    //cltcorr_2hub();
    //voltvolt_2hub();
    //voltcorr_2hub();
    //fueltable_2hub();
    //igntable_2hub();
    //chanenab_2hub();
    
    
    
    
    
    
    
        /* =================================================================== */
    
        /* =================================================================== */
        /* For debug purposes - populate chan array */
    //    for (i =0; i < 24; i++ )  {
    //      RTV[i] = i*10+10;
        //Chan_Enab[i] = 1;
    //    }
        /* =================================================================== */
    
    
    
        while(1)
            {
            fdserial_rxFlush(serial);
            c = fdserial_rxChar(serial);
    
            switch (c)
                {
    
                case 1 :
                    {
    				rpm = 2500;
    				map = 50;
                    ECUStats();
                    }
                break;
    
                case 130 :                   // Ack PC App.
                    {
                    fdserial_txChar(serial,160);
                    fdserial_rxFlush(serial);  // Clear rcv buffer from extraneous Smile
                    }
                break;
    
                /* +++++++++++++ FuelBaseTable Management */
    
                case 10 :
                    {
                    FuelBaseTable_EE2Mem();
                    }
                break;
    
                case 11 :
                    {
                    FuelBaseTable_Mem2EE();
                    }
                break;
    
                case 12 :
                    {
                    FuelBaseTable_Mem2App();
                    }
                break;
    
                case 13 :
                    {
                    FuelBaseTable_App2Mem();
                    }
                break;
    
                /* +++++++++++++ IgnBaseTable Management */
    
                case 20 :
                    {
                    IgnBaseTable_EE2Mem();
                    }
                break;
    
                case 21 :
                    {
                    IgnBaseTable_Mem2EE();
                    }
                break;
    
                case 22 :
                    {
                    IgnBaseTable_Mem2App();
                    }
                break;
    
                case 23 :
                    {
                    IgnBaseTable_App2Mem();
                    }
                break;
    
                /* +++++++++++++ AFRTable Management */
    
                case 30 :
                    {
                    AFRTable_EE2Mem();
                    }
                break;
    
                case 31 :
                    {
                    AFRTable_Mem2EE();
                    }
                break;
    
                case 32 :
                    {
                    AFRTable_Mem2App();
                    }
                break;
    
                case 33 :
                    {
                    AFRTable_App2Mem();
                    }
                break;
    
    
    
                /* +++++++++++++ CLTCompTable Management */
    
                case 40 :
                    {
                    CLTCompTable_EE2Mem();
                    }
                break;
    
                case 41 :
                    {
                    CLTCompTable_Mem2EE();
                    }
                break;
    
                case 42 :
                    {
                    CLTCompTable_Mem2App();
                    }
                break;
    
                case 43 :
                    {
                    CLTCompTable_App2Mem();
                    }
                break;
    
    
                /* +++++++++++++ MATCompTable Management */
    
                case 50 :
                    {
                    CLTCompTable_EE2Mem();
                    }
                break;
    
                case 51 :
                    {
                    CLTCompTable_Mem2EE();
                    }
                break;
    
                case 52 :
                    {
                    CLTCompTable_Mem2App();
                    }
                break;
    
                case 53 :
                    {
                    CLTCompTable_App2Mem();
                    }
                break;
    
    
                case 255 :
                    {
                    Reboot();
                    }
                break;
    
    
    
    
                }
            }
    
        }
    
    
    void adc(void *par)
        {
        int adcloops;
        while(1)
            {
    
            }
        }
    
    
    __attribute__((fcache))			// Runs completely within cog. Yes!!!
    void inj1(void *par)            // Totally test code to see how counters are best
        {
        // implemented in PropGCC.
        DIRA |= (1 << 1);
        CTRA = (0b00100<<26)+1;
        FRQA = 1;
        while(1)
            {
            PHSA = -10000; // for 100 uSec pulse
            //pause(1);
            waitcnt(CLKFREQ/1000+CNT);
            }
        }
    
    
    
    
    
    
    //__attribute__((optimize("-Os")))
    void calc(void *par)
        {
        int ix,jx;
    	uint_fast32_t interp1, interp2, interp3;
        //long interp1, interp2, interp3;
        int adcloopcnt[8],loop;
    #ifndef USEGLOB
        uint_fast32_t calc_start_cnt = 0;
        uint_fast32_t calc_end_cnt = 0;
    #endif
    
        while(1)
            {
            while (lock == 1); // Wait for lock to open
                {
                lock = 1;      // Set lock
                calc_start_cnt = CNT;
    
    
                for (loop = 0; loop<9 ; loop++ )
                    {
                    if ((adcloopcnt[loop] == ADCChanPri[loop]))
                        {
                        //adcval[loop] = readADCAverage(loop,2,3,4,5);
                        adcloopcnt[loop] = 0;
                        }
                    else
                        {
                        adcloopcnt[loop]++;
                        }
                    }
    
    
    
    
    
                if(rpm > FuelBaseTable[0][20])
                    {
                    rpm = FuelBaseTable[0][20];
                    }
                else if(rpm < FuelBaseTable[0][1])
                    {
                    rpm = FuelBaseTable[0][1];
                    }
                if(map > FuelBaseTable[20][0])
                    {
                    map = FuelBaseTable[20][0];
                    }
                else if(map < FuelBaseTable[1][0])
                    {
                    map = FuelBaseTable[1][0];
                    }
                for (ix = 20-2; ix>-1; ix--)
                    {
                    if (map>FuelBaseTable[ix][0])
                        {
                        break;
                        }
                    }
    
                if(ix < 0)ix = 0;
    
                for (jx = 20-2; jx > -1; jx--)
                    {
                    if (rpm>FuelBaseTable[0][jx])
                        {
                        break;
                        }
                    }
    
                if(jx < 0)jx = 0;
    
                interp1 = FuelBaseTable[ix + 1][0] - FuelBaseTable[ix][0];
                if(interp1 != 0)
                    {
                    interp3 = (map - FuelBaseTable[ix][0]);
                    interp3 = (100 * interp3);
                    interp1 = interp3 / interp1;
                    }
    
                interp2 =	FuelBaseTable[0][jx + 1] - FuelBaseTable[0][jx];
                if(interp2 != 0)
                    {
                    interp3 = (rpm - FuelBaseTable[0][jx]);
                    interp3 = (100 * interp3);
                    interp2 = interp3 / interp2;
                    }
    
                fuelresult = ((100 - interp1) * (100 - interp2) * FuelBaseTable[ix][jx]
                                + interp1 * (100 - interp2) * FuelBaseTable[ix+1][jx]
                                + interp2 * (100 - interp1) * FuelBaseTable[ix][jx+1]
                                + interp1 * interp2 * FuelBaseTable[ix+1][jx+1]) / 10000;
    
    
                calc_end_cnt = CNT;
                cnts_per_calc_loop = calc_end_cnt - calc_start_cnt;
    
                lock = 0;
                }
            }
        }
    
    
    void test(void *par)
        {
    #ifndef USEGLOB
        uint_fast32_t test_start_cnt = 0;
        uint_fast32_t test_end_cnt = 0;
    #endif
        while(1)
            {
            while (lock == 1); // Wait for lock to open
                {
                lock = 1;
                test_start_cnt = CNT;
                //pause(2);
                test_end_cnt = CNT;
                cnts_per_test_loop = test_end_cnt - test_start_cnt;
                //pause(1);
                lock = 0;
                }
    
            }
        }
    

    Here's an activity log generated from the PC app:
    INF: 071614 21:50:59:330: Read <SERPORT.LEFI>, last ComPort used = COM6
    INF: 071614 21:50:59:331: Connect attempt on COM6
    INF: 071614 21:51:02:694: Connect successful on COM6
    INF: 071614 21:51:02:695: Entering btn_FuelBaseTable_HubMem2AppClick
    INF: 071614 21:51:02:695: Retrieving FuelBaseTable from ECU Hub Memory
    INF: 071614 21:51:03:158: ByteCount: T=1 R=882
    INF: 071614 21:51:03:159: Exiting btn_FuelBaseTable_HubMem2AppClick
    INF: 071614 21:51:03:159: Entering btn_IgnBaseTable_HubMem2AppClick
    INF: 071614 21:51:03:159: Retrieving IgnBaseTable from ECU Hub Memory
    INF: 071614 21:51:03:622: ByteCount: T=1 R=882
    INF: 071614 21:51:03:623: Exiting btn_IgnBaseTable_HubMem2AppClick
    INF: 071614 21:51:03:623: 
    INF: 071614 21:51:03:623: --------------------------------
    INF: 071614 21:51:03:623: **ECU config loaded**
    INF: 071614 21:51:09:510: RPM: 2500
    INF: 071614 21:51:09:512: MAP: 50
    INF: 071614 21:51:09:513: FuelResult: 7300
    INF: 071614 21:51:09:515: calcloops: -1473660629
    INF: 071614 21:51:09:516: testloops: 4
    INF: 071614 21:51:09:518: calc_stack used: 52 longs.
    INF: 071614 21:51:09:520: calc_stack guard violation code: 0
    INF: 071614 21:51:09:522: calc_stack_size: 64
    INF: 071614 21:51:09:524: inj1_stack used: 44 longs.
    INF: 071614 21:51:09:526: inj1_stack guard violation code: 0
    INF: 071614 21:51:09:528: inj1_stack_size: 64
    INF: 071614 21:51:11:893: RPM: 2500
    INF: 071614 21:51:11:895: MAP: 50
    INF: 071614 21:51:11:897: FuelResult: 7300
    INF: 071614 21:51:11:900: calcloops: -1235359445
    INF: 071614 21:51:11:902: testloops: 4
    INF: 071614 21:51:11:906: calc_stack used: 52 longs.
    INF: 071614 21:51:11:909: calc_stack guard violation code: 0
    INF: 071614 21:51:11:913: calc_stack_size: 64
    INF: 071614 21:51:11:916: inj1_stack used: 44 longs.
    INF: 071614 21:51:11:920: inj1_stack guard violation code: 0
    INF: 071614 21:51:11:923: inj1_stack_size: 64
    INF: 071614 21:51:14:661: RPM: 2500
    INF: 071614 21:51:14:664: MAP: 50
    INF: 071614 21:51:14:668: FuelResult: 7300
    INF: 071614 21:51:14:671: calcloops: -958564181
    INF: 071614 21:51:14:674: testloops: 4
    INF: 071614 21:51:14:677: calc_stack used: 52 longs.
    INF: 071614 21:51:14:681: calc_stack guard violation code: 0
    INF: 071614 21:51:14:684: calc_stack_size: 64
    INF: 071614 21:51:14:687: inj1_stack used: 44 longs.
    INF: 071614 21:51:14:691: inj1_stack guard violation code: 0
    INF: 071614 21:51:14:694: inj1_stack_size: 64
    INF: 071614 21:51:25:612: DebugMemo contents dumped to 2014215125.debuglog
    

    Here's the batch file that compiles it:
    del %1\%3\%2.elf
    propeller-elf-gcc.exe -I . -L . -I %1/SimpleLibraries/Utility/libsimpletools -L %1/SimpleLibraries/Utility/libsimpletools/%3/ -I %1/SimpleLibraries/TextDevices/libsimpletext -L %1/SimpleLibraries/TextDevices/libsimpletext/%3/ -I %1/SimpleLibraries/Protocol/libsimplei2c -L %1/SimpleLibraries/Protocol/libsimplei2c/%3/ -I %1/SimpleLibraries/TextDevices/libfdserial -L %1/SimpleLibraries/TextDevices/libfdserial/%3/ -o %3/%2.elf -O2 -m%3 -Wall -m32bit-doubles -fno-exceptions -std=c99 -ffunction-sections -fdata-sections -Wl,--gc-sections %2.c -lsimpletools -lsimpletext -lsimplei2c -lfdserial -lsimpletools -lsimpletext -lsimplei2c -lsimpletools -lsimpletext -lsimpletools
    if %errorlevel% equ 0 goto success
    pause
    exit
    :success
    propeller-load -q -b c3 -e -r %1\%3\%2.elf
    exit
    
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 19:11
    Here's .map:
    Archive member included because of file (symbol)
    
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(pause.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_pause)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(setPauseDt.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(pause.o) (_set_pause_dt)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_ee_getByte)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_putByte.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_ee_putByte)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o) (_i2c_in)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_out.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_putByte.o) (_i2c_out)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_init.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o) (_ee_init)
    C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_init.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_init.o) (_i2c_newbus)
    C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a(simplei2c.o)
                                  C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o) (_i2c_start)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial_utils.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_fdserial_rxFlush)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_fdserial_open)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(pst_firmware.o)
                                  C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o) (_binary_pst_dat_start)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm_close.o)
                                  C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o) (_simpleterm_close)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
                                  C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm_close.o) (_dport_ptr)
    C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(serial_rxtx.o)
                                  C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o) (_serial_rxChar)
    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(malloc.o)
                                  C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o) (_malloc)
    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(sbrk.o)
                                  c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(malloc.o) (__sbrk)
    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(thread.o)
                                  c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o (__TLS)
    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(cogstart.o)
                                  C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o (_cogstart)
    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(memset.o)
                                  c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o (_memset)
    
    Allocating common symbols
    Common symbol       size              file
    
    _eeInitFlag         0x4               C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
    _Inj_Flow_Sec       0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _st                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _lock               0x1               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _Inj_Flow_Pri       0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _eeprom             0x4               C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
    _lx                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _FuelBaseTable      0x6e4             C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _et                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _x2                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _CLTCompTable       0x2a4             C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _IgnBaseTable       0x6e4             C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _Chan_Enab          0x18              C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _ly                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _MATCompTable       0x2a4             C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _ft                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _yl                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _r                  0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _adcval             0x20              C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _ul                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _y2                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _hy                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _hx                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _rpm_y              0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _debug_serial       0x14              C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
    _r2                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _x1                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _y1                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _AFRTable           0x6e4             C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _RTV                0x60              C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _ll                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _r3                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _ur                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _lr                 0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    _fuelresult         0x4               C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    
    Discarded input sections
    
     .text          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/spinboot.o
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/spinboot.o
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/spinboot.o
     .text          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o
     .text          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
     .text          0x00000000        0x0 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss           0x00000000        0x0 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.adc      0x00000000       0x10 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.clt       0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.batt      0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.mat       0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.baro      0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.p1       0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.CEL      0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.Inj_Flow_Sec_org
                    0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.Inj_Flow_Pri_org
                    0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.Chan_Enab_org
                    0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data.MATCompTable_org
                    0x00000000        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(pause.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(setPauseDt.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(setPauseDt.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_putByte.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_putByte.o)
     .text          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o)
     .text          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_out.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_out.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_out.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_init.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_init.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_init.o)
     .text          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a(simplei2c.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a(simplei2c.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a(simplei2c.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial_utils.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial_utils.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm_close.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm_close.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
     .data          0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(serial_rxtx.o)
     .bss           0x00000000        0x0 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(serial_rxtx.o)
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(sbrk.o)
     .text          0x00000000        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(thread.o)
     .data          0x00000000        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(thread.o)
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(cogstart.o)
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(cogstart.o)
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(memset.o)
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(memset.o)
     .text          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
     .data          0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
     .bss           0x00000000        0x0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
    
    Memory Configuration
    
    Name             Origin             Length             Attributes
    hub              0x00000000         0x00008000
    cog              0x00000000         0x000007c0
    coguser          0x00000000         0x000007c0
    ram              0x20000000         0x10000000
    rom              0x30000000         0x10000000
    drivers          0xc0000000         0x00100000
    dummy            0xe0000000         0x00100000
    *default*        0x00000000         0xffffffff
    
    Linker script and memory map
    
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/spinboot.o
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
    LOAD C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
    LOAD C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a
    LOAD C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles\libgcc.a
    START GROUP
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles\libgcc.a
    END GROUP
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles\libgcc.a
    LOAD c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
    
    .boot           0x00000000       0x20
     *(.boot)
     .boot          0x00000000       0x20 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/spinboot.o
                    0x00000000                __clkfreq
                    0x00000004                __clkmode
                    0x00000008                __sys_mbox
    
    .lmmkernel      0x00000000      0x794 load address 0x00000020
     *(.lmmkernel)
     .lmmkernel     0x00000000      0x790 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crt0.o
                    0x00000000                r0
                    0x00000000                __LMM_entry
                    0x00000004                r1
                    0x00000008                r2
                    0x0000000c                r3
                    0x00000010                r4
                    0x00000014                r5
                    0x00000018                r6
                    0x0000001c                r7
                    0x00000020                r8
                    0x00000024                r9
                    0x00000028                r10
                    0x0000002c                r11
                    0x00000030                r12
                    0x00000034                r13
                    0x00000038                r14
                    0x0000003c                lr
                    0x00000040                sp
                    0x00000044                pc
                    0x000000ac                __LMM_MVI_r0
                    0x000000b8                __LMM_MVI_r1
                    0x000000c4                __LMM_MVI_r2
                    0x000000d0                __LMM_MVI_r3
                    0x000000dc                __LMM_MVI_r4
                    0x000000e8                __LMM_MVI_r5
                    0x000000f4                __LMM_MVI_r6
                    0x00000100                __LMM_MVI_r7
                    0x0000010c                __LMM_MVI_r8
                    0x00000118                __LMM_MVI_r9
                    0x00000124                __LMM_MVI_r10
                    0x00000130                __LMM_MVI_r11
                    0x0000013c                __LMM_MVI_r12
                    0x00000148                __LMM_MVI_r13
                    0x00000154                __LMM_MVI_r14
                    0x00000160                __LMM_MVI_lr
                    0x0000016c                __LMM_CALL
                    0x00000174                __LMM_CALL_INDIRECT
                    0x00000180                __LMM_JMP
                    0x00000188                __LMM_PUSHM
                    0x000001a8                __LMM_PUSHM_ret
                    0x000001b0                __LMM_POPRET
                    0x000001b8                __LMM_POPRET_ret
                    0x000001bc                __LMM_POPM
                    0x000001dc                __LMM_POPM_ret
                    0x000001e0                __MASK_0000FFFF
                    0x000001e4                __MASK_FFFFFFFF
                    0x000001e8                __TMP0
                    0x000001fc                __CLZSI
                    0x00000200                __CTZSI
                    0x00000238                __CLZSI_ret
                    0x00000244                __UDIVSI
                    0x00000288                __UDIVSI_ret
                    0x00000290                __DIVSI
                    0x000002b8                __DIVSI_ret
                    0x000002c8                __MULSI
                    0x000002e8                __MULSI_ret
                    0x000002ec                __C_LOCK_PTR
                    0x000002f0                __CMPSWAPSI
                    0x00000310                __CMPSWAPSI_ret
                    0x0000031c                __LMM_RET
                    0x00000320                __LMM_FCACHE_LOAD
                    0x00000390                __LMM_FCACHE_START
     *(.kernel)
     .kernel        0x00000790        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(thread.o)
                    0x00000790                __TLS
    
    .init           0x000007b4       0xb8
     *(.init*)
     .init          0x000007b4       0xa0 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
                    0x000007b4                start
                    0x000007b4                entry
                    0x000007fc                ___init
     .init          0x00000854       0x18 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
    
    .text           0x0000086c     0x269c
     *(.text*)
     .text.calc     0x0000086c      0x438 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x0000086c                _calc
     .text.test     0x00000ca4       0x54 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00000ca4                _test
     .text.inj1     0x00000cf8       0x60 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00000cf8                _inj1
     .text.sendshortint.2937
                    0x00000d58       0x5c C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.sendint.2934
                    0x00000db4       0x98 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.FuelBaseTable_EE2Mem.2775
                    0x00000e4c      0x12c C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.IgnBaseTable_EE2Mem.2807
                    0x00000f78      0x134 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.CLTCompTable_EE2Mem.2871
                    0x000010ac      0x134 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.CLTCompTable_Mem2EE.2879
                    0x000011e0      0x144 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .text.startup.main
                    0x00001324      0xebc C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00001324                _main
     .text          0x000021e0       0x6c C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(pause.o)
                    0x000021e0                _pause
     .text          0x0000224c       0x10 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(setPauseDt.o)
                    0x0000224c                _set_pause_dt
     .text          0x0000225c       0x88 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
                    0x0000225c                _ee_getByte
     .text          0x000022e4       0xa0 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_putByte.o)
                    0x000022e4                _ee_putByte
     .text          0x00002384       0x44 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_init.o)
                    0x00002384                _ee_init
     .text          0x000023c8       0x70 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_init.o)
                    0x000023c8                _i2c_newbus
     .text          0x00002438       0xe8 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial_utils.o)
                    0x00002438                _fdserial_rxFlush
                    0x00002460                _fdserial_rxReady
                    0x00002488                _fdserial_rxTime
                    0x000024f8                _fdserial_txFlush
     .text          0x00002520      0x328 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(fdserial.o)
                    0x00002520                _fdserial_open
                    0x00002680                _fdserial_txEmpty
                    0x000026ac                _fdserial_rxCheck
                    0x00002700                _fdserial_rxChar
                    0x00002728                _fdserial_txChar
                    0x000027c8                _fdserial_close
     .text          0x00002848       0x4c C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm_close.o)
                    0x00002848                _simpleterm_close
     .text          0x00002894      0x10c C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
                    0x00002894                _simpleterm_open
                    0x00002990                _simpleterm_pointer
     .text          0x000029a0      0x130 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(serial_rxtx.o)
                    0x00002a20                _serial_rxChar
                    0x00002a78                _serial_txChar
     .text          0x00002ad0      0x300 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(malloc.o)
                    0x00002c50                __common_malloc
                    0x00002d48                _hubmalloc
                    0x00002d70                _malloc
                    0x00002d98                _free
                    0x00002db4                _hubfree
     .text          0x00002dd0       0x1c c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(sbrk.o)
                    0x00002dd0                __hubsbrk
                    0x00002dd0                __sbrk
                    0x00002dd0                _sbrk
     .text          0x00002dec       0x80 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(cogstart.o)
                    0x00002dec                _cogstart
     .text          0x00002e6c       0x9c c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(memset.o)
                    0x00002e6c                _memset
                    0x00002f08                _etext = .
    
    .fini           0x00002f08       0x3c
     *(.fini*)
     .fini          0x00002f08       0x28 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtbegin.o
                    0x00002f08                _exit
     .fini          0x00002f30       0x14 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
                    0x00002f34                __Exit
                    0x00002f34                __exit
                    0x00002f40                __ExitHook
    
    .hub            0x00002f44      0x810
     *(.hubstart)
     *(.hubtext*)
     .hubtext       0x00002f44       0xc8 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_in.o)
                    0x00002f44                _i2c_in
     .hubtext       0x0000300c       0xa8 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_out.o)
                    0x0000300c                _i2c_out
     .hubtext       0x000030b4      0x4d4 C:\PropGCC_EFI/SimpleLibraries/Protocol/libsimplei2c/lmm/\libsimplei2c.a(simplei2c.o)
                    0x00003138                _i2c_start
                    0x000031ec                _i2c_stop
                    0x0000326c                _i2c_open
                    0x000032d4                _i2c_writeByte
                    0x00003390                _i2c_readByte
                    0x0000348c                _i2c_writeData
                    0x000034ec                _i2c_readData
                    0x00003558                _i2c_poll
     *(.hubdata*)
     *(.hub)
     .hub           0x00003588       0x2c C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
                    0x00003588                _debug_port
                    0x000035b0                _dport_ptr
     *(.data)
     .data          0x000035b4        0x8 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .data          0x000035bc      0x150 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libfdserial/lmm/\libfdserial.a(pst_firmware.o)
                    0x000035bc                _binary_pst_dat_start
                    0x0000370c                _binary_pst_dat_end
     .data          0x0000370c        0x8 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(malloc.o)
                    0x0000370c                __malloc_heap
     .data          0x00003714        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(sbrk.o)
                    0x00003714                __heap_base
     *(.data*)
     .data.map      0x00003718        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003718                _map
     .data.rpm      0x0000371c        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x0000371c                _rpm
     .data.AFRTable_org
                    0x00003720        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003720                _AFRTable_org
     .data.CLTCompTable_org
                    0x00003724        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003724                _CLTCompTable_org
     .data.IgnBaseTable_org
                    0x00003728        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003728                _IgnBaseTable_org
     .data.FuelBaseTable_org
                    0x0000372c        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x0000372c                _FuelBaseTable_org
     .data.ADCChanPri
                    0x00003730       0x20 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003730                _ADCChanPri
     *(.rodata)
     *(.rodata*)
     *(.gnu.linkonce.d*)
                    0x00003750                PROVIDE (__C_LOCK, .)
                    0x00003750        0x4 LONG 0x0
    
    .ctors          0x00003754        0x8
     *(.ctors*)
     .ctors         0x00003754        0x4 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
     .ctors         0x00003758        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
                    0x00003758                __argv
                    0x00003758                __environ
    
    .dtors          0x0000375c        0x4
     *(.dtors*)
     .dtors         0x0000375c        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/short-doubles/_crtend.o
    
    .data           0x00003760        0x0
                    0x00003760                . = ALIGN (0x4)
    
    .bss            0x00003760     0x1f64
                    0x00003760                PROVIDE (__bss_start, .)
     *(.bss)
     .bss           0x00003760        0x4 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(pause.o)
                    0x00003760                _pauseTicks
     .bss           0x00003764       0xa4 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(i2c_init.o)
                    0x00003764                _buscnt
     .bss           0x00003808        0x4 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(malloc.o)
     .bss           0x0000380c       0xa8 c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/lib/short-doubles\libc.a(thread.o)
                    0x0000380c                ___napuntil_ptr
     *(.bss*)
     .bss.cnts_per_test_loop
                    0x000038b4        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x000038b4                _cnts_per_test_loop
     .bss.cnts_per_calc_loop
                    0x000038b8        0x4 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x000038b8                _cnts_per_calc_loop
     .bss.calc_stack
                    0x000038bc      0x100 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.test_stack
                    0x000039bc      0x100 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     .bss.inj1_stack
                    0x00003abc      0x100 C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
     *(COMMON)
     COMMON         0x00003bbc     0x1aec C:\Users\pmrobert\AppData\Local\Temp\cckZi7vh.o
                    0x00003bbc                _Inj_Flow_Sec
                    0x00003bc0                _st
                    0x00003bc4                _lock
                    0x00003bc8                _Inj_Flow_Pri
                    0x00003bcc                _lx
                    0x00003bd0                _FuelBaseTable
                    0x000042b4                _et
                    0x000042b8                _x2
                    0x000042bc                _CLTCompTable
                    0x00004560                _IgnBaseTable
                    0x00004c44                _Chan_Enab
                    0x00004c5c                _ly
                    0x00004c60                _MATCompTable
                    0x00004f04                _ft
                    0x00004f08                _yl
                    0x00004f0c                _r
                    0x00004f10                _adcval
                    0x00004f30                _ul
                    0x00004f34                _y2
                    0x00004f38                _hy
                    0x00004f3c                _hx
                    0x00004f40                _rpm_y
                    0x00004f44                _r2
                    0x00004f48                _x1
                    0x00004f4c                _y1
                    0x00004f50                _AFRTable
                    0x00005634                _RTV
                    0x00005694                _ll
                    0x00005698                _r3
                    0x0000569c                _ur
                    0x000056a0                _lr
                    0x000056a4                _fuelresult
     COMMON         0x000056a8        0x8 C:\PropGCC_EFI/SimpleLibraries/Utility/libsimpletools/lmm/\libsimpletools.a(eeprom_getByte.o)
                    0x000056a8                _eeInitFlag
                    0x000056ac                _eeprom
     COMMON         0x000056b0       0x14 C:\PropGCC_EFI/SimpleLibraries/TextDevices/libsimpletext/lmm/\libsimpletext.a(simpleterm.o)
                    0x000056b0                _debug_serial
                    0x000056c4                PROVIDE (__bss_end, .)
    
    .hub_heap       0x000056c4        0x4
                    0x000056c8                . = (. + 0x4)
     *fill*         0x000056c4        0x4 00
                    0x000056c4                ___hub_heap_start = ADDR (.hub_heap)
    
    .drivers
     *(.drivers)
                    0x00000020                __load_start_kernel = LOADADDR (.lmmkernel)
                    0x00003754                ___CTOR_LIST__ = ADDR (.ctors)
                    0x0000375c                ___DTOR_LIST__ = ADDR (.dtors)
    
    .hash
     *(.hash)
    
    .dynsym
     *(.dynsym)
    
    .dynstr
     *(.dynstr)
    
    .gnu.version
     *(.gnu.version)
    
    .gnu.version_d
     *(.gnu.version_d)
    
    .gnu.version_r
     *(.gnu.version_r)
    
    .rel.init
     *(.rel.init)
    
    .rela.init
     *(.rela.init)
    
    .rel.text
     *(.rel.text)
     *(.rel.text.*)
     *(.rel.gnu.linkonce.t*)
    
    .rela.text
     *(.rela.text)
     *(.rela.text.*)
     *(.rela.gnu.linkonce.t*)
    
    .rel.fini
     *(.rel.fini)
    
    .rela.fini
     *(.rela.fini)
    
    .rel.rodata
     *(.rel.rodata)
     *(.rel.rodata.*)
     *(.rel.gnu.linkonce.r*)
    
    .rela.rodata
     *(.rela.rodata)
     *(.rela.rodata.*)
     *(.rela.gnu.linkonce.r*)
    
    .rel.data
     *(.rel.data)
     *(.rel.data.*)
     *(.rel.gnu.linkonce.d*)
    
    .rela.data
     *(.rela.data)
     *(.rela.data.*)
     *(.rela.gnu.linkonce.d*)
    
    .rel.ctors
     *(.rel.ctors)
    
    .rela.ctors
     *(.rela.ctors)
    
    .rel.dtors
     *(.rel.dtors)
    
    .rela.dtors
     *(.rela.dtors)
    
    .rel.got
     *(.rel.got)
    
    .rela.got
     *(.rela.got)
    
    .rel.bss
     *(.rel.bss)
    
    .rela.bss
     *(.rela.bss)
    
    .rel.plt
     *(.rel.plt)
    
    .rela.plt
     *(.rela.plt)
    
    .stab
     *(.stab)
    
    .stabstr
     *(.stabstr)
    
    .stab.excl
     *(.stab.excl)
    
    .stab.exclstr
     *(.stab.exclstr)
    
    .stab.index
     *(.stab.index)
    
    .stab.indexstr
     *(.stab.indexstr)
    
    .comment
     *(.comment)
    
    .debug
     *(.debug)
    
    .line
     *(.line)
    
    .debug_srcinfo
     *(.debug_srcinfo .zdebug_srcinfo)
    
    .debug_sfnames
     *(.debug_sfnames .zdebug_sfnames)
    
    .debug_aranges
     *(.debug_aranges .zdebug_aranges)
    
    .debug_pubnames
     *(.debug_pubnames .zdebug_pubnames)
    
    .debug_info
     *(.debug_info .gnu.linkonce.wi.* .zdebug_info)
    
    .debug_abbrev
     *(.debug_abbrev .zdebug_abbrev)
    
    .debug_line
     *(.debug_line .zdebug_line)
    
    .debug_frame
     *(.debug_frame .zdebug_frame)
    
    .debug_str
     *(.debug_str .zdebug_str)
    
    .debug_loc
     *(.debug_loc .zdebug_loc)
    
    .debug_macinfo
     *(.debug_macinfo .zdebug_macinfo)
                    0x000007c0                PROVIDE (par, PAR)
                    0x000007c4                PROVIDE (cnt, CNT)
                    0x000007c8                PROVIDE (ina, INA)
                    0x000007cc                PROVIDE (inb, INB)
                    0x000007d0                PROVIDE (outa, OUTA)
                    0x000007d4                PROVIDE (outb, OUTB)
                    0x000007d8                PROVIDE (dira, DIRA)
                    0x000007dc                PROVIDE (dirb, DIRB)
                    0x000007e0                PROVIDE (ctra, CTRA)
                    0x000007e4                PROVIDE (ctrb, CTRB)
                    0x000007e8                PROVIDE (frqa, FRQA)
                    0x000007ec                PROVIDE (frqb, FRQB)
                    0x000007f0                PROVIDE (phsa, PHSA)
                    0x000007f4                PROVIDE (phsb, PHSB)
                    0x000007f8                PROVIDE (vcfg, VCFG)
                    0x000007fc                PROVIDE (vscl, VSCL)
                    0x000056d4                PROVIDE (__hub_end, (ADDR (.hub_heap) + 0x10))
                    0x00008000                PROVIDE (__stack_end, 0x8000)
    OUTPUT(lmm/EFI20140716.elf elf32-propeller)
    
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 19:14
    Here's the .asm - it's larger than 100K characters so can't post it in message code block.
    EFI20140716.asm
  • pmrobertpmrobert Posts: 673
    edited 2014-07-16 19:21
    And here's c3.cfg. A C3 is running with a 6.25mHz crystal.
    # c3.cfg
    # IDE:SDLOAD
    # IDE:SDXMMC
        clkfreq: 100000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        tvpin: 12   # only used if TV_DEBUG is defined
        cache-driver: c3_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        sd-driver: sd_driver.dat
        sdspi-do: 10
        sdspi-clk: 11
        sdspi-di: 9
        sdspi-clr: 25
        sdspi-inc: 8
        sdspi-addr: 5
    
  • jazzedjazzed Posts: 11,803
    edited 2014-07-16 19:52
    Thanks.

    I'll have a look in the morning when I'm fresh.

    SimpleIDE has a zip/archive that makes posting such projects a snap. It's ok to use other environments of course. I use vim and the command line when not writing Propeller programs unless a reasonable vendor package is available. I owe it to everyone to use the programs Parallax and I publish for Propeller. I do. Sometimes the dog-food is pretty bad, most of the time it tastes like candy (to me at least).
  • ersmithersmith Posts: 6,054
    edited 2014-07-17 07:03
    One thing I notice is that you consistently declare the global variables as "volatile" (as I think you should) but leave the "volatile" off of the local versions. Have you tried the local with "volatile"? It's very possible that if the locals are not volatile then the compiler is re-arranging some of the calculations so that end_cnt and start_cnt are not being read when you think they are.
  • pmrobertpmrobert Posts: 673
    edited 2014-07-17 07:03
    In that case, here's the zipped version that SimpleIDE generates. That is a much easier, all inclusive and more elegant solution.

    pmrobert.zip
  • pmrobertpmrobert Posts: 673
    edited 2014-07-17 07:26
    ersmith wrote: »
    One thing I notice is that you consistently declare the global variables as "volatile" (as I think you should) but leave the "volatile" off of the local versions. Have you tried the local with "volatile"? It's very possible that if the locals are not volatile then the compiler is re-arranging some of the calculations so that end_cnt and start_cnt are not being read when you think they are.
    That fixed it, it works if I declare calc_start_cnt as volatile. Things also work correctly with or without declaring the locals as volatile if I give that function "__attribute__((optimize("-O0")))" although that increases code size by ~2K and runs at less than half the speed. I guess I need to be more aware of the optimizer being a little over aggressive as a cause when weird stuff pops up. Another stubbed toe, another day - it's all worth it, thank you!
  • Dave HeinDave Hein Posts: 6,347
    edited 2014-07-17 10:12
    It shouldn't matter if your start_cnt and end_cnt variables are volatile or global, or whether they are static or stack variables. It is important that the cnts_per variables are volatile if they aren't referenced anywhere else in the file, but since they are referenced elsewhere I don't think these even need to be volatile.

    If you compile with the -S option you can save the intermediate assembly file. The assembly file shows that your test routine is run from FCACHE since it is so small. I think the problem may be a timing issue, where the test routine is setting the lock before calc can test it for 0. That is, test is clearing and setting lock so quickly that calc never has a chance to see it with a value of 0. When you change some variables from local to global it probably changes the timing enough where calc gets to run.

    Can you add a run count for calc and test, and print that out periodically? You may see that calc never runs a single loop.
  • pmrobertpmrobert Posts: 673
    edited 2014-07-17 13:28
    I did that and all 3 functions in separate cogs that use the lock are running and incrementing their loop counters as expected with the original issue (minor though it is, I'd like to understand it!) still existing. One thing I'm going to do is fall back and regroup by refactoring things so all variables are int_32. The compiler has "fixed" some of my type incompatibility errors with it's default behavior - which is fine - I'm the problem, not the compiler. My plan going forward is to make every variable volatile and int_32, get everything working properly then work on size and speed. I'll be doing this tonight and will report back. Advice and comments are actively solicited, as always.

    -Mike
  • pmrobertpmrobert Posts: 673
    edited 2014-07-19 08:55
    pgccefi(1).zip

    I have taken out all the "lock" related references, disabled all other functions and tried every optimization with various combinations of var declaration. volatile global & volatile local work, with the global being a bit faster. local nonvolatile gives that same erroneous result unless I compile with -O0 or comment out the fuelresult= equation at the end of calc. I can live with that but am unsettled as to the "why doesn't it work and will this bite me in the butt again?" issue as well as the idea that using nonvolatile locals should be the fastest and smallest implementation of my attempts at profiling measurement. As Dave says, "It shouldn't matter if your start_cnt and end_cnt variables are volatile or global, or whether they are static or stack variables." I have 3 defines, "CONDITION_x" in the attached version with the results of each. Any ideas?
Sign In or Register to comment.