Skip to content

Commit e7bb7c3

Browse files
committed
Auto-flag Timer6 IRQ and print stack at init
Update GD32 validation to mark when Timer6 IRQ is required by DMX/RDM/LTC features and automatically add `CONFIG_TIMER6_HAVE_NO_IRQ_HANDLER` otherwise, while still erroring on conflicting manual flags. In board initialization, always include and run I2C detect plus stack debug printing to improve startup diagnostics.
1 parent a7b1107 commit e7bb7c3

5 files changed

Lines changed: 16 additions & 123 deletions

File tree

common/make/gd32/Validate.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ ifneq ($(findstring _TIME_STAMP_YEAR_,$(FLAGS)),_TIME_STAMP_YEAR_)
1212
endif
1313

1414
ifneq (,$(findstring OUTPUT_DMX_SEND,$(FLAGS))$(findstring CONFIG_RDM,$(FLAGS))$(findstring RDM_CONTROLLER,$(FLAGS))$(findstring LTC,$(FLAGS)))
15+
TIMER6_HAVE_IRQ_HANDLER=1
1516
ifneq (,$(findstring CONFIG_TIMER6_HAVE_NO_IRQ_HANDLER,$(MAKE_FLAGS)))
1617
$(error CONFIG_TIMER6_HAVE_NO_IRQ_HANDLER is set)
1718
endif
1819
endif
1920

21+
ifndef TIMER6_HAVE_IRQ_HANDLER
22+
DEFINES+=-DCONFIG_TIMER6_HAVE_NO_IRQ_HANDLER
23+
endif
24+
2025
ifeq ($(findstring CONFIG_REMOTECONFIG_MINIMUM,$(FLAGS)),CONFIG_REMOTECONFIG_MINIMUM)
2126
DEFINES+=-DCONFIG_NET_APPS_NO_MDNS
2227
else

lib-board/src/gd32/board_init.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* THE SOFTWARE.
2424
*/
2525

26+
#include "firmware/debug/debug_stack.h"
2627
#if !defined(_TIME_STAMP_DAY_)
2728
#define _TIME_STAMP_DAY_ 0
2829
#endif
@@ -62,9 +63,7 @@
6263
#if defined(ENABLE_USB_HOST)
6364
#include "device/usb.h"
6465
#endif
65-
#if defined(DEBUG_I2C)
6666
#include "firmware/debug/debug_i2cdetect.h"
67-
#endif
6867
#include "board_statusled.h"
6968
#include "panelled.h"
7069
#include "logic_analyzer.h"
@@ -260,12 +259,12 @@ void Init() {
260259
#endif
261260
#endif
262261

263-
#if defined(DEBUG_I2C)
264262
debug::i2c::Detect();
265-
#endif
266263

267264
#if !defined(USE_FREE_RTOS)
268265
board::statusled::SetFrequency(1);
269266
#endif
267+
268+
debug::stack::Print();
270269
}
271270
} // namespace board

lib-network/src/emac/gd32/emac_phy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool Config(uint16_t address) {
159159
}
160160

161161
if (!(value & emac::mmi::BMCR_RESET)) {
162-
EMAC_PHY_DEBUG_PRINTF("%u", static_cast<unsigned>(millis() - kMillis));
162+
EMAC_PHY_DEBUG_PRINTF("%u", static_cast<unsigned>(gd32::Millis() - kMillis));
163163
EMAC_PHY_DEBUG_EXIT();
164164
return true;
165165
}
@@ -171,7 +171,7 @@ bool Config(uint16_t address) {
171171
return false;
172172
}
173173

174-
EMAC_PHY_DEBUG_PRINTF("%u", static_cast<unsigned>(millis() - kMillis));
174+
EMAC_PHY_DEBUG_PRINTF("%u", static_cast<unsigned>(gd32::Millis() - kMillis));
175175
EMAC_PHY_DEBUG_EXIT();
176176
return true;
177177
}

lib-network/src/emac/phy/emac_phy.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,17 @@ static bool UpdateLink(uint16_t address, Status& phy_status) {
166166
puts("Waiting for PHY auto negotiation to complete");
167167

168168
const auto kMillis = timing::Millis();
169+
169170
while (!(bmsr & mmi::BMSR_AUTONEGO_COMPLETE)) {
170171
if ((timing::Millis() - kMillis) > 5000) {
171172
EMAC_PHY_DEBUG_EXIT();
172173
return false;
173174
}
174-
phy::Read(address, mmi::REG_BMSR, bmsr);
175+
176+
if (!phy::Read(address, mmi::REG_BMSR, bmsr)) {
177+
EMAC_PHY_DEBUG_EXIT();
178+
return false;
179+
}
175180
}
176181

177182
phy_status.link = Link::kStateUp;

lib-remoteconfig/http/content/pixeltype.json

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)