AnsweredAssumed Answered

Help with simple xgate code to test a binutils port I did. S12XDP512

Question asked by sean keys on Jul 8, 2010
Latest reply on Jul 11, 2010 by sean keys

Hi I have created a binutils port to allow xgate assembly programming(  I have verified the output of the test suite, what I'm trying to do now is create a simple test. 


My init code looks like this


void initXgate(){

    unsigned short *memBuffer = (unsigned short*)&TXBuffer;
    unsigned char i;

    /* write an entry in the vector table */
    for(i = 0x12; i; i--, memBuffer++){ /* first vector-table entry starts 0x24 after vector base address */
        *memBuffer = 0;
    *memBuffer = (unsigned short)0x4800; /* Our first xgate thread starts here (s12x sees as E1x8800) */
    *memBuffer = (unsigned short)&(PORTP); /* address of LEDs */
    //*memBuffer = (unsigned short)&(PORTS);

    eraseSector(0xE0,(unsigned short *)0x8800);
    writeSector(RPAGE, (unsigned short*)&TXBuffer, 0xE0, (unsigned short*)0x8800); /* xgate sees flash starting at paged address0xE0_0x8800 */

    // XGATE threads execute from flash
    // Set the XGVBR register to its start address in flash (page 0xE0 after 2K register space)
    XGVBR = (unsigned short )0x0800;

    // Enable XGate and XGate interrupts
    XGMCTL= (unsigned short)0x8181;



My software trigger code looks like this

    XGSWT = 0x0101;


Any my xgate code looks like this.



     ; need code to flip LED(s)



Right now the CPU freezes unless I comment out my  XGSWT statement.  My s19 dump looks good.  My guess is that I'm missing some things. 


Any input would be greatly appreciated.