yefj
Advanced Member level 5
Hello, I wrote a blinking LED program for my SRM32F407 descovery.
but i got to the conclution that my KEIL compiler optimises away the FOR loop.
My KEIL uses -O1
In the internet i read that its about the local I vaiable in the for loop and that i should try to make it volotile.
But my video manual didnt use volotile.
What could be done?
Thanks.
but i got to the conclution that my KEIL compiler optimises away the FOR loop.
My KEIL uses -O1
In the internet i read that its about the local I vaiable in the for loop and that i should try to make it volotile.
But my video manual didnt use volotile.
What could be done?
Thanks.
Code:
#include "stm32f407xx.h"
int main()
{
RCC->AHB1ENR|=(1uL<<3); //set thirdbit
//GPIOD->MODER&=~(1uL<<31);//reset 0 on 31 01 to gpio_moder 31,30 bits in register
//GPIOD->MODER|=(1uL<<30);//set 1 on 30 output mode for pin 15 port D
GPIOD->MODER=0x55000000;
GPIOD->OTYPER=0; //all register is push pull
GPIOD->OSPEEDR=0;//speed low
//GPIOD->ODR|=(1<<15); //Sets pin 15
while(1)
{
GPIOD->BSRR=(1uL<<15);
for(uint32_t i=0;i<500000;i++){}
GPIOD->BSRR=(1uL<<(15+16));
}
}