diff --git a/2-3_asm/src/assembleur.s b/2-3_asm/src/assembleur.s index 9faf541de502200de7e34ebe46e97d15693f8162..630e5c21bf0a6d7b3769673243715bd85cba0af1 100644 --- a/2-3_asm/src/assembleur.s +++ b/2-3_asm/src/assembleur.s @@ -92,8 +92,12 @@ err_ex2: *****************************************************/ .thumb_func funcexo3: + // push {r4} + // c in r4 + // mov r - bx lr + + // bx lr @@ -105,6 +109,28 @@ funcexo3: *****************************************************/ .thumb_func funcexo4: + subs r0, #1 + bne rcall + mov r0, #1 + // add sp, #8 + bx lr + +rcall: + push {r0, lr} + bl funcexo4 + pop {r0, lr} + add r0, r0 + bx lr + +exit: + pop {r0, lr} + add r0, r0 + bx lr + + + + +/*funcexo4: mov r1, r0 push {r0, r1, lr} bl lhs_fact @@ -145,7 +171,7 @@ rcall: pop {r0, r1, lr} add r0, r1 - bx lr + bx lr*/ //.weak add_sat diff --git a/2-3_asm/src/labo2.3_asm.c b/2-3_asm/src/labo2.3_asm.c index e18d205b60df818809357e706bd3333d5b3be5fa..df128875481db768d2129a74b271af7ea54a3722 100644 --- a/2-3_asm/src/labo2.3_asm.c +++ b/2-3_asm/src/labo2.3_asm.c @@ -22,9 +22,10 @@ typedef struct { void funcexo1(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t *); uint32_t funcexo2(uint32_t a, uint32_t b, uint32_t c, uint32_t d); int funcexo3(numbers_t s); +int funcexo4(int n); /* global variables */ -int exo = 2; // change this number with the exercise number you want to test; +int exo = 4; // change this number with the exercise number you want to test; int main(void) { @@ -41,13 +42,17 @@ int main(void) res=funcexo2(0x10000, 0x10005, 6,7); // doit retourner 0 res=funcexo2(0xF000, 0x8805, 0x8700,0xF760); // doit retourner 0 break; - default: + case 3: s.a=5; s.b=-3; s.c=-1; s.d=10; s.e=3; res_ref=s.a+s.b+s.c+s.d+s.e; res=funcexo3(s); if (res!=res_ref) while(1); // error break; + default: + res=funcexo4(4); // doit retourner 5 + res=funcexo4(1); // doit retourner 1 + break; } return 0;