Help about compile with st20cc.exe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SatX
    New Member
    • Jan 2007
    • 4

    Help about compile with st20cc.exe

    Hi to all,
    I have question about compile with st20cc.exe
    How can compile one source code with st20cc.exe???
    Example:
    Code:
    /* Includes --------------------------------------------------------------- */
    #include "emu.h"
    #include "crypto.h"
    #include <string.h>
    
    //---------------------------------------------------------------------------
    
    int conax_ecm (byte *ecm, byte *dw, byte *emu_buf) {
    	int keyIdx;
    	byte *e,*n;
    
    	if(!emu_buf[0x20A]) return false; // send to card
    	keyIdx=ecm[6];
    	if(keyIdx==emu_buf[0xEF4]) {
    		e=emu_buf+0xEF6;
    		n=emu_buf+0xF76;
    	}
    	else if(keyIdx==emu_buf[0xEF5]) {
    		e=emu_buf+0xF36;
    		n=emu_buf+0xFB6;
    	}
    	else return false; // key not found in emu
    	return ( conax_decrypt (ecm+7,(int)ecm[4]-2,e,n,dw) );
    }
    
    int conax_decrypt (byte *buf, byte len, byte *e1, byte *n1, byte *plainwords) {
    	int i, j, num, index, nDigits, eDigits;
    	const byte hash[] = {0x05, 0x00, 0x05};
    
    	NN_DIGIT N1[MAX_NN_DIGITS], E1[MAX_NN_DIGITS], ecm[MAX_NN_DIGITS], decm[MAX_NN_DIGITS];
    
    	NN_Decode(N1,MAX_NN_DIGITS,n1, 64);
    	NN_Decode(E1,MAX_NN_DIGITS,e1, 64);
    	nDigits = NN_Digits (N1, MAX_NN_DIGITS);
    	eDigits = NN_Digits (E1, MAX_NN_DIGITS);
    
    	// begin RSA decrypt
    	if (buf[-2]==0x63) num = 1;
    	else num = 0;
    	for (i=len;i>0;)  {
    		index = i-64;  
    		if(index < 0) index = 0;
    
    		NN_Decode(ecm,MAX_NN_DIGITS,buf+index,64);
    		R_memset((POINTER)decm,0,sizeof(decm));
    		NN_ModExp(decm,ecm,E1,eDigits,N1,nDigits);
    		NN_Encode(buf+index,64-num,decm,MAX_NN_DIGITS);
    		if(num) {
    			len=len-num;
    			for(j=index+64-num; j < len; j++) buf[j]=buf[j+num];
    		}
    		if (i>120){
    			if (i%60) i-=i%60;
    			else i-=64;
    		}
    		else i-=64;
    	}
    	if(memcmp(hash, buf+2, 3) == 0 &&  memcmp(buf+5, buf+len-5, 5) == 0) {
    		/* Signature correct, parse decrypted packet */
    		ParseECM(buf+10,len-10,plainwords);
    		return true;
    	} else return false;	// Signature incorrect
    
    }
    
    void ParseECM (byte *buf, byte len, byte *plainwords) {
      int i;
      for(i=0; i<len; ) {
        byte nano = buf[i++];
        byte nanolen = buf[i++];
    
        switch(nano) {
        case 0x80:
        case 0x82:
          ParseECM(buf+i+3, nanolen-3, plainwords);
          break;
        case 0x81:
          ParseECM(buf+i+2, nanolen-2, plainwords);
          break;
        case 0x30:
          if(plainwords) {
    				memcpy(plainwords, buf+i+10, 8);
    				memcpy(plainwords+8, buf+i+2, 8);
    			}
          break;
        default:
          break;
        }
        i += nanolen;
      }
    }
    Please help me,
  • SatX
    New Member
    • Jan 2007
    • 4

    #2
    I performed this But I cannot compile it
    Code:
     st20cc: ST20
    ST20 Toolchain driver ...
    
    Usage: st20cc <filename> {-option}
    Options include: 
    F                 run only C++ preprocessor and C++ compiler
    I <directory>     Specify include directory
    NS                do not include default startup file to linker
    O0                disable optimization
    S                 produce assembly language
    T <scriptfile>    specify linker indirect file
    c                 suppress linking
    g                 comprehensive debugging data
    o <filename>      specify output file
    off <type>        format <type> of the output file to be produced
    p <procedure>     specify command procedure to execute
    v                 verbose mode
    w                 suppress all compiler warnings
    
    A complete option list is provided by the help option
    Default options may be placed in the environment variable ST20CCARG
    How can compile C Source code to Binary file(.bin)???

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      The command line you want is

      st20cc <filename>.c

      However the code you have provided is not a complete program so you can not link to a bin.

      Comment

      • SatX
        New Member
        • Jan 2007
        • 4

        #4
        Originally posted by Banfa
        The command line you want is

        st20cc <filename>.c

        However the code you have provided is not a complete program so you can not link to a bin.
        Ok thanks But Can you explain or instruction compile source code to .bin with st20cc.exe?!?!?

        I need to help you,

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          My memory of using the ST20 Toolset is that we used st20link.exe to link all the objects created with st20cc.exe (using the -c, compile only switch) to create a binary image.

          The dedicated linker program has many options and I think you will need to look them up in the documentation (which is available in the compiler program tree).

          Comment

          • SatX
            New Member
            • Jan 2007
            • 4

            #6
            Originally posted by Banfa
            My memory of using the ST20 Toolset is that we used st20link.exe to link all the objects created with st20cc.exe (using the -c, compile only switch) to create a binary image.

            The dedicated linker program has many options and I think you will need to look them up in the documentation (which is available in the compiler program tree).
            I have ST20 Toolset v1.8.1 & v1.9.6 But I have problem in use of st20link.exe to link all the objects created with st20cc.exe who switch C source to .bin

            Can you guide me to use of st20link.exe to link all the objects created with st20cc.exe and compile C source to .bin please???

            I amnot an expert

            Comment

            • ALSFelix
              New Member
              • Oct 2007
              • 1

              #7
              Hi.

              Can anyone help me to aquire the latest versions of these softwares:

              # SGS-Thomson Transputer ANSI C Toolset
              # SGS-Thomson Transputer Occam 2.1 Toolset
              # SGS-Thomson C++ for ST20 and T4/T8 Transputers

              I have some but they are very old and i can't find new ones.
              I've asked for help from SGS-Thomson but all thet tell me is to contact some company called ARROW but dont tell me how and i can't find them...

              Can anyone help me?

              Thank you.

              Comment

              • Banfa
                Recognized Expert Expert
                • Feb 2006
                • 9067

                #8
                About 2 minutes with Google got me http://www.arrowne.com/arrow_worldwide/uk/main.html who seam to meet the 2 criteria of being called Arrow and being an ST-Microelectronic supplier.

                Comment

                Working...