Пример #1
0
void Gpdasm::processInput( ProcessOptions options )
{
	resetLanguageProcess();
	m_asmOutput = "";
	m_processOptions = options;;

	*m_languageProcess << ("gpdasm");

	*m_languageProcess << ("--processor");
 	*m_languageProcess << ( options.m_picID );
	*m_languageProcess << ( options.inputFiles().first() );

	if ( !start() )
	{
		// QMessageBox::critical( LanguageManager::self()->logView(), tr("Disassembly failed. Please check you have gputils installed.") );
        qDebug() << "disassembly failed";
		processInitFailed();
		return;
	}
}
Пример #2
0
void Gplib::processInput( ProcessOptions options )
{
	resetLanguageProcess();
	m_processOptions = options;
	
	*m_languageProcess << ("gplib");
	*m_languageProcess << ("--create");
	
	*m_languageProcess << ( options.intermediaryOutput() );
	
	const QStringList inputFiles = options.inputFiles();
	QStringList::const_iterator end = inputFiles.end();
	for ( QStringList::const_iterator it = inputFiles.begin(); it != end; ++it )
		*m_languageProcess << ( *it );

	if ( !start() )
	{
		KMessageBox::sorry( LanguageManager::self()->logView(), i18n("Linking failed. Please check you have gputils installed.") );
		processInitFailed();
		return;
	}
}
Пример #3
0
void Microbe::processInput( ProcessOptions options )
{
    resetLanguageProcess();
    m_processOptions = options;

    *m_languageProcess << ("microbe");

    // Input Asm file
    *m_languageProcess << ( options.inputFiles().first() );

    // Output filename
    *m_languageProcess << ( options.intermediaryOutput() );

    *m_languageProcess << ("--show-source");

    if ( !start() )
    {
//		QMessageBox::critical( LanguageManager::self()->logView(), tr("Assembly failed. Please check you have KTechlab installed properly (\"microbe\" could not be started).") );
        qCritical() << "assembly failed";
        processInitFailed();
        return;
    }
}
Пример #4
0
void SDCC::processInput( ProcessOptions options )
{
    resetLanguageProcess();

    MicroInfo * info = MicroLibrary::self()->microInfoWithID( options.m_picID );
    if (!info)
    {
        outputError( i18n("Could not find PIC with ID \"%1\".").arg(options.m_picID) );
        return;
    }

    m_processOptions = options;

    *m_languageProcess << ("sdcc");


    //BEGIN Pass custom sdcc options
#define ARG(text,option) if ( KTLConfig::text() ) *m_languageProcess << ( QString("--%1").arg(option) );
    // General
    ARG( sDCC_nostdlib,			"nostdlib" )
    ARG( sDCC_nostdinc,			"nostdinc" )
    ARG( sDCC_less_pedantic,		"less-pedantic" )
    ARG( sDCC_std_c89,			"std-c89" )
    ARG( sDCC_std_c99,			"std-c99" )

    // Code generation
    ARG( sDCC_stack_auto,			"stack-auto" )
    ARG( sDCC_int_long_reent,		"int-long-reent" )
    ARG( sDCC_float_reent,			"float-reent" )
    ARG( sDCC_fommit_frame_pointer,	"fommit-frame-pointer" )
    ARG( sDCC_no_xinit_opt,			"no-xinit-opt" )
    ARG( sDCC_all_callee_saves,		"all-callee-saves" )

    // Optimization
    ARG( sDCC_nooverlay,			"nooverlay" )
    ARG( sDCC_nogcse,			"nogcse" )
    ARG( sDCC_nolabelopt,			"nolabelopt" )
    ARG( sDCC_noinvariant,			"noinvariant" )
    ARG( sDCC_noinduction,			"noinduction" )
    ARG( sDCC_no_peep,			"no-peep" )
    ARG( sDCC_noloopreverse,		"noloopreverse" )
    ARG( sDCC_opt_code_size,		"opt-code-size" )
    ARG( sDCC_opt_code_speed,		"opt-code-speed" )
    ARG( sDCC_peep_asm,			"peep-asm" )
    ARG( sDCC_nojtbound,			"nojtbound" )

    // PIC16 Specific
    if ( info->instructionSet()->set() == AsmInfo::PIC16 )
    {
        ARG( sDCC_nodefaultlibs,		"nodefaultlibs" )
        ARG( sDCC_pno_banksel,			"pno-banksel" )
        ARG( sDCC_pstack_model_large,	"pstack-model=large" )
        ARG( sDCC_debug_xtra,			"debug-xtra" )
        ARG( sDCC_denable_peeps,		"denable-peeps" )
        ARG( sDCC_calltree,			"calltree" )
        ARG( sDCC_fstack,			"fstack" )
        ARG( sDCC_optimize_goto,		"optimize-goto" )
        ARG( sDCC_optimize_cmp,			"optimize-cmp" )
        ARG( sDCC_optimize_df,			"optimize-df" )
    }
#undef ARG

    if ( !KTLConfig::miscSDCCOptions().isEmpty() )
        *m_languageProcess << ( KTLConfig::miscSDCCOptions() );
    //END Pass custom sdcc options


    *m_languageProcess << ("--debug"); // Enable debugging symbol output
    *m_languageProcess << ("-S"); // Compile only; do not assemble or link

    QString asmSwitch;
    switch ( info->instructionSet()->set() )
    {
    case AsmInfo::PIC12:
        // Last time I checked, SDCC doesn't support Pic12, and probably never will, but whatever...
        asmSwitch = "-mpic12";
        break;
    case AsmInfo::PIC14:
        asmSwitch = "-mpic14";
        break;
    case AsmInfo::PIC16:
        asmSwitch = "-mpic16";
        break;
    }

    *m_languageProcess << (asmSwitch);

    *m_languageProcess << ( "-"+options.m_picID.lower() );

    *m_languageProcess << ( options.inputFiles().first() );

    *m_languageProcess << ("-o");
    *m_languageProcess << ( options.intermediaryOutput() );

    if ( !start() )
    {
        KMessageBox::sorry( LanguageManager::self()->logView(), i18n("Compilation failed. Please check you have sdcc installed.") );
        processInitFailed();
        return;
    }
}
Пример #5
0
void Gplink::processInput( ProcessOptions options )
{
	resetLanguageProcess();
	m_processOptions = options;
	
	*m_languageProcess << ("gplink");
	
	if ( !options.m_hexFormat.isEmpty() )
	{
		*m_languageProcess << ("--hex-format");
		*m_languageProcess << (options.m_hexFormat);
	}
	
	if ( options.m_bOutputMapFile )
		*m_languageProcess << ("--map");
	
	if ( !options.m_libraryDir.isEmpty() )
	{
		*m_languageProcess << ("--include");
		*m_languageProcess << ( options.m_libraryDir );
	}
	
	if ( !options.m_linkerScript.isEmpty() )
	{
		*m_languageProcess << ("--script");
		*m_languageProcess << ( options.m_linkerScript );
	}
	
	if ( !options.m_linkOther.isEmpty() )
		*m_languageProcess << (options.m_linkOther);
	
	// Output hex file
	*m_languageProcess << ("--output");
	*m_languageProcess << ( options.intermediaryOutput() );
	
	// Input object file
	const QStringList inputFiles = options.inputFiles();
	QStringList::const_iterator end = inputFiles.end();
	for ( QStringList::const_iterator it = inputFiles.begin(); it != end; ++it )
		*m_languageProcess << ( *it );
	
	// Other libraries
	end = options.m_linkLibraries.end();
	for ( QStringList::const_iterator it = options.m_linkLibraries.begin(); it != end; ++it )
		*m_languageProcess << ( *it );
	
	// if selected to automatically link to SDCC libraries, add some options.
	if( KTLConfig::gplink_link_shared() ) 
	{	
		// set up the include directory
		MicroInfo * info = MicroLibrary::self()->microInfoWithID( options.m_picID );
		if ( ! info )
		{
			// be program won't link anyway, but the user can't say that the program didn't try
			kError() << k_funcinfo << "Couldn't find the requested PIC" << options.m_picID << endl;
			kWarning() << k_funcinfo << "Supposing that the pic is pic12 or pic14" << endl;
			*m_languageProcess << "-I" << m_sdccLibDir + "/pic" ;
		}
		else
		{
			if ( info->instructionSet()->set() == AsmInfo::PIC16 )
				*m_languageProcess << "-I" << m_sdccLibDir + "/pic16" ;
			else
				*m_languageProcess << "-I" << m_sdccLibDir + "/pic" ;
		
			// to pic to link against
			*m_languageProcess << options.m_picID.lower().replace ( "p","pic" ) + ".lib";
		}
		*m_languageProcess << "libsdcc.lib";
	}
	
	if ( !start() )
	{
		KMessageBox::sorry( LanguageManager::self()->logView(), i18n("Linking failed. Please check you have gputils installed.") );
		processInitFailed();
		return;
	}
}
Пример #6
0
void Gpasm::processInput( ProcessOptions options )
{
	resetLanguageProcess();
	m_processOptions = options;

	AsmParser p( options.inputFiles().first() );
	p.parse();

	*m_languageProcess << ("gpasm");

	if ( ProcessOptions::ProcessPath::from( options.processPath() ) == ProcessOptions::ProcessPath::AssemblyRelocatable )
		*m_languageProcess << ("--object");

// 	*m_languageProcess << ("--debug-info"); // Debug info

	// Output filename
	*m_languageProcess << ("--output");
	*m_languageProcess << ( options.intermediaryOutput() );

	if ( !options.m_hexFormat.isEmpty() )
	{
		*m_languageProcess << ("--hex-format");
		*m_languageProcess << (options.m_hexFormat);
	}

	// Radix
	if ( !p.containsRadix() )
	{
		*m_languageProcess << ("--radix");
		switch( KtlConfig::self()->radix() )
		{
            case KtlConfig::Binary:
				*m_languageProcess << ("BIN");
				break;
			case KtlConfig::Octal:
				*m_languageProcess << ("OCT");
				break;
			case KtlConfig::Hexadecimal:
				*m_languageProcess << ("HEX");
				break;
			case KtlConfig::Decimal:
			default:
				*m_languageProcess << ("DEC");
				break;
		}
		*m_languageProcess << ("DEC"); // choose the default
	}

	// Warning Level
	*m_languageProcess << ("--warning");
	switch( KtlConfig::self()->gpasmWarningLevel() )
	{
		case KtlConfig::Warnings:
			*m_languageProcess << ("1");
			break;
		case KtlConfig::Errors:
			*m_languageProcess << ("2");
			break;
		default:
		case KtlConfig::All:
			*m_languageProcess << ("0");
			break;
	}

	// Ignore case
	if ( KtlConfig::self()->ignoreCase() )
		*m_languageProcess << ("--ignore-case");
	// Dos formatting
	if ( KtlConfig::self()->dosFormat() )
		*m_languageProcess << ("--dos");

	// Force list
	if ( options.b_forceList )
		*m_languageProcess << ("--force-list");

	// Other options
	if ( !KtlConfig::self()->miscGpasmOptions().isEmpty() )
		*m_languageProcess << ( KtlConfig::self()->miscGpasmOptions() );
	// Input Asm file
	*m_languageProcess << ( options.inputFiles().first() );

	if ( !start() )
	{
		// KMessageBox::sorry( LanguageManager::self()->logView(), tr("Assembly failed. Please check you have gputils installed.") );
        qCritical() << "assembly failed";
		processInitFailed();
		return;
	}
}