Please check your reference manual for the flash chapter. Generally we do not support write-while-read function for flash, so you need to use IAP(bootloader) to program the internal flash
Not understand your point. If you are using Cubefirmware, there is HAL_TIM_PWM_Start function. After you configured the PWM Channel output, you need to the call the HAL_TIM_PWM_Start, then the PWM channel begin to output.