当前位置:网站首页>Points for attention in porting gd32 F4 series programs to gd32 F3 series

Points for attention in porting gd32 F4 series programs to gd32 F3 series

2022-07-07 15:38:00 sgmcy

1、 About the selection of assembly startup file :

The chip we use is GD32F303RGT6 , according to 《GD32F303xx_Datasheet_Rev1.4.pdf》, You can know the of the chip FLASH Its size is 1024KB , namely 1M.
according to GD32 Chinese manual description ,
GD32F303XX FLASH Size in 256K~512K It belongs to high-density products (GD32F30X_HD)
GD32F303XX FLASH Greater than 512K It belongs to ultra-high density products (GD32F30X_XD)
and GD32F305xx and GD32F307xx It belongs to interconnected products (GD32F30X_CL)
therefore , The assembly startup file we choose should be :startup_gd32f30x_xd.s

According to different product attributes , Choose assembly boot files with different suffixes

2、 The problem of adding macros to project settings

Add the following two macros to the project settings
USE_STDPERIPH_DRIVER,GD32F30X_XD
In the actual test , It is found that these two macros have not been added , Can also be compiled through , You can also debug when debugging .
And when debugging , By default, you enter GD32F30X_XD Macro control condition
Is it keil5 Is it so advanced ? This macro can be automatically opened according to the chip ? But gd32f30x.h It is clearly required to open the corresponding macro .
No matter what , For the sake of safety , Manually open these two macros in the project configuration .

3、 The problem of adding static libraries

load .a Library files , Error will be reported in compilation :
xx.a(1): error: A1167E: Invalid line start

You need to click and select this file in the project , Then right-click , choice "options for files", Configure the... Of the static library in the configuration options "File Type"
by "Library file ", This compilation problem can be solved . By default ,.lib Suffix file , There is no such problem .

in other words ,keil5 I only know .lib Static library file with suffix , If it is a static library file of other suffix faces , It is mandatory to manually specify this file as a library file

4、GD32 SPI The problem of dominant frequency

GD32F303 SPI0 stay APB2 On , The highest dominant frequency is 120MH
SPI1 and SPI2 stay APB1 On , The highest dominant frequency is 60MHZ

Therefore, it is necessary to set an appropriate frequency division coefficient .

5、 Warning about function nonparametric

When transplanting , There are functions without parameters , You need to fill in the parameter void, avoid "Deprecated declaration" Warning of

It's also a good programming habit . Nonparametric time , The parameter is void

6、GPIO The function interface of gpio_init() And GPIO_Init()

GD32 F3 GPIO Two interfaces are provided in the interface ,gpio_deinit() as well as gpio_init()
In especial gpio_init() , This function can be directly configured GPIO A specific pin , Configure whether it is input or output or AF Pattern ,
You can also configure the pin speed . Very easy to use .
GD32F4 Only gpio_deinit() Interface , Not provided gpio_init() Interface , It provides GPIO_Init() Interface
GPIO_Init() This interface is in the process of configuration , Manual configuration required PIN Foot's AF Pattern , This is very troublesome .
It's strange F4 Why is the series not retained F3 This interface of series ?( Interface developed by two teams ??)

7、 About the interrupt clock

GD32F4 When the configuration is interrupted , In addition to the port clock of the pin to be configured , Usually, you also need to configure RCU_SYSCFG The system clock
Because interrupts usually use the system clock
GD32F3 In the series , No, RCU_SYSCFG The system clock , When the configuration is interrupted , Need extra configuration RCU_AF The clock

原网站

版权声明
本文为[sgmcy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130612547614.html