diff --git a/APP_Framework/Applications/main.c b/APP_Framework/Applications/main.c index 3216586d0..92b793765 100644 --- a/APP_Framework/Applications/main.c +++ b/APP_Framework/Applications/main.c @@ -22,9 +22,13 @@ extern void ApplicationOtaTaskInit(void); extern int OtaTask(void); #endif +#ifdef USE_MONGOOSE +extern int webserver(void); +#endif + int main(void) { - printf("Hello, world! \n"); + printf("\nHello, world!\n"); FrameworkInit(); #ifdef APPLICATION_OTA ApplicationOtaTaskInit(); @@ -33,6 +37,11 @@ int main(void) #ifdef OTA_BY_PLATFORM OtaTask(); #endif + +#ifdef USE_MONGOOSE + webserver(); +#endif + return 0; } // int cppmain(void); diff --git a/APP_Framework/Applications/mongoose/Kconfig b/APP_Framework/Applications/mongoose/Kconfig index 90a6f2fbb..bb17a9631 100644 --- a/APP_Framework/Applications/mongoose/Kconfig +++ b/APP_Framework/Applications/mongoose/Kconfig @@ -1,3 +1,6 @@ menuconfig USE_MONGOOSE bool "Use mongoose as webserver" - default n \ No newline at end of file + default y + select BSP_USING_SDIO + select BSP_USING_W5500 + select BSP_USING_ETHERNET diff --git a/APP_Framework/Applications/mongoose/Makefile b/APP_Framework/Applications/mongoose/Makefile index 40f525b5e..5330a8d7f 100644 --- a/APP_Framework/Applications/mongoose/Makefile +++ b/APP_Framework/Applications/mongoose/Makefile @@ -1,3 +1,3 @@ -SRC_FILES += project.c +SRC_FILES += webserver_project.c include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/APP_Framework/Applications/mongoose/README.md b/APP_Framework/Applications/mongoose/README.md new file mode 100644 index 000000000..3e045b39d --- /dev/null +++ b/APP_Framework/Applications/mongoose/README.md @@ -0,0 +1 @@ +mongoose.a基于工具链arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620编译而来,若使用的arm工具链版本存在差异或使用的是RISC-V工具链,则需重新编译mongoose.a,避免遇到异常问题。 \ No newline at end of file diff --git a/APP_Framework/Applications/mongoose/lib/Makefile b/APP_Framework/Applications/mongoose/lib/Makefile deleted file mode 100644 index 0824ed779..000000000 --- a/APP_Framework/Applications/mongoose/lib/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -SRC_FILES += mongoose.c - -include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/APP_Framework/Applications/mongoose/mongoose.a b/APP_Framework/Applications/mongoose/mongoose.a index fd5000247..b962896e9 100644 Binary files a/APP_Framework/Applications/mongoose/mongoose.a and b/APP_Framework/Applications/mongoose/mongoose.a differ diff --git a/APP_Framework/Applications/mongoose/project.c b/APP_Framework/Applications/mongoose/webserver_project.c similarity index 81% rename from APP_Framework/Applications/mongoose/project.c rename to APP_Framework/Applications/mongoose/webserver_project.c index cf05a4af9..324cd7a97 100644 --- a/APP_Framework/Applications/mongoose/project.c +++ b/APP_Framework/Applications/mongoose/webserver_project.c @@ -8,6 +8,26 @@ // any other URI serves static files from s_root_dir // Data and results are JSON strings +/** +* @file webserver_project.c +* @brief support webserver_project for XiUOS +* @version 3.0 +* @author AIIT XUOS Lab +* @date 2023-11-07 +*/ + +/************************************************* +File name: webserver_project.c +Description: support webserver_project for XiUOS +Others: +History: +1. Date: 2023-11-07 +Author: AIIT XUOS Lab +Modification: +1、support xishutong-arm32 board, using W5500 to support webserver. +*************************************************/ + + #include "ip_addr.h" #include "mongoose.h" #include "netdev.h" @@ -19,11 +39,12 @@ static const char* s_root_dir = "webserver"; static const char* s_enable_hexdump = "no"; static const char* s_ssi_pattern = "#.html"; -static const char* device_type = "Edu-ARM32"; -static const char* web_version = "XUOS Webserver 1.0"; +static const char* device_type = "xishutong-arm32"; +static const char* web_version = "XiUOS WebServer 1.0"; static int enable_4g = 0; static struct netdev* p_netdev; +static pthread_t tid; static struct config { char *ip, *mask, *gw, *dns; @@ -104,11 +125,11 @@ static void fn(struct mg_connection* c, int ev, void* ev_data, void* fn_data) (void)fn_data; } -static void* do_webserver_demo(void* none) +static void* do_webserver(void* args) { p_netdev = netdev_get_by_name("wz"); if (p_netdev == NULL) { - MG_INFO(("Did nto find wz netdev, use default.\n")); + MG_INFO(("Did not find wz netdev, use default.\n")); p_netdev = NETDEV_DEFAULT; } MG_INFO(("Use Netdev %s", p_netdev->name)); @@ -119,7 +140,7 @@ static void* do_webserver_demo(void* none) struct mg_mgr mgr; // Event manager // mg_log_set(MG_LL_INFO); // Set to 3 to enable debug - mg_log_set(MG_LL_DEBUG); // Set to 3 to enable debug + mg_log_set(MG_LL_ERROR); // Set to 3 to enable debug mg_mgr_init(&mgr); // Initialise event manager mg_http_listen(&mgr, s_http_addr, fn, NULL); // Create HTTP listener for (;;) @@ -128,15 +149,24 @@ static void* do_webserver_demo(void* none) return NULL; } -int webserver_demo(int argc, char* argv[]) +int webserver(void) { - pthread_t tid = -1; + char* params[3] = {"LwipNetworkActive", "-e", "1"}; + extern void LwipNetworkActive(int argc, char* argv[]); + LwipNetworkActive(3, params); + pthread_attr_t attr; attr.schedparam.sched_priority = 30; attr.stacksize = 0x2000; - PrivTaskCreate(&tid, &attr, do_webserver_demo, NULL); + char task_name[] = "do_webserver"; + pthread_args_t args; + args.pthread_name = task_name; + + PrivTaskCreate(&tid, &attr, &do_webserver, (void *)&args); + PrivTaskStartup(&tid); return 0; } -SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(5), Webserver, webserver_demo, webserver for project); \ No newline at end of file +SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(5), + Webserver, webserver, webserver for project); \ No newline at end of file diff --git a/APP_Framework/lib/lorawan/lorawan_gateway_update.c b/APP_Framework/lib/lorawan/lorawan_gateway_update.c new file mode 100644 index 000000000..cbcc1e22a --- /dev/null +++ b/APP_Framework/lib/lorawan/lorawan_gateway_update.c @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2020 AIIT XUOS Lab +* XiUOS is licensed under Mulan PSL v2. +* You can use this software according to the terms and conditions of the Mulan PSL v2. +* You may obtain a copy of Mulan PSL v2 at: +* http://license.coscl.org.cn/MulanPSL2 +* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +* See the Mulan PSL v2 for more details. +*/ + +/** +* @file lorawan_gateway_update.c +* @brief support lorawan-gateway update function +* @version 3.0 +* @author AIIT XUOS Lab +* @date 2023-11-29 +*/ + +/************************************************* +File name: lorawan_gateway_update.c +Description: support lorawan-gateway update function +Others: +History: +1. Date: 2023-11-29 +Author: AIIT XUOS Lab +Modification: +1、first version. +*************************************************/ + + + diff --git a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/Kconfig b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/Kconfig index 6c0c47d98..daadea0b6 100644 --- a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/Kconfig +++ b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/Kconfig @@ -25,6 +25,7 @@ menuconfig BSP_USING_ETHERNET menuconfig BSP_USING_W5500 bool "Using W5500 ethernet device" default n + select BSP_USING_ETHERNET select BSP_USING_LWIP select BSP_USING_SPI select BSP_USING_SPI1 @@ -55,7 +56,7 @@ menuconfig BSP_USING_SPI menuconfig BSP_USING_SDRAM bool "Using SDRAM IS42S16400J" - default y + default n if BSP_USING_SDRAM source "$BSP_DIR/third_party_driver/sdram/Kconfig" endif diff --git a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/gpio/connect_gpio.c b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/gpio/connect_gpio.c index e3a0cfda5..cb7f2aeaa 100644 --- a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/gpio/connect_gpio.c +++ b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/gpio/connect_gpio.c @@ -303,7 +303,7 @@ static int GpioPinIndex(uint16_t pin) int ret = 0; for (; ret <= MAX_PIN_INDEX; ret++) { // ret must be 16-bit if ((0x0001U << ret) & pin) { - KPrintf("the int pin is %d\n", ret); + // KPrintf("the int pin is %d\n", ret); return ret; } }; diff --git a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/sdio/connect_sdio.c b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/sdio/connect_sdio.c index 63d9af327..249ba0ab7 100644 --- a/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/sdio/connect_sdio.c +++ b/Ubiquitous/XiZi_IIoT/board/xishutong-arm32/third_party_driver/sdio/connect_sdio.c @@ -214,9 +214,9 @@ static struct SdioDevDone dev_done = { static int MountSDCardFs(enum FilesystemType fs_type) { if (MountFilesystem(SDIO_BUS_NAME, SDIO_DEVICE_NAME, SDIO_DRIVER_NAME, fs_type, "/") == 0) - KPrintf("Sd card mount to '/'"); + KPrintf("Sd card mount to '/'\n"); else - KPrintf("Sd card mount to '/' failed!"); + KPrintf("Sd card mount to '/' failed!\n"); return 0; } @@ -291,7 +291,7 @@ int MountSDCard() { int sd_card_task = 0; sd_card_task = KTaskCreate("sd_card", SdCardTask, NONE, - SD_CARD_STACK_SIZE, 8); + SD_CARD_STACK_SIZE, 17); if (sd_card_task < 0) { KPrintf("sd_card_task create failed ...%s %d.\n", __FUNCTION__, __LINE__); return ERROR; diff --git a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c index 788e7e3e3..8a66462d9 100644 --- a/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c +++ b/Ubiquitous/XiZi_IIoT/resources/ethernet/LwIP/arch/sys_arch.c @@ -78,7 +78,7 @@ char lwip_eth0_gwaddr[20] = { 192, 168, 130, 1 }; char lwip_eth1_ipaddr[20] = { 192, 168, 131, 88 }; char lwip_eth1_netmask[20] = { 255, 255, 254, 0 }; -char lwip_eth1_gwaddr[20] = { 192, 168, 130, 1 }; +char lwip_eth1_gwaddr[20] = { 192, 168, 131, 1 }; char lwip_flag = 0; @@ -256,11 +256,11 @@ err_t sys_mbox_new(sys_mbox_t* mbox, int size) } #endif /* SYS_STATS */ if (*mbox < 0) { - lw_print("lw: [%s] alloc %d mbox %p failed\n", __func__, size, mbox); + lw_error("lw: [%s] alloc %d mbox %p failed\n", __func__, size, mbox); return ERR_MEM; } - lw_print("lw: [%s] alloc %d mbox %p ok!\n", __func__, size, mbox); + // lw_print("lw: [%s] alloc %d mbox %p ok!\n", __func__, size, mbox); return ERR_OK; }