how to decompile bytecode into human readable format

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: how to decompile bytecode into human readable format

Post by dhylands » Mon Dec 21, 2020 2:51 pm

Are you using pybricks? If so, the source code appears to be here: https://github.com/pybricks/pybricks-micropython

jcase
Posts: 3
Joined: Sun Dec 20, 2020 5:50 pm

Re: how to decompile bytecode into human readable format

Post by jcase » Mon Dec 21, 2020 6:28 pm

MasterOfGizmo wrote:
Sun Nov 29, 2020 8:44 pm
Any news on this?

The Lego Spike hub runs micropython and the source code doesn't seem to be public. Its default UI comes in form of a mpy and can easily be downloaded from the device. It would be nice to be able to decompile and modify this.
Can you provide these compiled mpy to me? jon <at> cunninglogic <dot> com, or explain to me what a lego spike hub is and where I can buy one?

I've got a semi working disassembler done. Hoping to make it stable, then work on a decompiler.

mohankrr
Posts: 1
Joined: Mon Dec 28, 2020 5:59 pm

Re: how to decompile bytecode into human readable format

Post by mohankrr » Mon Dec 28, 2020 11:26 pm

jcase wrote:
Mon Dec 21, 2020 6:28 pm
Can you provide these compiled mpy to me? jon <at> cunninglogic <dot> com, or explain to me what a lego spike hub is and where I can buy one?

I've got a semi working disassembler done. Hoping to make it stable, then work on a decompiler.
Check this repo.. this is regularly updated and there is some work going on here related to decompiler.

https://github.com/gpdaniels/spike-prime

The following folder contains the file sytem files (mpy) from various versions of the Lego Spike and Lego Mindstorms inventor firmwares..
https://github.com/gpdaniels/spike-prim ... filesystem

The current version of decompiler is here..
https://github.com/gpdaniels/spike-prim ... decompiler

Some conversations on it is here:
https://github.com/gpdaniels/spike-prime/pull/10

jcase
Posts: 3
Joined: Sun Dec 20, 2020 5:50 pm

Re: how to decompile bytecode into human readable format

Post by jcase » Fri Jan 08, 2021 7:21 pm

mohankrr wrote:
Mon Dec 28, 2020 11:26 pm
jcase wrote:
Mon Dec 21, 2020 6:28 pm
Can you provide these compiled mpy to me? jon <at> cunninglogic <dot> com, or explain to me what a lego spike hub is and where I can buy one?

I've got a semi working disassembler done. Hoping to make it stable, then work on a decompiler.
Check this repo.. this is regularly updated and there is some work going on here related to decompiler.

https://github.com/gpdaniels/spike-prime

The following folder contains the file sytem files (mpy) from various versions of the Lego Spike and Lego Mindstorms inventor firmwares..
https://github.com/gpdaniels/spike-prim ... filesystem

The current version of decompiler is here..
https://github.com/gpdaniels/spike-prim ... decompiler

Some conversations on it is here:
https://github.com/gpdaniels/spike-prime/pull/10
Thanks, my decompiler is somewhat reliable now, but im off on another project for the time being, work has me slammed

bobo
Posts: 4
Joined: Tue Mar 02, 2021 7:44 am

Re: how to decompile bytecode into human readable format

Post by bobo » Mon Mar 08, 2021 2:46 pm

Can I compile a py file using mpy-cross and run it directly using micropython (without any import or etc.)?

thanks

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: how to decompile bytecode into human readable format

Post by jimmo » Thu Mar 11, 2021 5:14 am

bobo wrote:
Mon Mar 08, 2021 2:46 pm
Can I compile a py file using mpy-cross and run it directly using micropython (without any import or etc.)?
Can you clarify what you mean? You'd like to copy the .mpy file to the device and have it run automatically on startup?

Or you want to run the .mpy directly from RAM (e.g. using pyboard.py).

Post Reply