Page 1 of 1
ARMv8/AArch64
Posted: Wed Dec 20, 2017 7:54 pm
by Tetraeder
Hi,
I tried to port the "minimal" to AArch64 but the repl does not work properly.
I get the access to the REPL ">>>" but if I type a simple "print", the controller executes his whole ARMv8 register and get stucked
But if I enter the Paste-Mode and paste some lines, it works fine. If the lines increase it prints also the ARMv8 register and get stucked.
Is there a define to switch to 64bit?
or is the reason because the memory allocation of GC?
Thanks in advance!
Re: ARMv8/AArch64
Posted: Sat Dec 23, 2017 5:06 am
by jickster
Tetraeder wrote: ↑Wed Dec 20, 2017 7:54 pm
Hi,
I tried to port the "minimal" to AArch64 but the repl does not work properly.
I get the access to the REPL ">>>" but if I type a simple "print", the controller executes his whole ARMv8 register and get stucked
But if I enter the Paste-Mode and paste some lines, it works fine. If the lines increase it prints also the ARMv8 register and get stucked.
Is there a define to switch to 64bit?
or is the reason because the memory allocation of GC?
Thanks in advance!
1. Turn off garbage collection and test again. The macro is MICROPY_ENABLE_GC. You will eventually run out of heap but at least you will eliminate that as a potential issue.
2. What happens if you test with correct expressions?
a = 3
b = a * 4
3. When you simply type “print” I think you may be triggering the Micro python error and exception handling mechanism which currently does not support ARM V8 unless you configure the build to use setjmp.h ( which you have to supply). Details are below:
This is the file that has assembly code which is architecture specific; This code is used for exceptions.
https://github.com/micropython/micropyt ... nlrthumb.c
Referencing the list of macros for architectures listed here
https://www.keil.com/pack/doc/CMSIS/Cor ... 6545ce59aa
You can see that technically there is no explicit support for armv8 so You need to supply the header file setjmp.h and set MICROPY_NLR_SETJMP 1 (see nlr.h) OR you need to supply your own implementation for nlr_push() and nlr_pop().
4. Can you please rephrase this? I am not sure exactly what you meant to say
the controller executes his whole ARMv8 register
Re: ARMv8/AArch64
Posted: Wed Jan 03, 2018 4:54 pm
by Tetraeder
Hi jickster,
* I used the uPy version 1.9.3.
1. MICROPY_ENABLE_GC -> off: same problem and the controller get stucked in "mp_init()". Even no REPL start.
2. Same problem.
- repl.png (49.63 KiB) Viewed 6018 times
3. Sorry, wrong statement. I wrote a simple "print("hello"):
but it works in Paste-Mode:
- paste_mode.png (42.19 KiB) Viewed 6018 times
Thanks for the information about nlr_push and nlr_pop. Is will not work if I change the registers names to ARMv8 syntax, right?
For example AArch64 Register X0 instead of R0 of AArch32.
I've found some information to port AArch32 to AArch64 -> here
http://infocenter.arm.com/help/index.js ... EGDHF.html
I keep trying....
4. I meant the ARM registers X0-X30 and special registers. (first picture)
Re: ARMv8/AArch64
Posted: Fri Jan 05, 2018 9:13 am
by Tetraeder
I solved my problem but I'm not sure why this occures a problem. And if it can lead to further problems! I keep trying....
The REPL get stucked in readline.c
https://github.com/micropython/micropyt ... ine.c#L436
At the this string-compare
strcmp(MP_STATE_PORT(readline_hist)[0], line)
It works with no array index of readline_hist ->
strcmp(MP_STATE_PORT(readline_hist), line)
And I did not write my own implementation of NLR I used -> #define MICROPY_NLR_SETJMP
Re: ARMv8/AArch64
Posted: Fri Jan 05, 2018 3:23 pm
by Tetraeder
And finally calling "readline_init0" in main.c also solved the issue a post before
Re: ARMv8/AArch64
Posted: Fri Jan 12, 2018 2:17 pm
by Tetraeder
further changes: set function failed "def test():",
solved with: in mpconfigport.h I changed the typedef's
typedef int64_t mp_int_t
typedef uint64_t mp_uint_t;
typedef long long mp_off_t;
and defined "#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_D)"
Re: ARMv8/AArch64
Posted: Tue Feb 27, 2018 1:29 pm
by Tetraeder
Update:
I had the problem with executing loops.
The program stucked in /py/vmc.c in MP_BC_JUMP by the macro DECODE_SLABEL.
The ISSUE-3201:
https://github.com/micropython/micropython/issues/3201, helps to find the right keyword:
unaligned access
AArch64/ARMv8 supports unaligned access out of box but I need opposite.
I used the build flag
-mstrict-align, for "unaligned accesses" are forbidden.
Compiler: AArch64 from linaro
maybe also useful, from the ARM-Manual. But not known flags for linaro-gcc:
-munaligned-access
-mno-unaligned-access
Re: ARMv8/AArch64
Posted: Mon Sep 16, 2019 5:05 pm
by jsouriv
Can I ask what flags you passed to the compiler and linker to successfully cross compile the code to this architecture? Having issues even getting to the REPL.
Are you running the .elf using qemu?