Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Ads

Discussion Groups

Discussion Groups | Comp.Arch.Embedded | Assembler to C converter for PIC?

There are 15 messages in this thread.

You are currently looking at messages 0 to 10.

Assembler to C converter for PIC? - booth multiplier - 03:35 05-04-05

Hi All,
 Has anybody heard of an assembly to C converter tool for Microchip
PICs. A Converter from MPASM to C, or is it impossible?
Thanks



Re: Assembler to C converter for PIC? - 10:15 05-04-05

booth multiplier wrote:
> Hi All,
>  Has anybody heard of an assembly to C converter tool for Microchip
> PICs. A Converter from MPASM to C, or is it impossible?
> Thanks

It's called reverse engineering.  Pretty straight-forward
and the converter tool is the brain.

Regards,
Ken Asbury


Re: Assembler to C converter for PIC? - SFC - 05:00 06-04-05

Only if you convert it from a hex file to asm or c i'll call it reverse 
engineering......

SFC

<a...@yahoo.com> schreef in bericht 
news:1...@l41g2000cwc.googlegroups.com...
>
> booth multiplier wrote:
>> Hi All,
>>  Has anybody heard of an assembly to C converter tool for Microchip
>> PICs. A Converter from MPASM to C, or is it impossible?
>> Thanks
>
> It's called reverse engineering.  Pretty straight-forward
> and the converter tool is the brain.
>
> Regards,
> Ken Asbury
> 



Re: Assembler to C converter for PIC? - Meindert Sprang - 05:23 06-04-05

"SFC" <s...@hetnet.nl> wrote in message
news:d308pk$383$1...@reader10.wxs.nl...
> Only if you convert it from a hex file to asm or c i'll call it reverse
> engineering......

Indeed. Converting from assembler to C is more like gambling....

Meindert



Re: Assembler to C converter for PIC? - Mike Fields - 21:55 06-04-05

It's easy .. if using the CCS PIC compiler, the following example ...

int count;
 #asm
      movlw    0x8
      movwf    count
 #endasm

or in other flavors of "C"
    asm("assembly_lang_statment");

Sorry -- I couldn't resist ;-)  You mean that was not what he
meant ??

mikey


"Meindert Sprang" <m...@NOcustomSPAMware.nl> wrote in message
news:1...@corp.supernews.com...
> "SFC" <s...@hetnet.nl> wrote in message
> news:d308pk$383$1...@reader10.wxs.nl...
> > Only if you convert it from a hex file to asm or c i'll call it reverse
> > engineering......
>
> Indeed. Converting from assembler to C is more like gambling....
>
> Meindert
>
>



Re: Assembler to C converter for PIC? - booth multiplier - 05:24 07-04-05

I meant something like this:
>       movlw    0x8
>       movwf    count
transforms to:

 count=8;

I was asking for a MPASM to C translator not for a Decompiler. I
thought it would be not so hard as MPASM has a specific Syntax.
 

"Mike Fields" <s...@comcast.net> wrote in message
news:<b...@comcast.com>...
> It's easy .. if using the CCS PIC compiler, the following example ...
> 
> int count;
>  #asm
>       movlw    0x8
>       movwf    count
>  #endasm
> 
> or in other flavors of "C"
>     asm("assembly_lang_statment");
> 
> Sorry -- I couldn't resist ;-)  You mean that was not what he
> meant ??
> 
> mikey
> 
> 
> "Meindert Sprang" <m...@NOcustomSPAMware.nl> wrote in message
> news:1...@corp.supernews.com...
> > "SFC" <s...@hetnet.nl> wrote in message
> > news:d308pk$383$1...@reader10.wxs.nl...
> > > Only if you convert it from a hex file to asm or c i'll call it reverse
> > > engineering......
> >
> > Indeed. Converting from assembler to C is more like gambling....
> >
> > Meindert
> >
> >

Re: Assembler to C converter for PIC? - Tauno Voipio - 06:53 07-04-05

booth multiplier wrote:
> I meant something like this:
> 
>>      movlw    0x8
>>      movwf    count
> 
> transforms to:
> 
>  count=8;
> 
> I was asking for a MPASM to C translator not for a Decompiler. I
> thought it would be not so hard as MPASM has a specific Syntax.
>  

All C compilers convert the code via assembly language.
The stage may not be externally viewable, but it's there
anyway. This is the compilation process. It loses very
much information of the original C code, and all the
information cannot be automatically restored.

The process of converting from machine code (hex, binary,
or whatever format) to assembly language is much simpler,
and it can be for the most part performed automatically.
This process is usually called dis-assembly. Even here
much of the information in the original code is missing
and has to be manually re-created.

The specific syntax and semantics of assembly language
helps very little in the whole picture of re-creating
the lost information needed to reconstruct the C source.

Your example is one of the easiest parts in a decompilation
process. Try again with some optimized loops with array
addressing to see the larger picture. The whole decompilation
process is like solving a cross-word puzzle.

Been there - done that.

-- 

Tauno Voipio
tauno voipio (at) iki fi


Re: Assembler to C converter for PIC? - Walter Banks - 09:02 07-04-05

Send me a private email with contact information. We may be able to help you.

w..


booth multiplier wrote:

> I meant something like this:
> >       movlw    0x8
> >       movwf    count
> transforms to:
>
>  count=8;


Re: Assembler to C converter for PIC? - Ben Bradley - 22:49 07-04-05

On 5 Apr 2005 00:35:56 -0700, b...@hotmail.com (booth
multiplier) wrote:

>Hi All,
> Has anybody heard of an assembly to C converter tool for Microchip
>PICs. A Converter from MPASM to C, or is it impossible?

   This thread seems to be arguing over what's possible (and what you
describe IS called a decompiler), but there's plenty of info on Usenet
as well as the Web, as you'll find if you search for:
assembly C decompiler
(see weblinks below)

   My short-to-medium answer is yes, sort of, it's possible for a
program to read a particular assembly (or equivalently, machine)
language and spit out a C program that does the same thing, but: 1)
the code compiled from that C program will surely be larger and slower
than the original machine/assembly code, and 2) it may not really be
any more readable than the assembly code. Code such as this (6502):

	ldx	10d
label005:
	jsr	sub003
	dex
	bne	label005

through a decompiler might look like this:

	int register_x;
	register_x = 10;
label005:
	sub003();
	registerx--;
	if (registerx != 0)
		goto label005;

   You rarely see labels and goto's in C, but that would be the most
straightforward (easiest for the decompiler writer) way of translating
it. Such a translator could generate 'for' and 'while' statements, but
that would mean recognizing several assembly statements as being
equivalent to such a high-level statement. Such things can be done
(this might be called an 'optimizing deompiler', but it might be only
marginally helpful.
   If your assembly is hand-written with comments and labels that make
sense in the context of the program, a decompiler could (and should)
pick these up and put them in the appropriate places of the C code.

   Google searches bring up lots of threads and discussion, mostly for
x86, though I saw a mention of 8051. I didn't look specifically for
PIC. Many references were about writing such a decompiler such as this
one:
http://compilers.iecc.com/comparch/article/86-04-001

   Here's a neat webpage showing 'original' C code on the left and
after compiling and running through the decompiler, apparently for
x86:
http://www.debugmode.com/dcompile/disc.htm

   Does that (the C code on the right) look like the kind of output
you were thinking of?

   If you think that's usable, do a search-engine search for a PIC
decompiler.

>Thanks

   Sorry you asked yet?  :-)

-----
http://mindspring.com/~benbradley

Re: Assembler to C converter for PIC? - hamilton - 23:00 07-04-05

I would like to know whose code are you trying to steal ???

| 1 | 2 | next