Version Fonctionnelle : Activité 1 terminée. MAJ : .gitignore ajout *.lst

This commit is contained in:
Paul Faure 2020-09-19 17:32:25 +02:00
parent 3eab7367ab
commit 93c6be6a07
6 changed files with 278 additions and 17 deletions

3
.gitignore vendored
View file

@ -2,4 +2,5 @@ MDK-ARM/DebugConfig/
MDK-ARM/*.scvd
MDK-ARM/NUCLEO-F103RB/
MDK-ARM/*.uvguix.*
MDK-ARM/RTE/
MDK-ARM/RTE/
*.lst

View file

@ -101,6 +101,8 @@
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>5</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
@ -190,8 +192,13 @@
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<DebugDescription>
<Enable>1</Enable>
<EnableFlashSeq>0</EnableFlashSeq>
<EnableLog>0</EnableLog>
<Protocol>2</Protocol>
<DbgClock>10000000</DbgClock>
@ -279,6 +286,8 @@
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>5</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
@ -296,7 +305,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>DLGDARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=-1,-1,-1,-1,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
<Name>(1010=75,104,451,661,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=-1,-1,-1,-1,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=859,49,1453,800,0)(131=828,47,1422,798,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -329,7 +338,120 @@
<Name>-U-O142 -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)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>32</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218060</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Services\Chrono.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Services/Chrono.c\32</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>64</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134219162</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Src/main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Src/main.c\64</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>117</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218136</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\Services\Chrono.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../Services/Chrono.c\117</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>20</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218220</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>..\MyDrivers\MyTimer.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\NUCLEO_F103RB\../MyDrivers/MyTimer.c\20</Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>40</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>startup_stm32f103xb.s</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
<WinNumber>1</WinNumber>
<ItemText>TIM1</ItemText>
</Ww>
<Ww>
<count>1</count>
<WinNumber>1</WinNumber>
<ItemText>GPIOB</ItemText>
</Ww>
<Ww>
<count>2</count>
<WinNumber>1</WinNumber>
<ItemText>SPI1</ItemText>
</Ww>
<Ww>
<count>3</count>
<WinNumber>1</WinNumber>
<ItemText>USART1</ItemText>
</Ww>
<Ww>
<count>4</count>
<WinNumber>1</WinNumber>
<ItemText>TIM2</ItemText>
</Ww>
<Ww>
<count>5</count>
<WinNumber>1</WinNumber>
<ItemText>Chrono_Time</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
@ -368,8 +490,20 @@
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<LogicAnalyzers>
<Wi>
<IntNumber>0</IntNumber>
<FirstString>`TIM2_CNT</FirstString>
<SecondString>FF00000000000000000000000000E0FFFFFFEF410000000000000000000000000000000054494D325F434E540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1800000000000000000000000000000000000000CE020008</SecondString>
</Wi>
</LogicAnalyzers>
<DebugDescription>
<Enable>1</Enable>
<EnableFlashSeq>0</EnableFlashSeq>
<EnableLog>0</EnableLog>
<Protocol>2</Protocol>
<DbgClock>10000000</DbgClock>
@ -407,7 +541,7 @@
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Services\Chrono.c</PathWithFileName>
@ -427,7 +561,7 @@
<GroupNumber>3</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\MyDrivers\MyTimer.c</PathWithFileName>

View file

@ -11,11 +11,12 @@
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F103RB</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F1xx_DFP.2.2.0</PackID>
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
@ -183,6 +184,7 @@
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
@ -323,6 +325,7 @@
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
@ -460,12 +463,13 @@
<TargetName>Simulateur</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F103RB</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F1xx_DFP.2.2.0</PackID>
<PackID>Keil.STM32F1xx_DFP.2.3.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
@ -633,6 +637,7 @@
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
@ -760,7 +765,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>4</Optim>
<Optim>1</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
@ -773,6 +778,7 @@
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>

View file

@ -11,3 +11,102 @@
*/
#include "stm32f103xb.h"
void (* ptrfonc1)(void);
void (* ptrfonc2)(void);
void (* ptrfonc3)(void);
void (* ptrfonc4)(void);
void MyTimer_Conf(TIM_TypeDef * Timer,int Arr, int Psc) {
int valid = 1;
if (Timer == TIM1) {
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
} else if (Timer == TIM2) {
RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
} else if (Timer == TIM3) {
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
} else if (Timer == TIM4) {
RCC->APB1ENR |= RCC_APB1ENR_TIM4EN;
} else {
valid = 0;
}
if (valid) {
Timer->ARR = Arr;
Timer->PSC = Psc;
}
}
void MyTimer_Start(TIM_TypeDef * Timer) {
Timer->CR1 |= TIM_CR1_CEN;
}
void MyTimer_Stop(TIM_TypeDef * Timer) {
Timer->CR1 &= ~TIM_CR1_CEN;
}
void MyTimer_IT_Conf(TIM_TypeDef * Timer, void (*IT_function) (void),int Prio) {
if (Timer == TIM1) {
NVIC->ISER[0] = NVIC->ISER[0] | (1 << 25);
NVIC->IP[25] = NVIC->IP[25] | (Prio << 4);
ptrfonc1 = IT_function;
} else if (Timer == TIM2) {
NVIC->ISER[0] = NVIC->ISER[0] | (1 << 28);
NVIC->IP[28] = NVIC->IP[28] | (Prio << 4);
ptrfonc2 = IT_function;
} else if (Timer == TIM3) {
NVIC->ISER[0] = NVIC->ISER[0] | (1 << 29);
NVIC->IP[29] = NVIC->IP[29] | (Prio << 4);
ptrfonc3 = IT_function;
} else if (Timer == TIM4) {
NVIC->ISER[0] = NVIC->ISER[0] | (1 << 30);
NVIC->IP[30] = NVIC->IP[30] | (Prio << 4);
ptrfonc4 = IT_function;
}
}
void MyTimer_IT_Enable(TIM_TypeDef * Timer) {
if (Timer == TIM1) {
TIM1->DIER |= TIM_DIER_UIE;
} else if (Timer == TIM2) {
TIM2->DIER |= TIM_DIER_UIE;
} else if (Timer == TIM3) {
TIM3->DIER |= TIM_DIER_UIE;
} else if (Timer == TIM4) {
TIM4->DIER |= TIM_DIER_UIE;
}
}
void MyTimer_IT_Disable(TIM_TypeDef * Timer) {
if (Timer == TIM1) {
TIM1->DIER &= ~TIM_DIER_UIE;
} else if (Timer == TIM2) {
TIM2->DIER &= ~TIM_DIER_UIE;
} else if (Timer == TIM3) {
TIM3->DIER &= ~TIM_DIER_UIE;
} else if (Timer == TIM4) {
TIM4->DIER &= ~TIM_DIER_UIE;
}
}
void TIM1_UP_IRQHandler(void) {
TIM1->SR &= ~TIM_SR_UIF;
(*ptrfonc1)();
}
void TIM2_IRQHandler(void) {
TIM2->SR &= ~TIM_SR_UIF;
(*ptrfonc2)();
}
void TIM3_IRQHandler(void) {
TIM3->SR &= ~TIM_SR_UIF;
(*ptrfonc3)();
}
void TIM4_IRQHandler(void) {
TIM4->SR &= ~TIM_SR_UIF;
(*ptrfonc4)();
}

View file

@ -37,13 +37,13 @@ void Chrono_Conf(TIM_TypeDef * Timer)
Chrono_Timer=Timer;
// Réglage Timer pour un débordement à 10ms
//MyTimer_Conf(Chrono_Timer...
MyTimer_Conf(Chrono_Timer, 99, 7199);
// Réglage interruption du Timer avec callback : Chrono_Task_10ms()
//MyTimer_IT_Conf(..
MyTimer_IT_Conf(Chrono_Timer, Chrono_Task_10ms, 7);
// Validation IT
//MyTimer_IT_Enable(..
MyTimer_IT_Enable(Chrono_Timer);
}
@ -57,7 +57,8 @@ void Chrono_Conf(TIM_TypeDef * Timer)
*/
void Chrono_Start(void)
{
//MyTimer_Start(..);
// Lancement du Timer
MyTimer_Start(Chrono_Timer);
}
@ -69,7 +70,7 @@ void Chrono_Start(void)
*/
void Chrono_Stop(void)
{
//MyTimer_Stop(..
MyTimer_Stop(Chrono_Timer);
}
@ -82,7 +83,7 @@ void Chrono_Stop(void)
void Chrono_Reset(void)
{
// Arrêt Chrono
//MyTimer_Stop(..
MyTimer_Stop(Chrono_Timer);
// Reset Time
Chrono_Time.Hund=0;

View file

@ -32,13 +32,33 @@ void SystemClock_Config(void);
* @retval None
*/
int main(void)
{
{
/* Configure the system clock to 72 MHz */
SystemClock_Config();
/* DU BLABLA POUR JOUER AU DéBUT
TIM1->CR2|=0x1 ;
TIM1->CR2=0xFFFF ;
TIM1->CR2 &= ~0x0040 ;
TIM1->CR2=0xFFFF ;
TIM1->CR2&=~(1<<6) ;
GPIOB->CRL=(0xFFFF ) ;
GPIOB->CRL&=~(0xF<<8) ;
GPIOB->CRL|= (0x5<<8) ;
GPIOB->ODR|=GPIO_ODR_ODR1 ;
SPI1->CR1 |= 0x2;
SPI1->CR1 = 0xFFFF;
SPI1->CR1 &= ~SPI_CR1_DFF;
USART1->CR2 = 0xFFFFFFFF;
USART1->CR2 &= ~USART_CR2_STOP;
USART1->CR2 |= (0x2 << USART_CR2_STOP_Pos);*/
/* Add your application code here */
// Configuration chronomètre
Chrono_Conf(TIM2);
Chrono_Conf(TIM1);
// Lancement chronomètre
Chrono_Start();