Skip to content

Commit

Permalink
AVR build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpq committed Jul 20, 2023
1 parent 09ce6ae commit 0a761c0
Show file tree
Hide file tree
Showing 37 changed files with 58 additions and 83 deletions.
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt > $@

DIR ?= test/data
OUT ?= packed_fs.c
mkfs:
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack -s $(DIR) `find $(DIR) -type f` > $(OUT)
# find $(DIR) -type f | sed -e s,^$(DIR),,g -e s,^/,,g

# Check that all external (exported) symbols have "mg_" prefix
mg_prefix: mongoose.c mongoose.h
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T ' | grep -v 'mg_' ; test $$? = 1
Expand Down Expand Up @@ -165,17 +158,26 @@ arduino: ENV = -v $(CWD)/arduino:/root
arduino:
curl -sL http://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz | unxz | tar -xf -
mv arduino-* $@

arduino-xiao-board:
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs
$(DOCKER) mdashnet/cc2 ./arduino/arduino --install-boards Seeeduino:samd

arduino-xiao: ENV = -v $(CWD)/arduino:/root
arduino-xiao: arduino
arduino-xiao: arduino arduino-xiao-board
rm -rf tmp; mkdir tmp
cp examples/arduino/w5500/w5500.ino tmp/tmp.ino
cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/
$(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 tmp/tmp.ino

arduino-nano: ENV = -v $(CWD)/arduino:/root
arduino-nano: arduino
rm -rf tmp; mkdir tmp
cp examples/arduino/w5500/w5500.ino tmp/tmp.ino
cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/
$(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board arduino:avr:nano tmp/tmp.ino

mingw++: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe

Expand Down
1 change: 1 addition & 0 deletions examples/arduino/w5500/mongoose_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
#define MG_ENABLE_SOCKET 0
#define MG_ENABLE_TCPIP 1
#define mkdir(a, b) (-1)
#define MG_IO_SIZE 128
//#define MG_ENABLE_LOG 0
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 1

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_STMPACK_ARCH

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 0

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_ARCH_FREERTOS

#define MG_STMPACK_NET 1

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 0

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_ARCH_CMSIS_RTOS2

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/nucleo-f429zi-freertos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CFLAGS += -IFreeRTOS-Kernel/include
CFLAGS += -IFreeRTOS-Kernel/portable/GCC/ARM_CM4F -Wno-conversion

SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h

# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"
Expand Down
1 change: 1 addition & 0 deletions examples/stm32/nucleo-f429zi-freertos/mongoose_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_IO_SIZE 256
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOURCES += cmsis_f4/Source/Templates/gcc/startup_stm32f429xx.s # ST startup file
# Mongoose-specific source code files and build options. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)

# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/nucleo-f429zi-rndis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CFLAGS += -Wno-conversion -Wno-sign-conversion
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)

ifeq ($(OS),Windows_NT)
RM = cmd /C del /Q /F /S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 1

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_STMPACK_ARCH

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 0

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_ARCH_FREERTOS

#define MG_STMPACK_NET 1

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 0

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_ARCH_CMSIS_RTOS2

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/nucleo-f746zg-freertos-tcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CFLAGS += -DSTM32F7xx -Wno-unused-parameter
CFLAGS += -DSTM32F746xx -Wno-sign-compare -Wno-undef -Wno-shadow -Wno-array-bounds -Wno-error

SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h

# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_FREERTOS_TCP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1

2 changes: 1 addition & 1 deletion examples/stm32/nucleo-f746zg-freertos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CFLAGS += -IFreeRTOS-Kernel/include
CFLAGS += -IFreeRTOS-Kernel/portable/GCC/ARM_CM7/r0p1 -Wno-conversion

SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h

# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"
Expand Down
1 change: 1 addition & 0 deletions examples/stm32/nucleo-f746zg-freertos/mongoose_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_IO_SIZE 256
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
1 change: 1 addition & 0 deletions examples/stm32/nucleo-f746zg-keil-rtx/mongoose_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
1 change: 1 addition & 0 deletions examples/stm32/nucleo-f746zg-keil-rtx5/mongoose_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SOURCES += cmsis_f7/Source/Templates/gcc/startup_stm32f746xx.s # ST startup file
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)

# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\" -DHTTPS_URL=\"https://0.0.0.0/\"
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/nucleo-f746zg-rndis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CFLAGS += -Wno-conversion -Wno-sign-conversion
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)

ifeq ($(OS),Windows_NT)
RM = cmd /C del /Q /F /S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 1

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_STMPACK_ARCH

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32H 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
#endif

#define MG_ENABLE_PACKED_FS 1

#define MG_ENABLE_CUSTOM_MILLIS 0

#define MG_ENABLE_MBEDTLS 0

#define MG_ARCH MG_ARCH_CMSIS_RTOS2

#define MG_STMPACK_NET 0

#define MG_ENABLE_CUSTOM_RANDOM 1

// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32H 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2
Expand Down
Loading

0 comments on commit 0a761c0

Please sign in to comment.