mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-13 17:00:19 +00:00
Use UART_DEBUG
This commit is contained in:
1 parent
56a33fd4c5
commit
d76e69f9a7
4 files changed
+14
-12
No files matched your search
@@ -1,16 +1,15 @@
|
|||||||
TARGET = firmware
|
TARGET = firmware
|
||||||
ROOT ?= $(realpath $(CURDIR)/../../..)
|
ROOT ?= $(realpath $(CURDIR)/../../..)
|
||||||
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
|
CFLAGS ?= -W -Wall -Wextra -Werror -Wundef -Wshadow -Wdouble-promotion \
|
||||||
-Wformat-truncation -fno-common -Wconversion \
|
-Wformat-truncation -fno-common -Wconversion \
|
||||||
-g3 -Os -ffunction-sections -fdata-sections -I. -I$(ROOT) \
|
-g3 -Os -ffunction-sections -fdata-sections -I. \
|
||||||
-DMG_ARCH=MG_ARCH_NEWLIB -DMIP_DEBUG=1 -DMG_ENABLE_PACKED_FS=1 \
|
-mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 $(EXTRA_CFLAGS)
|
||||||
-DMG_ENABLE_CUSTOM_MILLIS=1 -DxMG_ENABLE_LINES=1 -DMG_ENABLE_MIP=1 \
|
|
||||||
-mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 $(EXTRA_CFLAGS)
|
|
||||||
LDFLAGS ?= -Tlink.ld -nostartfiles -nostdlib --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
|
LDFLAGS ?= -Tlink.ld -nostartfiles -nostdlib --specs nano.specs -lc -lgcc -Wl,--gc-sections -Wl,-Map=$@.map
|
||||||
SOURCES = boot.c main.c syscalls.c \
|
SOURCES = boot.c main.c syscalls.c
|
||||||
$(ROOT)/mongoose.c \
|
|
||||||
$(ROOT)/examples/device-dashboard/packed_fs.c \
|
# Add Mongoose-specific flags and source files
|
||||||
$(ROOT)/examples/device-dashboard/net.c
|
CFLAGS += -I../../.. -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1 -DMG_ENABLE_MIP=1 -DMG_ENABLE_PACKED_FS=1
|
||||||
|
SOURCES += ../../../mongoose.c ../../device-dashboard/net.c ../../device-dashboard/packed_fs.c
|
||||||
|
|
||||||
all build example: $(TARGET).bin
|
all build example: $(TARGET).bin
|
||||||
|
|
||||||
|
|||||||
@@ -37,14 +37,13 @@ void EXTI15_10_IRQHandler(void) { // External interrupt handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
static struct uart *uart = UART3; // Use UART3 - its attached to debug
|
|
||||||
clock_init(); // Set clock to 216MHz
|
clock_init(); // Set clock to 216MHz
|
||||||
systick_init(SYS_FREQUENCY / 1000); // Increment s_ticks every ms
|
systick_init(SYS_FREQUENCY / 1000); // Increment s_ticks every ms
|
||||||
gpio_output(LED1); // Setup green LED
|
gpio_output(LED1); // Setup green LED
|
||||||
gpio_output(LED2); // Setup blue LED
|
gpio_output(LED2); // Setup blue LED
|
||||||
gpio_input(BTN1); // Set button to input
|
gpio_input(BTN1); // Set button to input
|
||||||
irq_exti_attach(BTN1); // Attach BTN1 to exti
|
irq_exti_attach(BTN1); // Attach BTN1 to exti
|
||||||
uart_init(uart, 115200); // It is wired to the debug port
|
uart_init(UART_DEBUG, 115200); // It is wired to the debug port
|
||||||
|
|
||||||
// Initialise Ethernet. Enable MAC GPIO pins, see
|
// Initialise Ethernet. Enable MAC GPIO pins, see
|
||||||
// https://www.farnell.com/datasheets/2014265.pdf section 6.10
|
// https://www.farnell.com/datasheets/2014265.pdf section 6.10
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ struct uart {
|
|||||||
#define UART2 ((struct uart *) 0x40004400)
|
#define UART2 ((struct uart *) 0x40004400)
|
||||||
#define UART3 ((struct uart *) 0x40004800)
|
#define UART3 ((struct uart *) 0x40004800)
|
||||||
|
|
||||||
|
#ifndef UART_DEBUG
|
||||||
|
#define UART_DEBUG UART3
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void uart_init(struct uart *uart, unsigned long baud) {
|
static inline void uart_init(struct uart *uart, unsigned long baud) {
|
||||||
// https://www.st.com/resource/en/datasheet/stm32f746zg.pdf
|
// https://www.st.com/resource/en/datasheet/stm32f746zg.pdf
|
||||||
uint8_t af = 7; // Alternate function
|
uint8_t af = 7; // Alternate function
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ int _getpid(void) {
|
|||||||
|
|
||||||
int _write(int fd, char *ptr, int len) {
|
int _write(int fd, char *ptr, int len) {
|
||||||
(void) fd, (void) ptr, (void) len;
|
(void) fd, (void) ptr, (void) len;
|
||||||
if (fd == 1) uart_write_buf(UART3, ptr, (size_t) len);
|
if (fd == 1) uart_write_buf(UART_DEBUG, ptr, (size_t) len);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user