Help Porting minimal to aarch64 armv8

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
jsouriv
Posts: 3
Joined: Thu Sep 12, 2019 10:18 pm

Help Porting minimal to aarch64 armv8

Post by jsouriv » Thu Sep 12, 2019 10:59 pm

Hello,

I am trying to get the minimal port of uPython to run on the Arm cortex-a53 cpu. I so far have switched the compiler and linker to use the arm tools gcc-arm-aarch64-elf. I have also changed mp_int_t and mp_uint_t to be 64 bit values from this post: viewtopic.php?p=29374#p29379

Yet when I run make, the elf file seems to be completely empty. Can anyone point out what else I am missing?

Thank you

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

Re: Help Porting minimal to aarch64 armv8

Post by jimmo » Fri Sep 13, 2019 12:48 am

Hi,

Can I get some more information about what you've done?

Which version and distribution of aarch64-gcc are you using?

Did you set CROSS=1

Did you change CFLAGS_CORTEX_M4 with the relevant settings for a53?

What do you mean by the elf was empty? Like actually a zero byte file?

User avatar
jsouriv
Posts: 3
Joined: Thu Sep 12, 2019 10:18 pm

Re: Help Porting minimal to aarch64 armv8

Post by jsouriv » Fri Sep 13, 2019 4:07 pm

Hi jimmo,

1. In addition to changing flags in the Makefile, I made the following changes to mpconfigport.h:

--- a/ports/minimal/mpconfigport.h
+++ b/ports/minimal/mpconfigport.h
@@ -7,6 +7,8 @@
+#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_D)
+#define MICROPY_NLR_SETJMP (1)

@@ -20,7 +22,7 @@
-#define MICROPY_ENABLE_GC (1)
+#define MICROPY_ENABLE_GC (0)

@@ -66,12 +68,12 @@
-#define UINT_FMT "%u"
-#define INT_FMT "%d"
-typedef int mp_int_t; // must be pointer size
-typedef unsigned mp_uint_t; // must be pointer size
+#define UINT_FMT "%lu"
+#define INT_FMT "%ld"
+typedef int64_t mp_int_t; // must be pointer size
+typedef uint64_t mp_uint_t; // must be pointer size

-typedef long mp_off_t;
+typedef long long mp_off_t;

2. I am using CROSS_COMPILE = ~/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-elf-
3. I did set CROSS=1
4. I am using the following for CFLAGS:
CFLAGS_CORTEX_A53 = -mcpu=cortex-a53 -fsingle-precision-constant -Wdouble-promotion
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_A53) $(COPT)

5. The elf file was not a zero byte file but the sections were all empty: text, data, bss, etc.

Side note: when I run "file build/firmware.elf" it says there is a corrupted program header...

Post Reply