Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove arch autodetection for embedded #2711

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/esp32/device-dashboard/main/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define MG_ARCH MG_ARCH_ESP32
1 change: 0 additions & 1 deletion examples/esp32/micropython/mongoose/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// For some reason, IDF detection at build time does not work here
#define MG_ARCH MG_ARCH_ESP32
1 change: 1 addition & 0 deletions examples/esp32/uart-bridge/main/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define MG_ARCH MG_ARCH_ESP32
1 change: 0 additions & 1 deletion examples/esp8266/http-client-server/src/main/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
# please read the ESP-IDF documents if you need to do this.
#

COMPONENT_INCLUDES += ../../../../../..
1 change: 1 addition & 0 deletions examples/esp8266/http-client-server/src/main/mongoose.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define MG_ARCH MG_ARCH_ESP8266

5 changes: 0 additions & 5 deletions examples/rp2040/pico-rmii/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@ pico_add_extra_outputs(firmware) # create map/bin/hex file etc.

pico_enable_stdio_usb(firmware 1) # Route stdio
pico_enable_stdio_uart(firmware 0) # to USB

# Mongoose build flags
add_definitions(-DMG_ENABLE_TCPIP=1)
add_definitions(-DMG_ENABLE_TCPIP_DRIVER_INIT=0)
add_definitions(-DMG_ENABLE_PACKED_FS=1)
5 changes: 5 additions & 0 deletions examples/rp2040/pico-rmii/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define MG_ARCH MG_ARCH_RP2040

#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
#define MG_ENABLE_PACKED_FS 1
7 changes: 1 addition & 6 deletions examples/rp2040/pico-rndis-dashboard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
pico_enable_stdio_usb(firmware 0) # Route stdio
pico_enable_stdio_uart(firmware 1) # to the UART

# Mongoose build flags
add_definitions(-DMG_ENABLE_TCPIP=1)
add_definitions(-DMG_ENABLE_PACKED_FS=1)
add_definitions(-DMG_ENABLE_TCPIP_DRIVER_INIT=0)
add_definitions(-DMG_ENABLE_POSIX_FS=0)
add_definitions(-DDISABLE_ROUTING=1)
# Mongoose build flags in mongoose_config.h

# Example build options
add_definitions(-DHTTP_URL="http://0.0.0.0/")
Expand Down
6 changes: 6 additions & 0 deletions examples/rp2040/pico-rndis-dashboard/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define MG_ARCH MG_ARCH_RP2040

#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_POSIX_FS 0
5 changes: 1 addition & 4 deletions examples/rp2040/pico-rndis-device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
pico_enable_stdio_usb(firmware 0) # Route stdio
pico_enable_stdio_uart(firmware 1) # to the UART

# Mongoose build flags
add_definitions(-DMG_ENABLE_TCPIP=1)
add_definitions(-DMG_ENABLE_TCPIP_DRIVER_INIT=0)
add_definitions(-DMG_ENABLE_POSIX_FS=0)
# Mongoose build flags in mongoose_config.h

# Example build options
6 changes: 6 additions & 0 deletions examples/rp2040/pico-rndis-device/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define MG_ARCH MG_ARCH_RP2040

#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_POSIX_FS 0
7 changes: 1 addition & 6 deletions examples/rp2040/pico-w5500/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
pico_enable_stdio_usb(firmware 0) # Route stdio
pico_enable_stdio_uart(firmware 1) # to the UART, for remote testing

# Mongoose build flags
add_definitions(-DMG_ENABLE_TCPIP=1)
add_definitions(-DMG_ENABLE_DRIVER_W5500=1)
add_definitions(-DMG_ENABLE_PACKED_FS=1)
add_definitions(-DMG_ENABLE_CUSTOM_RANDOM=1)
add_definitions(-DMG_ENABLE_POSIX_FS=0)
# Mongoose build flags in mongoose_config.h

# Example build options
add_definitions(-DHTTP_URL="http://0.0.0.0/")
Expand Down
8 changes: 8 additions & 0 deletions examples/rp2040/pico-w5500/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define MG_ARCH MG_ARCH_RP2040

#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
#define MG_ENABLE_DRIVER_W5500 1
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_POSIX_FS 0
1 change: 0 additions & 1 deletion examples/zephyr/device-dashboard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(device_dashboard)
add_definitions(-DMG_ENABLE_PACKED_FS=1)
target_sources(app PRIVATE src/main.c src/mongoose.c src/net.c src/packed_fs.c)
4 changes: 4 additions & 0 deletions examples/zephyr/device-dashboard/src/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MG_ARCH MG_ARCH_ZEPHYR

#define MG_ENABLE_PACKED_FS 1
#define MG_TLS MG_TLS_MBED
2 changes: 0 additions & 2 deletions examples/zephyr/http-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(http_client)
#add_definitions(-DMG_ENABLE_LINES=1)
add_definitions(-DMG_TLS=MG_TLS_MBED -DMG_MBEDTLS_DEBUG_LEVEL=4)
target_sources(app PRIVATE src/main.c src/mongoose.c)
4 changes: 4 additions & 0 deletions examples/zephyr/http-client/src/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MG_ARCH MG_ARCH_ZEPHYR

#define MG_ENABLE_PACKED_FS 1
#define MG_TLS MG_TLS_MBED
1 change: 0 additions & 1 deletion examples/zephyr/http-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(http_server)
add_definitions(-DMG_TLS=MG_TLS_MBED)
target_sources(app PRIVATE src/main.c src/mongoose.c)
4 changes: 4 additions & 0 deletions examples/zephyr/http-server/src/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MG_ARCH MG_ARCH_ZEPHYR

#define MG_ENABLE_PACKED_FS 1
#define MG_TLS MG_TLS_MBED
2 changes: 0 additions & 2 deletions examples/zephyr/mqtt-aws-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mqtt_aws_client)
#add_definitions(-DMG_ENABLE_LINES=1)
add_definitions(-DMG_TLS=MG_TLS_MBED -DMG_MBEDTLS_DEBUG_LEVEL=4)
target_sources(app PRIVATE src/main.c src/mongoose.c)
4 changes: 4 additions & 0 deletions examples/zephyr/mqtt-aws-client/src/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MG_ARCH MG_ARCH_ZEPHYR

#define MG_ENABLE_PACKED_FS 1
#define MG_TLS MG_TLS_MBED
2 changes: 0 additions & 2 deletions examples/zephyr/websocket-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(websocket_server)
#add_definitions(-DMG_ENABLE_LINES=1)
add_definitions(-DMG_TLS=MG_TLS_MBED)
target_sources(app PRIVATE src/main.c src/mongoose.c)
4 changes: 4 additions & 0 deletions examples/zephyr/websocket-server/src/mongoose_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define MG_ARCH MG_ARCH_ZEPHYR

#define MG_ENABLE_PACKED_FS 1
#define MG_TLS MG_TLS_MBED
17 changes: 1 addition & 16 deletions mongoose.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,6 @@ extern "C" {
#define MG_ARCH MG_ARCH_UNIX
#elif defined(_WIN32)
#define MG_ARCH MG_ARCH_WIN32
#elif defined(ICACHE_FLASH) || defined(ICACHE_RAM_ATTR)
#define MG_ARCH MG_ARCH_ESP8266
#elif defined(__ZEPHYR__)
#define MG_ARCH MG_ARCH_ZEPHYR
#elif defined(ESP_PLATFORM)
#define MG_ARCH MG_ARCH_ESP32
#elif defined(FREERTOS_IP_H)
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_FREERTOS_TCP 1
#elif defined(AZURE_RTOS_THREADX)
#define MG_ARCH MG_ARCH_AZURERTOS
#elif defined(PICO_TARGET_NAME)
#define MG_ARCH MG_ARCH_RP2040
#elif defined(__RTTHREAD__)
#define MG_ARCH MG_ARCH_RTTHREAD
#endif
#endif // !defined(MG_ARCH)

Expand All @@ -71,7 +56,7 @@ extern "C" {
#endif

#if !defined(MG_ARCH)
#error "MG_ARCH is not specified and we couldn't guess it. Set -D MG_ARCH=..."
#error "MG_ARCH is not specified and we couldn't guess it. Define MG_ARCH=... in your compiler"
#endif

// http://esr.ibiblio.org/?p=5095
Expand Down
17 changes: 1 addition & 16 deletions src/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,6 @@
#define MG_ARCH MG_ARCH_UNIX
#elif defined(_WIN32)
#define MG_ARCH MG_ARCH_WIN32
#elif defined(ICACHE_FLASH) || defined(ICACHE_RAM_ATTR)
#define MG_ARCH MG_ARCH_ESP8266
#elif defined(__ZEPHYR__)
#define MG_ARCH MG_ARCH_ZEPHYR
#elif defined(ESP_PLATFORM)
#define MG_ARCH MG_ARCH_ESP32
#elif defined(FREERTOS_IP_H)
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_FREERTOS_TCP 1
#elif defined(AZURE_RTOS_THREADX)
#define MG_ARCH MG_ARCH_AZURERTOS
#elif defined(PICO_TARGET_NAME)
#define MG_ARCH MG_ARCH_RP2040
#elif defined(__RTTHREAD__)
#define MG_ARCH MG_ARCH_RTTHREAD
#endif
#endif // !defined(MG_ARCH)

Expand All @@ -44,7 +29,7 @@
#endif

#if !defined(MG_ARCH)
#error "MG_ARCH is not specified and we couldn't guess it. Set -D MG_ARCH=..."
#error "MG_ARCH is not specified and we couldn't guess it. Define MG_ARCH=... in your compiler"
#endif

// http://esr.ibiblio.org/?p=5095
Expand Down
Loading