Skip to content

Commit aacbd86

Browse files
committed
Move serialnumber; remove lib-hal console
Consolidate serial number code into lib-gd32 and remove legacy lib-hal console implementations. - Renamed/moved hal_serialnumber.{h,cpp} -> lib-gd32/include/serialnumber.h and lib-gd32/src/serialnumber.cpp; updated header guard, file comments, include path, constexpr kSnSize, and removed the hal namespace. Copyright years updated. - Updated board headers (bw_opidmx4.h, dmx4.h) to check CONFIG_CLIB_USE_NULL instead of CONSOLE_NULL (macro name change). - Deleted multiple lib-hal console sources and headers (console.h, console_i2c.h, console_null.h, console_uart0.h and implementations under lib-hal/console/{i2c,null,uart0}), removing the bundled console backends. - Removed an unnecessary #include <cstdint> from lib-hal/include/gd32/hal.h. This is a cleanup/consolidation change; note the macro rename (CONSOLE_NULL -> CONFIG_CLIB_USE_NULL) and relocation of serialnumber files may require updating include paths or build configuration.
1 parent 79a851b commit aacbd86

12 files changed

Lines changed: 11 additions & 648 deletions

File tree

lib-gd32/include/board/bw_opidmx4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# error This file should be included later
3535
#endif
3636

37-
#if !(defined(CONSOLE_I2C) || defined(CONSOLE_NULL) || defined(CONFIG_USE_SOFTUART0))
37+
#if !(defined(CONSOLE_I2C) || defined(CONFIG_CLIB_USE_NULL) || defined(CONFIG_USE_SOFTUART0))
3838
# error USART0 is used for console
3939
#endif
4040

lib-gd32/include/board/dmx4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# error This file should be included later
3535
#endif
3636

37-
#if !(defined(CONSOLE_I2C) || defined(CONSOLE_NULL) || defined(CONFIG_USE_SOFTUART0))
37+
#if !(defined(CONSOLE_I2C) || defined(CONFIG_CLIB_USE_NULL) || defined(CONFIG_USE_SOFTUART0))
3838
# error USART0 is used for console
3939
#endif
4040

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file hal_serialnumber.h
2+
* @file serialnumber.h
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -22,16 +22,12 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
26-
#ifndef HAL_SERIALNUMBER_H_
27-
#define HAL_SERIALNUMBER_H_
25+
#ifndef SERIALNUMBER_H_
26+
#define SERIALNUMBER_H_
2827

2928
#include <cstdint>
3029

31-
namespace hal
32-
{
33-
inline static constexpr uint32_t kSnSize = 4;
30+
inline constexpr uint32_t kSnSize = 4;
3431
void SerialNumber(uint8_t sn[kSnSize]);
35-
} // namespace hal
3632

37-
#endif // HAL_SERIALNUMBER_H_
33+
#endif // SERIALNUMBER_H_
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @file hal_serialnumber.cpp
2+
* @file serialnumber.cpp
33
*
44
*/
5-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
5+
/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
66
*
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
88
* of this software and associated documentation files (the "Software"), to deal
@@ -25,9 +25,8 @@
2525

2626
#include <cstdint>
2727

28-
#include "hal_serialnumber.h"
28+
#include "serialnumber.h"
2929

30-
namespace hal {
3130
void SerialNumber(uint8_t sn[kSnSize]) {
3231
#if defined(GD32H7XX)
3332
const auto kMacaddressHigh = *reinterpret_cast<volatile uint32_t*>(0x1FF0F7E8);
@@ -42,4 +41,3 @@ void SerialNumber(uint8_t sn[kSnSize]) {
4241
sn[2] = static_cast<uint8_t>((kMacaddressHigh >> 16) & 0xFF);
4342
sn[3] = static_cast<uint8_t>((kMacaddressHigh >> 24) & 0xFF);
4443
}
45-
} // namespace hal

0 commit comments

Comments
 (0)