├── .gitignore ├── Examples ├── ADC │ ├── ADC0_ADC1_regular_parallel │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC0_EXTI_trigger_regular_inserted_channel │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC0_TIMER1_trigger_inserted_channel │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC0_regular_channel_discontinuous_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC0_regular_channel_with_DMA │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC0_temperature_Vref │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── ADC1_analog_watchdog │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── Oversample_shift │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ └── Resolution │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h ├── BKP │ ├── Backup_Data │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── Tamper │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── CAN │ ├── communication_Loopback │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── communication_among_CANs │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── communication_among_Devices │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── CRC │ └── CRC_calculate │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── DAC │ ├── DAC0_ADC_convert │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DAC0_DMA_convert │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DAC0_EXTI_trigger │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DAC0_LFSR_noise_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DAC1_triangle_noise_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DACC_independent_trigger_LFSR_noise │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DACC_output_voltage │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DACC_simultaneous_trigger_triangle_noise │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── DACC_software_trigger_LFSR_noise │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── DBG │ └── Timer1_stop │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h ├── DMA │ ├── Flash_to_ram │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Ram_to_ram │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── Ram_to_usart │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── EXMC │ ├── LCD │ │ ├── exmc_lcd.c │ │ ├── exmc_lcd.h │ │ ├── gd32vf103_libopt.h │ │ ├── ili9320.c │ │ ├── ili9320.h │ │ ├── ili9320_font.h │ │ ├── main.c │ │ ├── picture.c │ │ ├── picture.h │ │ └── readme.txt │ ├── NOR │ │ ├── exmc_norflash.c │ │ ├── exmc_norflash.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── SRAM │ │ ├── exmc_sram.c │ │ ├── exmc_sram.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── EXTI │ └── Key_external_interrupt_mode │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── FMC │ ├── Erase_Program │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── main.h │ │ └── readme.txt │ └── Write_Protection │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── FWDGT │ └── FWDGT_key │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h ├── GPIO │ ├── Keyboard_polling_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ └── Running_led │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h ├── I2C │ ├── Master_receiver │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_receiver_one_byte │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_receiver_slave_transmitter │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_receiver_slave_transmitter_interrupt │ │ ├── I2C0_IE.c │ │ ├── I2C1_IE.c │ │ ├── I2C_IE.h │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_receiver_two_bytes │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_transmitter │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_transmitter_slave_receiver │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_transmitter_slave_receiver_dma │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Master_transmitter_slave_receiver_interrupt │ │ ├── I2C0_IE.c │ │ ├── I2C1_IE.c │ │ ├── I2C_IE.h │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Slave_receiver │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── Slave_transmitter │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── PMU │ ├── Deepsleep_wakeup_exti │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── main.h │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── Low_voltage_detector │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── Standby_wakeup_pin │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── RTC │ └── Calendar_demo │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── rtc.c │ │ └── rtc.h ├── SPI │ ├── I2S_master_transmit_slave_receive_dma │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── SPI_master_slave_fullduplex_dma │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── SPI_master_slave_fullduplex_nssp_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── SPI_master_slave_fullduplex_polling │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── SPI_master_slave_fullduplex_ti_mode │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── SPI_master_transmit_slave_receive_interrupt │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── TIMER │ ├── TIMER0_6-steps │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── main.c │ │ ├── readme.txt │ │ ├── systick.c │ │ └── systick.h │ ├── TIMER0_complementarysignals │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER0_deadtime_break │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER0_dma │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER0_dma_burst │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_exttrigger │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_ocactive │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_ocinactive │ │ ├── gd32vf103_it.c │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_octoggle │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_pwmout │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_singlepulse │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER1_timebase │ │ ├── gd32vf103_it.c │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER2_inputcapture │ │ ├── gd32vf103_it.c │ │ ├── main.c │ │ └── readme.txt │ ├── TIMER2_pwminputcapture │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── main.c │ │ └── readme.txt │ ├── TIMERs_cascadesynchro │ │ ├── main.c │ │ └── readme.txt │ └── TIMERs_parallelsynchro │ │ ├── main.c │ │ └── readme.txt ├── USART │ ├── DMA_transmitter&receiver │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── DMA_transmitter&receiver_interrupt │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Half_duplex_transmitter&receiver │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Printf │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ ├── Synchronous │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt │ └── Transmitter&receiver_interrupt │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── main.c │ │ └── readme.txt ├── USBFS │ ├── USB_Device │ │ ├── Audio │ │ │ ├── Eclipse │ │ │ │ └── usbd_audio │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── .settings │ │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ │ ├── audio_core.h │ │ │ │ ├── gd32vf103_audio_codec.h │ │ │ │ ├── gd32vf103_it.h │ │ │ │ ├── gd32vf103_libopt.h │ │ │ │ ├── usb_conf.h │ │ │ │ ├── usbd_audio_out_if.h │ │ │ │ └── usbd_conf.h │ │ │ ├── Source │ │ │ │ ├── app.c │ │ │ │ ├── audio_core.c │ │ │ │ ├── gd32vf103_audio_codec.c │ │ │ │ ├── gd32vf103_hw.c │ │ │ │ ├── gd32vf103_it.c │ │ │ │ ├── system_gd32vf103.c │ │ │ │ └── usbd_audio_out_if.c │ │ │ └── readme.txt │ │ ├── CDC_ACM │ │ │ ├── Eclipse │ │ │ │ └── cdc_acm │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── .settings │ │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ │ ├── cdc_acm_core.h │ │ │ │ ├── gd32vf103_it.h │ │ │ │ ├── gd32vf103_libopt.h │ │ │ │ ├── usb_conf.h │ │ │ │ └── usbd_conf.h │ │ │ ├── Source │ │ │ │ ├── app.c │ │ │ │ ├── cdc_acm_core.c │ │ │ │ ├── gd32vf103_hw.c │ │ │ │ ├── gd32vf103_it.c │ │ │ │ └── system_gd32vf103.c │ │ │ └── readme.txt │ │ ├── DFU │ │ │ ├── Eclipse │ │ │ │ └── usbd_dfu │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── .settings │ │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ │ ├── dfu_core.h │ │ │ │ ├── dfu_mal.h │ │ │ │ ├── flash_if.h │ │ │ │ ├── gd32vf103_it.h │ │ │ │ ├── gd32vf103_libopt.h │ │ │ │ ├── usb_conf.h │ │ │ │ └── usbd_conf.h │ │ │ ├── Source │ │ │ │ ├── app.c │ │ │ │ ├── dfu_core.c │ │ │ │ ├── dfu_mal.c │ │ │ │ ├── flash_if.c │ │ │ │ ├── gd32vf103_hw.c │ │ │ │ ├── gd32vf103_it.c │ │ │ │ └── system_gd32vf103.c │ │ │ └── readme.txt │ │ ├── HID_IAP │ │ │ ├── Eclipse │ │ │ │ └── in_application_program │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── .settings │ │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ │ ├── gd32vf103_it.h │ │ │ │ ├── gd32vf103_libopt.h │ │ │ │ ├── iap_core.h │ │ │ │ ├── usb_conf.h │ │ │ │ └── usbd_conf.h │ │ │ ├── Source │ │ │ │ ├── app.c │ │ │ │ ├── gd32vf103_hw.c │ │ │ │ ├── gd32vf103_it.c │ │ │ │ ├── iap_core.c │ │ │ │ └── system_gd32vf103.c │ │ │ └── readme.txt │ │ ├── HID_Mouse │ │ │ ├── Eclipse │ │ │ │ └── usbd_mouse │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── .settings │ │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ │ ├── gd32vf103_it.h │ │ │ │ ├── gd32vf103_libopt.h │ │ │ │ ├── standard_hid_core.h │ │ │ │ ├── systick.h │ │ │ │ ├── usb_conf.h │ │ │ │ ├── usb_hid.h │ │ │ │ └── usbd_conf.h │ │ │ ├── Source │ │ │ │ ├── app.c │ │ │ │ ├── gd32vf103_hw.c │ │ │ │ ├── gd32vf103_it.c │ │ │ │ ├── standard_hid_core.c │ │ │ │ ├── system_gd32vf103.c │ │ │ │ └── systick.c │ │ │ └── readme.txt │ │ └── MSC_Internal_flash │ │ │ ├── Eclipse │ │ │ └── usbd_msc │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── .settings │ │ │ │ └── language.settings.xml │ │ │ ├── Include │ │ │ ├── flash_msd.h │ │ │ ├── gd32vf103_it.h │ │ │ ├── gd32vf103_libopt.h │ │ │ ├── msc_bbb.h │ │ │ ├── msc_scsi.h │ │ │ ├── usb_conf.h │ │ │ ├── usb_msc.h │ │ │ ├── usbd_conf.h │ │ │ ├── usbd_msc_bbb.h │ │ │ ├── usbd_msc_core.h │ │ │ ├── usbd_msc_data.h │ │ │ ├── usbd_msc_mem.h │ │ │ └── usbd_msc_scsi.h │ │ │ ├── Source │ │ │ ├── app.c │ │ │ ├── flash_msd.c │ │ │ ├── gd32vf103_hw.c │ │ │ ├── gd32vf103_it.c │ │ │ ├── system_gd32vf103.c │ │ │ ├── usbd_msc_bbb.c │ │ │ ├── usbd_msc_core.c │ │ │ ├── usbd_msc_data.c │ │ │ ├── usbd_msc_scsi.c │ │ │ └── usbd_storage_msd.c │ │ │ └── readme.txt │ └── USB_Host │ │ ├── HID_Host │ │ ├── Eclipse │ │ │ └── usbh_hid │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── .settings │ │ │ │ └── language.settings.xml │ │ ├── Include │ │ │ ├── gd32vf103_it.h │ │ │ ├── gd32vf103_libopt.h │ │ │ ├── lcd_font.h │ │ │ ├── lcd_log.h │ │ │ ├── usb_conf.h │ │ │ ├── usb_hid.h │ │ │ ├── usbh_conf.h │ │ │ ├── usbh_hid_core.h │ │ │ ├── usbh_hid_keybd.h │ │ │ ├── usbh_hid_mouse.h │ │ │ └── usbh_usr.h │ │ ├── Source │ │ │ ├── app.c │ │ │ ├── gd32vf103_it.c │ │ │ ├── gd32vf103_usb_hw.c │ │ │ ├── lcd_font.c │ │ │ ├── lcd_log.c │ │ │ ├── system_gd32vf103.c │ │ │ ├── usbh_hid_core.c │ │ │ ├── usbh_hid_keybd.c │ │ │ ├── usbh_hid_mouse.c │ │ │ └── usbh_usr.c │ │ └── readme.txt │ │ └── MSC_Host │ │ ├── Eclipse │ │ └── usbh_msc │ │ │ ├── .cproject │ │ │ ├── .project │ │ │ └── .settings │ │ │ └── language.settings.xml │ │ ├── Include │ │ ├── diskio.h │ │ ├── fattime.h │ │ ├── ff.h │ │ ├── ffconf.h │ │ ├── gd32vf103_it.h │ │ ├── gd32vf103_libopt.h │ │ ├── integer.h │ │ ├── lcd_font.h │ │ ├── lcd_log.h │ │ ├── msc_bbb.h │ │ ├── msc_scsi.h │ │ ├── usb_conf.h │ │ ├── usb_msc.h │ │ ├── usbh_conf.h │ │ ├── usbh_msc_bbb.h │ │ ├── usbh_msc_core.h │ │ ├── usbh_msc_scsi.h │ │ └── usbh_usr.h │ │ ├── Source │ │ ├── app.c │ │ ├── fattime.c │ │ ├── ff.c │ │ ├── gd32vf103_it.c │ │ ├── gd32vf103_usb_hw.c │ │ ├── lcd_font.c │ │ ├── lcd_log.c │ │ ├── system_gd32vf103.c │ │ ├── usbh_msc_bbb.c │ │ ├── usbh_msc_core.c │ │ ├── usbh_msc_fatfs.c │ │ ├── usbh_msc_scsi.c │ │ └── usbh_usr.c │ │ └── readme.txt └── WWDGT │ └── WWDGT_delay_feed │ ├── gd32vf103_libopt.h │ ├── main.c │ ├── readme.txt │ ├── systick.c │ └── systick.h ├── Firmware ├── GD32VF103_standard_peripheral │ ├── Include │ │ ├── gd32vf103_adc.h │ │ ├── gd32vf103_bkp.h │ │ ├── gd32vf103_can.h │ │ ├── gd32vf103_crc.h │ │ ├── gd32vf103_dac.h │ │ ├── gd32vf103_dbg.h │ │ ├── gd32vf103_dma.h │ │ ├── gd32vf103_eclic.h │ │ ├── gd32vf103_exmc.h │ │ ├── gd32vf103_exti.h │ │ ├── gd32vf103_fmc.h │ │ ├── gd32vf103_fwdgt.h │ │ ├── gd32vf103_gpio.h │ │ ├── gd32vf103_i2c.h │ │ ├── gd32vf103_pmu.h │ │ ├── gd32vf103_rcu.h │ │ ├── gd32vf103_rtc.h │ │ ├── gd32vf103_spi.h │ │ ├── gd32vf103_timer.h │ │ ├── gd32vf103_usart.h │ │ └── gd32vf103_wwdgt.h │ ├── Source │ │ ├── gd32vf103_adc.c │ │ ├── gd32vf103_bkp.c │ │ ├── gd32vf103_can.c │ │ ├── gd32vf103_crc.c │ │ ├── gd32vf103_dac.c │ │ ├── gd32vf103_dbg.c │ │ ├── gd32vf103_dma.c │ │ ├── gd32vf103_eclic.c │ │ ├── gd32vf103_exmc.c │ │ ├── gd32vf103_exti.c │ │ ├── gd32vf103_fmc.c │ │ ├── gd32vf103_fwdgt.c │ │ ├── gd32vf103_gpio.c │ │ ├── gd32vf103_i2c.c │ │ ├── gd32vf103_pmu.c │ │ ├── gd32vf103_rcu.c │ │ ├── gd32vf103_rtc.c │ │ ├── gd32vf103_spi.c │ │ ├── gd32vf103_timer.c │ │ ├── gd32vf103_usart.c │ │ └── gd32vf103_wwdgt.c │ ├── gd32vf103.h │ ├── system_gd32vf103.c │ └── system_gd32vf103.h ├── GD32VF103_usbfs_driver │ ├── Include │ │ ├── drv_usb_core.h │ │ ├── drv_usb_dev.h │ │ ├── drv_usb_host.h │ │ ├── drv_usb_hw.h │ │ ├── drv_usb_regs.h │ │ ├── drv_usbd_int.h │ │ ├── drv_usbh_int.h │ │ ├── usb_ch9_std.h │ │ ├── usbd_core.h │ │ ├── usbd_enum.h │ │ ├── usbd_transc.h │ │ ├── usbh_core.h │ │ ├── usbh_enum.h │ │ ├── usbh_pipe.h │ │ └── usbh_transc.h │ └── Source │ │ ├── drv_usb_core.c │ │ ├── drv_usb_dev.c │ │ ├── drv_usb_host.c │ │ ├── drv_usbd_int.c │ │ ├── drv_usbh_int.c │ │ ├── usbd_core.c │ │ ├── usbd_enum.c │ │ ├── usbd_transc.c │ │ ├── usbh_core.c │ │ ├── usbh_enum.c │ │ ├── usbh_pipe.c │ │ └── usbh_transc.c └── RISCV │ ├── drivers │ ├── n200_eclic.h │ ├── n200_func.c │ ├── n200_func.h │ ├── n200_timer.h │ ├── riscv_bits.h │ ├── riscv_const.h │ └── riscv_encoding.h │ ├── env_Eclipse │ ├── GD32VF103x4.lds │ ├── GD32VF103x6.lds │ ├── GD32VF103x8.lds │ ├── GD32VF103xB.lds │ ├── entry.S │ ├── handlers.c │ ├── init.c │ ├── start.S │ └── your_printf.c │ └── stubs │ ├── _exit.c │ ├── close.c │ ├── fstat.c │ ├── isatty.c │ ├── lseek.c │ ├── read.c │ ├── sbrk.c │ ├── stub.h │ ├── write.c │ └── write_hex.c ├── README.md ├── Template ├── Makefile ├── eclipse │ ├── .cproject │ ├── .project │ └── .settings │ │ ├── language.settings.xml │ │ ├── org.eclipse.cdt.codan.core.prefs │ │ └── org.eclipse.cdt.core.prefs ├── gd32vf103_libopt.h ├── gd32vf103v_eval.c ├── gd32vf103v_eval.h ├── handlers.c ├── init.c ├── main.c ├── main.h ├── openocd_cmsis-dap.cfg ├── openocd_ft2232.cfg ├── openocd_ftdi.cfg ├── openocd_gdlink.cfg ├── openocd_ub.cfg ├── openocd_wch.cfg ├── readme.txt ├── systick.c └── systick.h └── Utilities ├── LCD_common ├── lcd_font.c └── lcd_font.h ├── gd32vf103v_eval.c ├── gd32vf103v_eval.h ├── gd32vf103v_lcd_eval.c └── gd32vf103v_lcd_eval.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | */build 3 | *~ 4 | *.tmp 5 | */.deps 6 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_ADC1_regular_parallel/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_EXTI_trigger_regular_inserted_channel/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | 42 | /* this function handles ADC0 and ADC1 interrupt */ 43 | void ADC0_1_IRQHandler(void); 44 | 45 | #endif /* GD32VF103_IT_H */ 46 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_EXTI_trigger_regular_inserted_channel/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_TIMER1_trigger_inserted_channel/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | 42 | /* this function handles ADC0 and ADC1 interrupt */ 43 | void ADC0_1_IRQHandler(void); 44 | 45 | #endif /* GD32VF103_IT_H */ 46 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_TIMER1_trigger_inserted_channel/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the ADC TIMER trigger injected channel 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-1.0 board, it shows how to convert ADC inserted 36 | group channels continuously using TIMER1 external trigger. 37 | 38 | The inserted group length is 4, the scan mode is set, every compare event will trigger ADC 39 | to convert all the channels in the inserted group. 40 | 41 | We can watch adc_value in debug mode or by COM. 42 | JP5 and JP6 jump to USART. 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_TIMER1_trigger_inserted_channel/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_regular_channel_discontinuous_mode/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the ADC discontinuous mode example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-1.0 board, it shows how to use the ADC discontinuous 36 | mode. The ADC is configured in discontinuous mode, group length is 8, conversion length is 3, 37 | using software trigger. Every trigger converts 3 channels. 38 | 39 | We can watch array adc_value[] in debug mode or by COM. 40 | JP5 and JP6 jump to USART. -------------------------------------------------------------------------------- /Examples/ADC/ADC0_regular_channel_discontinuous_mode/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_regular_channel_with_DMA/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC0_temperature_Vref/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/ADC1_analog_watchdog/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | 42 | /* this function handles ADC0_1 exception */ 43 | void ADC0_1_IRQHandler(void); 44 | 45 | #endif /* GD32VF103_IT_H */ 46 | -------------------------------------------------------------------------------- /Examples/ADC/ADC1_analog_watchdog/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/Oversample_shift/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the ADC oversample shift example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-1.0 board, it shows how to use 36 | the function of oversample and shift. In this demo, 16 times ratio of 37 | oversample and 4 bits shift are configured. PC3(channel13) is chosen as 38 | analog input pin. The ADC conversion begins by software, the converted 39 | data is printed by USART. 40 | 41 | The analog input pin should configured to analog mode. 42 | JP5 and JP6 jump to USART. -------------------------------------------------------------------------------- /Examples/ADC/Oversample_shift/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/ADC/Resolution/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the ADC resolution demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-1.0 board, it shows how to use 36 | the function of programmble resolusion. In this demo, 6B resolusion 37 | is configured. PC3(channel13) is chosen as analog input pin. The ADC 38 | conversion begins by software, the converted data is printed by USART. 39 | 40 | The analog input pin should configured to analog mode. 41 | JP5 and JP6 jump to USART. -------------------------------------------------------------------------------- /Examples/ADC/Resolution/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/BKP/Tamper/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* TAMPER handle function */ 42 | void TAMPER_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/CAN/communication_Loopback/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | 7 | */ 8 | 9 | /* 10 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef GD32VF103_IT_H 37 | #define GD32VF103_IT_H 38 | 39 | #include "gd32vf103.h" 40 | 41 | /* function declarations */ 42 | /* CAN0 RX0 handle function */ 43 | void CAN0_RX0_IRQHandler(void); 44 | /* CAN1 RX0 handle function */ 45 | void CAN1_RX0_IRQHandler(void); 46 | 47 | #endif /* GD32VF103_IT_H */ 48 | -------------------------------------------------------------------------------- /Examples/CAN/communication_among_CANs/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | 7 | */ 8 | 9 | /* 10 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef GD32VF103_IT_H 37 | #define GD32VF103_IT_H 38 | 39 | #include "gd32vf103.h" 40 | 41 | /* function declarations */ 42 | /* CAN0 RX0 handle function */ 43 | void CAN0_RX0_IRQHandler(void); 44 | /* CAN1 RX0 handle function */ 45 | void CAN1_RX0_IRQHandler(void); 46 | 47 | #endif /* GD32VF103_IT_H */ 48 | -------------------------------------------------------------------------------- /Examples/CAN/communication_among_Devices/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | 7 | */ 8 | 9 | /* 10 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | 1. Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 2. Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 3. Neither the name of the copyright holder nor the names of its contributors 21 | may be used to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | OF SUCH DAMAGE. 34 | */ 35 | 36 | #ifndef GD32VF103_IT_H 37 | #define GD32VF103_IT_H 38 | 39 | #include "gd32vf103.h" 40 | 41 | /* function declarations */ 42 | /* CAN0 RX0 handle function */ 43 | void CAN0_RX0_IRQHandler(void); 44 | /* CAN1 RX0 handle function */ 45 | void CAN1_RX0_IRQHandler(void); 46 | 47 | #endif /* GD32VF103_IT_H */ 48 | -------------------------------------------------------------------------------- /Examples/CRC/CRC_calculate/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of CRC example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 3. Neither the name of the copyright holder nor the names of its contributors 22 | may be used to endorse or promote products derived from this software without 23 | specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 34 | OF SUCH DAMAGE. 35 | */ 36 | 37 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use CRC to 38 | calculate the CRC value. 39 | 40 | In this demo, 1 CRC value is calculated for a 32-bit data. If the result is success, 41 | turn on the LED2 and LED3. 42 | -------------------------------------------------------------------------------- /Examples/DAC/DAC0_ADC_convert/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | 42 | /* this function handles ADC0 and ADC1 interrupt */ 43 | void ADC0_1_IRQHandler(void); 44 | 45 | #endif /* GD32VF103_IT_H */ 46 | -------------------------------------------------------------------------------- /Examples/DAC/DAC0_ADC_convert/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DAC0_ADC_convert example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC0 to generate 36 | a signal from ADC. In the ADC interrupt, ADC data transfer from ADC_RDATA to DAC0_R8DH. 37 | The DAC0 output pin is configured PA4. The signal can be observed through the oscilloscope. 38 | -------------------------------------------------------------------------------- /Examples/DAC/DAC0_DMA_convert/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DAC0_DMA_convert example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC0 to generate 36 | a staircase-shaped signal. TIMER5 is chosen to trigger DAC0 and DMA is configured to transfer 37 | data from memory to DAC0_R8DH. The DAC0 output pin is configured PA4. The signal can be 38 | observed through the oscilloscope. 39 | -------------------------------------------------------------------------------- /Examples/DAC/DAC0_EXTI_trigger/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DAC0_EXTI_trigger example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use EXTI line 9 36 | to trigger DAC0. The DAC0 output pin is configured PA4. Connect one key (PA0 for 37 | example) and GPIO PE9 with Dupont line. Press the key (Wakeup for example) for many 38 | times, the variations of the wave can be observed through the oscilloscope. 39 | -------------------------------------------------------------------------------- /Examples/DAC/DAC0_LFSR_noise_mode/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DAC0_LFSR_noise_mode example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC0 to generate 36 | LFSR noise wave. TIMER5 is chosen to trigger DAC0. The DAC0 output pin is configured PA4. 37 | The LFSR noise wave can be observed through the oscilloscope. 38 | -------------------------------------------------------------------------------- /Examples/DAC/DAC1_triangle_noise_mode/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DAC1_triangle_noise_mode example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC1 to generate 36 | triangle noise wave. TIMER6 is chosen to trigger DAC1. The DAC1 output pin is configured 37 | PA5. The triangle noise wave can be observed through the oscilloscope. 38 | -------------------------------------------------------------------------------- /Examples/DAC/DACC_independent_trigger_LFSR_noise/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DACC_independent_trigger_LFSR_noise example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC concurrent mode 36 | independent trigger to generate LFSR noise wave with different configurations. TIMER5 is 37 | chosen to trigger DAC0. TIMER6 is chosen to trigger DAC1. The DAC0 output pin is configured 38 | PA4 and DAC1 output pin is configured PA5. The LFSR noise wave can be observed through the 39 | oscilloscope. 40 | -------------------------------------------------------------------------------- /Examples/DAC/DACC_output_voltage/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DACC_output_voltage example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC concurrent mode 36 | output voltage. No trigger source is chosen to trigger DAC. The DAC0 output pin is configured 37 | PA4 and DAC1 output pin is configured PA5. There are two different voltage in PA4 and PA5. The 38 | voltage of PA4 is VREF/2 and the voltage of PA5 is VREF/8. 39 | -------------------------------------------------------------------------------- /Examples/DAC/DACC_simultaneous_trigger_triangle_noise/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DACC_simultaneous_trigger_triangle_noise example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC concurrent mode 36 | simultaneous trigger to generate triangle noise wave with same amplitude. TIMER5 is chosen 37 | to trigger DAC0 and DAC1. The DAC0 output pin is configured PA4 and DAC1 output pin is configured 38 | PA5. The triangle noise wave can be observed through the oscilloscope. 39 | -------------------------------------------------------------------------------- /Examples/DAC/DACC_software_trigger_LFSR_noise/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of DACC_software_trigger_LFSR_noise example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use DAC concurrent 36 | mode software trigger to generate LFSR noise wave with different configurations. The 37 | DAC0 output pin is configured PA4 and DAC1 output pin is configured PA5. The LFSR 38 | noise wave can be observed through the oscilloscope. -------------------------------------------------------------------------------- /Examples/DBG/Timer1_stop/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/DMA/Flash_to_ram/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* DMA0_Channel0 handle function */ 42 | void DMA0_Channel0_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/DMA/Ram_to_usart/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* DMA0_Channel3 handle function */ 42 | void DMA0_Channel3_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/EXMC/LCD/exmc_lcd.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file exmc_lcd.h 3 | \brief the header file of EXMC LCD driver 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef EXMC_LCD_H 36 | #define EXMC_LCD_H 37 | 38 | /* lcd peripheral initialize */ 39 | void exmc_lcd_init(void); 40 | 41 | #endif /* EXMC_LCD_H */ 42 | -------------------------------------------------------------------------------- /Examples/EXMC/LCD/picture.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file picture.h 3 | \brief picture header file 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef PICTURE_H 36 | #define PICTURE_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | #define BMP_HEADSIZE (8) 41 | 42 | extern const uint8_t picture[]; 43 | 44 | #endif /* PICTURE_H */ 45 | -------------------------------------------------------------------------------- /Examples/EXMC/LCD/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the EXMC_LCD demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use EXMC 36 | peripheral to drive LCD. This board uses EXMC_NE0 to support LCD. You can see 37 | GigaDevice logo and website on the LCD screen. 38 | 39 | JP13 and JP14 must be fitted to EXMC. 40 | 41 | -------------------------------------------------------------------------------- /Examples/EXMC/NOR/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the EXMC_NOR demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V board, it shows how to use EXMC peripheral to 36 | control NOR memory. 37 | 38 | This demo shows the write and read data operation process of NOR memory by 39 | EXMC module. If the operation is correct, a success information and the data writed 40 | to the NOR memory. Otherwise, a failure information will be printed out. 41 | -------------------------------------------------------------------------------- /Examples/EXMC/SRAM/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the EXMC_SRAM demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V board, it shows how to use EXMC peripheral 36 | to control SRAM memory. 37 | 38 | This demo shows the write and read data operation process of SRAM memory by EXMC 39 | module. If the operation is correct, "SRAM test successed!" will be printed and the 40 | data read from the SRAM will be printed out. Otherwise, "SRAM test failed!" will be 41 | printed. 42 | -------------------------------------------------------------------------------- /Examples/EXTI/Key_external_interrupt_mode/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 3. Neither the name of the copyright holder nor the names of its contributors 22 | may be used to endorse or promote products derived from this software without 23 | specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 34 | OF SUCH DAMAGE. 35 | */ 36 | 37 | 38 | #ifndef GD32VF103_IT_H 39 | #define GD32VF103_IT_H 40 | 41 | #include "gd32vf103.h" 42 | 43 | /* function declarations */ 44 | /* this function handles external lines 10 to 15 interrupt request */ 45 | void EXTI10_15_IRQHandler(void); 46 | 47 | #endif /* GD32VF103_IT_H */ 48 | -------------------------------------------------------------------------------- /Examples/FMC/Erase_Program/main.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file main.h 3 | \brief the header file of main 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_H 36 | #define MAIN_H 37 | 38 | /* erase fmc pages from FMC_WRITE_START_ADDR to FMC_WRITE_END_ADDR */ 39 | void fmc_erase_pages(void); 40 | /* program fmc word by word from FMC_WRITE_START_ADDR to FMC_WRITE_END_ADDR */ 41 | void fmc_program(void); 42 | /* check fmc erase result */ 43 | void fmc_erase_pages_check(void); 44 | /* check fmc program result */ 45 | void fmc_program_check(void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Examples/FWDGT/FWDGT_key/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* external lines 10 to 15 interrupt handle function */ 42 | void EXTI10_15_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/FWDGT/FWDGT_key/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/GPIO/Keyboard_polling_mode/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of keyboard polling mode example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it provides a description 36 | of how to use Tamper key to control the LED1. The example uses polling mode. 37 | 38 | Press the KEY_B, LED1 will be on. Press the KEY_B again, LED1 will be off. 39 | 40 | On the GD32VF103V-EVAL-V1.0 board, the Tamper key is connected to PA0 and the LED1 41 | is connected to PC0. 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Examples/GPIO/Keyboard_polling_mode/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/GPIO/Running_led/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of running led example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it provides a description 36 | of Running_led. After system start-up, firstly, LED1 on, then, LED2 on, four 37 | LEDs can light periodically. 38 | 39 | On the GD32VF103V-EVAL-V1.0 board,LED1 connected to PC0, LED2 connected to PC2, LED3 40 | connected to PE0, LED4 connected to PE1. 41 | -------------------------------------------------------------------------------- /Examples/GPIO/Running_led/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Examples/I2C/Master_transmitter_slave_receiver_interrupt/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* I2C0 event handle function */ 42 | void I2C0_EV_IRQHandler(void); 43 | /* I2C0 error handle function */ 44 | void I2C0_ER_IRQHandler(void); 45 | /* I2C1 event handle function */ 46 | void I2C1_EV_IRQHandler(void); 47 | /* I2C1 error handle function */ 48 | void I2C1_ER_IRQHandler(void); 49 | 50 | #endif /* GD32VF103_IT_H */ 51 | -------------------------------------------------------------------------------- /Examples/PMU/Deepsleep_wakeup_exti/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* eclic_mtip handle function */ 42 | void eclic_mtip_handler(void); 43 | /* EXTI10_15 handle function */ 44 | void EXTI10_15_IRQHandler(void); 45 | 46 | #endif /* GD32VF103_IT_H */ 47 | -------------------------------------------------------------------------------- /Examples/PMU/Deepsleep_wakeup_exti/main.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file main.h 3 | \brief the header file of the main 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_H 36 | #define MAIN_H 37 | 38 | /* led spark function */ 39 | void led_spark(void); 40 | 41 | #endif /* MAIN_H */ 42 | -------------------------------------------------------------------------------- /Examples/PMU/Deepsleep_wakeup_exti/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the deepsleep wakeup through exti demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows pmu how to enter deepsleep 36 | mode and wakeup it. Press wakeup key to enter deepsleep mode, led stop flashing. When 37 | you press tamper key to generate an exti interrupt, mcu will be wakeuped from deepsleep 38 | mode, led sparks again. But the led sparks slower, because at this time IRC8M is the system 39 | clock. 40 | -------------------------------------------------------------------------------- /Examples/PMU/Deepsleep_wakeup_exti/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | /* configure systick */ 41 | void systick_config(void); 42 | /* delay a time in milliseconds */ 43 | void delay_1ms(uint32_t count); 44 | /* delay decrement */ 45 | void delay_decrement(void); 46 | 47 | #endif /* SYS_TICK_H */ 48 | -------------------------------------------------------------------------------- /Examples/PMU/Low_voltage_detector/gd32vf103_it.c: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.c 3 | \brief interrupt service routines 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #include "gd32vf103_it.h" 36 | #include "gd32vf103v_eval.h" 37 | 38 | /*! 39 | \brief this function handles LVD exception 40 | \param[in] none 41 | \param[out] none 42 | \retval none 43 | */ 44 | void LVD_IRQHandler(void) 45 | { 46 | if(RESET != exti_interrupt_flag_get(EXTI_16)){ 47 | gd_eval_led_toggle(LED1); 48 | exti_interrupt_flag_clear(EXTI_16); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Examples/PMU/Low_voltage_detector/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* LVD handle function */ 42 | void LVD_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/PMU/Low_voltage_detector/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the low voltage detector demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use low voltage detector. 36 | If VDD/VDDA is higher or lower than the LVD threshold, then a lvd event will occur. The event 37 | is internally connected to the EXTI line 16 and can generate an interrupt if enabled through 38 | the EXTI registers. Use external power connect 3.3v pin and GND pin of the board , adjust 39 | voltage higher or lower than the LVD threshold 2.9v, LED1 will toggle. 40 | -------------------------------------------------------------------------------- /Examples/PMU/Standby_wakeup_pin/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the standby mode wakeup through wakeup pin demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows pmu how to enter standby 36 | mode and wakeup it. Press tamper key enter standby mode, led turn off. When you press 37 | wakeup key, mcu will be wakeuped from standby mode, led will be turn on. when exit from 38 | the standby mode, a power-on reset occurs and the mcu will execute instruction code 39 | from the 0x00000000 address. 40 | -------------------------------------------------------------------------------- /Examples/RTC/Calendar_demo/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* RTC global interrupt function */ 42 | void RTC_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/RTC/Calendar_demo/rtc.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file rtc.h 3 | \brief headfile of RTC check and config,time_show and time_adjust function 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __RTC_H 36 | #define __RTC_H 37 | 38 | #include "gd32vf103.h" 39 | #include 40 | 41 | void rtc_configuration(void); 42 | uint32_t time_regulate(void); 43 | void time_adjust(void); 44 | void time_display(uint32_t timevar); 45 | void time_show(void); 46 | uint8_t usart_scanf(uint32_t value); 47 | 48 | #endif /* __RTC_H */ 49 | 50 | -------------------------------------------------------------------------------- /Examples/SPI/SPI_master_slave_fullduplex_polling/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the master and slave fullduplex communication use polling demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows SPI0 and SPI2 fullduplex 36 | communication use polling mode.After the communicate is complete,if receive data is equal 37 | to send data, led2 and led3 turn on, if not led2 and led3 turn off. 38 | 39 | Connect SPI0 SCK PIN(PA5) TO SPI2 SCK PIN(PC10). 40 | Connect SPI0 MISO PIN(PA6) TO SPI2 MISO PIN(PC11). 41 | Connect SPI0 MOSI PIN(PA7) TO SPI2 MOSI PIN(PC12). -------------------------------------------------------------------------------- /Examples/SPI/SPI_master_transmit_slave_receive_interrupt/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* SPI0 handle function */ 42 | void SPI0_IRQHandler(void); 43 | /* SPI2 handle function */ 44 | void SPI2_IRQHandler(void); 45 | 46 | #endif /* GD32VF103_IT_H */ 47 | -------------------------------------------------------------------------------- /Examples/SPI/SPI_master_transmit_slave_receive_interrupt/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the master transmit and slave receive through interrupt demo 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it shows master send data and 36 | slave receive data use intterupt mode. 37 | After the communicate is complete,if receive data is equal to send data,led2 turns 38 | on,if not led2 turns off. 39 | 40 | Connect SPI0 SCK PIN(PA5) to SPI2 SCK PIN(PC10). 41 | Connect SPI0 MOSI PIN(PA7) to SPI2 MISO PIN(PC11). -------------------------------------------------------------------------------- /Examples/TIMER/TIMER0_6-steps/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* Core Timer handle function */ 41 | void clic_mtip_handler(void); 42 | /*TIMER0 handle function*/ 43 | void TIMER0_BRK_UP_TRG_COM_IRQHandler(void); 44 | 45 | #endif /* GD32VF103_IT_H */ 46 | -------------------------------------------------------------------------------- /Examples/TIMER/TIMER0_6-steps/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYSTICK_H 36 | #define SYSTICK_H 37 | 38 | #include 39 | 40 | /* configure systick */ 41 | void systick_config(void); 42 | /* delay a time in milliseconds */ 43 | void delay_1ms(uint32_t count); 44 | 45 | #endif /* SYSTICK_H */ 46 | -------------------------------------------------------------------------------- /Examples/TIMER/TIMER1_timebase/gd32vf103_it.c: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.c 3 | \brief interrupt service routines 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | #include "gd32vf103.h" 35 | #include "gd32vf103v_eval.h" 36 | 37 | /** 38 | * @brief This function handles TIMER1 interrupt request. 39 | * @param None 40 | * @retval None 41 | */ 42 | void TIMER1_IRQHandler(void) 43 | { 44 | if(SET == timer_interrupt_flag_get(TIMER1, TIMER_INT_CH0)){ 45 | /* clear channel 0 interrupt bit */ 46 | timer_interrupt_flag_clear(TIMER1, TIMER_INT_CH0); 47 | gd_eval_led_toggle(LED2); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Examples/TIMER/TIMER2_pwminputcapture/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef gd32vf103_IT_H 36 | #define gd32vf103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* TIMER2 handle function */ 41 | void TIMER2_IRQHandler(void); 42 | 43 | #endif /* gd32vf103_IT_H */ 44 | -------------------------------------------------------------------------------- /Examples/USART/DMA_transmitter&receiver/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief USART DMA transmitter receiver 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-V1.0 board, it shows how to use the USART 36 | DMA transmit and receive. 37 | 38 | Firstly, the USART sends the strings to the hyperterminal and then loops waiting for 39 | receiving max 10 bytes data from the hyperterminal.If the number of data you enter 40 | equal with or more than 10 bytes, USART will send 10 bytes to the hyperterminal. 41 | 42 | JP5 and JP6 must be fitted. 43 | 44 | -------------------------------------------------------------------------------- /Examples/USART/DMA_transmitter&receiver_interrupt/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* this function handles DMA0_Channel3_IRQHandler interrupt */ 42 | void DMA0_Channel3_IRQHandler(void); 43 | /* this function handles DMA0_Channel4_IRQHandler interrupt */ 44 | void DMA0_Channel4_IRQHandler(void); 45 | 46 | #endif /* GD32VF103_IT_H */ 47 | -------------------------------------------------------------------------------- /Examples/USART/Printf/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of the USART printf 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This demo is based on the GD32VF103V-EVAL-V1.0 board, it shows how to retarget the C 36 | library printf function to the USART. 37 | 38 | The USARTx is configured as follow: 39 | - BaudRate = 115200 baud 40 | - Word Length = 8 Bits 41 | - One Stop Bit 42 | - No parity 43 | - Hardware flow control disabled (RTS and CTS signals) 44 | - Receive and transmit enabled 45 | 46 | JP5 and JP6 must be fitted. 47 | -------------------------------------------------------------------------------- /Examples/USART/Transmitter&receiver_interrupt/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* this function handles USART RBNE interrupt request and TBE interrupt request */ 42 | void USART0_IRQHandler(void); 43 | 44 | #endif /* GD32VF103_IT_H */ 45 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/Audio/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include "usbd_core.h" 43 | 44 | /* function declarations */ 45 | /* this function handles USB wakeup interrupt handler */ 46 | void USBFS_WKUP_IRQHandler(void); 47 | /* this function handles USBFS IRQ Handler */ 48 | void USBFS_IRQHandler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GD32VF103_IT_H */ 55 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/CDC_ACM/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include "usbd_core.h" 43 | 44 | /* function declarations */ 45 | /* this function handles USB wakeup interrupt handler */ 46 | void USBFS_WKUP_IRQHandler(void); 47 | /* this function handles USBFS IRQ Handler */ 48 | void USBFS_IRQHandler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GD32VF103_IT_H */ 55 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/DFU/Eclipse/usbd_dfu/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/DFU/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include "usbd_core.h" 43 | 44 | /* function declarations */ 45 | /* this function handles USB wakeup interrupt handler */ 46 | void USBFS_WKUP_IRQHandler(void); 47 | /* this function handles USBFS IRQ Handler */ 48 | void USBFS_IRQHandler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GD32VF103_IT_H */ 55 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/HID_IAP/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include "usbd_core.h" 43 | 44 | /* function declarations */ 45 | /* this function handles USB wakeup interrupt handler */ 46 | void USBFS_WKUP_IRQHandler(void); 47 | /* this function handles USBFS IRQ Handler */ 48 | void USBFS_IRQHandler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GD32VF103_IT_H */ 55 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/HID_Mouse/Include/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 3. Neither the name of the copyright holder nor the names of its contributors 22 | may be used to endorse or promote products derived from this software without 23 | specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 34 | OF SUCH DAMAGE. 35 | */ 36 | 37 | #ifndef SYS_TICK_H 38 | #define SYS_TICK_H 39 | 40 | #include 41 | 42 | void systick_config(void); 43 | 44 | #endif /* SYS_TICK_H */ 45 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/HID_Mouse/Source/systick.c: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.c 3 | \brief the systick configuration file 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | 1. Redistributions of source code must retain the above copyright notice, this 17 | list of conditions and the following disclaimer. 18 | 2. Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 3. Neither the name of the copyright holder nor the names of its contributors 22 | may be used to endorse or promote products derived from this software without 23 | specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 34 | OF SUCH DAMAGE. 35 | */ 36 | 37 | #include "gd32vf103.h" 38 | #include "systick.h" 39 | 40 | void systick_config(void) 41 | { 42 | eclic_global_interrupt_enable(); 43 | *(uint64_t*)(TIMER_CTRL_ADDR + TIMER_MTIMECMP) = TIMER_FREQ / 100; 44 | eclic_set_nlbits(ECLIC_GROUP_LEVEL2_PRIO2); 45 | eclic_irq_enable(CLIC_INT_TMR, 3, 3); 46 | *(uint64_t*)(TIMER_CTRL_ADDR + TIMER_MTIME) = 0; 47 | } 48 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Device/MSC_Internal_flash/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | #include "usbd_core.h" 43 | 44 | /* function declarations */ 45 | /* this function handles USB wakeup interrupt handler */ 46 | void USBFS_WKUP_IRQHandler(void); 47 | /* this function handles USBFS IRQ Handler */ 48 | void USBFS_IRQHandler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* GD32VF103_IT_H */ 55 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/HID_Host/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* this function handles USB wakeup interrupt handler */ 42 | void USBFS_WKUP_IRQHandler(void); 43 | /* this function handles USBFS IRQ Handler */ 44 | void USBFS_IRQHandler(void); 45 | 46 | #endif /* GD32VF103_IT_H */ 47 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/HID_Host/Include/lcd_font.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file lcd_font.h 3 | \brief the header file of LCD font 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LCD_FONT_H 36 | #define LCD_FONT_H 37 | 38 | #include 39 | 40 | extern unsigned char const ascii_8x16[1536]; 41 | 42 | extern const uint16_t ASCII_Table_16x24[]; 43 | 44 | #endif /* LCD_FONT_H */ 45 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/HID_Host/Include/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbh_conf.h 3 | \brief general low level driver configuration 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __USBH_CONF_H 36 | #define __USBH_CONF_H 37 | 38 | #define USBH_MAX_EP_NUM 2 39 | #define USBH_MAX_INTERFACES_NUM 2 40 | #define USBH_MSC_MPS_SIZE 0x200 41 | 42 | #endif /* __USBH_CONF_H */ 43 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file R0.07 (C)ChaN, 2009 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO 6 | 7 | #define _READONLY 0 /* 1: Read-only mode */ 8 | #define _USE_IOCTL 1 9 | 10 | #include "integer.h" 11 | 12 | /* Status of Disk Functions */ 13 | typedef BYTE DSTATUS; 14 | 15 | /* Results of Disk Functions */ 16 | typedef enum { 17 | RES_OK = 0, /* 0: Successful */ 18 | RES_ERROR, /* 1: R/W Error */ 19 | RES_WRPRT, /* 2: Write Protected */ 20 | RES_NOTRDY, /* 3: Not Ready */ 21 | RES_PARERR /* 4: Invalid Parameter */ 22 | } DRESULT; 23 | 24 | 25 | /*---------------------------------------*/ 26 | /* Prototypes for disk control functions */ 27 | 28 | bool assign_drives (int argc, char *argv[]); 29 | DSTATUS disk_initialize (BYTE); 30 | DSTATUS disk_status (BYTE); 31 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 32 | #if _READONLY == 0 33 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 34 | #endif 35 | DRESULT disk_ioctl (BYTE, BYTE, void*); 36 | 37 | 38 | 39 | /* Disk Status Bits (DSTATUS) */ 40 | 41 | #define STA_NOINIT 0x01 /* Drive not initialized */ 42 | #define STA_NODISK 0x02 /* No medium in the drive */ 43 | #define STA_PROTECT 0x04 /* Write protected */ 44 | 45 | 46 | /* Command code for disk_ioctrl() */ 47 | 48 | /* Generic command */ 49 | #define CTRL_SYNC 0 /* Mandatory for write functions */ 50 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ 51 | #define GET_SECTOR_SIZE 2 52 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ 53 | #define CTRL_POWER 4 54 | #define CTRL_LOCK 5 55 | #define CTRL_EJECT 6 56 | /* MMC/SDC command */ 57 | #define MMC_GET_TYPE 10 58 | #define MMC_GET_CSD 11 59 | #define MMC_GET_CID 12 60 | #define MMC_GET_OCR 13 61 | #define MMC_GET_SDSTAT 14 62 | /* ATA/CF command */ 63 | #define ATA_GET_REV 20 64 | #define ATA_GET_MODEL 21 65 | #define ATA_GET_SN 22 66 | 67 | #define _DISKIO 68 | #endif 69 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/fattime.h: -------------------------------------------------------------------------------- 1 | #ifndef FATTIME_H_ 2 | 3 | #include "integer.h" 4 | 5 | DWORD get_fattime (void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/gd32vf103_it.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file gd32vf103_it.h 3 | \brief the header file of the ISR 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GD32VF103_IT_H 36 | #define GD32VF103_IT_H 37 | 38 | #include "gd32vf103.h" 39 | 40 | /* function declarations */ 41 | /* this function handles USB wakeup interrupt handler */ 42 | void USBFS_WKUP_IRQHandler(void); 43 | /* this function handles USBFS IRQ Handler */ 44 | void USBFS_IRQHandler(void); 45 | 46 | #endif /* GD32VF103_IT_H */ 47 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _INTEGER 6 | 7 | #if 0 8 | #include 9 | #else 10 | 11 | #include "usb_conf.h" 12 | 13 | /* These types must be 16-bit, 32-bit or larger integer */ 14 | typedef int INT; 15 | typedef unsigned int UINT; 16 | 17 | /* These types must be 8-bit integer */ 18 | typedef signed char CHAR; 19 | typedef unsigned char UCHAR; 20 | typedef unsigned char BYTE; 21 | 22 | /* These types must be 16-bit integer */ 23 | typedef short SHORT; 24 | typedef unsigned short USHORT; 25 | typedef unsigned short WORD; 26 | typedef unsigned short WCHAR; 27 | 28 | /* These types must be 32-bit integer */ 29 | typedef long LONG; 30 | typedef unsigned long ULONG; 31 | typedef unsigned long DWORD; 32 | 33 | /* Boolean type */ 34 | // typedef enum { FALSE = 0, TRUE } BOOL; 35 | #include 36 | //typedef bool BOOL; 37 | #ifndef FALSE 38 | #define FALSE false 39 | #define TRUE true 40 | #endif 41 | 42 | 43 | #endif 44 | 45 | #define _INTEGER 46 | #endif 47 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/lcd_font.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file lcd_font.h 3 | \brief the header file of LCD font 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LCD_FONT_H 36 | #define LCD_FONT_H 37 | 38 | #include 39 | 40 | extern unsigned char const ascii_8x16[1536]; 41 | 42 | extern const uint16_t ASCII_Table_16x24[]; 43 | 44 | #endif /* LCD_FONT_H */ 45 | 46 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Include/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file usbh_conf.h 3 | \brief general low level driver configuration 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __USBH_CONF_H 36 | #define __USBH_CONF_H 37 | 38 | #define USBH_MAX_EP_NUM 2 39 | #define USBH_MAX_INTERFACES_NUM 2 40 | #define USBH_MSC_MPS_SIZE 0x200 41 | 42 | #endif /* __USBH_CONF_H */ 43 | -------------------------------------------------------------------------------- /Examples/USBFS/USB_Host/MSC_Host/Source/fattime.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "integer.h" 4 | #include "fattime.h" 5 | 6 | 7 | DWORD get_fattime (void) 8 | { 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Examples/WWDGT/WWDGT_delay_feed/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Firmware/GD32VF103_standard_peripheral/Source/gd32vf103_fmc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/riscv-mcu/GD32VF103_Firmware_Library/bc2be118f67341b8951ab4814f3dc019e2bd56d8/Firmware/GD32VF103_standard_peripheral/Source/gd32vf103_fmc.c -------------------------------------------------------------------------------- /Firmware/GD32VF103_usbfs_driver/Include/drv_usbh_int.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file drv_usbh_int.h.h 3 | \brief USB host mode interrupt management header file 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32 USBFS&USBHS 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __DRV_USBH_INT_H 36 | #define __DRV_USBH_INT_H 37 | 38 | #include "drv_usb_host.h" 39 | 40 | typedef struct _usbh_int_cb 41 | { 42 | uint8_t (*SOF) (usb_core_driver *pudev); 43 | } usbh_int_cb; 44 | 45 | extern usbh_int_cb *usbh_int_fop; 46 | 47 | uint32_t usbh_isr (usb_core_driver *pudev); 48 | 49 | #endif /* __DRV_USBH_INT_H */ 50 | -------------------------------------------------------------------------------- /Firmware/RISCV/drivers/n200_eclic.h: -------------------------------------------------------------------------------- 1 | // See LICENSE file for licence details 2 | 3 | #ifndef N200_ECLIC_H 4 | #define N200_ECLIC_H 5 | 6 | #include 7 | 8 | #define ECLICINTCTLBITS 4 9 | 10 | //ECLIC memory map 11 | // Offset 12 | // 0x0000 1B RW ecliccfg 13 | #define ECLIC_CFG_OFFSET 0x0 14 | // 0x0004 4B R eclicinfo 15 | #define ECLIC_INFO_OFFSET 0x4 16 | // 0x000B 1B RW mintthresh 17 | #define ECLIC_MTH_OFFSET 0xB 18 | // 19 | // 0x1000+4*i 1B/input RW eclicintip[i] 20 | #define ECLIC_INT_IP_OFFSET _AC(0x1000,UL) 21 | // 0x1001+4*i 1B/input RW eclicintie[i] 22 | #define ECLIC_INT_IE_OFFSET _AC(0x1001,UL) 23 | // 0x1002+4*i 1B/input RW eclicintattr[i] 24 | #define ECLIC_INT_ATTR_OFFSET _AC(0x1002,UL) 25 | 26 | #define ECLIC_INT_ATTR_SHV 0x01 27 | #define ECLIC_INT_ATTR_TRIG_LEVEL 0x00 28 | #define ECLIC_INT_ATTR_TRIG_EDGE 0x02 29 | #define ECLIC_INT_ATTR_TRIG_POS 0x00 30 | #define ECLIC_INT_ATTR_TRIG_NEG 0x04 31 | 32 | // 0x1003+4*i 1B/input RW eclicintctl[i] 33 | #define ECLIC_INT_CTRL_OFFSET _AC(0x1003,UL) 34 | // 35 | // ... 36 | // 37 | #define ECLIC_ADDR_BASE 0xd2000000 38 | 39 | 40 | #define ECLIC_CFG_NLBITS_MASK _AC(0x1E,UL) 41 | #define ECLIC_CFG_NLBITS_LSB (1u) 42 | 43 | #define MSIP_HANDLER eclic_msip_handler 44 | #define MTIME_HANDLER eclic_mtip_handler 45 | #define BWEI_HANDLER eclic_bwei_handler 46 | #define PMOVI_HANDLER eclic_pmovi_handler 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Firmware/RISCV/drivers/n200_timer.h: -------------------------------------------------------------------------------- 1 | // See LICENSE file for licence details 2 | 3 | #ifndef N200_TIMER_H 4 | #define N200_TIMER_H 5 | 6 | #define TIMER_MSIP 0xFFC 7 | #define TIMER_MSIP_size 0x4 8 | #define TIMER_MTIMECMP 0x8 9 | #define TIMER_MTIMECMP_size 0x8 10 | #define TIMER_MTIME 0x0 11 | #define TIMER_MTIME_size 0x8 12 | 13 | #define TIMER_CTRL_ADDR 0xd1000000 14 | #define TIMER_REG(offset) _REG32(TIMER_CTRL_ADDR, offset) 15 | #define TIMER_FREQ ((uint32_t)SystemCoreClock/4) //units HZ 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /Firmware/RISCV/drivers/riscv_bits.h: -------------------------------------------------------------------------------- 1 | // See LICENSE for license details. 2 | #ifndef _RISCV_BITS_H 3 | #define _RISCV_BITS_H 4 | 5 | #define likely(x) __builtin_expect((x), 1) 6 | #define unlikely(x) __builtin_expect((x), 0) 7 | 8 | #define ROUNDUP(a, b) ((((a)-1)/(b)+1)*(b)) 9 | #define ROUNDDOWN(a, b) ((a)/(b)*(b)) 10 | 11 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 12 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 13 | #define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi) 14 | 15 | #define EXTRACT_FIELD(val, which) (((val) & (which)) / ((which) & ~((which)-1))) 16 | #define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1)))) 17 | 18 | #define STR(x) XSTR(x) 19 | #define XSTR(x) #x 20 | 21 | #if __riscv_xlen == 64 22 | # define SLL32 sllw 23 | # define STORE sd 24 | # define LOAD ld 25 | # define LWU lwu 26 | # define LOG_REGBYTES 3 27 | #else 28 | # define SLL32 sll 29 | # define STORE sw 30 | # define LOAD lw 31 | # define LWU lw 32 | # define LOG_REGBYTES 2 33 | #endif 34 | #define REGBYTES (1 << LOG_REGBYTES) 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Firmware/RISCV/drivers/riscv_const.h: -------------------------------------------------------------------------------- 1 | // See LICENSE for license details. 2 | /* Derived from */ 3 | 4 | #ifndef _RISCV_CONST_H 5 | #define _RISCV_CONST_H 6 | 7 | #ifdef __ASSEMBLER__ 8 | #define _AC(X,Y) X 9 | #define _AT(T,X) X 10 | #else 11 | #define _AC(X,Y) (X##Y) 12 | #define _AT(T,X) ((T)(X)) 13 | #endif /* !__ASSEMBLER__*/ 14 | 15 | #define _BITUL(x) (_AC(1,UL) << (x)) 16 | #define _BITULL(x) (_AC(1,ULL) << (x)) 17 | 18 | #endif /* _NUCLEI_CONST_H */ 19 | -------------------------------------------------------------------------------- /Firmware/RISCV/env_Eclipse/handlers.c: -------------------------------------------------------------------------------- 1 | //See LICENSE for license details. 2 | #include 3 | #include 4 | #include 5 | #include "riscv_encoding.h" 6 | #include "n200_func.h" 7 | 8 | __attribute__((weak)) uintptr_t handle_nmi() 9 | { 10 | write(1, "nmi\n", 5); 11 | _exit(1); 12 | return 0; 13 | } 14 | 15 | 16 | __attribute__((weak)) uintptr_t handle_trap(uintptr_t mcause, uintptr_t sp) 17 | { 18 | if(mcause == 0xFFF) { 19 | handle_nmi(); 20 | } 21 | write(1, "trap\n", 5); 22 | //printf("In trap handler, the mcause is %d\n", mcause); 23 | //printf("In trap handler, the mepc is 0x%x\n", read_csr(mepc)); 24 | //printf("In trap handler, the mtval is 0x%x\n", read_csr(mbadaddr)); 25 | _exit(mcause); 26 | return 0; 27 | } 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Firmware/RISCV/env_Eclipse/init.c: -------------------------------------------------------------------------------- 1 | //See LICENSE for license details. 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "riscv_encoding.h" 7 | #include "n200_func.h" 8 | 9 | extern uint32_t disable_mcycle_minstret(); 10 | void _init() 11 | { 12 | SystemInit(); 13 | 14 | //ECLIC init 15 | eclic_init(ECLIC_NUM_INTERRUPTS); 16 | eclic_mode_enable(); 17 | 18 | //printf("After ECLIC mode enabled, the mtvec value is %x \n\n\r", read_csr(mtvec)); 19 | 20 | // // It must be NOTED: 21 | // // * In the RISC-V arch, if user mode and PMP supported, then by default if PMP is not configured 22 | // // with valid entries, then user mode cannot access any memory, and cannot execute any instructions. 23 | // // * So if switch to user-mode and still want to continue, then you must configure PMP first 24 | //pmp_open_all_space(); 25 | //switch_m2u_mode(); 26 | 27 | /* Before enter into main, add the cycle/instret disable by default to save power, 28 | only use them when needed to measure the cycle/instret */ 29 | disable_mcycle_minstret(); 30 | } 31 | 32 | void _fini() 33 | { 34 | } 35 | -------------------------------------------------------------------------------- /Firmware/RISCV/env_Eclipse/your_printf.c: -------------------------------------------------------------------------------- 1 | int __wrap_printf(const char* fmt, ...) 2 | { 3 | // You can implement your own printf to reduce the code size, because the printf is really a big function 4 | } 5 | 6 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/_exit.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | 5 | #include "stub.h" 6 | 7 | #if 0 8 | void _exit(int code) 9 | { 10 | const char message[] = "\nProgram has exited with code:"; 11 | 12 | write(STDERR_FILENO, message, sizeof(message) - 1); 13 | write_hex(STDERR_FILENO, code); 14 | write(STDERR_FILENO, "\n", 1); 15 | 16 | for (;;); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/close.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include "stub.h" 5 | 6 | int _close(int fd) 7 | { 8 | return _stub(EBADF); 9 | } 10 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/fstat.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include "stub.h" 7 | 8 | int _fstat(int fd, struct stat* st) 9 | { 10 | if (isatty(fd)) { 11 | st->st_mode = S_IFCHR; 12 | return 0; 13 | } 14 | 15 | return _stub(EBADF); 16 | } 17 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/isatty.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | 5 | int _isatty(int fd) 6 | { 7 | if (fd == STDOUT_FILENO || fd == STDERR_FILENO) 8 | return 1; 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/lseek.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include "stub.h" 7 | 8 | off_t _lseek(int fd, off_t ptr, int dir) 9 | { 10 | if (isatty(fd)) 11 | return 0; 12 | 13 | return _stub(EBADF); 14 | } 15 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/read.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "stub.h" 9 | 10 | ssize_t _read(int fd, void* ptr, size_t len) 11 | { 12 | return _stub(EBADF); 13 | } 14 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/sbrk.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | 5 | void *_sbrk(ptrdiff_t incr) 6 | { 7 | extern char _end[]; 8 | extern char _heap_end[]; 9 | static char *curbrk = _end; 10 | 11 | if ((curbrk + incr < _end) || (curbrk + incr > _heap_end)) 12 | return NULL - 1; 13 | 14 | curbrk += incr; 15 | return curbrk - incr; 16 | } -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/stub.h: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | #ifndef _NUCLEI_SYS_STUB_H 3 | #define _NUCLEI_SYS_STUB_H 4 | 5 | #include 6 | #include 7 | 8 | void write_hex(int fd, unsigned long int hex); 9 | 10 | static inline int _stub(int err) 11 | { 12 | return -1; 13 | } 14 | 15 | 16 | #endif /* _NUCLEI_SYS_STUB_H */ 17 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/write.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "stub.h" 11 | #include "gd32vf103.h" 12 | 13 | typedef unsigned int size_t; 14 | 15 | extern int _put_char(int ch) __attribute__((weak)); 16 | 17 | ssize_t _write(int fd, const void* ptr, size_t len) { 18 | const uint8_t * current = (const uint8_t *) ptr; 19 | 20 | // if (isatty(fd)) 21 | { 22 | for (size_t jj = 0; jj < len; jj++) { 23 | _put_char(current[jj]); 24 | 25 | if (current[jj] == '\n') { 26 | _put_char('\r'); 27 | } 28 | } 29 | return len; 30 | } 31 | 32 | return _stub(EBADF); 33 | } 34 | 35 | int puts(const char* string) { 36 | return _write(0, (const void *) string, strlen(string)); 37 | } 38 | 39 | int _put_char(int ch) 40 | { 41 | usart_data_transmit(USART0, (uint8_t) ch ); 42 | while (usart_flag_get(USART0, USART_FLAG_TBE)== RESET){ 43 | } 44 | 45 | return ch; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Firmware/RISCV/stubs/write_hex.c: -------------------------------------------------------------------------------- 1 | /* See LICENSE of license details. */ 2 | 3 | #include 4 | #include 5 | 6 | void write_hex(int fd, unsigned long int hex) 7 | { 8 | uint8_t ii; 9 | uint8_t jj; 10 | char towrite; 11 | write(fd , "0x", 2); 12 | for (ii = sizeof(unsigned long int) * 2 ; ii > 0; ii--) { 13 | jj = ii - 1; 14 | uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4)); 15 | towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA)); 16 | write(fd, &towrite, 1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This is the directory to save original GD32VF103 Firmware Library 2 | For more comprehensive information, please visit www.riscv-mcu.com 3 | 4 | # New development environment choices for GD32VF103 5 | 6 | Nuclei have released [NMSIS](https://github.com/Nuclei-Software/NMSIS) and [Nuclei SDK](https://github.com/Nuclei-Software/nuclei-sdk) 7 | to provide better support for Nuclei RISC-V Processor including GD32VF103. 8 | 9 | We have modified the gd32vf103 firmware library to match NMSIS design, 10 | which you can play with it using the following platforms: 11 | 12 | * [Nuclei SDK](https://github.com/Nuclei-Software/nuclei-sdk) 13 | 14 | * [PlatformIO For Nuclei](https://github.com/Nuclei-Software/platform-nuclei) 15 | 16 | * [Nuclei Studio IDE](https://www.nucleisys.com/download.php) 17 | 18 | * [Segger Embedded Studio](https://www.nucleisys.com/upload/files/doc/ses/Nuclei_SES_IDE_QuickStart_202008.pdf) 19 | 20 | We also released a development board call [**Nuclei RV-STAR**](https://www.nucleisys.com/developboard.php), 21 | which you can play with it by following https://doc.nucleisys.com/nuclei_board_labs/. 22 | 23 | To learn about **Nuclei Software Platform**, please click https://doc.nucleisys.com 24 | -------------------------------------------------------------------------------- /Template/eclipse/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/CWD/delimiter=; 3 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/CWD/operation=replace 4 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/CWD/value=E\:\\Delivered_Pattern\\GD32501\\fw32501\\GD32VF103_Firmware_Library_V1.0.0\\project\\eclipse\\FLASH 5 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/PWD/delimiter=; 6 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/PWD/operation=replace 7 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/PWD/value=E\:\\Delivered_Pattern\\GD32501\\fw32501\\GD32VF103_Firmware_Library_V1.0.0\\project\\eclipse\\FLASH 8 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/append=true 9 | environment/project/ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.1146769190.1656381579/appendContributed=true 10 | -------------------------------------------------------------------------------- /Template/handlers.c: -------------------------------------------------------------------------------- 1 | //See LICENSE for license details. 2 | #include 3 | #include 4 | #include 5 | #include "riscv_encoding.h" 6 | #include "n200_func.h" 7 | 8 | __attribute__((weak)) uintptr_t handle_nmi() 9 | { 10 | write(1, "nmi\n", 5); 11 | _exit(1); 12 | return 0; 13 | } 14 | 15 | 16 | __attribute__((weak)) uintptr_t handle_trap(uintptr_t mcause, uintptr_t sp) 17 | { 18 | if(mcause == 0xFFF) { 19 | handle_nmi(); 20 | } 21 | write(1, "trap\n", 5); 22 | //printf("In trap handler, the mcause is %d\n", mcause); 23 | //printf("In trap handler, the mepc is 0x%x\n", read_csr(mepc)); 24 | //printf("In trap handler, the mtval is 0x%x\n", read_csr(mbadaddr)); 25 | _exit(mcause); 26 | return 0; 27 | } 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Template/init.c: -------------------------------------------------------------------------------- 1 | //See LICENSE for license details. 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "riscv_encoding.h" 7 | #include "n200_func.h" 8 | 9 | extern uint32_t disable_mcycle_minstret(); 10 | void _init() 11 | { 12 | SystemInit(); 13 | 14 | //ECLIC init 15 | eclic_init(ECLIC_NUM_INTERRUPTS); 16 | eclic_mode_enable(); 17 | 18 | //printf("After ECLIC mode enabled, the mtvec value is %x \n\n\r", read_csr(mtvec)); 19 | 20 | // // It must be NOTED: 21 | // // * In the RISC-V arch, if user mode and PMP supported, then by default if PMP is not configured 22 | // // with valid entries, then user mode cannot access any memory, and cannot execute any instructions. 23 | // // * So if switch to user-mode and still want to continue, then you must configure PMP first 24 | //pmp_open_all_space(); 25 | //switch_m2u_mode(); 26 | 27 | /* Before enter into main, add the cycle/instret disable by default to save power, 28 | only use them when needed to measure the cycle/instret */ 29 | disable_mcycle_minstret(); 30 | } 31 | 32 | void _fini() 33 | { 34 | } 35 | -------------------------------------------------------------------------------- /Template/main.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file main.h 3 | \brief the header file of main 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef __MAIN_H 36 | #define __MAIN_H 37 | 38 | /* led spark function */ 39 | void led_spark(void); 40 | 41 | #endif /* __MAIN_H */ 42 | -------------------------------------------------------------------------------- /Template/openocd_cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 1000 2 | 3 | #interface ftdi 4 | #ftdi_device_desc "Dual RS232-HS" 5 | #ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | interface cmsis-dap 10 | transport select jtag 11 | #ftdi_layout_init 0x0008 0x001b 12 | #ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | #adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | riscv expose_csrs 3040-3071 30 | 31 | bindto 0.0.0.0 32 | 33 | init 34 | #reset 35 | #if {[ info exists pulse_srst]} { 36 | # ftdi_set_signal nSRST 0 37 | # ftdi_set_signal nSRST z 38 | #} 39 | halt 40 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 41 | #flash protect 0 0 last off 42 | -------------------------------------------------------------------------------- /Template/openocd_ft2232.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 1000 2 | 3 | interface ftdi 4 | ftdi_device_desc "Dual RS232-HS" 5 | ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | #interface cmsis-dap 10 | transport select jtag 11 | ftdi_layout_init 0x0008 0x001b 12 | ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | #adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | #riscv expose_csrs 3040-3071 30 | init 31 | #reset 32 | #if {[ info exists pulse_srst]} { 33 | # ftdi_set_signal nSRST 0 34 | # ftdi_set_signal nSRST z 35 | #} 36 | halt 37 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 38 | #flash protect 0 0 last off 39 | -------------------------------------------------------------------------------- /Template/openocd_ftdi.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 4000 2 | 3 | interface ftdi 4 | ftdi_device_desc "Dual RS232" 5 | ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | #interface cmsis-dap 10 | transport select jtag 11 | ftdi_layout_init 0x0008 0x001b 12 | ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | #adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | #riscv expose_csrs 3040-3071 30 | init 31 | #reset 32 | #if {[ info exists pulse_srst]} { 33 | # ftdi_set_signal nSRST 0 34 | # ftdi_set_signal nSRST z 35 | #} 36 | halt 37 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 38 | #flash protect 0 0 last off 39 | -------------------------------------------------------------------------------- /Template/openocd_gdlink.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 1000 2 | 3 | #interface ftdi 4 | #ftdi_device_desc "Dual RS232-HS" 5 | #ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | interface cmsis-dap 10 | transport select jtag 11 | #ftdi_layout_init 0x0008 0x001b 12 | #ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | #adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | riscv expose_csrs 3040-3071 30 | 31 | bindto 0.0.0.0 32 | 33 | init 34 | #reset 35 | #if {[ info exists pulse_srst]} { 36 | # ftdi_set_signal nSRST 0 37 | # ftdi_set_signal nSRST z 38 | #} 39 | halt 40 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 41 | #flash protect 0 0 last off 42 | -------------------------------------------------------------------------------- /Template/openocd_ub.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 1000 2 | 3 | interface usb_blaster 4 | #ftdi_device_desc "Dual RS232-HS" 5 | #ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | #interface cmsis-dap 10 | #transport select jtag 11 | #ftdi_layout_init 0x0008 0x001b 12 | #ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | riscv expose_csrs 3040-3071 30 | 31 | init 32 | #reset 33 | #if {[ info exists pulse_srst]} { 34 | # ftdi_set_signal nSRST 0 35 | # ftdi_set_signal nSRST z 36 | #} 37 | halt 38 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 39 | #flash protect 0 0 last off 40 | 41 | -------------------------------------------------------------------------------- /Template/openocd_wch.cfg: -------------------------------------------------------------------------------- 1 | adapter_khz 1000 2 | 3 | interface ftdi 4 | ftdi_device_desc "Sipeed-Debug" 5 | ftdi_vid_pid 0x0403 0x6010 6 | 7 | #autoexit true 8 | 9 | #interface cmsis-dap 10 | transport select jtag 11 | ftdi_layout_init 0x0008 0x001b 12 | ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 13 | 14 | #Reset Stretcher logic on FE310 is ~1 second long 15 | #This doesn't apply if you use 16 | # ftdi_set_signal, but still good to document 17 | #adapter_nsrst_delay 1500 18 | 19 | set _CHIPNAME riscv 20 | jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d 21 | 22 | set _TARGETNAME $_CHIPNAME.cpu 23 | target create $_TARGETNAME riscv -chain-position $_TARGETNAME 24 | $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 10000 -work-area-backup 1 25 | 26 | set _FLASHNAME $_CHIPNAME.flash 27 | flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME 28 | 29 | #riscv expose_csrs 3040-3071 30 | init 31 | #reset 32 | #if {[ info exists pulse_srst]} { 33 | # ftdi_set_signal nSRST 0 34 | # ftdi_set_signal nSRST z 35 | #} 36 | halt 37 | # We must turn on this because otherwise the IDE version debug cannot download the program into flash 38 | #flash protect 0 0 last off 39 | -------------------------------------------------------------------------------- /Template/readme.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | \file readme.txt 3 | \brief description of running led example 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | This example is based on the GD32VF103V-EVAL-V1.0 board, it provides a description 36 | of Running_led. After system start-up, firstly, LED1 on, then, LED2 on, four 37 | LEDs can light periodically. 38 | 39 | On the GD32VF103V-EVAL-V1.0 board,LED1 connected to PC0, LED2 connected to PC2, LED3 40 | connected to PE0, LED4 connected to PE1. 41 | -------------------------------------------------------------------------------- /Template/systick.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file systick.h 3 | \brief the header file of systick 4 | 5 | \version 2019-6-5, V1.0.0, firmware for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef SYS_TICK_H 36 | #define SYS_TICK_H 37 | 38 | #include 39 | 40 | void delay_1ms(uint32_t count); 41 | 42 | #endif /* SYS_TICK_H */ 43 | -------------------------------------------------------------------------------- /Utilities/LCD_common/lcd_font.h: -------------------------------------------------------------------------------- 1 | /*! 2 | \file lcd_font.h 3 | \brief the header file of LCD font 4 | 5 | \version 2019-6-5, V1.0.0, demo for GD32VF103 6 | */ 7 | 8 | /* 9 | Copyright (c) 2019, GigaDevice Semiconductor Inc. 10 | 11 | Redistribution and use in source and binary forms, with or without modification, 12 | are permitted provided that the following conditions are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright notice, this 15 | list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 3. Neither the name of the copyright holder nor the names of its contributors 20 | may be used to endorse or promote products derived from this software without 21 | specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 | OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LCD_FONT_H 36 | #define LCD_FONT_H 37 | 38 | #include 39 | 40 | extern unsigned char const ascii_8x16[1536]; 41 | 42 | extern const uint16_t ASCII_Table_16x24[]; 43 | 44 | #endif /* LCD_FONT_H */ 45 | 46 | --------------------------------------------------------------------------------