Build with -DMG_ENABLE_FS=1

This commit is contained in:
cpq 2021-05-19 08:10:38 +01:00
parent 1a5e3d3151
commit 7c0d126edc
4 changed files with 15 additions and 5 deletions

View File

@ -6,7 +6,7 @@ DOCKER ?= docker run -it --rm -v $(PROJECT_ROOT_PATH):$(PROJECT_ROOT_PATH) -w $(
FREERTOS_KERNEL_PATH ?= $(PROJECT_ROOT_PATH)/test/freertos-kernel
FREERTOS_PLUS_TCP_PATH ?= $(PROJECT_ROOT_PATH)/test/freertos-tcp
MONGOOSE_FLAGS = -DMG_ARCH=MG_ARCH_FREERTOS_TCP -DMG_ENABLE_FS=0
MONGOOSE_FLAGS = -DMG_ARCH=MG_ARCH_FREERTOS_TCP -DMG_ENABLE_FS=1
MCU_FLAGS = -mcpu=cortex-m7 -mthumb -mfloat-abi=softfp -mfpu=vfpv4
#-mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard

View File

@ -10,7 +10,12 @@ static const char *s_listening_address = "http://0.0.0.0:80";
// Event handler for the listening connection.
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_HTTP_MSG) {
#if MG_ENABLE_FS
struct mg_http_serve_opts opts = {.root_dir = "/"};
mg_http_serve_dir(c, ev_data, &opts);
#else
mg_http_reply(c, 200, "", "hello, %s!\n", "world");
#endif
}
(void) fn_data;
(void) ev_data;
@ -33,7 +38,6 @@ static void blinker(void *args) {
gpio_toggle(pin);
vTaskDelay(pdMS_TO_TICKS(ms));
LOG(LL_INFO, ("blink %s, RAM: %u", (char *) args, xPortGetFreeHeapSize()));
// printf("blink %s, RAM: %u\n", (char *) args, xPortGetFreeHeapSize());
}
}
@ -88,8 +92,6 @@ uint32_t SystemCoreClock = 216000000;
uint32_t HAL_RCC_GetHCLKFreq(void) {
return SystemCoreClock;
}
// void assert_failed(void) {
//}
uint32_t HAL_GetTick(void) {
return configTICK_RATE_HZ;
@ -138,4 +140,4 @@ int vLoggingPrintf(const char *fmt, ...) {
void *_sbrk(ptrdiff_t incr) {
(void) incr;
return NULL;
}
}

View File

@ -132,6 +132,10 @@
#include <string.h>
#include <time.h>
#if MG_ENABLE_FS
#include <sys/stat.h>
#endif
#include <FreeRTOS.h>
#include <FreeRTOS_IP.h>
#include <FreeRTOS_Sockets.h>

View File

@ -13,6 +13,10 @@
#include <string.h>
#include <time.h>
#if MG_ENABLE_FS
#include <sys/stat.h>
#endif
#include <FreeRTOS.h>
#include <FreeRTOS_IP.h>
#include <FreeRTOS_Sockets.h>