From 529b92926391af8e3715c366d8b99fb5ae2c78a9 Mon Sep 17 00:00:00 2001 From: iliya <iliya.saroukha@hes-so.ch> Date: Wed, 1 Nov 2023 14:16:25 +0100 Subject: [PATCH] =?UTF-8?q?jsp=20ce=20que=20j'ai=20chang=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2-3_asm/src/assembleur.s | 30 ++++++++++++++++++++++++++++-- 2-3_asm/src/labo2.3_asm.c | 9 +++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/2-3_asm/src/assembleur.s b/2-3_asm/src/assembleur.s index 9faf541..630e5c2 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 e18d205..df12887 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; -- GitLab