py32duino / Arduino-PY32

Arduino core for the PY32.
MIT License
43 stars 8 forks source link

can not compile in arduino ide #16

Open be-engineer opened 6 months ago

be-engineer commented 6 months ago

描述一下这个bug / Describe the bug

I installed py32duino in arduino ide and selected py32f003 board,when I compile blink demo code.I got many error messages

复现步骤 / To Reproduce

Open demo code :

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

Select board Generic PY32F003 series. Press compile button.

如果正常,应该是什么样 / Expected behavior

If OK, the code should compile without errors.

截图 / Screenshots

image

日志 / Logs

error message are as follow:

WARNING: library SrcWrapper claims to run on AirMCU architecture(s) and may be incompatible with your current board which runs on PY32 architecture(s).
In file included from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_def.h:35,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:32,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/PY32F0xx/py32f0xx_hal_conf_default.h:208,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/PY32F0xx/py32f0xx_hal_conf.h:13,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal.h:33,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:57,
                 from /home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/libraries/SrcWrapper/src/HAL/py32yyxx_hal_rcc.c:8:
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c: In function 'HAL_RCC_DeInit':
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:251:28: error: 'RCC_CR_PLLRDY' undeclared (first use in this function); did you mean 'RCC_IT_PLLRDY'?
  251 |   while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) != 0U)
      |                            ^~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:174:41: note: in definition of macro 'READ_BIT'
  174 | #define READ_BIT(REG, BIT)    ((REG) & (BIT))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:251:28: note: each undeclared identifier is reported only once for each function it appears in
  251 |   while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) != 0U)
      |                            ^~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:174:41: note: in definition of macro 'READ_BIT'
  174 | #define READ_BIT(REG, BIT)    ((REG) & (BIT))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:260:8: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
  260 |   RCC->PLLCFGR = 0x00000000u;
      |        ^~~~~~~
      |        CFGR
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c: In function 'HAL_RCC_OscConfig':
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1514:56: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1514 | #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC))
      |                                                        ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:322:21: note: in expansion of macro '__HAL_RCC_GET_PLL_OSCSOURCE'
  322 |     temp_pllckcfg = __HAL_RCC_GET_PLL_OSCSOURCE();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1514:66: error: 'RCC_PLLCFGR_PLLSRC' undeclared (first use in this function)
 1514 | #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC))
      |                                                                  ^~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:322:21: note: in expansion of macro '__HAL_RCC_GET_PLL_OSCSOURCE'
  322 |     temp_pllckcfg = __HAL_RCC_GET_PLL_OSCSOURCE();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:325:29: error: 'RCC_CFGR_SWS_PLL' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_Pos'?
  325 |     if (((temp_sysclksrc == RCC_CFGR_SWS_PLL) && (temp_pllckcfg == RCC_PLLSOURCE_HSE)) || (temp_sysclksrc == RCC_CFGR_SWS_HSE))
      |                             ^~~~~~~~~~~~~~~~
      |                             RCC_CFGR_SWS_Pos
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:408:40: error: 'RCC_PLLCFGR_PLLSRC_HSE' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_HSE'?
  408 | #define RCC_PLLSOURCE_HSE              RCC_PLLCFGR_PLLSRC_HSE  /*!< HSE clock selected as PLL entry clock source */
      |                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:325:68: note: in expansion of macro 'RCC_PLLSOURCE_HSE'
  325 |     if (((temp_sysclksrc == RCC_CFGR_SWS_PLL) && (temp_pllckcfg == RCC_PLLSOURCE_HSE)) || (temp_sysclksrc == RCC_CFGR_SWS_HSE))
      |                                                                    ^~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1514:56: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1514 | #define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC))
      |                                                        ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:398:21: note: in expansion of macro '__HAL_RCC_GET_PLL_OSCSOURCE'
  398 |     temp_pllckcfg = __HAL_RCC_GET_PLL_OSCSOURCE();
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:407:40: error: 'RCC_PLLCFGR_PLLSRC_HSI' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_HSI'?
  407 | #define RCC_PLLSOURCE_HSI              RCC_PLLCFGR_PLLSRC_HSI  /*!< HSI clock selected as PLL entry clock source */
      |                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:399:68: note: in expansion of macro 'RCC_PLLSOURCE_HSI'
  399 |     if (((temp_sysclksrc == RCC_CFGR_SWS_PLL) && (temp_pllckcfg == RCC_PLLSOURCE_HSI)) || (temp_sysclksrc == RCC_CFGR_SWS_HSI))
      |                                                                    ^~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1492:59: error: 'RCC_CR_PLLON' undeclared (first use in this function); did you mean 'RCC_CR_HSION'?
 1492 | #define __HAL_RCC_PLL_DISABLE()        CLEAR_BIT(RCC->CR, RCC_CR_PLLON)
      |                                                           ^~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:172:43: note: in definition of macro 'CLEAR_BIT'
  172 | #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
      |                                           ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:656:9: note: in expansion of macro '__HAL_RCC_PLL_DISABLE'
  656 |         __HAL_RCC_PLL_DISABLE();
      |         ^~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:662:34: error: 'RCC_CR_PLLRDY' undeclared (first use in this function); did you mean 'RCC_IT_PLLRDY'?
  662 |         while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) != 0U)
      |                                  ^~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:174:41: note: in definition of macro 'READ_BIT'
  174 | #define READ_BIT(REG, BIT)    ((REG) & (BIT))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1505:35: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1505 |                   MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
      |                                   ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:178:33: note: in definition of macro 'WRITE_REG'
  178 | #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
      |                                 ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1505:19: note: in expansion of macro 'MODIFY_REG'
 1505 |                   MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
      |                   ^~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:679:9: note: in expansion of macro '__HAL_RCC_PLL_PLLSOURCE_CONFIG'
  679 |         __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_OscInitStruct->PLL.PLLSource);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1505:35: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1505 |                   MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
      |                                   ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:178:41: note: in definition of macro 'WRITE_REG'
  178 | #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:182:66: note: in expansion of macro 'READ_REG'
  182 | #define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
      |                                                                  ^~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:1505:19: note: in expansion of macro 'MODIFY_REG'
 1505 |                   MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
      |                   ^~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:679:9: note: in expansion of macro '__HAL_RCC_PLL_PLLSOURCE_CONFIG'
  679 |         __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_OscInitStruct->PLL.PLLSource);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:702:25: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
  702 |         MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSOURCE_NONE);
      |                         ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:178:33: note: in definition of macro 'WRITE_REG'
  178 | #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
      |                                 ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:702:9: note: in expansion of macro 'MODIFY_REG'
  702 |         MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSOURCE_NONE);
      |         ^~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:702:25: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
  702 |         MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSOURCE_NONE);
      |                         ^~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:178:41: note: in definition of macro 'WRITE_REG'
  178 | #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:182:66: note: in expansion of macro 'READ_REG'
  182 | #define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
      |                                                                  ^~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:702:9: note: in expansion of macro 'MODIFY_REG'
  702 |         MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, PLLSOURCE_NONE);
      |         ^~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:727:30: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
  727 |         temp_pllckcfg = RCC->PLLCFGR;
      |                              ^~~~~~~
      |                              CFGR
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c: In function 'HAL_RCC_ClockConfig':
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:858:29: error: 'RCC_CR_PLLRDY' undeclared (first use in this function); did you mean 'RCC_IT_PLLRDY'?
  858 |       if (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == 0U)
      |                             ^~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/CMSIS/Device/PY32F0xx/Include/py32f0xx.h:174:41: note: in definition of macro 'READ_BIT'
  174 | #define READ_BIT(REG, BIT)    ((REG) & (BIT))
      |                                         ^~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c: In function 'HAL_RCC_GetSysClockFreq':
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1118:45: error: 'RCC_CFGR_SWS_PLL' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_Pos'?
 1118 |   else if (__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL)
      |                                             ^~~~~~~~~~~~~~~~
      |                                             RCC_CFGR_SWS_Pos
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1120:23: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1120 |     pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
      |                       ^~~~~~~
      |                       CFGR
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1120:33: error: 'RCC_PLLCFGR_PLLSRC' undeclared (first use in this function)
 1120 |     pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
      |                                 ^~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:408:40: error: 'RCC_PLLCFGR_PLLSRC_HSE' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_HSE'?
  408 | #define RCC_PLLSOURCE_HSE              RCC_PLLCFGR_PLLSRC_HSE  /*!< HSE clock selected as PLL entry clock source */
      |                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1124:10: note: in expansion of macro 'RCC_PLLSOURCE_HSE'
 1124 |     case RCC_PLLSOURCE_HSE:  /* HSE used as PLL clock source */
      |          ^~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal_rcc.h:407:40: error: 'RCC_PLLCFGR_PLLSRC_HSI' undeclared (first use in this function); did you mean 'RCC_CFGR_SWS_HSI'?
  407 | #define RCC_PLLSOURCE_HSI              RCC_PLLCFGR_PLLSRC_HSI  /*!< HSI clock selected as PLL entry clock source */
      |                                        ^~~~~~~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1128:10: note: in expansion of macro 'RCC_PLLSOURCE_HSI'
 1128 |     case RCC_PLLSOURCE_HSI:  /* HSI used as PLL clock source */
      |          ^~~~~~~~~~~~~~~~~
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c: In function 'HAL_RCC_GetOscConfig':
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1266:18: error: 'RCC_CR_PLLON' undeclared (first use in this function); did you mean 'RCC_CR_HSION'?
 1266 |   if ((RCC->CR & RCC_CR_PLLON) == RCC_CR_PLLON)
      |                  ^~~~~~~~~~~~
      |                  RCC_CR_HSION
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1275:44: error: 'RCC_TypeDef' has no member named 'PLLCFGR'; did you mean 'CFGR'?
 1275 |   RCC_OscInitStruct->PLL.PLLSource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
      |                                            ^~~~~~~
      |                                            CFGR
/home/leon/.arduino15/packages/PY32Duino/hardware/PY32/0.1.3/system/Arduino-PY32F0xx-Drivers/PY32F0xx_HAL_Driver/Src/py32f0xx_hal_rcc.c:1275:54: error: 'RCC_PLLCFGR_PLLSRC' undeclared (first use in this function)
 1275 |   RCC_OscInitStruct->PLL.PLLSource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC);
      |                                                      ^~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

系统 / System

debian12

PACK包版本 / Version

0.1.3

验证

HalfSweet commented 6 months ago

What specific series did you choose? PY32F003x8 or PY32F003x6

be-engineer commented 6 months ago

What specific series did you choose? PY32F003x8 or PY32F003x6 PY32F003x8

XusMochizuki commented 6 months ago

same here, i tried build a f002(air001) led blink rom and download to 003, download can be success, but seems nothing works :(

XusMochizuki commented 6 months ago

Hi. I found a way to resolve this problem and its working now. you need change the include file in

Arduino15\packages\PY32Duino\hardware\PY32\0.1.3\system\Arduino-PY32F0xx-Drivers\CMSIS\Device\PY32F0xx\Include\py32f0xx.h

about line 126(maybe, i change some code thus i dont know the origin line number :D, but its close)

replace `#elif defined(PY32F003x8)

include "py32f003x8.h"`

to `#elif defined(PY32F003x8)

include "py32f030x8.h"`

then compile and run will be ok just like other chips.

with error logs, i think thats because py32f003x8.h doesn't contain relevant defines about "Bit definition for RCC_CR register " and I didnt find it in official latest py32f003x8.h, but py32Arduino use the generic codes for all chips that need some definitions like RCC_CR_HSION doesn't contain in 003xx.h

after change 003x8 to 030x8 , seems all function works correct and u can use all of 64k flashs i tested some codes like LED blink, Serial print and DHT11 Temper and Humid sensor, it runs successfully

btw this is my code about DHT11

#include <DHT11.h>

DHT11 dht11 = DHT11(PA_12);
void setup() {
    Serial.begin(9600);
    Serial.println("ARDUINO PY003 READY!");
}

void loop() {
  int humid = dht11.readHumidity();
  int temper = dht11.readTemperature();
  Serial.printf("Temp:%d Humid:%d\n",temper,humid);
  delay(1000);
}

oh, and the wire connect: USBTTL -> py32f003f18P6 TXD -> PA3 RXD -> PA2

pull up boot(maybe button or pin header) and reset to download mode :D

hope someone can helps to fix this bug

HalfSweet commented 6 months ago

Thank you very much for your reply, may I ask what is the real model of the MCU you are using @XusMochizuki

XusMochizuki commented 6 months ago

Thank you very much for your reply, may I ask what is the real model of the MCU you are using @XusMochizuki

py32f003f18P6

be-engineer commented 6 months ago

Thank you very much for your reply, may I ask what is the real model of the MCU you are using @XusMochizuki

py32f003f18P6

It works fine with modified .h file,thanks

NoNamedCat commented 5 months ago

Can you make a pr with the modified code?

ANH2018 commented 5 months ago

Dear @XusMochizuki Do you have any tool to upload code? I wrote a program using Arduino ide but I don't know how to load the program. Thanks

be-engineer commented 4 months ago

Dear @XusMochizuki Do you have any tool to upload code? I wrote a program using Arduino ide but I don't know how to load the program. Thanks

I use pyocd with pwlink tool in linux.You can refer to it

XusMochizuki commented 4 months ago

Can you make a pr with the modified code?

Im afraid that I cant do it now, thats because this proj was created based some MCU with PLL function, many codes need reference the defines of PLL, these defines in the official file such as "py32f003x8.h", due to issues such as open source protocols not being included in this GitHub project, it is not feasible to add definitions. Although it is possible to modify the code in this repository for areas that require special definitions (such as # ifdef NOPLL...), this is a complex project and I currently do not have much time to solve this problem. Therefore, if conditions permit, I recommend fixing it by modifying the reference files

我很抱歉我现在不能做到, 因为项目是基于有PLL外设的MCU的代码开发的, 在像是py32f003这样的mcu代码中并不包括这些定义, 并且定义代码是由普冉官方创建的, 由于开源协议等问题并不包括在该github项目中, 因此通过添加定义的方法并不可行, 虽然可以通过修改该仓库中的代码对需要特殊定义的地方进行修改(例如#ifdef NO_PLL...)但这是一个较为复杂的工程, 由于我最近的工作较为繁忙因此难以抽出较多时间来修复 因此, 如果条件允许, 我还是推荐通过修改引用文件的方式来修复