Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GD32VF103] Align port to ChibiOS naming conventions and add missing flash sectors counts #325

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/CAN/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/CANv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_CAN TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CANv1/hal_can_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CANv1/hal_can_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CANv1
11 changes: 0 additions & 11 deletions os/hal/ports/GD/GD32VF103/CRC/driver.mk

This file was deleted.

11 changes: 11 additions & 0 deletions os/hal/ports/GD/GD32VF103/CRCv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_CRC TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CRCv1/hal_crc_lld.c \
${CHIBIOS_CONTRIB}/os/various/crcsw.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CRCv1/hal_crc_lld.c \
${CHIBIOS_CONTRIB}/os/various/crcsw.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CRCv1
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/DAC/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/DACv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_DAC TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DACv1/hal_dac_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DACv1/hal_dac_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DACv1
2 changes: 0 additions & 2 deletions os/hal/ports/GD/GD32VF103/DMA/driver.mk

This file was deleted.

2 changes: 2 additions & 0 deletions os/hal/ports/GD/GD32VF103/DMAv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DMAv1/gd32_dma.c
PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DMAv1
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/GPIO/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/GPIOv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_PAL TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/GPIOv1/hal_pal_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/GPIOv1/hal_pal_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/GPIOv1
21 changes: 0 additions & 21 deletions os/hal/ports/GD/GD32VF103/I2C/driver.mk

This file was deleted.

21 changes: 21 additions & 0 deletions os/hal/ports/GD/GD32VF103/I2Cv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ifeq ($(USE_HAL_I2C_FALLBACK),yes)
# Fallback SW driver.
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_I2C TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += $(CHIBIOS)/os/hal/lib/fallback/I2C/hal_i2c_lld.c
endif
else
PLATFORMSRC_CONTRIB += $(CHIBIOS)/os/hal/lib/fallback/I2C/hal_i2c_lld.c
endif
PLATFORMINC_CONTRIB += $(CHIBIOS)/os/hal/lib/fallback/I2C
else
# Default HW driver.
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_I2C TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/I2Cv1/hal_i2c_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/I2Cv1/hal_i2c_lld.c
endif
PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/I2Cv1
endif
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/OTG/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/OTGv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_USB TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/OTGv1/hal_usb_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/OTGv1/hal_usb_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/OTGv1
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/RTC/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/RTCv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_RTC TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/RTCv1/hal_rtc_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/RTCv1/hal_rtc_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/RTCv1
13 changes: 0 additions & 13 deletions os/hal/ports/GD/GD32VF103/SPI/driver.mk

This file was deleted.

13 changes: 13 additions & 0 deletions os/hal/ports/GD/GD32VF103/SPIv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_I2S TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1/hal_i2s_lld.c
endif
ifneq ($(findstring HAL_USE_SPI TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1/hal_spi_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1/hal_i2s_lld.c
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1/hal_spi_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1
19 changes: 0 additions & 19 deletions os/hal/ports/GD/GD32VF103/TIM/driver.mk

This file was deleted.

19 changes: 19 additions & 0 deletions os/hal/ports/GD/GD32VF103/TIMv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_st_lld.c

ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_GPT TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_gpt_lld.c
endif
ifneq ($(findstring HAL_USE_ICU TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_icu_lld.c
endif
ifneq ($(findstring HAL_USE_PWM TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_pwm_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_gpt_lld.c
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_icu_lld.c
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/hal_pwm_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1
13 changes: 0 additions & 13 deletions os/hal/ports/GD/GD32VF103/USART/driver.mk

This file was deleted.

13 changes: 13 additions & 0 deletions os/hal/ports/GD/GD32VF103/USARTv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1/hal_serial_lld.c
endif
ifneq ($(findstring HAL_USE_UART TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1/hal_uart_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1/hal_serial_lld.c
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1/hal_uart_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1
13 changes: 12 additions & 1 deletion os/hal/ports/GD/GD32VF103/gd32_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,19 @@
/* Flash attributes.*/
#define GD32_FLASH_NUMBER_OF_BANKS 1
#define GD32_FLASH_SECTOR_SIZE 1024U

#if defined(GD32VF103T4) || defined(GD32VF103R4) || defined(GD32VF103C4)
#define GD32_FLASH_SECTORS_PER_BANK 16
#elif defined(GD32VF103C6) || defined(GD32VF103T6) || defined(GD32VF103R6)
#define GD32_FLASH_SECTORS_PER_BANK 32
#elif defined(GD32VF103C8) || defined(GD32VF103T8) || defined(GD32VF103R8) || defined(GD32VF103V8)
#define GD32_FLASH_SECTORS_PER_BANK 64
#elif defined(GD32VF103TB) || defined(GD32VF103VB) || defined(GD32VF103CB) || defined(GD32VF103RB)
#define GD32_FLASH_SECTORS_PER_BANK 128
#endif

#if !defined(GD32_FLASH_SECTORS_PER_BANK) || defined(__DOXYGEN__)
#define GD32_FLASH_SECTORS_PER_BANK 128 /* Maximum, can be redefined.*/
#define GD32_FLASH_SECTORS_PER_BANK 128 /* Maximum, can be redefined.*/
#endif

/* GPIO attributes.*/
Expand Down
36 changes: 18 additions & 18 deletions os/hal/ports/GD/GD32VF103/platform.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Required platform files.
PLATFORMSRC := ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/hal_lld.c \
PLATFORMSRC_CONTRIB := ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/hal_lld.c \
${CHIBIOS_CONTRIB}/os/hal/ports/common/RISCV-ECLIC/eclic.c \
${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/gd32_isr.c \
${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/hal_efl_lld.c

# Required include directories.
PLATFORMINC := ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103 \
PLATFORMINC_CONTRIB := ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103 \
${CHIBIOS_CONTRIB}/os/hal/ports/common/RISCV-ECLIC

# Optional platform files.
Expand All @@ -23,26 +23,26 @@ endif
HALCONF := $(strip $(shell cat $(HALCONFDIR)/halconf.h $(HALCONFDIR)/halconf_community.h | egrep -e "\#define"))

ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),)
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/hal_adc_lld.c
PLATFORMSRC_CONTRIB += $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/hal_adc_lld.c
endif
else
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/hal_adc_lld.c
PLATFORMSRC_CONTRIB += $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/hal_adc_lld.c
endif

# Drivers compatible with the platform.
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CAN/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CRC/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DAC/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DMA/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/GPIO/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/I2C/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/RTC/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPI/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIM/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USART/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/OTG/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/xWDG/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CANv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/CRCv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DACv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/DMAv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/GPIOv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/I2Cv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/RTCv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/SPIv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/TIMv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/USARTv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/OTGv1/driver.mk
include ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/xWDGv1/driver.mk

# Shared variables
ALLCSRC += $(PLATFORMSRC)
ALLINC += $(PLATFORMINC)
ALLCSRC += $(PLATFORMSRC_CONTRIB)
ALLINC += $(PLATFORMINC_CONTRIB)
9 changes: 0 additions & 9 deletions os/hal/ports/GD/GD32VF103/xWDG/driver.mk

This file was deleted.

9 changes: 9 additions & 0 deletions os/hal/ports/GD/GD32VF103/xWDGv1/driver.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_WDG TRUE,$(HALCONF)),)
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/xWDGv1/hal_wdg_lld.c
endif
else
PLATFORMSRC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/xWDGv1/hal_wdg_lld.c
endif

PLATFORMINC_CONTRIB += ${CHIBIOS_CONTRIB}/os/hal/ports/GD/GD32VF103/xWDGv1