|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| .github/workflows/ | | 03-Aug-2024 | - | 36 | 33 |
| common_include/ | | 03-Aug-2024 | - | 744 | 436 |
| gd32a50x/ | | 03-Aug-2024 | - | 28,920 | 13,619 |
| gd32e10x/ | | 03-Aug-2024 | - | 19,629 | 8,944 |
| gd32e50x/ | | 03-Aug-2024 | - | 41,841 | 21,468 |
| gd32f3x0/ | | 03-Aug-2024 | - | 22,313 | 10,231 |
| gd32f403/ | | 03-Aug-2024 | - | 23,713 | 11,137 |
| gd32f4xx/ | | 03-Aug-2024 | - | 36,245 | 17,390 |
| gd32l23x/ | | 03-Aug-2024 | - | 27,951 | 12,835 |
| gd32vf103/ | | 03-Aug-2024 | - | 23,325 | 12,185 |
| include/dt-bindings/pinctrl/ | | 03-Aug-2024 | - | 55,470 | 38,477 |
| pinconfigs/ | | 03-Aug-2024 | - | 10,091 | 9,753 |
| scripts/ | | 03-Aug-2024 | - | 1,030 | 727 |
| zephyr/ | | 03-Aug-2024 | - | 7 | 6 |
| .gitignore | D | 03-Aug-2024 | 61 | 9 | 7 |
| README.md | D | 03-Aug-2024 | 5.5 KiB | 146 | 113 |
README.md
1# Introduction
2
3The **hal_gigadevice** is a set of both standard firmware library and ARM CMSIS
4configurations for GigaDevice MCUs. The HAL is organized following the
5directory structure detailed below.
6
7## Directory Structure
8
9The directory is composed by three parts:
10
11 - SoC specific libraries.
12 - ZephyrRTOS module directory (`zephyr`).
13 - This README file.
14
15### ARM
16
17Each ARM firmware library is organized in the following structure:
18
19```
20.
21└── gd32xxx
22 ├── cmsis
23 │ └── gd
24 │ └── gd32xxx
25 ├── standard_peripheral
26 │ ├── include
27 │ └── source
28 └── support (optional)
29 └── GigaDevice.GD32xxx_DFP.1.0.0.pack (Only for packs not in [Keil MDK5 Software Packs](https://www.keil.com/dd2/pack/))
30```
31
32### RISC-V
33
34The RISC-V structure is not defined yet. The riscv sub-directory will change
35based on how [NMSIS library](https://github.com/Nuclei-Software/NMSIS/) will
36be integrated in Zephyr. At present date, the structure only reflects current
37manufacturer version.
38
39```
40└── gd32bf103
41 ├── riscv
42 │ ├── drivers
43 │ ├── include
44 │ ├── source
45 │ └── stubs
46 └── standard_peripheral
47 ├── include
48 └── source
49```
50
51 Any contribution should follow the `How to submit code` using as premisses the
52 [Zephyr Contribution Guidelines](https://docs.zephyrproject.org/latest/contribute/index.html).
53
54# How to submit code
55
56 - When submiting an updated firmware library version, it is important to make
57 sure that the last firmware version will be merged. The library version is
58 used to be checked at [GigaDevice MCU Site](http://www.gd32mcu.com/en/download/).
59 - This repository is managed mainly on Linux. This means that changes should
60 be submited using Linux LF format. Usually running a similar command to
61 `find * type f -print0 | xargs -0 dos2unix -k` should be enough.
62 - Make sure directory structure is respected.
63 - Directory names should be converted to lowercase.
64 - Exceptions should be discussed at review phase.
65
66## The gd32 standard peripheral API
67
68The gd32 standard peripheral API define all information to access GigaDevice
69peripherals. The firmware library does not have namespaces and prefixes which
70easily results in name collision with ZephyrRTOS core and libraries. To avoid
71that situation, macros, enum values and function names should follow two
72general rules:
73
74 - Public API funtions must be prefixed with `gd32_`.
75 - Public defines and enum values must be uppercase and prefixed with `GD32_`.
76
77The cmsis and riscv contents are not part of standard peripheral library and
78changes are treated as exceptions. This means that `<firmware_library>.h>` and
79`system_<firmware_library>.h>` files should reside on their own respective
80places instead in standard peripheral library directory.
81
82### Grace Period
83
84Rework gd32 standard peripheral API is a huge step. To allow developers move
85forward a grace period was created. The grace period is available until
86`gd32_api_convert` script be available. When the script be available any new
87firmware library must be converted. The main objective of the script is to
88automate conversion process of all gd32 standard peripheral API.
89
90Besides there is a grace period developers are obligated to solve any existent
91conflict. The conflict should follow gd32 standard peripheral API rules.
92
93### Current known conflict list
94
95The conflicts at gd32 standard peripheral API are listed by the afected file(s).
96In general, a name is the conflict itself and that whould be reworked following
97the gd32 standard peripheral API rules.
98
99 - `<firmware_library>_timer.h/c`: `timer_init()` should be prefixed with
100 `gd32_` and become `gd32_timer_init()`.
101 - `<firmware_library>_can.h/c`: all `CAN_` macros that collide with any
102 macro defined at `/include/drivers/can.h` should be prefixed with `GD32_`
103 and become `GD32_CAN_*`.
104
105## Exceptions
106
107The exception list define macros and enum values that may have a different
108conflict resolution. See below list with the proposed solution:
109
110 - The `BIT` macro is already define in Zephyr. Fix using `#ifndef`:
111```review
112+#ifndef BIT
113#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
114+#endif
115```
116- i2c-gd32 driver needs to know the clock frequency boundary. Fix it with
117 two step work. First move I2CCLK_MAX and I2CCLK_MIN marco from i2c source
118 file to header file. Then split the I2CCLK_MIN for each supported transfer
119 mode.
120
121- gd32l23x
122
123 - `SystemInit` function in `system_gd32l23x.c` contain an invalid usage of
124 `nvic_vector_table_set` function, just remove it.
125
126 - `gd32l23x_libopt.h` file not exist, add it manually.
127
128 - i2c have different implement than current gd32 i2c driver. no need to patch
129 upper i2c speed requirement.
130
131- gd32a50x
132
133 - `SystemCoreClockUpdate` function contain an `pllmf` calculate error.
134 Fix by change `0xFU` to `RCU_CFG0_PLLMF`:
135 ``` diff
136 /* PLL multiplication factor */
137 pllmf = GET_BITS(RCU_CFG0, 18, 21);
138 pllmf += ((RCU_CFG0 & RCU_CFG0_PLLMF_4) ? 15U : 0U);
139 - pllmf += ((0xFU == (RCU_CFG0 & RCU_CFG0_PLLMF)) ? 1U : 2U);
140 + pllmf += ((RCU_CFG0_PLLMF == (RCU_CFG0 & RCU_CFG0_PLLMF)) ? 1U : 2U);
141 ```
142 - For debug this board, `pyocd` need a pack file from Gigadevice,
143 But Gigadevice don't upload pack file to [keil packs repo](https://www.keil.com/dd2/pack/).
144 Fix: Storage pack as `gd32a50x/support/GigaDevice.GD32A50x_DFP.1.0.0.pack`
145 (Download from https://gd32mcu.com/cn/download/7?kw=GD32A5 -> GD32A50x AddOn)
146