mirror of
https://github.com/apache/nuttx.git
synced 2026-08-18 01:49:24 +08:00
risc-v/gd32vw55x: make the build warning-clean for CI (-Werror)
Build Documentation / build-html (push) Canceled after 0s
MemBrowse Memory Report / changes-filter (push) Canceled after 0s
MemBrowse Memory Report / load-targets (push) Canceled after 0s
MemBrowse Memory Report / identical (push) Canceled after 0s
MemBrowse Memory Report / analyze (push) Canceled after 0s
Build Documentation / build-html (push) Canceled after 0s
MemBrowse Memory Report / changes-filter (push) Canceled after 0s
MemBrowse Memory Report / load-targets (push) Canceled after 0s
MemBrowse Memory Report / identical (push) Canceled after 0s
MemBrowse Memory Report / analyze (push) Canceled after 0s
CI builds with -Werror and the board's build carried thousands of warnings, all rooted in the vendor SDK integration: - The NMSIS riscv_encoding.h redefines 32 CSR macros that NuttX's <arch/csr.h> (pulled in through <nuttx/irq.h>) already defines with its own encodings. No -Wno flag covers macro redefinitions, so the SDK patch now undefines those names right before the NMSIS definitions. Same treatment for COMPILE_TIME_ASSERT in wifi_management.h. - The vendor sources are not NuttX-warning-clean (undefined macros in #if, %d for uint32_t, shadowed locals, K&R prototypes, ...); add the matching -Wno suppressions scoped to this chip's build. - Fix the port's own warnings properly: gd32vw55x_eclic.h redefined CSR_MINTSTATUS with the Nuclei address (0x346) over the standard CLIC one in csr.h (renamed to CSR_NUCLEI_MINTSTATUS), an unused variable in gdwifi_transmit() and a dead function in wrapper_nuttx.c. All seven configurations now build with "-Wno-cpp -Werror" (the CI flags). Smoke-validated on hardware: Wi-Fi WPA2 association and ping, BLE advertising, connect and GATT write. Assisted-by: Claude Opus 4.8 Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
This commit is contained in:
@@ -33,6 +33,14 @@
|
||||
# not use: WPA comes from the lightweight libwpas.a, via wifi_wpa.c.
|
||||
CFLAGS += -DCFG_RTOS -DEXEC_USING_STD_PRINTF -DGDWIFI_NUTTX
|
||||
|
||||
# The vendor SDK sources are not NuttX-warning-clean (undefined macros in
|
||||
# #if, %d for uint32_t, shadowed locals, K&R prototypes, ...). These
|
||||
# suppressions are scoped to this chip's build; the macro redefinitions
|
||||
# that no -Wno flag covers are fixed in the SDK patch instead
|
||||
# (riscv_encoding.h, wifi_management.h).
|
||||
CFLAGS += -Wno-undef -Wno-format -Wno-shadow -Wno-address
|
||||
CFLAGS += -Wno-unused-function -Wno-strict-prototypes -Wno-array-parameter
|
||||
|
||||
# Include paths: our patched config dir must come first
|
||||
|
||||
INCLUDES += $(INCDIR_PREFIX)$(ARCH_SRCDIR)$(DELIM)gd32vw55x$(DELIM)gdwifi$(DELIM)config
|
||||
|
||||
@@ -529,7 +529,6 @@ static int gdwifi_ifdown(struct netdev_lowerhalf_s *dev)
|
||||
|
||||
static int gdwifi_transmit(struct netdev_lowerhalf_s *dev, netpkt_t *pkt)
|
||||
{
|
||||
struct gdwifi_dev_s *priv = (struct gdwifi_dev_s *)dev;
|
||||
unsigned int len = netpkt_getdatalen(dev, pkt);
|
||||
struct pbuf *p;
|
||||
|
||||
|
||||
@@ -1,3 +1,53 @@
|
||||
diff --git a/MSDK/plf/riscv/NMSIS/Core/Include/riscv_encoding.h b/MSDK/plf/riscv/NMSIS/Core/Include/riscv_encoding.h
|
||||
index 8b87225..51cb931 100644
|
||||
--- a/MSDK/plf/riscv/NMSIS/Core/Include/riscv_encoding.h
|
||||
+++ b/MSDK/plf/riscv/NMSIS/Core/Include/riscv_encoding.h
|
||||
@@ -31,6 +31,45 @@
|
||||
* The following macros are used for CSR encodings
|
||||
* @{
|
||||
*/
|
||||
+/* NuttX port: the NuttX <arch/csr.h> (pulled in through <nuttx/irq.h>)
|
||||
+ * already defines several of these names with its own encodings; undefine
|
||||
+ * them so this header provides the NMSIS values to the SDK sources without
|
||||
+ * macro redefinition warnings.
|
||||
+ */
|
||||
+
|
||||
+#undef CSR_FCSR
|
||||
+#undef CSR_FFLAGS
|
||||
+#undef CSR_FRM
|
||||
+#undef CSR_MINTSTATUS
|
||||
+#undef CSR_USTATUS
|
||||
+#undef MIE_MEIE
|
||||
+#undef MIE_MSIE
|
||||
+#undef MIE_MTIE
|
||||
+#undef MIE_SEIE
|
||||
+#undef MIE_SSIE
|
||||
+#undef MIE_STIE
|
||||
+#undef MIP_MEIP
|
||||
+#undef MIP_MSIP
|
||||
+#undef MIP_MTIP
|
||||
+#undef MIP_SEIP
|
||||
+#undef MIP_SSIP
|
||||
+#undef MIP_STIP
|
||||
+#undef MSTATUS_FS
|
||||
+#undef MSTATUS_FS_CLEAN
|
||||
+#undef MSTATUS_FS_DIRTY
|
||||
+#undef MSTATUS_MIE
|
||||
+#undef MSTATUS_MPIE
|
||||
+#undef MSTATUS_MPRV
|
||||
+#undef MSTATUS_MXR
|
||||
+#undef MSTATUS_SIE
|
||||
+#undef MSTATUS_SPIE
|
||||
+#undef MSTATUS_UIE
|
||||
+#undef MSTATUS_XS
|
||||
+#undef SSTATUS_FS
|
||||
+#undef SSTATUS_SIE
|
||||
+#undef SSTATUS_SPIE
|
||||
+#undef SSTATUS_XS
|
||||
+
|
||||
/* === Standard CSR bit mask === */
|
||||
#define MSTATUS_UIE 0x00000001
|
||||
#define MSTATUS_SIE 0x00000002
|
||||
diff --git a/MSDK/plf/riscv/gd32vw55x/gd32vw55x.h b/MSDK/plf/riscv/gd32vw55x/gd32vw55x.h
|
||||
index f4e200e..c9189ca 100644
|
||||
--- a/MSDK/plf/riscv/gd32vw55x/gd32vw55x.h
|
||||
@@ -37,6 +87,24 @@ index e7f393f..8731cb8 100644
|
||||
|
||||
/* 2. wifi power on */
|
||||
wifi_exist_flag = 1;
|
||||
diff --git a/MSDK/wifi_manager/wifi_management.h b/MSDK/wifi_manager/wifi_management.h
|
||||
index 3a108f9..3923f02 100644
|
||||
--- a/MSDK/wifi_manager/wifi_management.h
|
||||
+++ b/MSDK/wifi_manager/wifi_management.h
|
||||
@@ -94,6 +94,13 @@ extern "C" {
|
||||
#define wifi_sm_printf(...)
|
||||
#endif
|
||||
|
||||
+/* NuttX port: <nuttx/compiler.h> also defines COMPILE_TIME_ASSERT; use the
|
||||
+ * SDK's own definition here without redefining the other one.
|
||||
+ */
|
||||
+#ifdef COMPILE_TIME_ASSERT
|
||||
+#undef COMPILE_TIME_ASSERT
|
||||
+#endif
|
||||
+
|
||||
#define COMPILE_TIME_ASSERT(constant_expr) \
|
||||
do { \
|
||||
switch(0) { \
|
||||
diff --git a/MSDK/wifi_manager/wifi_netlink.c b/MSDK/wifi_manager/wifi_netlink.c
|
||||
index aec26cc..445c109 100644
|
||||
--- a/MSDK/wifi_manager/wifi_netlink.c
|
||||
|
||||
@@ -1033,28 +1033,6 @@ void sys_sched_unlock(void)
|
||||
* Public Functions - timers
|
||||
****************************************************************************/
|
||||
|
||||
static void timer_worker_fixed(void *arg)
|
||||
{
|
||||
struct nx_timer_s *t = arg;
|
||||
|
||||
if (!t->active)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (t->periodic)
|
||||
{
|
||||
wd_start(&t->wdog, MSEC2TICK(t->delay_ms), timer_wdog_handler,
|
||||
(wdparm_t)(uintptr_t)t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t->active = 0;
|
||||
}
|
||||
|
||||
t->func(t, t->arg);
|
||||
}
|
||||
|
||||
void sys_timer_init(os_timer_t *timer, const uint8_t *name, uint32_t delay,
|
||||
uint8_t periodic, timer_func_t func, void *arg)
|
||||
{
|
||||
|
||||
@@ -86,10 +86,14 @@
|
||||
|
||||
#define ECLIC_INTCTL_LEVEL(l) ((((l) & 0xf) << 4) | 0x0f)
|
||||
|
||||
/* Nuclei-specific CSRs used with the ECLIC */
|
||||
/* Nuclei-specific CSRs used with the ECLIC. Note: the Nuclei interrupt
|
||||
* level status CSR lives at 0x346, not at the standard CLIC MINTSTATUS
|
||||
* address that arch/risc-v/include/csr.h names CSR_MINTSTATUS (0xfb1); a
|
||||
* distinct name avoids redefining it.
|
||||
*/
|
||||
|
||||
#define CSR_MTVT 0x307 /* Vector table base */
|
||||
#define CSR_MINTSTATUS 0x346 /* Interrupt level status */
|
||||
#define CSR_NUCLEI_MINTSTATUS 0x346 /* Interrupt level status */
|
||||
#define CSR_MCACHE_CTL 0x7ca /* I-cache control */
|
||||
#define CSR_MMISC_CTL 0x7d0 /* Misc control (NMI base) */
|
||||
#define CSR_MTVT2 0x7ec /* Non-vectored irq entry */
|
||||
|
||||
Reference in New Issue
Block a user