Skip to content

how to build for CH32V003 #1

@inajob

Description

@inajob

Is this project support CH32V003?

I try to build for CH32V003(by TARGET_MCU=CH32V003) but below errors happened.

Do I have to rewrite these constants for CH32V003?

main.c: In function 't1pwm_init':
main.c:136:25: error: 'AFIO_PCFR1_TIM1_RM' undeclared (first use in this function); did you mean 'AFIO_PCFR1_TIM1_1_RM'?
  136 |         AFIO->PCFR1 &= ~AFIO_PCFR1_TIM1_RM;      // clear the 2-bit field
      |                         ^~~~~~~~~~~~~~~~~~
      |                         AFIO_PCFR1_TIM1_1_RM
main.c:136:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:137:25: error: 'AFIO_PCFR1_TIM1_RM_1' undeclared (first use in this function); did you mean 'AFIO_PCFR1_TIM1_REMAP_1'?
  137 |         AFIO->PCFR1 |=  AFIO_PCFR1_TIM1_RM_1 | AFIO_PCFR1_TIM1_RM_0;    // set remap = 2 (don't OR the same macro twice)
      |                         ^~~~~~~~~~~~~~~~~~~~
      |                         AFIO_PCFR1_TIM1_REMAP_1
main.c:137:48: error: 'AFIO_PCFR1_TIM1_RM_0' undeclared (first use in this function); did you mean 'AFIO_PCFR1_TIM1_REMAP_0'?
  137 |         AFIO->PCFR1 |=  AFIO_PCFR1_TIM1_RM_1 | AFIO_PCFR1_TIM1_RM_0;    // set remap = 2 (don't OR the same macro twice)
      |                                                ^~~~~~~~~~~~~~~~~~~~
      |                                                AFIO_PCFR1_TIM1_REMAP_0
main.c:162:25: error: 'TIM1_CTLR1_CMS' undeclared (first use in this function); did you mean 'TIM_CTLR1_CKD'?
  162 |         TIM1->CTLR1 &= ~TIM1_CTLR1_CMS;
      |                         ^~~~~~~~~~~~~~
      |                         TIM_CTLR1_CKD
main.c:163:24: error: 'TIM1_CTLR1_CMS_0' undeclared (first use in this function); did you mean 'TIM_CTLR1_CKD'?
  163 |         TIM1->CTLR1 |= TIM1_CTLR1_CMS_0;  // Mode 1: center-aligned, interrupt on down-count
      |                        ^~~~~~~~~~~~~~~~
      |                        TIM_CTLR1_CKD
main.c:166:26: error: 'TIM1_SWEVGR_UG' undeclared (first use in this function)
  166 |         TIM1->SWEVGR |=  TIM1_SWEVGR_UG;
      |                          ^~~~~~~~~~~~~~
main.c:169:23: error: 'TIM1_CCER_CC1NE' undeclared (first use in this function)
  169 |         TIM1->CCER |= TIM1_CCER_CC1NE | TIM1_CCER_CC1NP;
      |                       ^~~~~~~~~~~~~~~
main.c:169:41: error: 'TIM1_CCER_CC1NP' undeclared (first use in this function)
  169 |         TIM1->CCER |= TIM1_CCER_CC1NE | TIM1_CCER_CC1NP;
      |                                         ^~~~~~~~~~~~~~~
main.c:172:23: error: 'TIM1_CCER_CC1E' undeclared (first use in this function)
  172 |         TIM1->CCER |= TIM1_CCER_CC1E | TIM1_CCER_CC1P;
      |                       ^~~~~~~~~~~~~~
main.c:172:40: error: 'TIM1_CCER_CC1P' undeclared (first use in this function)
  172 |         TIM1->CCER |= TIM1_CCER_CC1E | TIM1_CCER_CC1P;
      |                                        ^~~~~~~~~~~~~~
main.c:175:26: error: 'TIM1_CHCTLR1_OC1M_2' undeclared (first use in this function)
  175 |         TIM1->CHCTLR1 |= TIM1_CHCTLR1_OC1M_2 | TIM1_CHCTLR1_OC1M_1;
      |                          ^~~~~~~~~~~~~~~~~~~
main.c:175:48: error: 'TIM1_CHCTLR1_OC1M_1' undeclared (first use in this function)
  175 |         TIM1->CHCTLR1 |= TIM1_CHCTLR1_OC1M_2 | TIM1_CHCTLR1_OC1M_1;
      |                                                ^~~~~~~~~~~~~~~~~~~
main.c:181:23: error: 'TIM1_BDTR_MOE' undeclared (first use in this function)
  181 |         TIM1->BDTR |= TIM1_BDTR_MOE;
      |                       ^~~~~~~~~~~~~
main.c: In function 'pwm_audio_start':
main.c:207:28: error: 'TIM1_DMAINTENR_UDE' undeclared (first use in this function)
  207 |         TIM1->DMAINTENR |= TIM1_DMAINTENR_UDE;
      |                            ^~~~~~~~~~~~~~~~~~
main.c:213:24: error: 'TIM1_CTLR1_CEN' undeclared (first use in this function); did you mean 'TIM_CTLR1_CKD'?
  213 |         TIM1->CTLR1 |= TIM1_CTLR1_CEN;
      |                        ^~~~~~~~~~~~~~
      |                        TIM_CTLR1_CKD
main.c: In function 'pwm_audio_stop':
main.c:233:25: error: 'TIM1_CTLR1_CEN' undeclared (first use in this function); did you mean 'TIM_CTLR1_CKD'?
  233 |         TIM1->CTLR1 &= ~TIM1_CTLR1_CEN;
      |                         ^~~~~~~~~~~~~~
      |                         TIM_CTLR1_CKD
main.c:234:29: error: 'TIM1_DMAINTENR_UDE' undeclared (first use in this function)
  234 |         TIM1->DMAINTENR &= ~TIM1_DMAINTENR_UDE;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions