py: Support arm and thumb ARM ISAs, in addition to thumb2.

These changes were tested with QEMU, and by few people of real hardware.
pull/690/head
Paul Sokolovsky 2014-06-22 01:14:28 +03:00
rodzic 59c675a64c
commit a96cc824bd
3 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -45,7 +45,7 @@ struct _nlr_buf_t {
#else #else
void *regs[8]; void *regs[8];
#endif #endif
#elif defined(__thumb2__) #elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
void *regs[10]; void *regs[10];
#else #else
#define MICROPY_NLR_SETJMP (1) #define MICROPY_NLR_SETJMP (1)

Wyświetl plik

@ -24,19 +24,21 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#if defined(__thumb2__) && !MICROPY_NLR_SETJMP #if !MICROPY_NLR_SETJMP && (defined(__thumb2__) || defined(__thumb__) || defined(__arm__))
/* thumb callee save: bx, bp, sp, r12, r14, r14, r15 */ /* arm callee save: bx, bp, sp, r12, r14, r14, r15 */
.syntax unified .syntax unified
/*.cpu cortex-m4*/ /*.cpu cortex-m4*/
.thumb /*.thumb*/
.text .text
.align 2 .align 2
/* uint nlr_push(r0=nlr_buf_t *nlr) */ /* uint nlr_push(r0=nlr_buf_t *nlr) */
.global nlr_push .global nlr_push
#if defined(__thumb2__)
.thumb .thumb
.thumb_func .thumb_func
#endif
.type nlr_push, %function .type nlr_push, %function
nlr_push: nlr_push:
str lr, [r0, #8] @ store lr into nlr_buf str lr, [r0, #8] @ store lr into nlr_buf
@ -64,8 +66,10 @@ nlr_push:
@ void nlr_pop() @ void nlr_pop()
.global nlr_pop .global nlr_pop
#if defined(__thumb2__)
.thumb .thumb
.thumb_func .thumb_func
#endif
.type nlr_pop, %function .type nlr_pop, %function
nlr_pop: nlr_pop:
ldr r3, .L5 @ load addr of nlr_top ldr r3, .L5 @ load addr of nlr_top
@ -80,8 +84,10 @@ nlr_pop:
/* void nlr_jump(r0=uint val) */ /* void nlr_jump(r0=uint val) */
.global nlr_jump .global nlr_jump
#if defined(__thumb2__)
.thumb .thumb
.thumb_func .thumb_func
#endif
.type nlr_jump, %function .type nlr_jump, %function
nlr_jump: nlr_jump:
ldr r3, .L2 @ load addr of nlr_top ldr r3, .L2 @ load addr of nlr_top

Wyświetl plik

@ -97,7 +97,7 @@ void gc_helper_get_regs(regs_t arr) {
} }
#endif #endif
#ifdef __thumb2__ #if defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
typedef machine_uint_t regs_t[10]; typedef machine_uint_t regs_t[10];
void gc_helper_get_regs(regs_t arr) { void gc_helper_get_regs(regs_t arr) {