Skip to content

Commit 1378bb6

Browse files
committed
Sync with local development
1 parent 0674542 commit 1378bb6

File tree

9 files changed

+56
-256
lines changed

9 files changed

+56
-256
lines changed

firmware-template-gd32/Board.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@ endif
7878

7979
ifeq ($(strip $(BOARD)),BOARD_BW_OPIDMX4)
8080
BOARD_DMX=4
81+
DEFINES+=-DCONFIG_STORE_USE_SPI
8182
endif
8283

8384
ifeq ($(strip $(BOARD)),BOARD_DMX3)
8485
BOARD_DMX=3
86+
DEFINES+=-DCONFIG_STORE_USE_SPI
8587
endif
8688

8789
ifeq ($(strip $(BOARD)),BOARD_DMX4)
88-
BOARD_DMX=4
90+
DEFINES+=-DCONFIG_STORE_USE_SPI
91+
BOARD_DMX=4
8992
endif
9093

9194
ifdef BOARD_DMX

firmware-template-gd32/FreeRTOS.mk

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

firmware-template-gd32/Mcu.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ifeq ($(strip $(MCU)),GD32F470ZK)
6666
endif
6767

6868
ifeq ($(strip $(MCU)),GD32H759IM)
69-
LINKER=$(FIRMWARE_DIR)gd32h7xx_M_flash.ld
69+
LINKER=$(FIRMWARE_DIR)gd32h7xx_xM_flash.ld
7070
FAMILY=gd32h7xx
7171
LINE=gd32h759
7272
endif

include/stdio.h

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file stdio.h
33
*
44
*/
5-
/* Copyright (C) 2017-2020 by Arjan van Vught mailto:[email protected]
5+
/* Copyright (C) 2017-2024 by Arjan van Vught mailto:[email protected]
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
@@ -28,10 +28,29 @@
2828

2929
#include <stddef.h>
3030
#include <stdarg.h>
31-
32-
#define EOF -1
33-
34-
typedef void *FILE;
31+
#include <stdint.h>
32+
33+
#define EOF (-1)
34+
35+
typedef struct __sFILE {
36+
void *udata;
37+
#define __SLBF 0x0001 /* line buffered */
38+
#define __SNBF 0x0002 /* unbuffered */
39+
#define __SRD 0x0004 /* OK to read */
40+
#define __SWR 0x0008 /* OK to write */
41+
/* RD and WR are never simultaneously asserted */
42+
#define __SRW 0x0010 /* open for reading & writing */
43+
#define __SEOF 0x0020 /* found EOF */
44+
#define __SERR 0x0040 /* found error */
45+
uint8_t flags;
46+
} FILE;
47+
48+
#if defined(CONFIG_POSIX_ENABLE_STDIN)
49+
#error Not supported
50+
extern FILE *stdin;
51+
extern FILE *stdout;
52+
extern FILE *stderr;
53+
#endif
3554

3655
#ifndef SEEK_SET
3756
#define SEEK_SET 0 /* set file offset to offset */
@@ -49,36 +68,39 @@ typedef void *FILE;
4968
extern "C" {
5069
#endif
5170

52-
extern int puts(const char *s);
53-
extern int putchar(int c);
71+
int puts(const char *s);
72+
int putchar(int c);
73+
74+
int fileno(FILE *stream);
5475

55-
extern FILE *fopen(const char *path, const char *mode);
56-
extern int fclose(FILE *stream);
76+
FILE *fopen(const char *path, const char *mode);
77+
int fclose(FILE *stream);
5778

58-
extern int fgetc(FILE *stream);
79+
int fgetc(FILE *stream);
5980

60-
extern char *fgets(char *s, int size, FILE *stream);
61-
extern int fputs(const char *s, FILE *stream);
81+
char *fgets(char *s, int size, FILE *stream);
82+
int fputs(const char *s, FILE *stream);
6283

63-
extern size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
64-
extern size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
84+
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
85+
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
6586

66-
extern int fseek(FILE *stream, long offset, int whence);
87+
int fseek(FILE *stream, long offset, int whence);
6788

68-
extern long ftell(FILE *stream);
89+
long ftell(FILE *stream);
6990

70-
extern void clearerr(FILE *stream);
71-
extern int ferror(FILE *stream);
91+
void clearerr(FILE *stream);
92+
int ferror(FILE *stream);
93+
int feof(FILE *stream);
7294

73-
extern int printf(const char *format, ...);
95+
int printf(const char *format, ...);
7496

75-
extern int sprintf(char *str, const char *format, ...);
76-
extern int snprintf(char *str, size_t size, const char *format, ...);
97+
int sprintf(char *str, const char *format, ...);
98+
int snprintf(char *str, size_t size, const char *format, ...);
7799

78-
extern int vprintf(const char *format, va_list ap);
79-
extern int vsnprintf(char *str, size_t size, const char *format, va_list);
100+
int vprintf(const char *format, va_list ap);
101+
int vsnprintf(char *str, size_t size, const char *format, va_list);
80102

81-
extern void perror(const char *s);
103+
void perror(const char *s);
82104

83105
#ifdef __cplusplus
84106
}

lib-gd32/include/FreeRTOSConfig.h

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

lib-gd32/src/f/gd32_spi_dma_i2s.cpp

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file gd32_spi_dma_i2s.cpp
33
*
44
*/
5-
/* Copyright (C) 2021-2022 by Arjan van Vught mailto:[email protected]
5+
/* Copyright (C) 2021-2024 by Arjan van Vught mailto:[email protected]
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
@@ -50,7 +50,7 @@ void i2s_psc_config_dump(uint32_t spi_periph, uint32_t audiosample, uint32_t fra
5050

5151
static uint16_t s_TxBuffer[SPI_BUFFER_SIZE] __attribute__ ((aligned (4)));
5252

53-
static void _spi_i2s_dma_config() {
53+
static void spi_i2s_dma_config() {
5454
rcu_periph_clock_enable(RCU_DMA1);
5555

5656
dma_deinit(SPI_DMAx, SPI_DMA_CHx);
@@ -114,36 +114,12 @@ void gd32_spi_dma_begin() {
114114
gpio_output_options_set(SPI_NSS_GPIOx, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, SPI_NSS_GPIO_PINx);
115115
#endif
116116

117-
#if defined (GD32F10X_CL) || defined (GD32F20X_CL)
118-
/**
119-
* Setup PLL2
120-
*
121-
* i2sclock=160000000
122-
* i2sdiv=12, i2sof=256
123-
*/
124-
125-
RCU_CTL &= ~RCU_CTL_PLL2EN;
126-
127-
rcu_pll2_config(RCU_PLL2_MUL16);
128-
129-
RCU_CTL |= RCU_CTL_PLL2EN;
130-
131-
while ((RCU_CTL & RCU_CTL_PLL2STB) == 0U) {
132-
}
133-
134-
if (SPI_PERIPH == SPI2) {
135-
rcu_i2s2_clock_config(RCU_I2S2SRC_CKPLL2_MUL2);
136-
} else {
137-
rcu_i2s1_clock_config(RCU_I2S1SRC_CKPLL2_MUL2);
138-
}
139-
#endif
140-
141117
i2s_disable(SPI_PERIPH);
142118
i2s_psc_config(SPI_PERIPH, 200000, I2S_FRAMEFORMAT_DT16B_CH16B, I2S_MCKOUT_DISABLE);
143119
i2s_init(SPI_PERIPH, I2S_MODE_MASTERTX, I2S_STD_MSB, I2S_CKPL_LOW);
144120
i2s_enable(SPI_PERIPH);
145121

146-
_spi_i2s_dma_config();
122+
spi_i2s_dma_config();
147123

148124
#ifndef NDEBUG
149125
i2s_psc_config_dump(SPI_PERIPH, 200000, I2S_FRAMEFORMAT_DT16B_CH16B, I2S_MCKOUT_DISABLE);

0 commit comments

Comments
 (0)