Etape 3 #1

Merged
yoboujon merged 29 commits from etape_3 into main 2023-05-29 22:57:47 +02:00
4 changed files with 170 additions and 34 deletions
Showing only changes of commit 6f7d973e2c - Show all commits

View file

@ -75,7 +75,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -142,9 +142,57 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>65</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222852</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression>\\Simu_Etape0\FonctionEtape3.asm\65</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>64</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222850</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression>\\Simu_Etape0\FonctionEtape3.asm\64</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>63</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222848</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression>\\Simu_Etape0\FonctionEtape3.asm\63</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>204</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222900</Address>
<Address>134222764</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
@ -156,27 +204,27 @@
<Expression>\\Simu_Etape0\FonctionEtape2.asm\204</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Number>4</Number>
<Type>0</Type>
<LineNumber>51</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222440</Address>
<Address>134222816</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\Principale.asm</Filename>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression>\\Simu_Etape0\Principale.asm\51</Expression>
<Expression>\\Simu_Etape0\FonctionEtape3.asm\51</Expression>
</Bp>
</Breakpoint>
<MemoryWindow1>
<Mm>
<WinNumber>1</WinNumber>
<SubType>0</SubType>
<ItemText>0x40010800</ItemText>
<ItemText>0xE000ED08</ItemText>
<AccSizeX>0</AccSizeX>
</Mm>
</MemoryWindow1>
@ -198,7 +246,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>0</aLwin>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
@ -310,7 +358,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
@ -382,6 +430,54 @@
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>52</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>51</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>50</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FonctionEtape3.asm</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>67</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134222690</Address>
@ -396,7 +492,7 @@
<Expression>\\Reel_Etape0\Principale.asm\67</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Number>4</Number>
<Type>0</Type>
<LineNumber>60</LineNumber>
<EnabledFlag>1</EnabledFlag>
@ -524,7 +620,7 @@
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\FonctionEtape3.asm</PathWithFileName>

View file

@ -12,6 +12,7 @@
;***************IMPORT/EXPORT**********************************************
IMPORT DataSend
EXPORT Init_TVI
;**************************************************************************
@ -29,6 +30,12 @@
AREA MesDonnees, data, readwrite
;**************************************************************************
Timer_Up_Reg EQU 25
Timer_Cc_Reg EQU 27
MAX_Interrupt EQU 256
TVI_Flash EQU 0x0
TVI_Pile EQU 0x20000200 ;9 bits de poids faible = 0
;**************************************************************************
@ -37,5 +44,26 @@
AREA moncode, code, readonly
;**************************************************************************
Init_TVI PROC
;On copie toute la TVI dans la RAM (0x2....)
;On modifie les interruptions Up et CC pour pointer sur nos fonctions rien qu'à nous
;On fait pointer à SCB_VTOR l'adresse de la TVI que nous avons copié
LDR R0,=TVI_Flash ;On Lit le premier TVI
LDR R1,=TVI_Pile ;Nouvelle TVI
MOV R2,#0 ;i
for_tvi ;for(int i=0;i<MAX_Interrupt;i++)
LDR R3,[R0] ;temp = TVI_Flash[i]
STR R3, [R1] ;TVI_Pile[i] = temp
ADD R1,R1,#4 ;TVI_Pile++
ADD R0,R0,#4 ;TVI_Flash++
ADD R2,R2,#1 ;i++
CMP R2,#MAX_Interrupt ;is i == MAX_Interrupt?
BNE for_tvi
scbvector_link
LDR R1,=TVI_Pile ;On relit l'adresse de TVIPile
LDR R0,=SCB_VTOR ;ON lit l'adresse de SCB_VTOR
STR R1,[R0] ;On met l'adresse de TVI_Pile dans le SCB_VTOR
ENDP
;**************************************************************************
END

View file

@ -23,16 +23,24 @@
IMPORT Init_Cible
IMPORT Run_Timer3
;******ETAPE 1*********
IMPORT Eteint_LED
IMPORT Allume_LED
IMPORT Inverse_LED
;******ETAPE 2*********
IMPORT Set_SCLK
IMPORT Reset_SCLK
IMPORT DriverGlobal
IMPORT DriverReg
IMPORT Tempo
;******ETAPE 3*********
IMPORT Init_TVI
EXPORT main
;***************VARIABLES*******************************************************
@ -48,30 +56,34 @@ M EQU 20
main PROC
;*******************************************************************************
BL Run_Timer3 ;Allumage du Timer 3
MOV R0,#1
MOV R0,#2
BL Init_Cible;
;*******************************************************************************
; ETAPE 3
;*******************************************************************************
BL Init_TVI;
;*******************************************************************************
; ETAPE 2
;*******************************************************************************
MOV R7,#0
Etape2 ;for(int=0;i<M;i++)
LDR R0, =Barette3 ;Adresse Jeu de led 1 : Argument
BL DriverReg ;*******************
MOV R0, #500 ;Argument : 500ms
BL Tempo; :Tempo(10)
LDR R0, =Barette2 ;Adresse Jeu de led 2 : Argument
BL DriverReg ;*******************
MOV R0, #500 ;Argument : 500ms
BL Tempo; :Tempo(10)
LDR R6,=GPIOBASEA ;On récup l'adresse du GPIOA
LDR R6,[R6,#OffsetInput] ;On lit le GPIOA_IDR
AND R6, R6, #(0x01<<8) ;On masque pour n'avoir que le 9ème bit (Capteur)
CMP R6, #(0x01<<8) ;On vérifie que ce dernier bit est bien à 1.
BNE TheEnd ;if capteur = true -> on sort de la boucle
ADD R7,R7,#1 ;i++
CMP R7, #M ;i==M ?
BNE Etape2 ;if i!=10 -> on continue la boucle (Au final : R7 == M || R6)
; MOV R7,#0
;Etape2 ;for(int=0;i<M;i++)
; LDR R0, =Barette3 ;Adresse Jeu de led 1 : Argument
; BL DriverReg ;*******************
; MOV R0, #500 ;Argument : 500ms
; BL Tempo; :Tempo(10)
; LDR R0, =Barette2 ;Adresse Jeu de led 2 : Argument
; BL DriverReg ;*******************
; MOV R0, #500 ;Argument : 500ms
; BL Tempo; :Tempo(10)
;
; LDR R6,=GPIOBASEA ;On récup l'adresse du GPIOA
; LDR R6,[R6,#OffsetInput] ;On lit le GPIOA_IDR
; AND R6, R6, #(0x01<<8) ;On masque pour n'avoir que le 9ème bit (Capteur)
; CMP R6, #(0x01<<8) ;On vérifie que ce dernier bit est bien à 1.
; BNE TheEnd ;if capteur = true -> on sort de la boucle
; ADD R7,R7,#1 ;i++
; CMP R7, #M ;i==M ?
; BNE Etape2 ;if i!=10 -> on continue la boucle (Au final : R7 == M || R6)
;*******************************************************************************
; ETAPE 1
;*******************************************************************************

View file

@ -3,7 +3,7 @@
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'Etape_2'
* Project: 'Etape_3'
* Target: 'Simulé'
*/