How to configure STM32F4s TIM1 and 8 for PWM
With help from people on STM32 forum, I found out I was missing the following additional code to make advanced timer work the same way as general-purpose timer:

TIM_BDTRInitTypeDef TIM_BDTRInitStruct;
TIM_BDTRStructInit(&amp;TIM_BDTRInitStruct);
TIM_BDTRConfig(TIM1, &amp;TIM_BDTRInitStruct);
TIM_CCPreloadControl(TIM1, ENABLE);
TIM_CtrlPWMOutputs(TIM1, ENABLE);


Note: Channels must be initialized before calling the code for advanced features. If you try to initialize channels after that there might be problems (my LED connected to channel 3, which was initialized after advanced features, was always ON and did not respond to pwm changes, oddly channel 4 was working but was also initialized after advanced features).