Anyone port to AArch64?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
jlipham
Posts: 4
Joined: Mon Aug 13, 2018 2:25 pm

Anyone port to AArch64?

Post by jlipham » Tue Aug 14, 2018 3:57 pm

Hello,

I think I tried to post earlier, but for whatever reason it's not showing up so I'll try again!

Has anyone already ported MicroPython to AArch64? I know a few people are targeting older ARM chips for the RPi1 and 2, but I'm thinking of getting it going on the 3. I'd rather not reinvent the wheel if someone has already done it though!

Thanks a bunch, and just let me know and I'll look into it if needed!

Best,
Jimmy

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Anyone port to AArch64?

Post by jickster » Tue Aug 14, 2018 6:14 pm

jlipham wrote:
Tue Aug 14, 2018 3:57 pm
Hello,

I think I tried to post earlier, but for whatever reason it's not showing up so I'll try again!

Has anyone already ported MicroPython to AArch64? I know a few people are targeting older ARM chips for the RPi1 and 2, but I'm thinking of getting it going on the 3. I'd rather not reinvent the wheel if someone has already done it though!

Thanks a bunch, and just let me know and I'll look into it if needed!

Best,
Jimmy
Since you can run a 32-bit executable on 64-bit hardware, what advantage is there in compiling it as 64-bit?

User avatar
jlipham
Posts: 4
Joined: Mon Aug 13, 2018 2:25 pm

Re: Anyone port to AArch64?

Post by jlipham » Tue Aug 14, 2018 6:27 pm

[quote=jickster post_id=29352 time=1534270464 user_id=3167]
Since you can run a 32-bit executable on 64-bit hardware, what advantage is there in compiling it as 64-bit?
[/quote]

The thought is that if I'm running it on the bare metal, it'll make a difference as well as run properly under QEMU Raspi3 AArch64 emulation if needed.

loboris
Posts: 317
Joined: Fri Oct 02, 2015 6:19 pm

Re: Anyone port to AArch64?

Post by loboris » Wed Aug 15, 2018 10:52 am

jlipham wrote:
Tue Aug 14, 2018 6:27 pm
The thought is that if I'm running it on the bare metal, it'll make a difference as well as run properly under QEMU Raspi3 AArch64 emulation if needed.
Is there any bare metal MicroPython port on ARM (32 or 64 bit) other than this one for RPi Zero.

User avatar
jlipham
Posts: 4
Joined: Mon Aug 13, 2018 2:25 pm

Re: Anyone port to AArch64?

Post by jlipham » Wed Aug 15, 2018 12:56 pm

loboris wrote:
Wed Aug 15, 2018 10:52 am
Is there any bare metal MicroPython port on ARM (32 or 64 bit) other than this one for RPi Zero.
Not that I've found. Hence I intend to create one or port an existing one over. From what I've found, QEMU gets a bit squirrelly when you're trying to emulate AArch64 (using the -M raspi3 setting) with a 32 bit kernel file.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Anyone port to AArch64?

Post by jickster » Wed Aug 15, 2018 9:46 pm

To port to 64-bit, there's two categories of stuff you need to consider: core micropython and C-modules you've added.

CORE MICROPYTHON - define mp_int_t, mp_uint_t as 64-bit

https://github.com/micropython/micropyt ... er+size%22

Code: Select all

typedef int32_t mp_int_t; // must be pointer size
typedef uint32_t mp_uint_t; // must be pointer size
For 64-bit, you'd change them to be the 64-bit versions int64_t and uint64_t

CORE MICROPYTHON - choose correct object model from mpconfig.h

You cannot choose REPR C because that's only 32-bit but you can choose any of the other 3.

OTHER CODE

Once you've configured "CORE MICROPYTHON", only thing left is any C-modules you've added.
What about the C-modules that come with micropython? Well I'm assuming the stuff that's checked-in is written to properly take advantage of 64-bit in case it is thus configured.

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Anyone port to AArch64?

Post by jickster » Thu Aug 16, 2018 3:18 pm

loboris wrote:
Wed Aug 15, 2018 10:52 am
jlipham wrote:
Tue Aug 14, 2018 6:27 pm
The thought is that if I'm running it on the bare metal, it'll make a difference as well as run properly under QEMU Raspi3 AArch64 emulation if needed.
Is there any bare metal MicroPython port on ARM (32 or 64 bit) other than this one for RPi Zero.
Referring to my post viewtopic.php?p=29374#p29379 the only CODE you'd need to change is that for the peripherals: SPI, ADC, etc.

User avatar
jlipham
Posts: 4
Joined: Mon Aug 13, 2018 2:25 pm

Re: Anyone port to AArch64?

Post by jlipham » Sat Aug 18, 2018 10:51 pm

Hey jickster

Thanks for your expert advice! After a bit of tinkering, I've got the REPL showing up over UART on a Raspberry Pi 3 (AArch64) under QEMU. It also runs on hardware. Now I've got to diagnose a few issues with UART input, but that shouldn't be bad at all, then I'm off to get the framebuffer running.

Again, thanks!
Screen Shot 2018-08-18 at 5.51.19 PM.png
Screen Shot 2018-08-18 at 5.51.19 PM.png (25.61 KiB) Viewed 608 times

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Anyone port to AArch64?

Post by jickster » Sun Aug 19, 2018 1:40 am

jlipham wrote:Hey jickster

Thanks for your expert advice! After a bit of tinkering, I've got the REPL showing up over UART on a Raspberry Pi 3 (AArch64) under QEMU. It also runs on hardware. Now I've got to diagnose a few issues with UART input, but that shouldn't be bad at all, then I'm off to get the framebuffer running.

Again, thanks!
Screen Shot 2018-08-18 at 5.51.19 PM.png
I’m definitely not the expert but I think this issue is not that complicated.

Always happy to help when I can.

Post Reply