Hi Tomasz
You can find the iMX6UL FreeRTOS here: https://github.com/wangben85/imx6ul_freertos
For Driver implementation for the iMX7 you have to do changes to following files: ccm_imx7d.h:
--- ccm_imx7d.h
+++ ccm_imx7d.h
@@ -297,6 +297,10 @@ enum _ccm_ccgr_gate
ccmCcgrGateGpt2 = (uint32_t)(&CCM_CCGR125), /*!< GPT2 Clock Gate.*/
ccmCcgrGateGpt3 = (uint32_t)(&CCM_CCGR126), /*!< GPT3 Clock Gate.*/
ccmCcgrGateGpt4 = (uint32_t)(&CCM_CCGR127), /*!< GPT4 Clock Gate.*/
+ ccmCcgrGatePwm1 = (uint32_t)(&CCM_CCGR132), /*!< PWM1 Clock Gate.*/
+ ccmCcgrGatePwm2 = (uint32_t)(&CCM_CCGR133), /*!< PWM2 Clock Gate.*/
+ ccmCcgrGatePwm3 = (uint32_t)(&CCM_CCGR134), /*!< PWM3 Clock Gate.*/
+ ccmCcgrGatePwm4 = (uint32_t)(&CCM_CCGR135), /*!< PWM4 Clock Gate.*/
ccmCcgrGateI2c1 = (uint32_t)(&CCM_CCGR136), /*!< I2C1 Clock Gate.*/
ccmCcgrGateI2c2 = (uint32_t)(&CCM_CCGR137), /*!< I2C2 Clock Gate.*/
ccmCcgrGateI2c3 = (uint32_t)(&CCM_CCGR138), /*!< I2C3 Clock Gate.*/
MCIMX7D_M4.h:
--- MCIMX7D_M4.h
+++ MCIMX7D_M4.h
@@ -33289,16 +33289,23 @@ typedef struct {
#define PWM_PWMCR_POUTC(x) (((uint32_t)(((uint32_t)(x))<<PWM_PWMCR_POUTC_SHIFT))&PWM_PWMCR_POUTC_MASK)
#define PWM_PWMCR_HCTR_MASK 0x100000u
#define PWM_PWMCR_HCTR_SHIFT 20
+#define PWM_PWMCR_HCTR(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_HCTR_SHIFT)) & PWM_PWMCR_HCTR_MASK)
#define PWM_PWMCR_BCTR_MASK 0x200000u
#define PWM_PWMCR_BCTR_SHIFT 21
+#define PWM_PWMCR_BCTR(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_BCTR_SHIFT)) & PWM_PWMCR_BCTR_MASK)
#define PWM_PWMCR_DBGEN_MASK 0x400000u
#define PWM_PWMCR_DBGEN_SHIFT 22
+#define PWM_PWMCR_DBGEN(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_DBGEN_SHIFT)) & PWM_PWMCR_DBGEN_MASK)
#define PWM_PWMCR_WAITEN_MASK 0x800000u
#define PWM_PWMCR_WAITEN_SHIFT 23
+#define PWM_PWMCR_WAITEN(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_WAITEN_SHIFT)) & PWM_PWMCR_WAITEN_MASK)
#define PWM_PWMCR_DOZEN_MASK 0x1000000u
#define PWM_PWMCR_DOZEN_SHIFT 24
+#define PWM_PWMCR_DOZEN(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_DOZEN_SHIFT)) & PWM_PWMCR_DOZEN_MASK)
#define PWM_PWMCR_STOPEN_MASK 0x2000000u
#define PWM_PWMCR_STOPEN_SHIFT 25
+#define PWM_PWMCR_STOPEN(x) (((uint32_t)(((uint32_t)(x)) << PWM_PWMCR_STOPEN_SHIFT)) & PWM_PWMCR_STOPEN_MASK)
#define PWM_PWMCR_FWM_MASK 0xC000000u
#define PWM_PWMCR_FWM_SHIFT 26
#define PWM_PWMCR_FWM(x) (((uint32_t)(((uint32_t)(x))<<PWM_PWMCR_FWM_SHIFT))&PWM_PWMCR_FWM_MASK)
and add the drivers in /inc, /src (I think these are the same as in the iMX6UL FreeRTOS but not sure anymore)
You can use parts of the main file, but you have to pay attention to the names of the Makros.
in the hardware_init.c file just add
/* In this example, we need to grasp PWM1 module exclusively */
RDC_SetPdapAccess(RDC, BOARD_PWM1_RDC_PDAP, 3 << (BOARD_DOMAIN_ID * 2), false, false);
/* Enable PWM1 clock */
CCM_ControlGate(CCM, BOARD_PWM1_CCM_CCGR, ccmClockNeededRunWait);
If you have any other questions please let me know.
Best Regards
Erik