Added Init_TVI procedure, reads TVIFlash and put it in TVIPile, Replace actual SCBVTOR

This commit is contained in:
Yohan Boujon 2023-03-30 11:55:35 +02:00
parent 7f451cc7e9
commit 6f7d973e2c
4 changed files with 170 additions and 34 deletions

View file

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

View file

@ -12,6 +12,7 @@
;***************IMPORT/EXPORT********************************************** ;***************IMPORT/EXPORT**********************************************
IMPORT DataSend IMPORT DataSend
EXPORT Init_TVI
;************************************************************************** ;**************************************************************************
@ -29,6 +30,12 @@
AREA MesDonnees, data, readwrite 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 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 END

View file

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

View file

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