New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic native ARM emitter #833

Merged
merged 2 commits into from Aug 28, 2014

Conversation

Projects
None yet
4 participants
@Vogtinator
Copy link
Contributor

Vogtinator commented Aug 27, 2014

Resolves issue #800.
It closely resembles the thumb2 emitter, due to the similiarities and is feature-wise on par.
A basic fibonacci snippet

def fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)

print(fib(30))

executes sucessfully, as does tests/micropython/viper.py.
The command line works as well. I haven't implemented a better use of registers > R7, as it was unclear for me what to change.

@Vogtinator Vogtinator force-pushed the Vogtinator:arm-native branch from 49ab4be to 97e543b Aug 27, 2014

@Vogtinator Vogtinator force-pushed the Vogtinator:arm-native branch from 97e543b to fe3d16e Aug 27, 2014

@dpgeorge

This comment has been minimized.

Copy link
Contributor

dpgeorge commented Aug 27, 2014

Thank you, it looks really solid!

py/asmarm.c Outdated
*
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Fabian Vogt

This comment has been minimized.

@dpgeorge

dpgeorge Aug 27, 2014

Contributor

You probably didn't write any of this in 2013 :)

This comment has been minimized.

@Vogtinator

Vogtinator Aug 27, 2014

Contributor

Sure? I could have copy-pasted my name :P

This comment has been minimized.

@dpgeorge

dpgeorge Aug 27, 2014

Contributor

True, and also maybe you copied some of your other existing code to encode ARM instructions, so that's a fair point. (But then, did you also copy code from asmthumb.c?)

#include "asmarm.h"

// wrapper around everything in this file
#if MICROPY_EMIT_ARM

This comment has been minimized.

@dpgeorge

dpgeorge Aug 27, 2014

Contributor

Is 'ARM' a fair name to use for this new emitter, that won't clash with another emitter later on? I mean, are there any other ARM instruction sets to support?

This comment has been minimized.

@Vogtinator

Vogtinator Aug 27, 2014

Contributor

It's called "ARM Architecture Reference Manual", so that's the official name. With the newer 64bit counterpart, AArch64, it could also be called "AArch32", but there's no reason for it.
Also, shouldn't the thumb2 emitter be called thumb2 emitter instead of "thumb" emitter? It was a bit puzzling to see no mention of thumb2 anywhere yet 32 bit instructions.

This comment has been minimized.

@dpgeorge

dpgeorge Aug 27, 2014

Contributor

Ok, ARM is fine I'd say.

You're right that it should be thumb2, but I had no intention of supporting thumb (non 2) because it can't (AFAIK) do enough to be a general CPU. Ie you need to switch back to ARM state to do some things. So it would be ARM+thumb in that case. In the current code, "thumb" means thumb2 exclusively, with no ability to switch to ARM mode.

@dpgeorge

This comment has been minimized.

Copy link
Contributor

dpgeorge commented Aug 27, 2014

Another good test you can do is the following: in tests/run-tests script, change emit=bytecode to emit=native on line 70. Then run ./run-tests. On x86-64, 212 tests pass, 67 fail. You should get the same numbers.

@Vogtinator

This comment has been minimized.

Copy link
Contributor

Vogtinator commented Aug 27, 2014

That would be easy if I could do that, but sadly I haven't got an appropriate platform to test on. It's limited in speed and functionality, doesn't really have an OS and file transfers are a PITA.

dpgeorge added a commit that referenced this pull request Aug 28, 2014

Merge pull request #833 from Vogtinator/arm-native
Basic native ARM emitter

@dpgeorge dpgeorge merged commit 1ac6faa into micropython:master Aug 28, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@dpgeorge

This comment has been minimized.

Copy link
Contributor

dpgeorge commented Aug 28, 2014

Thanks again for this, it's a really great addition.

BTW, I didn't mean for you to also add my name in the copyright notice, but it's nice that you did. It's a fuzzy line whether you have modified existing code, or rewritten in (mostly) from scratch. The key words in the license are "substantial portion", and it's arguable if you have taken a substantial portion of asmthumb.[ch] or not. You took the framework and concepts and translated it from thumb to arm. I'm not at all expert on this stuff, and would be happy if this new code was attributed solely to you.

@Vogtinator Vogtinator deleted the Vogtinator:arm-native branch Aug 29, 2014

@NO-1-1

This comment has been minimized.

Copy link

NO-1-1 commented Dec 30, 2017

Hey, i really want to install microPython on my ti-nspire cx cas but i dont know how. could someone please tell me?

@peterhinch

This comment has been minimized.

Copy link
Contributor

peterhinch commented Dec 30, 2017

You'll get a better response if you raise this in the forum rather than in this bug tracker.

@Vogtinator

This comment has been minimized.

Copy link
Contributor

Vogtinator commented Dec 30, 2017

@NO-1-1

This comment has been minimized.

Copy link

NO-1-1 commented Dec 30, 2017

thanks it worked :)

tannewt pushed a commit to tannewt/circuitpython that referenced this pull request May 22, 2018

Merge pull request micropython#833 from rhooper/master
Fix for Issue micropython#770 - Provide a better error message when timers are s…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment