From 739aba2f09140223919a299d9f42918289c52de3 Mon Sep 17 00:00:00 2001 From: Boyu Fu Date: Fri, 24 Mar 2023 18:30:00 +0100 Subject: [PATCH] TP2 non fini --- soft/PjtKEIL_StepDeb_2/BacASable.uvoptx | 52 +++++++++++++++++++++++- soft/PjtKEIL_StepDeb_2/BacASable.uvprojx | 9 +--- soft/PjtKEIL_StepDeb_2/Src/Cligno.s | 50 +++++++++++++++++++++-- soft/PjtKEIL_StepDeb_2/Src/principal.c | 28 ++++--------- 4 files changed, 105 insertions(+), 34 deletions(-) diff --git a/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx index f1315bb..397712b 100644 --- a/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx +++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvoptx @@ -10,7 +10,7 @@ *.s*; *.src; *.a* *.obj; *.o *.lib - *.txt; *.h; *.inc + *.txt; *.h; *.inc; *.md *.plm *.cpp 0 @@ -153,7 +153,55 @@ -U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - + + + 0 + 0 + 22 + 1 +
134220300
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\principal.c + + \\BacASable\Src/principal.c\22 +
+ + 1 + 0 + 56 + 1 +
134220362
+ 0 + 0 + 0 + 0 + 0 + 1 + .\Src\Cligno.s + + \\BacASable\Src/Cligno.s\56 +
+
+ + + 0 + 1 + FlagCligno + + + + + 1 + 0 + r1 + 0 + + 0 diff --git a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx index d99d0f0..2c5376a 100644 --- a/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx +++ b/soft/PjtKEIL_StepDeb_2/BacASable.uvprojx @@ -10,7 +10,7 @@ Simu 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -357,7 +357,7 @@ - + .\Driver @@ -1338,11 +1338,6 @@ <Project Info> - - - - - 0 1 diff --git a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s index 8a75b7a..ae499f7 100644 --- a/soft/PjtKEIL_StepDeb_2/Src/Cligno.s +++ b/soft/PjtKEIL_StepDeb_2/Src/Cligno.s @@ -2,6 +2,10 @@ THUMB + + + + ; ====================== zone de réservation de données, ====================================== ;Section RAM (read only) : area mesdata,data,readonly @@ -10,21 +14,59 @@ ;Section RAM (read write): area maram,data,readwrite +FlagCligno dcb 0 + EXPORT FlagCligno ; =============================================================================================== - +;constantes (équivalent du #define en C) +;char FlagCligno; + EXPORT timer_callback ; la fonction timer_callback est rendue publique donc utilisable par d'autres modules. ;Section ROM code (read only) : area moncode,code,readonly -; écrire le code ici - - +; écrire le code ici + +;*void timer_callback(void) +;{ +; if (FlagCligno==1) +; { +; FlagCligno=0; +; GPIOB_Set(1); +; } +; else +; { +; FlagCligno=1; +; GPIOB_Clear(1); +; } +; + include DriverJeuLaser.inc +timer_callback proc + + ldr r1,=FlagCligno ; + cmp r1,#0x1 ; si r1(FlagCligno) == 1, on continue. + bne L0 ; sinon break to L0 + mov r2, #0x0 ; copie valeur "0" dans r2 + str r2, [r1] ; la valeur 32bits contenue dans r2 est copiée en RAM à l'adresse spécifiée dans r1 + mov r0, #1 ; GPIOB_Set(r0 = "1") + bl GPIOB_Set + bx lr + +L0 + mov r2, #0x1 + str r2, [r1] + mov r0, #1 ; GPIOB_Clear("1") + bl GPIOB_Clear + + bx lr + endp + + END \ No newline at end of file diff --git a/soft/PjtKEIL_StepDeb_2/Src/principal.c b/soft/PjtKEIL_StepDeb_2/Src/principal.c index 4d726a1..1794570 100644 --- a/soft/PjtKEIL_StepDeb_2/Src/principal.c +++ b/soft/PjtKEIL_StepDeb_2/Src/principal.c @@ -2,7 +2,8 @@ #include "DriverJeuLaser.h" -void timer_callback(void); +extern void timer_callback(void); +extern char FlagCligno; int main(void) { @@ -17,11 +18,12 @@ CLOCK_Configure(); // configuration du Timer 4 en débordement 100ms //** Placez votre code là ** // + +Timer_1234_Init_ff(TIM4, 7200000); +Active_IT_Debordement_Timer(TIM4, 2, timer_callback); - - -// Activation des interruptions issues du Timer 4 -// Association de la fonction à exécuter lors de l'interruption : timer_callback +// Activation des interruptions issues du Timer 4 +// Association de la fonction à exécuter lors de l'interruption : timer_callback // cette fonction (si écrite en ASM) doit être conforme à l'AAPCS //** Placez votre code là ** // @@ -42,20 +44,4 @@ while (1) } } -char FlagCligno; - -void timer_callback(void) -{ - if (FlagCligno==1) - { - FlagCligno=0; - GPIOB_Set(1); - } - else - { - FlagCligno=1; - GPIOB_Clear(1); - } - -}