<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1540645472206959902" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
+ <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1481427363850259294" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
- <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1540645472206959902" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
+ <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1481427363850259294" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
# Generated by System Workbench for STM32\r
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)\r
\r
-source [find interface/stlink-tcp.cfg]\r
+source [find interface/stlink.cfg]\r
\r
set WORKAREASIZE 0x5000\r
\r
void SystemInit() {
InitSystemClock();
+ InitSysTick();
+
// 使能时钟
RCCEnableGPIOBClock();
}
void delay() {
- Delay();
- return;
- int i=965536;
- while(i--);
+ Delay(200);
}
int main() {
#define SYSTICK_CTRL_ENABLE_MASK (1 << SYSTICK_CTRL_ENABLE_POS)
#define SYSTICK_CTRL_ENABLE (1 << SYSTICK_CTRL_ENABLE_POS)
-void Delay() {
+uint32_t gSysTickCnt = 0;
+void SysTick_Handler() {
+ gSysTickCnt++;
+}
+
+// 每1ms触发一次SysTick中断
+void InitSysTick() {
+ SysTick->CTRL &= ~SYSTICK_CTRL_ENABLE_MASK;
+ SysTick->CTRL &= ~SYSTICK_CTRL_TICKINT_MASK;
+ SysTick->CTRL &= ~SYSTICK_CTRL_CLKSOURCE_MASK;
+
+
+ SysTick->LOAD = 9000;
+ SysTick->VAL = 0;
+
+
+ SysTick->CTRL |= SYSTICK_CTRL_ENABLE | SYSTICK_CTRL_TICKINT_ENABLE;
+}
+
+void Delay(uint32_t ms) {
+ gSysTickCnt = 0;
+ while(gSysTickCnt < ms) {
+
+ }
+}
+
+// 非中断版本的Delay
+// ms 最大值为1864
+void NoneIntDelay(uint32_t ms) {
SysTick->CTRL &= ~SYSTICK_CTRL_ENABLE_MASK;
SysTick->CTRL &= ~SYSTICK_CTRL_TICKINT_MASK;
SysTick->CTRL &= ~SYSTICK_CTRL_CLKSOURCE_MASK;
- SysTick->LOAD = 9000*1000; // 1000ms
+ SysTick->LOAD = 9000*ms;
SysTick->VAL = 0;
#define SysTick ((SysTick_t*) 0xE000E010)
-
-void Delay();
+void InitSysTick();
+void Delay(uint32_t ms);
+void NoneIntDelay(uint32_t ms);
#endif /* SYSTICK_H_ */