Gd32f30x v3.0.3 - #11
Merged
Merged
Conversation
Upgrade GD32F30x standard peripheral headers/sources to firmware V3.0.3 (2026). Updates include copyright year bumps and header version tags. ADC: renamed many occurrences of "regular" to "routine" (comments, macros and flags), adjusted ADC register/macro names and renamed several APIs (e.g. adc_regular_channel_config -> adc_routine_channel_config, adc_regular_data_read -> adc_routine_data_read) and related parameter name changes. CAN: fix incorrect filter register offsets, correct numerous typos in identifiers/comments, adjust struct/type names (can_trasnmit_message_struct -> can_transmit_message_struct), add mailbox-empty mask, and change some API signatures/return types. DAC: refactor register/macros to per-DAC-instance style (DAC_CTL0, DAC_SWT(dacx), DAC_OUT0_R12DH, etc.), simplify device count to DAC0, and update related bitfield macros and trigger defines. Miscellaneous cleanups across peripheral headers/sources for consistency and correctness.
Add Gd32FirmwareOps.mk to centralize GCC warning suppressions for GD32 firmware builds. Update common/make/gd32/Includes.mk to mark CMSIS and lib-gd32 headers as -isystem (reducing external-header warnings), reorder and consolidate include paths, and keep local ./include. Update firmware-template-gd32/lib/Rules.mk to include the new ops file and apply GD32FIRMWAREOPS to C compilation; also remove a redundant generic C compile rule. These changes aim to silence third-party header warnings and simplify include handling for GD32 builds.
Extend GD32F30x include detection to handle the GD32F30X_XD variant and update the MCU guard macro accordingly. Remove surrounding C++ diagnostic push/pop and pragma ignores from gd32xxxx.h to simplify the header. Add conditional IRQ name/number mapping for the XD variant in softuart0 uart0.cpp and simplify the TIMER_INTF interrupt clear by removing an unnecessary cast.
Use an explicit index variable when storing DMX data to avoid the post-increment-in-assignment pattern (prevents potential undefined behavior/overflow when updating slots_in_packet). Also remove redundant static_cast<uint32_t> around bitwise negation when clearing timer interrupt flags in multiple IRQ handlers (TIMER1, TIMER4, TIMER6 and their channel clears) to simplify the code and improve clarity.
Replace static_cast<uint32_t>(~kIntFlag) with ~kIntFlag in TIMER6_IRQHandler. This removes an unnecessary explicit cast when writing the interrupt-clear value to TIMER_INTF, keeping behavior the same and avoiding potential compiler warnings about redundant conversions.
Simplify assignments to USART_TDATA in gd32_uart.cpp by removing explicit (uint32_t) casts when masking and writing byte data. Updated both Gd32UartTransmit and Gd32UartTransmitString for the GD32H7XX branch to rely on implicit integer promotion, reducing unnecessary casts and potential compiler warnings.
Update makefile compiler options to improve build compatibility: add `-Dcplusplus` to C++ flags and expand GD32 firmware warning overrides into separate entries, including new `-Wno-error` rules for `unused-function`, `unused-variable`, and `duplicated-cond`.
Reformatted `debug_dump.h` to match the project’s brace/loop style without changing dump behavior. In release builds, the no-op `Dump` function is now declared `static inline`, giving it internal linkage in each translation unit.
Add explicit underlying type for `dmxnode::FailSafe` and introduce targeted casts/unsigned literals in ADC, SPI, BKP, and FT245RL code paths. These changes make integer promotions explicit and avoid implicit conversion warnings while preserving existing behavior.
Update `BCD2DEC` and `DEC2BCD` in `hwclockrtc.cpp` to return `uint8_t` and use explicit `static_cast<uint8_t>`/unsigned literals in the math. This tightens type safety for RTC BCD conversions and avoids implicit signed-integer behavior.
Relax the GD32 firmware build by allowing missing field initializers and implicit function declarations without failing, and include extra C/C++ source directories in `SRCDIR` so additional sources are picked up during object generation.
Update CMSIS HAL files to firmware version 3.0.3 with enhanced stability during clock frequency switching. Key changes include: - Improved RCU_MODIFY macro for Vcore fluctuation prevention - Added software delay function to stabilize transitions - Converted direct register writes to read-modify-write pattern in clock functions - Added firmware version query support - Updated copyright year to 2026 - Removed deprecated GCC diagnostic pragmas - Added HardFault_IRQn to interrupt enumeration
Add an explicit `static_cast<uint16_t>` when computing `sv_rx_count.rx` in `USART0_IRQHandler` to avoid implicit narrowing from `dma_transfer_number_get(...)` and make the intended RX counter type conversion clear.
Fix duplicate 'info@' in email addresses in delete.cpp and dso_handle.cpp. Update copyright year to 2026 in delete.cpp and new.cpp. Rename parameter `p` to `pointer` in delete operators and add `noexcept` to non-sized overloads. Name previously unnamed `size` parameter in placement new.
Moved lib-display/include/spi/config.h to lib-display/include/spi/config/config_lcd.h and updated the namespace from `config` to `config::lcd` for better organization and clarity. Updated all include paths and namespace references in ili9341.h, paint.h, spilcd.h, st7735s.h, and st7789.h. Also fixed macro definition formatting for consistency.
Extract unique ID memory access into a dedicated header file (gd32_unique_id.h) to eliminate code duplication across macaddress, serialnumber, and uuid modules. This provides a single source of truth for device-specific memory addresses and simplifies future maintenance.
Introduce DMX slot and baud-rate constants in `dmxconst.h`, and reformat the direction/send enums for consistency. This provides shared values for start-code plus channel counts and the standard DMX250k baud timing.
Tightens brace formatting in the RDM headers and cleans up a minor endif spacing inconsistency without changing behavior.
Extend `flash.py` to read GD32 chip UID and flash size, resolve series/part numbers from `gd32.json`, and add `--get-size`, `--get-uid`, and `--go` CLI options. The flasher also now handles serial reads more safely and includes a reusable memory read helper.
Remove `${workspace_loc:/lib-hal/include}` and `${workspace_loc:/lib-properties/include}` from multiple Eclipse CDT `.cproject` files to align project include settings with current dependencies and avoid stale include search paths.
Introduce `common/scripts/gd32/gd32.json` with initial GD32 MCU definitions keyed by device ID. The file maps series names and flash-size variants, and adds a probe rule to distinguish GD32F407 from GD32F450 for 0x0419 devices.
Improve API clarity and static-analysis friendliness across DMX and GD32 helpers. In `dmx.h`, add `[[nodiscard]]` to getter-like methods, rename the RDM timeout parameter to `timeout_ms`, and apply minor signature/format cleanups. In `board.cpp`, replace the hardcoded system-name string/length with a shared `kSysName` constant and computed length. In `delayus.cpp`, preserve the required include for IWYU, suppress a swappable-parameter lint warning for `DelayUs`, and use `while (true)` instead of `while (1)`.
Replace series/probe-based GD32 part lookup with identifier-based matching from the bootloader `0x06` command. This updates the device database to map chip IDs to per-identifier series and part numbers, prints the identifier in device info, and adds a CLI flag to read it directly. The flasher command path also gains more explicit sync and command diagnostics to make identifier reads and bootloader communication easier to troubleshoot.
Introduce a new `gd32::trng` wrapper with `Init()` and `Get()` helpers, plus the GD32F20X/GD32F4XX implementation. The new code enables the TRNG peripheral, waits for valid data with timeout handling, and reports clock/seed errors when random data is not ready or repeats.
Modernizes the GitHub Actions workflow by upgrading to actions/checkout@v4, adding Python 3.10 setup, and printing the arm-none-eabi compiler version. It also replaces the two manual per-project make steps with a single `scripts/build_all.sh` run to centralize and simplify CI builds.
Simplifies several common utility headers with consistent brace/style cleanup, streamlines UTC offset formatting and validation, and updates the common make flags to `-std=c++23`.
- Convert Global singleton class to free inline functions in the global namespace - Fix printf format specifier warnings by adding static_cast<unsigned> casts - Rename single-letter pointer variables (p/q) to ptr/q for clarity - Remove verbose TX/RX debug prints from flash.py _send_command - Add braces to single-line if statements in json_parser.h - Add 1000U unsigned literal in debug_stack.h - Update copyright year to 2026 in debug_dump.h
Add `watchdog::Feed()` before verbose `DEBUG_HEAP` print paths in `malloc`, `free`, and `DebugHeap` so extended diagnostics don’t trigger watchdog timeouts. The patch also tightens pointer naming (`p` -> `ptr`), updates `%p` logging to use explicit `void*` casts, and applies minor cleanup/const-correctness improvements in allocation helpers.
Removes a duplicate board header include and tidies constant initializers in `main.cpp`. It also updates widget mode logging to use `%u` with an unsigned cast, keeping the format specifier and argument types consistent and avoiding signed/unsigned mismatch warnings.
- Fix indentation and brace style to be consistent throughout - Replace `Global::Instance().SetUtcOffsetIfValid()` with `global::SetUtcOffsetIfValid()` - Add explicit casts for DEBUG_PRINTF format arguments to suppress warnings - Expand single-line while loop bodies to multi-line for clarity - Remove redundant `private:` section separator
Replace %d with %u for unsigned types in printf/snprintf calls, adding explicit static_cast<unsigned> casts for correctness. Add missing <cstdarg> include in uart0.cpp. Remove duplicate `private:` label in dmxsend.h. Rename short variable names (v, kR/kG/kB) to more descriptive names. Reformat brace styles and if/else blocks for consistency. Add [[nodiscard]] to GetOutputStyle().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.