Compare commits

..

320 Commits

Author SHA1 Message Date
TXuian 6d465f3a65 Update xishutong-arm32 2023-12-06 16:22:13 +08:00
TXuian 616dc4584f Support double lwip eport, use mongoose.a 2023-12-06 15:59:27 +08:00
IACU 4de08ed386 feat add ethernet mac\W5500\spi for xishutong-arm32 board from Liu_Weichao
it is OK
2023-11-30 11:29:53 +08:00
Liu_Weichao d5da547813 feat add ethernet mac\W5500\spi for xishutong-arm32 board 2023-11-30 11:25:43 +08:00
IACU c55286286e feat support freemobus lib in connection framework from Liu_Weichao
it is OK
2023-11-29 14:40:48 +08:00
Liu_Weichao a7d3e92357 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into connection 2023-11-28 16:55:16 +08:00
IACU c4aaf920cd 1. Self-developed management platform performs ota upgrade 2. Add jerryscript source code 3. Rectify the ota directory from Wang_Guozhu
it is OK
2023-11-28 11:23:20 +08:00
Liu_Weichao 3378579d9e 1、fix uart dev_recv_callback not init error;2、fix app_test compile error. 2023-11-28 11:11:53 +08:00
Liu_Weichao 8a8a513cf1 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into connection 2023-11-28 11:10:45 +08:00
wgzAIIT a92dc71ce4 Modify the header file to include 2023-11-21 08:40:57 +08:00
wgz d0bf9c9564 add Mulan PSL v2 2023-11-20 21:11:55 +08:00
wgzAIIT b2fef14aef Update flash_for_ota.h 2023-11-20 20:23:46 +08:00
wgzAIIT 8c1423f50e modify ota function dir 2023-11-20 17:10:28 +08:00
wgzAIIT 55ce48e0ba Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into develop 2023-11-20 14:36:31 +08:00
IACU f27c6d2091 modify ota dir to fix conflict from Liu_Weichao
it is OK
2023-11-20 13:24:20 +08:00
Liu_Weichao 6d7250d4fd modify ota dir to fix conflict 2023-11-20 13:21:15 +08:00
IACU 52454eec8d feat add xishutong-arm32 board for XiUOS from Liu_Weichao
it is OK
2023-11-20 10:40:06 +08:00
Liu_Weichao 94d3d37a19 feat add 4G function for xishutong-arm32 board 2023-11-20 10:36:47 +08:00
Liu_Weichao 88e8cc4193 modify ota function dir 2023-11-20 10:31:04 +08:00
Liu_Weichao 270d2b9ea3 feat add xishutong-arm32 board for XiZi kernel 2023-11-20 10:22:08 +08:00
wgzAIIT 418bf921c6 chmod +x build.py 2023-11-20 09:42:29 +08:00
wgzAIIT 516b8627f7 add jerryscript source code 2023-11-20 09:05:58 +08:00
wgzAIIT d1d846184b change JerryScript test case 2023-11-20 09:02:11 +08:00
wgzAIIT ba81c73a06 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-11-20 08:31:29 +08:00
IACU 50d8ff5488 feat add Ubiquitous/XiZi_Micro DIR and delete useless yaml files from Liu_Weichao
it is ok
2023-11-17 19:43:27 +08:00
TXuian e0e314e301 Add xishutong-arm32 BSP 2023-11-16 17:07:42 +08:00
Liu_Weichao 98232123e4 support freemodbus RTU master and slave mode 2023-11-16 16:12:29 +08:00
wgzAIIT af33a3289c Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-11-13 15:12:37 +08:00
Liu_Weichao b2ab878a33 Merge branch 'connection' of https://gitlink.org.cn/IACU/xiuos into connection 2023-11-13 11:05:33 +08:00
IACU 3c40a39d15 解决CJson编译及LWIP不能访问外网问题 from Huang_Chen
it is OK
2023-11-09 17:44:58 +08:00
TXuian 0f2e05aed4 Add mongoose 2023-11-09 17:25:03 +08:00
TXuian 71e3c8a654 Add mongoose, add xishutong-arm32. 2023-11-09 17:21:13 +08:00
huang 892bef64e9 解决CJson编译及LWIP不能访问外网问题 2023-11-06 13:59:26 +08:00
Liu_Weichao 79d627a969 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into connection 2023-11-02 15:50:32 +08:00
wgzAIIT b7e405ac94 Update Kconfig 2023-11-02 15:25:36 +08:00
wgzAIIT 9b3f219b01 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-11-02 15:18:23 +08:00
Liu_Weichao d255ffaee5 Merge branch 'master' of https://gitlink.org.cn/IACU/xiuos 2023-11-01 16:45:13 +08:00
IACU ab08ad959c update 2023_open_source_contest pr to prepare_for_master
it is OK
2023-11-01 16:31:52 +08:00
IACU e03b3b390a update prepare_for_master latest commit(5a10e4153c) to 2023_open_source_contest
it is OK
2023-11-01 16:29:47 +08:00
IACU 5a10e4153c feat support SQLite function from Liu_Weichao
it is OK
2023-11-01 16:27:09 +08:00
Liu_Weichao 0aa73a14c2 Merge branch 'prepare_for_master' of https://www.gitlink.org.cn/xuos/xiuos into 2023_open 2023-11-01 16:26:02 +08:00
Liu_Weichao b3f473ec86 Merge branch 'prepare_for_master' of https://www.gitlink.org.cn/xuos/xiuos into 2023_open 2023-11-01 16:22:01 +08:00
Liu_Weichao d35d0bedb2 fix lwip_connect error, enable CHECKSUM_BY_HARDWARE in lwipopts.h 2023-11-01 16:17:50 +08:00
Liu_Weichao 4b579d1c8f feat support SQLite function, need follow README.md, RAM > 512KB, shell task stack > 32KB, TF card mount FATFS 2023-11-01 16:09:52 +08:00
Liu_Weichao dfa6b664ac feat add SQLite, compile OK 2023-10-25 16:07:23 +08:00
IACU eed7d2f37c 2023_open_source_contest_final_1st_issue3 from 华东师范大学_bdislab_final战队_杨龙
it is OK
2023-10-24 09:27:53 +08:00
yanglong 261a2a1653 fix the conflict 2023-10-23 19:50:31 +08:00
IACU ad2dba22c3 2023_open_source_contest_preliminary_1st_issue3 from 东华大学_第二乐章战队_方源
it is OK
2023-10-23 15:56:32 +08:00
ambrumf 6a2e18806a bugfix 2023-10-23 15:49:50 +08:00
Ambrumf eca32c203b bugfix 2023-10-23 15:29:03 +08:00
ambrumf c3e686c50b bugfix 2023-10-23 15:26:41 +08:00
ambrumf ab77fe8a09 update ftpclient 2023-10-23 15:06:13 +08:00
IACU a883474327 2023_open_source_contest_preliminary_1st_issue2 from Huang_Chen
it is OK
2023-10-23 14:20:51 +08:00
IACU 77b6b8cb97 2023_open_source_contest_preliminary_1st_issue1 from 上海大学_每天学习战队_姚文莹
it is OK
2023-10-23 14:20:25 +08:00
IACU 91ee0f7b28 2023_open_source_contest_final_2st_issue1 from 西北工业大学_天仙永昌战队_楚云飞
it is OK
2023-10-23 14:18:16 +08:00
IACU c7bbf2935f 2023_open_source_contest_preliminary_2st_issue1 from 西北工业大学_天仙永昌战队_楚云飞
it is OK
2023-10-23 13:57:15 +08:00
IACU 21785c37ee 2023_open_source_contest_preliminary_1st_issue3 from 华东师范大学_bdislab_final战队_杨龙
it is OK
2023-10-23 13:56:24 +08:00
Liu_Weichao 6db0eccbe5 feat add Ubiquitous/XiZi_Micro DIR and delete useless yaml files 2023-10-13 13:54:23 +08:00
wgzAIIT e90c465a23 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-10-13 09:39:45 +08:00
Liu_Weichao 719b02a3e7 feat support freemodbus from [https://github.com/RT-Thread-packages/freemodbus/tree/master:a7a61d5], compile OK 2023-10-12 20:04:13 +08:00
IACU 0705bdaf1a fix create event bug and add dev_recv_callback for uart in APP_Framework from Liu_Weichao
it is OK
2023-10-12 20:01:46 +08:00
Liu_Weichao 2b44a0c6fb feat add dev_recv_callback for uart in APP_Framework 2023-10-12 19:58:24 +08:00
Liu_Weichao d4b47088d2 update lorawan submodule, fix create event bug 2023-10-12 19:56:32 +08:00
wgz-code c96376ea25 Merge branch 'xidatong-arm32' into jerryscript 2023-10-12 14:30:03 +08:00
wgz-code 37764d4501 delete unused files 2023-10-12 14:19:27 +08:00
wgzAIIT 267707c920 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-10-12 10:34:03 +08:00
wgzAIIT 29b15812b7 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-10-12 10:30:30 +08:00
IACU dc25947261 feat support cortex-m7-emulator for XiZi from Huang_Chen
it is OK
2023-10-12 09:38:48 +08:00
yanglong c508c2d43b add print file content function 2023-10-11 21:29:10 +08:00
huang 1cf3baeb2e delete clock 2023-10-11 17:57:09 +08:00
huang 24023fd343 modify description 2023-10-11 17:51:27 +08:00
wgzAIIT 7885326768 Merge branch 'xidatong-arm32' into jerryscript 2023-10-11 17:36:19 +08:00
huang 341cfd34bd modify location 2023-10-11 17:34:24 +08:00
huang 196a8e001a add some files 2023-10-11 17:30:56 +08:00
wgzAIIT 966ccb5030 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-10-11 17:27:41 +08:00
huang 3fe9cf3d91 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 2023-10-11 17:23:02 +08:00
huang 3f1be486cf remove aiot 2023-10-11 17:20:52 +08:00
wgzAIIT 53fc43e077 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-10-11 17:15:12 +08:00
IACU f82f41ade7 update gitmodules url for lorawan from Liu_Weichao
it is OK
2023-10-11 17:10:44 +08:00
huang c17c899ea7 add m7 readme 2023-10-11 17:08:19 +08:00
Liu_Weichao 648aaaae90 update gitsubmodules commit for lorawan 2023-10-11 17:07:00 +08:00
wgzAIIT fa439abd68 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-10-11 17:03:32 +08:00
Liu_Weichao dd4cfd93c6 update gitmodules url for lorawan 2023-10-11 16:55:42 +08:00
wgzAIIT 4f4bbc1d68 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-10-11 16:51:55 +08:00
huang 699c04e94d Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 2023-10-11 16:48:47 +08:00
IACU 1e651e74b4 feat support lorawan end-device stack and fix some bugs from Liu_Weichao
it is OK
2023-10-11 16:26:13 +08:00
Liu_Weichao bc8b003c1e update lorawan function, support lorawan-ed-device connect chirpstack through lorawan-gateway-Ebyte-E890 2023-10-11 16:08:23 +08:00
yanglong 56216a530d Optimization server algorithm and add a test 2023-10-11 13:17:06 +08:00
Liu_Weichao f962cf6919 fix timer bug in posix_support for XiZi kernel 2023-10-11 09:34:14 +08:00
Liu_Weichao ca0ef77764 fix timer callback bug 2023-10-10 13:23:05 +08:00
Ambrumf 7f14d047cb update TestFtp 2023-10-09 21:13:11 +08:00
Ambrumf b8335863ba create branch 2023-10-09 20:41:09 +08:00
yanglong 5039ebc85f add ftp_server code 2023-10-08 18:53:59 +08:00
安果尤拉 03751e3d1e update copyright 2023-10-07 02:31:50 -07:00
yanglong 380aa361fe add reference 2023-10-07 17:01:28 +08:00
yanglong ff720789ab fix merge conflict 2023-10-07 16:47:02 +08:00
wgzAIIT 8c86c3c574 Merge remote-tracking branch 'origin/xidatong-arm32' into jerryscript 2023-10-07 15:06:04 +08:00
huang 30b98101ec readme modify 2023-10-07 15:01:05 +08:00
huang e07d4e2711 调整格式 2023-10-07 14:59:41 +08:00
wgzAIIT dbfa37bf44 add ota error_message for platform 2023-10-07 14:57:40 +08:00
wgzAIIT 29853ef76d Merge branch 'xidatong-arm32' into jerryscript 2023-10-07 10:34:44 +08:00
wgzAIIT 5b62808e28 add ota error_message for platform 2023-10-07 10:05:46 +08:00
安果尤拉 f85dfb3ccf delete p2p 2023-10-03 06:32:56 -07:00
chuyunfei 499047e31b Update README.md 2023-10-03 21:25:42 +08:00
安果尤拉 11ae2bd7da upload code 2023-10-03 06:19:24 -07:00
Yao15921243763 bf505768e8 test webserver 2023-09-30 23:16:14 +08:00
Yao15921243763 0f77f4e86b Merge branch '2023_open_source_contest' of https://gitlink.org.cn/xuos/xiuos into 2023_open_source_contest 2023-09-28 15:40:54 +08:00
Yao15921243763 682460747b test LwipSetIP 2023-09-28 15:40:25 +08:00
Liu_Weichao 58fe8fc887 feat support set task name using PrivTaskCreate in XiZi 2023-09-27 17:05:27 +08:00
huang cf565f5d69 transport modify 2023-09-27 16:24:11 +08:00
huang 40cedd339c add license 2023-09-27 16:21:43 +08:00
huang 6c40800dfe delete cjson process 2023-09-27 16:04:55 +08:00
huang cc4106dd11 imx6q dts 2023-09-27 15:58:37 +08:00
huang e055ffdc2c modify microkernel 2023-09-27 15:54:00 +08:00
huang 014e51c0ad mmodify the liscence 2023-09-27 15:47:47 +08:00
wgzAIIT 4d3858bf8f Fix jerryscript compilation error 2023-09-27 14:30:34 +08:00
huang 339ea93b09 delete no need 2023-09-27 14:21:14 +08:00
Liu_Weichao 6228e76194 1、add ch32v307 riscv support in Makefile;2、fix lock uninitialized error in dev_serial. 2023-09-27 14:13:37 +08:00
huang 5a02b89ffc delete mqtt 2023-09-27 14:13:10 +08:00
huang 274759aafb Merge branch '2023_open_source_contest' of https://gitlink.org.cn/hc0014/xiuos into 2023_open_source_contest 2023-09-27 14:02:20 +08:00
wgzAIIT 987622d1e3 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-09-26 17:08:55 +08:00
wgzAIIT a473111e5d Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-09-26 17:05:26 +08:00
wgzAIIT 3437bfdc19 Merge pull request 'merge code' (#63) from xidatong-arm32 into jerryscript 2023-09-26 17:03:15 +08:00
IACU cb785cf8a1 Fix Task priority bug, rename some wrong variables from Tu_Yuyang
it is ok
2023-09-26 17:01:39 +08:00
wgzAIIT 98587d876d Optimize ota progress display 2023-09-26 16:06:51 +08:00
huang d50d16bc86 Merge branch 'prepare_for_master' of https://gitlink.org.cn/hc0014/xiuos into prepare_for_master 2023-09-26 10:35:53 +08:00
huang e745fc9129 aiot cache codes 2023-09-26 10:33:24 +08:00
huang d884774bca contest final 2023-09-26 10:20:29 +08:00
huang 085c418faa contest chusai 2023-09-26 10:17:33 +08:00
wgzAIIT 6bbf1e2c4c Merge pull request 'merge code' (#61) from xidatong-arm32 into jerryscript 2023-09-25 09:18:26 +08:00
wgzAIIT c2abf66f23 OTA prints prompt message when upgrade is not required 2023-09-22 15:04:10 +08:00
wgzAIIT d14272c55f Merge remote-tracking branch 'origin/xidatong-arm32' into jerryscript 2023-09-21 13:45:21 +08:00
wgzAIIT aa3e6c9370 1、Optimize mqtt transfer speed 3k/s
2、add json file to sd card by mqtt
3、check the sd card is mounted successfully
2023-09-21 13:40:19 +08:00
wgzAIIT f7d0b0925c Merge pull request 'merge code' (#59) from xidatong-arm32 into jerryscript 2023-09-21 11:13:15 +08:00
wgzAIIT b41a1709c6 json file download needs to check whether the sd card is mounted successfully 2023-09-21 11:10:36 +08:00
TXuian 159159ecde Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into wiz_lwip 2023-09-21 10:34:11 +08:00
TXuian b82a86d5c0 Fix Task priority bug, rename some wrong variables 2023-09-21 10:32:14 +08:00
wgzAIIT 0b1489cfed Merge pull request 'merge code' (#56) from xidatong-arm32 into jerryscript 2023-09-20 16:11:36 +08:00
wgzAIIT 9fd61d3d2a 1、Optimize mqtt transfer speed 3k/s
2、add json file to sd card by mqtt
2023-09-20 14:37:42 +08:00
wgzAIIT 60a7835ef8 Modify the return value of the mqtt function 2023-09-19 09:22:26 +08:00
wgzAIIT 5ef61d14b1 1、Verify file size before ota file transfer
2、update MQTT connection parameter configuration
2023-09-18 18:28:01 +08:00
yanglong c326f7189e add concurrent upload function 2023-09-17 17:04:59 +08:00
yanglong 6bc375c316 add ftpclient final 2023-09-17 15:35:13 +08:00
wgzAIIT 474557a5ac 1、Optimize ota Bootloader function
2、add reboot after flash copy
2023-09-14 16:07:16 +08:00
wgzAIIT 0a76e9c583 update JerryScript README.md 2023-09-12 16:46:24 +08:00
wgzAIIT e61ffc4589 Optimize ota transfer function 2023-09-12 09:32:14 +08:00
huang 4d2e4498cc Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 2023-09-11 11:19:52 +08:00
wgzAIIT e8061577da Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into jerryscript 2023-09-11 10:12:03 +08:00
wgzAIIT 652e5789a7 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into xidatong-arm32 2023-09-11 10:05:37 +08:00
IACU 83681208ec ota project related from Wang_guozhu
it is OK
2023-09-11 10:04:00 +08:00
IACU fb368d24a9 Support lwip with w5500 from Tu_Yuyang 2023-09-11 10:00:18 +08:00
wgzAIIT 5da9a9c4ae 1、Optimize transmission string matching rules
2、change Kconfig for mqtt and ota
2023-09-08 17:32:43 +08:00
wgzAIIT 117789121e Optimize ota transfer function 2023-09-08 10:08:26 +08:00
wgzAIIT bad8dc0fc2 1、add support xiuos platform for ota
2、change Kconfig for mqtt and Modify variable name
3、change ota functions for support xiuos platform
2023-09-07 16:53:20 +08:00
涂煜洋 aefe92d67d Fix multicore byte_manager illegal parallel execution, fix w5500 pbuf creation failed checking. 2023-09-07 09:30:37 +08:00
涂煜洋 efba3f3bf3 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 2023-09-06 11:20:46 +08:00
涂煜洋 31b939fbb8 Fit w5500 to lwip, fix some unintialized params and printf warning. 2023-09-06 11:12:42 +08:00
wgzAIIT f24a0f2d47 change Kconfig for JerryScript 2023-09-05 15:23:21 +08:00
IACU a1df906d16 2023_open_source_contest_warmup_2nd_issue1 from 好果汁有限公司
it is OK
2023-09-01 11:03:57 +08:00
IACU 74c04f2dbd Fix radix tree test from Zhao_Jiasheng
it is OK
2023-09-01 11:01:21 +08:00
chuyunfei 2615c5aab3 Update README.md 2023-08-31 11:33:26 +08:00
chuyunfei 8c601b031a Added data frame parsing 2023-08-30 20:06:31 -07:00
wgzAIIT e33bd9dd78 Merge branch 'mqtt' into xidatong-arm32 2023-08-30 10:03:03 +08:00
wgzAIIT 488419a6d0 update MQTT connection parameter configuration 2023-08-30 09:51:22 +08:00
wgzAIIT 3427b3629d Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into xidatong-arm32 2023-08-29 11:02:44 +08:00
wgzAIIT fd608d8e81 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-08-29 11:02:27 +08:00
wgzAIIT 29499a1ec3 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into jerryscript 2023-08-29 11:01:41 +08:00
IACU 3fc12f67b9 add plc data store function for control framework from Liu_Weichao
it is OK
2023-08-28 16:17:42 +08:00
Liu_Weichao 5bb0f2aaf5 add plc data store function for control framework 2023-08-28 16:15:32 +08:00
wgzAIIT 2ae328c773 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into jerryscript 2023-08-28 08:41:32 +08:00
wgzAIIT 570e4a029c Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into xidatong-arm32 2023-08-28 08:40:55 +08:00
wgzAIIT 610810da32 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-08-28 08:40:28 +08:00
IACU e2c32e9e72 fix adapter_lora and lwip_tcp_demo bug from Liu_Weichao
it is OK
2023-08-25 15:31:08 +08:00
Liu_Weichao 4b75e1283a Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into micro_kernel 2023-08-25 15:27:56 +08:00
IACU ff9a1645bd it is OK 2023-08-25 15:20:22 +08:00
涂煜洋 8b32c2f4ed Trying to support lwip with w5500. 2023-08-25 13:43:11 +08:00
Liu_Weichao 0278d54a24 fix lwip_tcp_demo lwip init bug 2023-08-25 09:25:56 +08:00
Liu_Weichao 1c775d42f6 fix adapter lora bug on edu-arm32 board 2023-08-24 14:38:24 +08:00
wgzAIIT b41748dfb6 Merge pull request 'merge code' (#47) from mqtt into xidatong-arm32 2023-08-24 10:21:40 +08:00
wgzAIIT 1f21fc15b2 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into mqtt 2023-08-24 10:17:32 +08:00
wgzAIIT 23b938f242 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-08-24 10:16:43 +08:00
wgzAIIT 355e717cb8 Fix tests for edu-riscv64 textbook and edu-arm32 textbook 2023-08-23 20:24:41 +08:00
JasenChao deb1f63d9e Merge branch '2023_open_source_contest' of https://gitlink.org.cn/JasenChao/xiuos into 2023_open_source_contest 2023-08-23 18:34:47 +08:00
JasenChao 68b7484fc5 Merge branch '2023_open_source_contest' of https://gitlink.org.cn/xuos/xiuos into 2023_open_source_contest 2023-08-23 18:33:53 +08:00
IACU a5a809aa0a Fix tests for edu-riscv64 textbook from Jiang_Yufan
it is OK
2023-08-23 17:59:50 +08:00
Jiang Yufan a289c0d653 Fix: test_app makefile update 2023-08-23 14:19:25 +08:00
Jiang Yufan 0f32060aea Fix: mergebin.py generate .bin file according to board 2023-08-23 13:53:04 +08:00
Jiang Yufan f4c9edd070 Fix: LVGL file rename 2023-08-23 13:51:48 +08:00
Jiang Yufan f848f36efb Fix: LVGL file rename 2023-08-23 10:44:46 +08:00
chuyunfei 202a43cbcb update some code 2023-08-22 19:10:57 -07:00
Jiang Yufan 4c9cc39801 BMP180 sensor test update 2023-08-22 14:48:39 +08:00
Jiang Yufan 48c40541f9 I2C driver update 2023-08-22 14:47:48 +08:00
Jiang Yufan cdb2be7ca4 I2C test update 2023-08-22 14:33:27 +08:00
Jiang Yufan feb0d29fc9 RS485 test update 2023-08-22 14:27:02 +08:00
Jiang Yufan aef55df1dc Face recognition kconfig update 2023-08-22 14:11:48 +08:00
Jiang Yufan fdc1783300 Task isolation test update 2023-08-22 14:10:43 +08:00
Jiang Yufan 379045d7eb WDT test update 2023-08-22 14:06:06 +08:00
Jiang Yufan 7447152767 Tensorflow test update 2023-08-22 14:05:10 +08:00
Jiang Yufan df7de36516 HardwareTimer Kconfig update 2023-08-22 14:03:59 +08:00
Jiang Yufan 3ba4aa845f HardwareTimer test update 2023-08-22 14:02:39 +08:00
Jiang Yufan a7d6f8215e HS300X app update 2023-08-22 14:00:05 +08:00
Jiang Yufan fbeb75d1f1 LVGL demo update 2023-08-22 13:56:41 +08:00
chuyunfei a6f1215923 add func header 2023-08-21 22:55:07 -07:00
chuyunfei a274a809cc add copyright 2023-08-21 22:51:26 -07:00
yanglong 51a5fa5563 add ftp client 2023-08-22 11:04:21 +08:00
chuyunfei 859184945f test lora p2p 2023-08-21 19:49:08 -07:00
wgzAIIT 55d63408fe Merge pull request 'merge code' (#46) from mqtt into xidatong-arm32 2023-08-17 20:20:26 +08:00
wgzAIIT 9e031ecee0 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript 2023-08-17 19:15:34 +08:00
wgzAIIT d4b7fd6ba5 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-08-17 19:15:09 +08:00
wgzAIIT 1eb783cc18 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into mqtt 2023-08-17 19:12:40 +08:00
IACU 7d3d4651d3 update prepare_for_master latest commit(90b7740ca0) to 2023_open_source_contest from Liu_Weichao
it is OK
2023-08-17 15:09:30 +08:00
IACU 90b7740ca0 feat add RS485 using usart4 for edu_arm32 board and fix test_rs485 error from Liu_Weichao
it is OK
2023-08-17 15:08:07 +08:00
Liu_Weichao 7077cf74c2 feat add RS485 using usart4 for edu_arm32 board and fix test_rs485 error 2023-08-17 15:04:48 +08:00
Liu_Weichao d73470de3c Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into micro_kernel 2023-08-15 15:53:44 +08:00
wgzAIIT 34e855a3a9 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into mqtt 2023-08-11 11:17:10 +08:00
IACU dd383ef424 Add app test and command line tool from Tu_Yuyang
it is OK
2023-08-11 11:06:42 +08:00
涂煜洋 3896242622 23/08/11 Add app test_uart. 2023-08-11 11:03:10 +08:00
涂煜洋 167bc3c047 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into cmdline 2023-08-11 10:11:36 +08:00
涂煜洋 dd35692866 23/08/11 Fix app test socket 2023-08-11 10:07:31 +08:00
涂煜洋 586ceba08e 23/08/11 Fix app test socket 2023-08-11 10:02:51 +08:00
涂煜洋 a9ebe1e96d 23/08/11 Add app test socket; Fix app test i2c; Add command line argument parse tool argparse; Increase lwip related threads' priority. 2023-08-11 10:01:08 +08:00
huang 6d9b66f05f Merge branch '2023_open_source_contest' into prepare_for_master 2023-08-10 16:47:21 +08:00
IACU d1a198a4bc Fix edu-arm32 i2c from Tu_Yuyang
it is OK
2023-08-09 17:36:02 +08:00
涂煜洋 0e82fac640 Fix edu-arm32 i2c. 2023-08-09 17:31:06 +08:00
涂煜洋 bcf75bd62f Merge branch 'prepare_for_master' of https://gitlink.org.cn/tuyuyang/xiuos into HEAD 2023-08-09 16:35:26 +08:00
涂煜洋 379cd567a2 Fix edu-arm32 i2c. 2023-08-09 16:33:17 +08:00
wgzAIIT 74b31a5420 add JerryScript test file and update README.md 2023-08-09 15:21:18 +08:00
IACU 8becc52a90 fix adc/dac funciton error on edu-arm32 baord from Liu_Weichao
it is OK
2023-08-09 15:12:13 +08:00
Liu_Weichao 5f642507b4 fix adc/dac funciton error on edu-arm32 baord 2023-08-09 15:10:11 +08:00
wgzAIIT a868ed3238 Merge pull request 'merge code' (#43) from mqtt into xidatong-arm32 2023-08-09 12:19:03 +08:00
wgzAIIT 544b0bcba4 Merge pull request 'merge code' (#40) from prepare_for_master into jerryscript 2023-08-09 12:16:28 +08:00
wgzAIIT 20113601e7 Merge pull request 'merge code' (#41) from prepare_for_master into xidatong-arm32 2023-08-09 12:16:22 +08:00
wgzAIIT ed67ff5c62 Merge pull request 'merge code' (#42) from prepare_for_master into mqtt 2023-08-09 12:16:16 +08:00
xxq250 8c1ad40f81 Update README.md 2023-08-09 11:13:42 +08:00
xxq250 5510123098 更新 'Ubiquitous/XiZi_IIoT/board/cortex-m4-emulator/README.md' 2023-08-09 11:09:53 +08:00
xxq250 d6e7637128 更新 'Ubiquitous/XiZi_IIoT/board/cortex-m4-emulator/README.md' 2023-08-09 11:09:00 +08:00
xxq250 6a2a006a3f revert 87a57d0db0
revert Delete 'Ubiquitous/XiZi_IIoT/board/cortex-m4-emulator/README.md'
2023-08-09 11:03:52 +08:00
chenyh 87a57d0db0 Delete 'Ubiquitous/XiZi_IIoT/board/cortex-m4-emulator/README.md' 2023-08-09 10:59:04 +08:00
wgzAIIT fb458fe6cd git submodule add jerryscript base tag v2.4.0 2023-08-09 10:50:41 +08:00
wgzAIIT bb0fb51e7e support jerryscript on edu-arm32 board and add test case 2023-08-09 10:29:03 +08:00
wgzAIIT 7ce3748947 add JerryScript test case 2023-08-08 15:10:21 +08:00
wgzAIIT fa2c91e690 1、git submodule add jerryscript v2.4.0
2、support JerryScript on XiZi for stm32f407-st-discovery board and cortex-m4-emulator
2023-08-08 15:02:48 +08:00
wgzAIIT e2edd918c3 Merge pull request 'merge code' (#37) from mqtt into xidatong-arm32 2023-08-08 14:26:42 +08:00
IACU da7220a60c update prepare_for_master latest commit(3acc7e431f) to 2023_open_source_contest from Liu_Weichao
it is OK
2023-08-08 11:17:32 +08:00
IACU 3acc7e431f Fix UDPSend Bug from Tu_Yuyang
it is OK
2023-08-08 11:16:20 +08:00
涂煜洋 a51ef1c41f Fix edu-arm32 UDPSend bug. 2023-08-08 11:06:34 +08:00
wgzAIIT 91ddfea1ed Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into xidatong-arm32 2023-08-08 08:57:35 +08:00
wgzAIIT e29eb633ca Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-08-08 08:56:51 +08:00
IACU 63b02913e4 update prepare_for_master latest commit(ec318c603a) to 2023_open_source_contest from Liu_Weichao
it is OK
2023-08-07 19:58:47 +08:00
IACU ec318c603a fix lwip tcp/udp demo、test_i2c、usb irqhandle error from Liu_Weichao
it is OK
2023-08-07 19:55:30 +08:00
huang 53619b9b99 simplify codes 2023-08-07 17:43:40 +08:00
Liu_Weichao ec7d9f1fcd 1、fix lwip_tcp_demo and lwip_udp_demo error;2、add license for ethernet/netdev;3、add netdev for xiwangtong、ok1052、imxrt1176 board。 2023-08-07 14:48:37 +08:00
huang b481abd4eb cortex m7 emulator 2023-08-07 09:41:15 +08:00
Liu_Weichao aa6fb2a8b0 fix test_i2c WriteReg coredump error 2023-08-04 10:39:11 +08:00
Liu_Weichao 3c1129d88a fix edu-arm32 board USB IRQ configure error 2023-08-04 10:14:23 +08:00
Liu_Weichao 27734606f5 Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into lorawan_develop 2023-08-04 10:06:26 +08:00
IACU 62eda1e3fa Net(Webnet and Lwip) and memory related updates from Tu_Yuyang
it is OK
2023-08-04 10:02:57 +08:00
涂煜洋 e9b4a0de6c 23/08/03 Fix former commit errors 2023-08-03 20:08:01 +08:00
涂煜洋 219575898a 23/08/03 Add Netdev to xidatong-arm32 2023-08-03 20:08:01 +08:00
涂煜洋 06b9d67f2d Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into prepare_for_master 2023-08-03 19:02:47 +08:00
涂煜洋 ee10eccb26 23/08/02 1.Fix ByteManager Bug; 2.Move net delay to webnet(wn_session.h) so it wont affect other net functions. 2023-08-03 19:01:42 +08:00
涂煜洋 fce13fe874 23/08/02 1.Fix ByteManager Bug; 2.Move net delay to webnet(wn_session.h) so it wont affect other net functions. 2023-08-03 19:01:39 +08:00
IACU fc4411dad4 feat add app_test DIR for 2023_open_source_contest from Liu_Weichao
it is OK
2023-08-03 19:01:15 +08:00
Gitlinkiacu2016 a25eccfac8 feat add app_test DIR for 2023_open_source_contest 2023-08-03 19:00:44 +08:00
涂煜洋 0307fb2671 23/07/27 1.Add netdev module and for edu-arm32, fit Lwip to it; 2.Fit Webnet to edu-arm32; 2023-08-03 18:53:16 +08:00
JasenChao b04544f842 Fix conflict 2023-08-03 15:41:35 +08:00
Liu_Weichao 3efe663ee0 update lorawan submodule commit 2023-08-03 15:40:11 +08:00
JasenChao 8effd59528 Fix test 2023-08-02 21:13:41 +08:00
JasenChao c56298fa99 Further completion 2023-08-02 19:09:46 +08:00
kkk 2df7b63f03 仓库同步修改 2023-07-31 12:51:36 +08:00
kkk 9c0eced907 Merge remote-tracking branch 'upstream/2023_open_source_contest' into 2023_open_source_contest_warmup_2nd_issue1 2023-07-31 11:46:12 +08:00
wgzAIIT 21ca38158e Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-07-28 09:09:57 +08:00
wgzAIIT 2e4eb538b9 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into xidatong-arm32 2023-07-28 09:09:04 +08:00
IACU 20ffe20c36 Merge pull request 'feat add app_test DIR for 2023_open_source_contest' (#344) from prepare_for_master into 2023_open_source_contest 2023-07-27 15:24:02 +08:00
wgzAIIT 4d56788af3 Merge branch 'mqtt' into xidatong-arm32 2023-07-27 11:06:05 +08:00
wgzAIIT 02089a48ee move mqtt to APP_Framework/lib dir for ota 2023-07-27 11:01:10 +08:00
wgzAIIT 6559210341 Merge pull request 'merge code' (#32) from prepare_for_master into mqtt 2023-07-27 10:48:29 +08:00
wgzAIIT 0f5546a679 Merge pull request 'merge code' (#33) from prepare_for_master into xidatong-arm32 2023-07-27 10:48:21 +08:00
IACU 8010ba6a36 feat update 2023_open_source_contest latest commit from prepare_for_master from Liu_Weichao
it is OK
2023-07-27 10:40:46 +08:00
wgzAIIT 69d86ef4e4 Merge pull request 'merge code' (#29) from prepare_for_master into mqtt 2023-07-27 09:16:57 +08:00
wgzAIIT b580f6b377 Merge pull request 'merge code' (#30) from prepare_for_master into xidatong-arm32 2023-07-27 09:16:48 +08:00
huang b0eabde4f6 modify features 2023-07-26 11:31:29 +08:00
huang d8265d3579 Merge branch '2023_open_source_contest' of https://gitlink.org.cn/xuos/xiuos into pr2 2023-07-26 10:44:04 +08:00
pgh_dd 10482724a9 "添加资源文件" 2023-07-25 22:10:16 +08:00
pgh_dd b779734061 "modbustcp_20230725" 2023-07-25 20:02:06 +08:00
wgzAIIT 7740e3c5ef change CONNECTION_FRAMEWORK_DEBUG default n 2023-07-21 09:29:15 +08:00
wgzAIIT 8bd8187e82 Merge pull request 'merge code' (#27) from prepare_for_master into mqtt 2023-07-20 17:29:38 +08:00
wgzAIIT 5baf461e48 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-07-20 16:30:51 +08:00
wgzAIIT 24fcbb54e8 Merge branch 'prepare_for_master' of https://git.trustie.net/xuos/xiuos into mqtt 2023-07-19 13:49:03 +08:00
wgzAIIT b9e5e97741 The password for logging in to the mqtt server is generated using a function 2023-07-19 11:04:05 +08:00
huang 5869154cca delete online 2023-07-17 14:23:08 +08:00
huang d33184cbd9 Merge branch 'lwip' of https://gitlink.org.cn/tuyuyang/xiuos into 2023_open_source_contest 2023-07-17 13:43:19 +08:00
huang c06138364f mqtt update 2023-07-13 10:56:50 +08:00
huang 455fd31c7f mqtt update 2023-07-13 10:56:20 +08:00
wgzAIIT 3c179e7879 1、add MQTT connection parameter configuration by Kconfig
2、Send a heartbeat packet every 1 minute during idle time to keep alive
2023-06-28 14:54:20 +08:00
wgzAIIT 5900b504e3 1、improving MQTT transmission speed 2K Bytes per package
2、rename mqtt file name
2023-06-26 15:23:13 +08:00
wgzAIIT 6f3d3b8862 improving MQTT transmission speed 2023-06-21 14:00:09 +08:00
wgzAIIT 87921c4212 Support OTA upgrade by MQTT 2023-06-20 15:49:07 +08:00
wgzAIIT dd43dd6d17 Optimize ota function:changge ota version type 2023-06-16 17:40:00 +08:00
wgzAIIT 555b014bc9 Optimize mqtt function add MQTT_PublishDataQs1 function 2023-06-16 11:12:25 +08:00
wgzAIIT 9995980a1a 1.fix AT cmd framework bug
2.add mqtt support in the tool directory
2023-06-15 16:52:52 +08:00
wgzAIIT ed1c5eea1f Optimize ota function 2023-06-15 16:43:02 +08:00
wgzAIIT 26f74120db Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-06-14 13:36:24 +08:00
wgzAIIT fb9250181f 1、Increase the size of the EntmSend function send_buff
2、Optimize ota.c、ota.h and server_tcp.c files
2023-06-13 17:08:42 +08:00
wgzAIIT dcea61d5e0 Merge pull request 'merge code' (#16) from prepare_for_master into xidatong-arm32 2023-06-06 10:23:14 +08:00
wgzAIIT e9b538c2dc Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into xidatong-arm32 2023-06-06 10:08:20 +08:00
wgzAIIT 5a1fe0be3b 1、Optimize the tcp server file reading operation during the OTA process
2、Optimize the ota.c file

3、revert dev_serial.c
2023-06-06 10:07:00 +08:00
wgzAIIT e48bd6fd67 1、OTA supports 4g retransmission after file sending failure
2、Optimize the startup process of OTA
2023-06-02 17:07:56 +08:00
wgzAIIT f2b64e4306 fix OTA upgrade through 4G 2023-06-01 18:32:37 +08:00
wgzAIIT 8ecb3a8804 OTA upgrade through 4G is successful 2023-06-01 11:14:24 +08:00
wgzAIIT 5faa3e7b5a Optimize functions related to flash operation 2023-06-01 11:10:23 +08:00
wgzAIIT 938d46d5d9 Modify the tcp server to send 1024 bytes each time 2023-05-31 16:28:08 +08:00
wgzAIIT c6af847c73 Improve the speed of 4G transmission bin package 2023-05-30 20:11:43 +08:00
wgzAIIT 788eb53f39 discard invalid data frames 2023-05-29 19:47:06 +08:00
wgzAIIT 7ba883affe modify data length for 4g translation 2023-05-29 19:43:59 +08:00
Liu_Weichao 3463c8515f feat add abstruction_mmu for XiZi_AIoT(support MmuInit\MmuSectionMap\MmuSectionUnmap\MmuTtbSwitch\MmuTransform) 2023-05-29 16:58:22 +08:00
wgzAIIT f59139f78e send bin file by 4g 2023-05-26 11:23:12 +08:00
wgzAIIT c7ac5681e4 Merge pull request 'merge code' (#14) from develop into xidatong-arm32 2023-05-23 19:13:39 +08:00
wgzAIIT a056aea50e Merge pull request 'merge code' (#13) from develop into xidatong-arm32 2023-05-22 10:17:40 +08:00
xxq250 3d5ca66e7a Update .gitmodules subdomain 2023-05-20 12:46:01 +08:00
2965 changed files with 703408 additions and 6153 deletions

6
.gitmodules vendored
View File

@ -24,11 +24,11 @@
url = https://www.gitlink.org.cn/chunyexixiaoyu/kendryte-sdk-source.git
[submodule "APP_Framework/lib/lorawan/lora_radio_driver"]
path = APP_Framework/lib/lorawan/lora_radio_driver
url = https://gitlink.org.cn/IACU/lora_radio_driver.git
url = https://gitlink.org.cn/xuos/lora_radio_driver
[submodule "APP_Framework/lib/lorawan/lorawan_devicenode"]
path = APP_Framework/lib/lorawan/lorawan_devicenode
url = https://gitlink.org.cn/IACU/lorawan_devicenode.git
url = https://gitlink.org.cn/xuos/lorawan_devicenode.git
branch = master
[submodule "APP_Framework/lib/lorawan/lorawan_gateway_single_channel"]
path = APP_Framework/lib/lorawan/lorawan_gateway_single_channel
url = https://gitlink.org.cn/IACU/lorawan_gateway_single_channel.git
url = https://gitlink.org.cn/xuos/lorawan_gateway_single_channel.git

View File

@ -20,4 +20,5 @@ menu "Applications"
source "$APP_DIR/Applications/sensor_app/Kconfig"
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
source "$APP_DIR/Applications/webnet/Kconfig"
source "$APP_DIR/Applications/mongoose/Kconfig"
endmenu

View File

@ -36,5 +36,13 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
SRC_DIR += control_app
endif
ifeq ($(CONFIG_APP_USING_WEBNET),y)
SRC_DIR += webnet
endif
ifeq ($(CONFIG_USE_MONGOOSE),y)
SRC_DIR += mongoose
endif
include $(KERNEL_ROOT)/compiler.mk
endif

View File

@ -72,6 +72,24 @@ menu "test app"
endif
endif
menuconfig USER_TEST_SOCKET
select BSP_USING_LWIP
bool "Config test socket(lwip)"
default n
menuconfig USER_TEST_UART
select BSP_USING_UART
select BSP_USING_UART6
bool "Config test uart"
default n
if USER_TEST_UART
if ADD_XIZI_FEATURES
config UART_DEV_DRIVER
string "Set uart dev path"
default "/dev/usart6_dev6"
endif
endif
menuconfig USER_TEST_RS485
select BSP_USING_UART
select BSP_USING_GPIO
@ -252,6 +270,10 @@ menu "test app"
bool "Config test red black tree"
default n
menuconfig USER_TEST_MODBUS_TCP
bool "Config test modbus_tcp"
default n
menuconfig USER_TEST_WEBSERVER
bool "Config test webserver"
default n
@ -259,11 +281,16 @@ menu "test app"
menuconfig USER_TEST_MQTTCLIENT
bool "Config test mqtt client"
default n
select LIB_USING_CJSON
menuconfig USER_TEST_FTPCLIENT
bool "Config test ftp client"
default n
menuconfig USER_TEST_FTPCLIENT_RISCV
bool "Config test ftp client on riscv"
default n
menuconfig USER_TEST_LORA_P2P
bool "Config test lora p2p"
default n

View File

@ -24,7 +24,7 @@ endif
ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
SRC_FILES := test_shell.c
ifeq ($(CONFIG_USER_TEST_ADC),y)
SRC_FILES += test_adc.c
endif
@ -46,7 +46,16 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
endif
ifeq ($(CONFIG_USER_TEST_I2C),y)
SRC_FILES += test_i2c.c
ifeq ($(CONFIG_BOARD_EDU_RISCV64_EVB),y)
SRC_FILES += test_i2c_riscv.c
endif
ifeq ($(CONFIG_BOARD_EDU_ARM32_EVB),y)
SRC_FILES += test_i2c_arm.c
endif
endif
ifeq ($(CONFIG_USER_TEST_UART),y)
SRC_FILES += test_uart.c
endif
ifeq ($(CONFIG_USER_TEST_GPIO),y)
@ -62,7 +71,12 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
endif
ifeq ($(CONFIG_USER_TEST_RS485),y)
SRC_FILES += test_rs485.c
ifeq ($(CONFIG_BOARD_EDU_RISCV64_EVB),y)
SRC_FILES += test_rs485_riscv.c
endif
ifeq ($(CONFIG_BOARD_EDU_ARM32_EVB),y)
SRC_FILES += test_rs485_arm.c
endif
endif
ifeq ($(CONFIG_USER_TEST_HWTIMER),y)
@ -111,18 +125,34 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
ifeq ($(CONFIG_USER_TEST_RBTREE),y)
SRC_FILES += test_rbtree/test_rbtree.c
endif
ifeq ($(CONFIG_USER_TEST_SOCKET),y)
SRC_FILES += test_socket.c
endif
ifeq ($(CONFIG_USER_TEST_MODBUS_TCP),y)
SRC_DIR += test_modbus_tcp
endif
ifeq ($(CONFIG_USER_TEST_WEBSERVER),y)
SRC_FILES +=
SRC_FILES += test_webserver/test_webserver.c
endif
ifeq ($(CONFIG_USER_TEST_MQTTCLIENT),y)
SRC_DIR:= test_mqttclient
SRC_FILES +=
endif
ifeq ($(CONFIG_USER_TEST_FTPCLIENT),y)
SRC_FILES +=
SRC_FILES += test_ftpclient/test_ftpclient.c test_ftpclient/ftp_client/ftp_client.c\
test_ftpclient/ftp_client/my_socket.c
endif
ifeq ($(CONFIG_USER_TEST_FTPCLIENT_RISCV),y)
ifeq ($(CONFIG_BSP_USING_W5500),y)
SRC_FILES += test_ftpclient_riscv/test_ftpclient_riscv.c
endif
endif
ifeq ($(CONFIG_USER_TEST_LORA_P2P),y)
@ -139,7 +169,11 @@ ifeq ($(CONFIG_ADD_XIZI_FEATURES),y)
ifeq ($(CONFIG_USER_TEST_USB_CAMERA),y)
SRC_FILES +=
endif
endif
ifeq ($(CONFIG_USER_TEST_FTPCLIENT_FINAL),y)
SRC_FILES += test_ftpclient_final/test_ftpclient_final.c test_ftpclient_final/ftp_client/ftp_client.c test_ftpclient_final/ftp_client/my_socket.c
endif
include $(KERNEL_ROOT)/compiler.mk
endif

View File

@ -0,0 +1,162 @@
/*
* 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 test_4g_ec200a.c
* @brief Implement the connection 4G function, using QUECTEL EC200A device
* @version 1.1
* @author AIIT XUOS Lab
* @date 2023.10.15
*/
#include <stdio.h>
#include <string.h>
#include <transform.h>
#ifdef ADD_XIZI_FEATURES
char *trans_data = "{\"saleid\": \"52330000MJ87322565\", \"gateid\": \"10100001011\", \"type\": \"report\", \"time\": \"2023-06-15 17:22:00\", \"sequence\": \"268\", \"source\": \"da\", \"meter\": [{\"id\": \"T100106\", \"status\": \"1\", \"name\": \"T100106\", \"values\": {}}]}\r\n";
// const char chk_buad[] = {"AT+IPR?\r\n"};
const char set_mode[] = {"AT+QMTCFG=\"recv/mode\",0,0,1\r\n"};
// const char set_cfg[] = {"AT+QMTCFG=\"aliauth\",0,\"k0celEMx5DK\",\"test_device\",\"411aa14c0dc671f7ee869adced442d13\"\r\n"};
const char set_server[] = {"AT+QMTOPEN=0,\"xyheqmx.e3.luyouxia.net\",13333\r\n"};
// const char set_server[] = {"AT+QMTOPEN=0,\"iot-060a7p7c.mqtt.iothub.aliyuncs.com\",1883\r\n"};
const char set_conn[] = {"AT+QMTCONN=0,\"quectel\",\"test\",\"test123456\"\r\n"};
// const char set_conn[] = {"AT+QMTCONN=0,\"sysoul\"\r\n"};
// const char set_get[] = {"AT+QMTSUB=0,1,\"/get\",0\r\n"};
// const char set_reply[] = {"AT+QMTPUBEX=0,0,0,0,\"/reply\",1000\r\n"};
char recv_buf[100] = {0};
int buf_len = 0;
void Test4G(void)
{
int quectel_fd = PrivOpen(ADAPTER_QUECTEL_DRIVER, O_RDWR);
if (quectel_fd < 0) {
printf("open quectel fd error:%d\n", quectel_fd);
return;
}
printf("quectel fopen success\n");
struct SerialDataCfg quectel_cfg;
memset(&quectel_cfg, 0, sizeof(struct SerialDataCfg));
quectel_cfg.serial_baud_rate = BAUD_RATE_115200;
quectel_cfg.serial_data_bits = DATA_BITS_8;
quectel_cfg.serial_stop_bits = STOP_BITS_1;
quectel_cfg.serial_parity_mode = PARITY_NONE;
quectel_cfg.serial_bit_order = BIT_ORDER_LSB;
quectel_cfg.serial_invert_mode = NRZ_NORMAL;
// quectel_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
quectel_cfg.serial_buffer_size = 1024;
quectel_cfg.serial_timeout = 1000;
quectel_cfg.is_ext_uart = 0;
// quectel_cfg.ext_uart_no = ADAPTER_QUECTEL_DRIVER_EXT_PORT;
// quectel_cfg.port_configure = PORT_CFG_INIT;
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
ioctl_cfg.args = &quectel_cfg;
if (0 != PrivIoctl(quectel_fd, OPE_INT, &ioctl_cfg)) {
printf("ioctl quectel fd error %d\n", quectel_fd);
PrivClose(quectel_fd);
return;
}
printf("4G module set\n");
// memset(recv_buf, 0, sizeof(recv_buf));
// printf("chk_buad: %s\n", chk_buad);
// printf("chk_buad_len: %d\n", strlen(chk_buad));
// PrivWrite(quectel_fd, chk_buad, strlen(chk_buad));
// PrivTaskDelay(30);
// buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
// printf("buf_len: %d\n", buf_len);
// printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
// PrivTaskDelay(1000);
memset(recv_buf, 0, sizeof(recv_buf));
printf("set_mode: %s\n", set_mode);
printf("set_mode_len: %d\n", strlen(set_mode));
PrivWrite(quectel_fd, set_mode, strlen(set_mode));
PrivTaskDelay(30);
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
printf("buf_len: %d\n", buf_len);
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
PrivTaskDelay(1000);
// memset(recv_buf, 0, sizeof(recv_buf));
// printf("set_cfg: %s\n", set_cfg);
// printf("set_cfg_len: %d\n", strlen(set_cfg));
// PrivWrite(quectel_fd, set_cfg, strlen(set_cfg));
// PrivTaskDelay(30);
// buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
// printf("buf_len: %d\n", buf_len);
// printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
// PrivTaskDelay(1000);
memset(recv_buf, 0, sizeof(recv_buf));
printf("set_server: %s\n", set_server);
printf("set_server_len: %d\n", strlen(set_server));
PrivWrite(quectel_fd, set_server, strlen(set_server));
PrivTaskDelay(30);
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
printf("buf_len: %d\n", buf_len);
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
PrivTaskDelay(1000);
memset(recv_buf, 0, sizeof(recv_buf));
printf("set_conn: %s\n", set_conn);
printf("set_conn_len: %d\n", strlen(set_conn));
PrivWrite(quectel_fd, set_conn, strlen(set_conn));
PrivTaskDelay(30);
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
printf("buf_len: %d\n", buf_len);
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
PrivTaskDelay(1000);
while (1) {
printf("start send\n");
char set_reply[50] = {"AT+QMTPUBEX=0,0,0,0,\"/reply\","};
char data_len_str[20];
sprintf(data_len_str, "%d", strlen(trans_data));
printf("data_len_str: %s\n", data_len_str);
strcat(set_reply, data_len_str);
strcat(set_reply, "\r\n");
memset(recv_buf, 0, sizeof(recv_buf));
printf("set_reply: %s\n", set_reply);
printf("set_reply_len: %d\n", strlen(set_reply));
PrivWrite(quectel_fd, set_reply, strlen(set_reply));
PrivTaskDelay(30);
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
printf("buf_len: %d\n", buf_len);
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
PrivTaskDelay(500);
memset(recv_buf, 0, sizeof(recv_buf));
printf("send_data: %s\n", trans_data);
printf("send_data_len: %d\n", strlen(trans_data));
PrivWrite(quectel_fd, trans_data, strlen(trans_data));
PrivTaskDelay(30);
buf_len = PrivRead(quectel_fd, recv_buf, sizeof(recv_buf));
printf("buf_len: %d\n", buf_len);
printf("[%s] Info: Recv from uart: %s\n", __func__, recv_buf);
PrivTaskDelay(5000);
}
PrivClose(quectel_fd);
return;
}
PRIV_SHELL_CMD_FUNCTION(Test4G, a quectel test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@ -26,9 +26,8 @@
void TestAdc(void)
{
int adc_fd;
uint8 adc_channel = 0x0;
uint16 adc_sample, adc_value_decimal = 0;
float adc_value;
uint8 adc_channel = 0x1;
uint16 adc_sample = 0;
adc_fd = PrivOpen(ADC_DEV_DRIVER, O_RDWR);
if (adc_fd < 0) {
@ -45,13 +44,11 @@ void TestAdc(void)
return;
}
PrivRead(adc_fd, &adc_sample, 2);
adc_value = (float)adc_sample * (3.3 / 4096);
adc_value_decimal = (adc_value - (uint16)adc_value) * 1000;
printf("adc sample %u value integer %u decimal %u\n", adc_sample, (uint16)adc_value, adc_value_decimal);
for (int i = 0; i < 10; i ++) {
PrivRead(adc_fd, &adc_sample, 2);
printf("adc sample %u mv\n", adc_sample);
PrivTaskDelay(500);
}
PrivClose(adc_fd);

View File

@ -22,17 +22,16 @@
#include <transform.h>
#ifdef ADD_XIZI_FEATURES
void TestDac(void)
static pthread_t test_dac_task;
static void *TestDacTask(void *parameter)
{
int dac_fd;
uint16 dac_set_value = 800;
uint16 dac_sample, dac_value_decimal = 0;
float dac_value;
uint16 dac_set_value = 4096 * 10;//sin length
dac_fd = PrivOpen(DAC_DEV_DRIVER, O_RDWR);
if (dac_fd < 0) {
KPrintf("open dac fd error %d\n", dac_fd);
return;
}
struct PrivIoctlCfg ioctl_cfg;
@ -41,20 +40,24 @@ void TestDac(void)
if (0 != PrivIoctl(dac_fd, OPE_CFG, &ioctl_cfg)) {
KPrintf("ioctl dac fd error %d\n", dac_fd);
PrivClose(dac_fd);
return;
}
PrivRead(dac_fd, &dac_sample, 2);
dac_value = (float)dac_sample * (3.3 / 4096);//Vref+ need to be 3.3V
dac_value_decimal = (dac_value - (uint16)dac_value) * 1000;
printf("dac sample %u value integer %u decimal %u\n", dac_sample, (uint16)dac_value, dac_value_decimal);
while (1) {
//start dac output sin
PrivWrite(dac_fd, NULL, 0);
}
PrivClose(dac_fd);
}
return;
void TestDac(void)
{
pthread_attr_t tid;
tid.schedparam.sched_priority = 20;
tid.stacksize = 4096;
PrivTaskCreate(&test_dac_task, &tid, &TestDacTask, NULL);
PrivTaskStartup(&test_dac_task);
}
PRIV_SHELL_CMD_FUNCTION(TestDac, a dac test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@ -22,6 +22,7 @@
#include <transform.h>
#ifdef ADD_XIZI_FEATURES
#ifdef BSP_USING_W5500
#include <socket.h>
#define BUFF_SIZE 128
@ -189,6 +190,6 @@ PRIV_SHELL_CMD_FUNCTION(TestSocketAsClient, a w5500 client-ip-port-msg test samp
#endif
#endif
#endif

View File

@ -0,0 +1,60 @@
# 初赛一级赛题3基于矽璓已实现的Lwip在ARM上实现FTP协议的Client功能
## 1. 简介
本项目是基于矽璓已实现的Lwip在ARM上实现FTP协议的Client功能
test_ftpclient.h声明了下载10个文件的测试函数
test_ftpclient.c实现了下载10个文件的测试函数
ftp_client文件夹定义了ftp_client的相关类库其中my_socket.h,my_socket.c定义了socket抽象层并基于
Lwip实现了该抽象层ftp_client.h,ftp_client.c实现了ftp登录获取文件大小下载文件等功能
## 2. 数据结构设计说明
- ftp_client.c 的设计
分别定义了发送命令和接收数据的socket和相应的缓冲区并且实现了登录、发送命令、接收响应数据、查找文件大小、进入被动模式、下载文件、关闭ftp客户端等操作
```c
static int m_socket_cmd; // 发送命令的socket文件描述符
static int m_socket_data; // 接收ftp服务器文件的socket文件描述符
static char m_send_buffer[1024]; // 发送缓冲区
static char m_recv_buffer[1024]; // 接收缓冲区
```
## 3. 测试程序说明
- test_ftpclient.c用于测试下载10个文件
连接电脑上的ftp服务器下载10个4KB文件,通过终端日志打印确定文件是否下载成功,以及追踪通信流程和下载进度
```c
void TestFtpClient(int argc, char* argv[])
{
FtpInitCmd();
int ret = FtpLogin("192.168.0.248", 21, "anonymous", "anonymous");
int size;
char *buf;
for(int i = 1;i <= 10;i++){
char fileName[20] = "/file";
char temp[5] = "";
sprintf(temp,"%d",i);
strcat(fileName,temp);
size = FtpFileSize(fileName);
buf = malloc(size);
FtpInitData(); // data socket 每次下载都要重新创建,下载完都要关闭
ret = FtpDownload(fileName, buf, size);
free(buf);
}
FtpQuit();
return;
}
```
## 4. 运行结果(##需结合运行测试截图按步骤说明##
1. 配置开启BSP_USING_LWIP、USER_TEST_FTPCLIENT
![](./img/image.png)
![](./img/image-1.png)
2. 编译
![](./img/image-2.png)
3. 烧写
![](./img/image-3.png)
4. xshell连接串口终端
![](./img/image-4.png)
6. 配置ip
![](./img/image-5.png)
7. 运行TestFtpClient开始下载文件
![](./img/image-6.png)
![](./img/image-7.png)
![](./img/image-8.png)

View File

@ -0,0 +1,256 @@
/*
* 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: ftp_client.c
* @brief: ftp client tool
* @version: 1.0
* @author: bdislab_final
* @date: 2023/7/25
* @reference https://kerndev.blog.csdn.net/article/details/89383888
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "my_socket.h"
#include "ftp_client.h"
static int m_socket_cmd;
static int m_socket_data;
static char m_send_buffer[1024];
static char m_recv_buffer[1024];
static int FtpSendCommand(char *cmd)
{
int ret;
printf("send command: %s\r\n", cmd);
ret = SocketSend(m_socket_cmd, cmd, (int)strlen(cmd));
if(ret < 0)
{
printf("failed to send command: %s\r\n",cmd);
return 0;
}
return 1;
}
static int FtpRecvRespond(char *resp, int len)
{
int ret;
int off;
len -= 1;
for(off=0; off<len; off+=ret)
{
ret = SocketRecv(m_socket_cmd, &resp[off], 1);
if(ret < 0)
{
printf("recv respond error(ret=%d)!\r\n", ret);
return 0;
}
if(resp[off] == '\n')
{
break;
}
}
resp[off+1] = 0;
printf("respond:%s\r\n", resp);
return atoi(resp);
}
static int FtpEnterPasv(char *ipaddr, int *port)
{
int ret;
char *find;
int a,b,c,d;
int pa,pb;
ret = FtpSendCommand("PASV\r\n");
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 227)
{
return 0;
}
find = strrchr(m_recv_buffer, '(');
sscanf(find, "(%d,%d,%d,%d,%d,%d)", &a, &b, &c, &d, &pa, &pb);
sprintf(ipaddr, "%d.%d.%d.%d", a, b, c, d);
*port = pa * 256 + pb;
return 1;
}
int FtpDownload(char *name, char *buf, int len)
{
int i;
int ret;
char ipaddr[32];
int port;
//查询数据地址
ret = FtpEnterPasv(ipaddr, &port);
if(ret != 1)
{
return 0;
}
//连接数据端口
ret = SocketConnect(m_socket_data, ipaddr, port);
if(ret != 1)
{
printf("failed to connect data port\r\n");
return 0;
}
//准备下载
sprintf(m_send_buffer, "RETR %s\r\n", name);
ret = FtpSendCommand(m_send_buffer);
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 150)
{
SocketClose(m_socket_data);
return 0;
}
//开始下载,读取完数据后,服务器会自动关闭连接
for(i=0; i<len; i+=ret)
{
ret = SocketRecv(m_socket_data, ((char *)buf) + i, len);
printf("download %d/%d.\r\n", i + ret, len);
if(ret < 0)
{
printf("download was interrupted.\r\n");
break;
}
}
//下载完成
printf("download %d/%d bytes complete.\r\n", i, len);
printf("====file content====\n");
buf[100] = '\0';
printf("%s\n",buf);
printf("====================\n");
// FILE *fp = NULL;
// fp = fopen(name+1, "wb");
// fwrite(buf,len,1,fp);
// fclose(fp);
SocketClose(m_socket_data);
ret = FtpRecvRespond(m_recv_buffer, 1024);
return (ret==226);
}
int FtpFileSize(char *name)
{
int ret;
int size;
sprintf(m_send_buffer,"SIZE %s\r\n",name);
ret = FtpSendCommand(m_send_buffer);
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 213)
{
return 0;
}
size = atoi(m_recv_buffer + 4);
return size;
}
int FtpLogin(char *addr, int port, char *username, char *password)
{
int ret;
printf("connect...\r\n");
ret = SocketConnect(m_socket_cmd, addr, port);
if(ret != 1)
{
printf("connect server failed!\r\n");
return 0;
}
printf("connect ok.\r\n");
//等待欢迎信息
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 220)
{
printf("bad server, ret=%d!\r\n", ret);
SocketClose(m_socket_cmd);
return 0;
}
printf("login...\r\n");
//发送USER
sprintf(m_send_buffer, "USER %s\r\n", username);
ret = FtpSendCommand(m_send_buffer);
if(ret != 1)
{
SocketClose(m_socket_cmd);
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 331)
{
SocketClose(m_socket_cmd);
return 0;
}
//发送PASS
sprintf(m_send_buffer, "PASS %s\r\n", password);
ret = FtpSendCommand(m_send_buffer);
if(ret != 1)
{
SocketClose(m_socket_cmd);
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 230)
{
SocketClose(m_socket_cmd);
return 0;
}
printf("login success.\r\n");
//设置为二进制模式
ret = FtpSendCommand("TYPE I\r\n");
if(ret != 1)
{
SocketClose(m_socket_cmd);
return 0;
}
ret = FtpRecvRespond(m_recv_buffer, 1024);
if(ret != 200)
{
SocketClose(m_socket_cmd);
return 0;
}
return 1;
}
void FtpQuit(void)
{
FtpSendCommand("QUIT\r\n");
SocketClose(m_socket_cmd);
}
void FtpInitCmd(void)
{
m_socket_cmd = SocketCreate();
}
void FtpInitData(void){
m_socket_data= SocketCreate();
}

View File

@ -0,0 +1,42 @@
/*
* 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: ftp_client.h
* @brief: ftp client tool
* @version: 1.0
* @author: bdislab_final
* @date: 2023/7/25
*/
#ifndef FTP_CLIENT_H
#define FTP_CLIENT_H
/* init ftp cmd socket */
void FtpInitCmd(void);
/* init ftp data socket */
void FtpInitData(void);
/* quit ftp */
void FtpQuit(void);
/* fpt login */
int FtpLogin(char *addr, int port, char *username, char *password);
/* get file size */
int FtpFileSize(char *name);
/* ftp download file*/
int FtpDownload(char *name, char *buf, int len);
#endif

View File

@ -0,0 +1,57 @@
/*
* 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: my_socket.c
* @brief: a abstract socket api
* @version: 1.0
* @author: bdislab_final
* @date: 2023/7/25
* @reference https://kerndev.blog.csdn.net/article/details/89383888
*/
#include "my_socket.h"
#include <sockets.h>
#include <def.h>
#include <errno.h>
int SocketCreate(void){
return socket(AF_INET,SOCK_STREAM,0);
}
int SocketConnect(int sock, const char *addr, int port){
// unsigned int iRemoteAddr = 0;
struct sockaddr_in stRemoteAddr = {0}; //对端,即目标地址信息
stRemoteAddr.sin_family = AF_INET;
stRemoteAddr.sin_port = htons(port);
stRemoteAddr.sin_addr.s_addr = inet_addr(addr);
// inet_pton(AF_INET, addr, &iRemoteAddr);
// stRemoteAddr.sin_addr.s_addr=iRemoteAddr;
int res = connect(sock,(struct sockaddr *)&stRemoteAddr,sizeof(stRemoteAddr));
if(res == -1){
printf("error:%d\n",errno);
}
return res == 0 ? 1 : 0;
}
int SocketSend(int sock, void *data, int len){
return send(sock,data,len,0);
}
int SocketRecv(int sock, void *data, int len){
return recv(sock,data,len,0);
}
void SocketClose(int sock){
close(sock);
}

View File

@ -0,0 +1,46 @@
/*
* 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 my_socket.h
* @brief a abstract socket api
* @version 1.0
* @author bdislab_final
* @date 2023/7/25
*/
#ifndef MYSOCKET_H
#define MYSOCKET_H
#ifdef __cplusplus
extern "C" {
#endif
/* create a socket */
int SocketCreate(void);
/* connect a socket */
int SocketConnect(int sock, const char *addr, int port);
/* send data through socket*/
int SocketSend(int sock, void *data, int len);
/* receive data from socket*/
int SocketRecv(int sock, void *data, int len);
/* close socket*/
void SocketClose(int sock);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -0,0 +1,50 @@
/*
* 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: test_ftpclient.c
* @brief: a ftpClient test sample
* @version: 1.0
* @author: bdislab_final
* @date: 2023/7/25
*/
#include "test_ftpclient.h"
#include "ftp_client/ftp_client.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <transform.h>
/* test for ftp client */
void TestFtpClient(int argc, char* argv[])
{
FtpInitCmd();
int ret = FtpLogin("192.168.1.248", 21, "anonymous", "anonymous");
int size;
char *buf;
for(int i = 1;i <= 10;i++){
char fileName[20] = "/file";
char temp[5] = "";
sprintf(temp,"%d",i-1);
strcat(fileName,temp);
size = FtpFileSize(fileName);
buf = malloc(size);
FtpInitData(); // data socket 每次下载都要重新创建,下载完都要关闭
ret = FtpDownload(fileName, buf, size);
free(buf);
}
FtpQuit();
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFtpClient, a ftpClient test sample, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@ -0,0 +1,35 @@
/*
* 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 test_ftpclient.h
* @brief a ftpClient test sample
* @version 1.0
* @author bdislab_final
* @date 2023/7/25
*/
#ifndef TEST_FTPCLIENT_H
#define TEST_FTPCLIENT_H
#ifdef __cplusplus
extern "C" {
#endif
/* test for ftp client */
void TestFtpClient(int argc, char* argv[]);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,135 @@
# 决赛一级赛题3基于初赛一级赛题3在云服务器上实现FTP Server功能
## 1. 简介
本项目是基于赛事提供的云服务器实现FTP协议的Server功能其功能支持至少10个Client端并发向Server端传输4KB大小的文件
支持Server端并发地向至少10个Client端传输4KB大小的文件。
test_ftpclient_final.h声明了多个客户端并发下载文件、并发上传文件的测试函数
test_ftpclient_final.c实现了多个客户端并发下载文件、并发上传文件的测试函数
ftp_client文件夹定义了ftp_client的相关类库其中my_socket.h,my_socket.c定义了socket抽象层并基于
Lwip实现了该抽象层ftp_client.h,ftp_client.c实现了ftp登录获取文件大小下载文件等功能
注意:在赛事提供的云服务器/root/yanglongFTP上有对应服务器代码 ./server运行服务器为了方便查看代码我们讲服务器代码备份存放在ftp_server目录下
## 2. 数据结构设计说明
- ftp_client.c 的设计
分别定义了发送命令和接收数据的socket和相应的缓冲区并且实现了登录、发送命令、接收响应数据、查找文件大小、进入被动模式、下载文件、关闭ftp客户端等操作
```c
static int m_socket_cmd[THREAD_NUM]; // 发送命令的socket文件描述符,THREAD_NUM表示线程数目用来模拟多个客户端并发访问
static int m_socket_data[THREAD_NUM]; // 接收ftp服务器文件的socket文件描述符
static char m_send_buffer[THREAD_NUM][1024]; // 发送缓冲区
static char m_recv_buffer[THREAD_NUM][1024]; // 接收缓冲区
```
- server.c 的设计(具体代码在赛事提供的云服务器的/root/yanglongFTP下)
```c
#define THREAD_NUM 10000 // thread num
static int isBinary = 0; // transmit binary data
static int port = 9992; // service port
static int dataPort = 9993; // the port for file download
static char order[4]; // receive order
static char param[20]; // receive order param
static char *respMessage; // respose message
static int serverFd; // the server fd for deal with order requests
static int dataServerFd; // the server fd for file download
sem_t mutex; // mutex lock
struct Data{ // 线程间通信传输的数据
char fileName[20]; // file name
int type; // 0:download 1:upload
sem_t isDone; // complete file downlaod
sem_t isReady; // 文件准备好了
} data;
```
## 3. 测试程序说明
- test_ftpclient_final.c用于测试多个客户端并发下载文件
通过多线程模拟多个客户端并发访问服务器,通过 TestFtpClient options threads进行测试
其中options=1表示下载options=2表示上传threads表示线程数/模拟的并发客户端数目
```c
/* test for 10 ftp client */
void TestFtpClient(int argc, char* argv[])
{
int options = atoi(argv[1]);
int n = atoi(argv[2]);
pthread_t threads[THREAD_NUM];
for(int i = 0;i < n;++i){
threadIDs[i] = i;
if(options == 1){ // 全部都是下载
pthread_create(&threads[i],NULL,&DownLoad,&threadIDs[i]);
}else if(options == 2){ // 全部都是上传
pthread_create(&threads[i],NULL,&UpLoad,&threadIDs[i]);
}else if(options == 3){ // 随机下载/上传
int r = rand()%2;
if(r == 0){
printf("===============download===============\n");
pthread_create(&threads[i],NULL,&DownLoad,&threadIDs[i]);
}else{
printf("===============upload===============\n");
pthread_create(&threads[i],NULL,&UpLoad,&threadIDs[i]);
}
}
}
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFtpClient, a ftpClient test sample, PRIV_SHELL_CMD_MAIN_ATTR);
```
## 4. 运行结果(##需结合运行测试截图按步骤说明##
1. 配置开启BSP_USING_LWIP、USER_TEST_FTPCLIENT
![](./img/image.png)
![](./img/image-1.png)
![](./img/image-2.png)
2. 编译
![](./img/image-3.png)
3. 烧写
![](./img/image-4.png)
4. xshell连接串口终端并配置ip
![](./img/image-5.png)
5. 通过./server在云服务器运行FTP服务器
![](./img/image-6.png)
6. 运行TestFtpClient 1 10模拟10个客户端并发下载文件
- 客户端日志
![](./img/image-7.png)
![](./img/image-8.png)
![](./img/image-9.png)
![](./img/image-10.png)
![](./img/image-11.png)
![](./img/image-12.png)
![](./img/image-13.png)
![](./img/image-14.png)
![](./img/image-15.png)
![](./img/image-16.png)
- 服务器日志
![](./img/image-17.png)
![](./img/image-18.png)
![](./img/image-19.png)
![](./img/image-20.png)
![](./img/image-21.png)
7. 运行TestFtpClient 2 10模拟10个客户端并发上传文件
- 客户端日志
![](./img/image-22.png)
![](./img/image-23.png)
![](./img/image-24.png)
![](./img/image-25.png)
![](./img/image-26.png)
![](./img/image-27.png)
![](./img/image-28.png)
- 服务器日志
![](./img/image-29.png)
![](./img/image-30.png)
![](./img/image-31.png)
![](./img/image-32.png)
- 上传结果
![](./img/image-33.png)
8. 运行TestFtpClient 3 10模拟10个客户端混合并发下载和上传文件
- 客户端日志
![](./img/image-34.png)
![](./img/image-35.png)
![](./img/image-36.png)
![](./img/image-37.png)
![](./img/image-38.png)
![](./img/image-39.png)
- 服务器日志
![](./img/image-40.png)
![](./img/image-41.png)
![](./img/image-42.png)
- 下载和上传结果
![](./img/image-43.png)
![](./img/image-44.png)

View File

@ -0,0 +1,299 @@
/*
* 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: ftp_client.c
* @brief: ftp client tool
* @version: 1.0
* @author: bdislab_final
* @date: 2023/9/16
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include "my_socket.h"
#include "ftp_client.h"
static int m_socket_cmd[THREAD_NUM];
static int m_socket_data[THREAD_NUM];
static char m_send_buffer[THREAD_NUM][1024];
static char m_recv_buffer[THREAD_NUM][1024];
static int FtpSendCommand(int threadID,char *cmd)
{
int ret;
printf("send command: %s,threadID=%d\r\n", cmd,threadID);
ret = SocketSend(m_socket_cmd[threadID], cmd, (int)strlen(cmd));
if(ret < 0)
{
printf("failed to send command: %s\r\n",cmd);
return 0;
}
return 1;
}
static int FtpRecvRespond(int threadID,char *resp, int len)
{
int ret;
int off;
len -= 1;
for(off=0; off<len; off+=ret)
{
ret = SocketRecv(m_socket_cmd[threadID], &resp[off], 1);
if(ret < 0)
{
printf("recv respond error(ret=%d)!\r\n", ret);
return 0;
}
if(resp[off] == '\n')
{
break;
}
}
resp[off+1] = 0;
printf("respond:%s,threadID=%d\r\n", resp,threadID);
return atoi(resp);
}
static int FtpEnterPasv(int threadID,char *ipaddr, int *port)
{
int ret;
char *find;
int a,b,c,d;
int pa,pb;
ret = FtpSendCommand(threadID,"PASV\r\n");
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 227)
{
return 0;
}
find = strrchr(m_recv_buffer[threadID], '(');
sscanf(find, "(%d,%d,%d,%d,%d,%d)", &a, &b, &c, &d, &pa, &pb);
sprintf(ipaddr, "%d.%d.%d.%d", a, b, c, d);
*port = pa * 256 + pb;
return 1;
}
int FtpUpload(int threadID,char *name, void *buf, int len)
{
int ret;
char ipaddr[32];
int port;
//查询数据地址
ret=FtpEnterPasv(threadID,ipaddr, &port);
if(ret != 1)
{
return 0;
}
ret=SocketConnect(m_socket_data[threadID], ipaddr, port);
if(ret != 1)
{
return 0;
}
//准备上传
sprintf(m_send_buffer[threadID], "STOR %s\r\n", name);
ret = FtpSendCommand(threadID,m_send_buffer[threadID]);
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 150)
{
SocketClose(m_socket_data[threadID]);
return 0;
}
//开始上传
ret = SocketSend(m_socket_data[threadID], buf, len);
if(ret != len)
{
printf("send data error!\r\n");
SocketClose(m_socket_data[threadID]);
return 0;
}
SocketClose(m_socket_data[threadID]);
//上传完成,等待回应
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
return (ret==226);
}
int FtpDownload(int threadID,char *name, void *buf, int len)
{
int i;
int ret;
char ipaddr[32];
int port;
//查询数据地址
ret = FtpEnterPasv(threadID,ipaddr, &port);
if(ret != 1)
{
return 0;
}
printf("m_socket_data[threadID]=%d,threadID=%d\n",m_socket_data[threadID],threadID);
//连接数据端口
ret = SocketConnect(m_socket_data[threadID], ipaddr, port);
if(ret != 1)
{
printf("failed to connect data port\r\n");
return 0;
}
//准备下载
sprintf(m_send_buffer[threadID], "RETR %s\r\n", name);
ret = FtpSendCommand(threadID,m_send_buffer[threadID]);
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 150)
{
SocketClose(m_socket_data[threadID]);
return 0;
}
//开始下载,读取完数据后,服务器会自动关闭连接
for(i=0; i<len; i+=ret)
{
ret = SocketRecv(m_socket_data[threadID], ((char *)buf) + i, len);
printf("download %d/%d.,threadID=%d\r\n", i + ret, len,threadID);
if(ret < 0)
{
printf("download was interrupted.\r\n");
break;
}
}
//下载完成
printf("download %d/%d bytes complete.,threadID=%d\r\n", i, len,threadID);
// FILE *fp = NULL;
// fp = fopen(name+1, "wb");
// fwrite(buf,len,1,fp);
// fclose(fp);
SocketClose(m_socket_data[threadID]);
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
return (ret==226);
}
int FtpFileSize(int threadID,char *name)
{
int ret;
int size;
sprintf(m_send_buffer[threadID],"SIZE %s\r\n",name);
ret = FtpSendCommand(threadID,m_send_buffer[threadID]);
if(ret != 1)
{
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 213)
{
return 0;
}
size = atoi(m_recv_buffer[threadID] + 4);
return size;
}
int FtpLogin(int threadID,char *addr, int port, char *username, char *password)
{
int ret;
printf("connect...,threadID=%d\r\n",threadID);
ret = SocketConnect(m_socket_cmd[threadID], addr, port);
if(ret != 1)
{
printf("connect server failed!\r\n");
return 0;
}
printf("connect ok.,threadID=%d\r\n",threadID);
//等待欢迎信息
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 220)
{
printf("bad server, ret=%d!\r\n", ret);
SocketClose(m_socket_cmd[threadID]);
return 0;
}
printf("login...threadID=%d\r\n",threadID);
//发送USER
sprintf(m_send_buffer[threadID], "USER %s\r\n", username);
ret = FtpSendCommand(threadID,m_send_buffer[threadID]);
if(ret != 1)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 331)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
//发送PASS
sprintf(m_send_buffer[threadID], "PASS %s\r\n", password);
ret = FtpSendCommand(threadID,m_send_buffer[threadID]);
if(ret != 1)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 230)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
printf("login success.threadID=%d\r\n",threadID);
//设置为二进制模式
ret = FtpSendCommand(threadID,"TYPE I\r\n");
if(ret != 1)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
ret = FtpRecvRespond(threadID,m_recv_buffer[threadID], 1024);
if(ret != 200)
{
SocketClose(m_socket_cmd[threadID]);
return 0;
}
return 1;
}
void FtpQuit(int threadID)
{
FtpSendCommand(threadID,"QUIT\r\n");
SocketClose(m_socket_cmd[threadID]);
}
void FtpInitCmd(int threadID)
{
m_socket_cmd[threadID] = SocketCreate();
}
void FtpInitData(int threadID){
m_socket_data[threadID]= SocketCreate();
}

View File

@ -0,0 +1,46 @@
/*
* 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: ftp_client.h
* @brief: ftp client tool
* @version: 1.0
* @author: bdislab_final
* @date: 2023/9/16
*/
#ifndef FTP_CLIENT_H
#define FTP_CLIENT_H
#define THREAD_NUM 10
/* init ftp cmd socket */
void FtpInitCmd(int threadID);
/* init ftp data socket */
void FtpInitData(int threadID);
/* quit ftp */
void FtpQuit(int threadID);
/* fpt login */
int FtpLogin(int threadID,char *addr, int port, char *username, char *password);
/* get file size */
int FtpFileSize(int threadID,char *name);
/* ftp download file*/
int FtpDownload(int threadID,char *name, void *buf, int len);
/*ftp upload*/
int FtpUpload(int threadID,char *name, void *buf, int len);
#endif

View File

@ -0,0 +1,55 @@
/*
* 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: my_socket.c
* @brief: a abstract socket api
* @version: 1.0
* @author: bdislab_final
* @date: 2023/9/16
*/
#include "my_socket.h"
#include <sockets.h>
#include <def.h>
#include <errno.h>
#include <string.h>
int SocketCreate(void){
return socket(AF_INET,SOCK_STREAM,0);
}
int SocketConnect(int sock, const char *addr, int port){
// unsigned int iRemoteAddr = 0;
struct sockaddr_in stRemoteAddr = {0}; //对端,即目标地址信息
stRemoteAddr.sin_family = AF_INET;
stRemoteAddr.sin_port = htons(port);
stRemoteAddr.sin_addr.s_addr = inet_addr(addr);
int res = connect(sock,(struct sockaddr *)&stRemoteAddr,sizeof(stRemoteAddr));
if(res == -1){
printf("error:%d,str error:%s\n",errno,strerror(errno));
}
return res == 0 ? 1 : 0;
}
int SocketSend(int sock, void *data, int len){
return send(sock,data,len,0);
}
int SocketRecv(int sock, void *data, int len){
return recv(sock,data,len,0);
}
void SocketClose(int sock){
close(sock);
}

View File

@ -0,0 +1,46 @@
/*
* 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 my_socket.h
* @brief a abstract socket api
* @version 1.0
* @author bdislab_final
* @date 2023/9/16
*/
#ifndef MYSOCKET_H
#define MYSOCKET_H
#ifdef __cplusplus
extern "C" {
#endif
/* create a socket */
int SocketCreate(void);
/* connect a socket */
int SocketConnect(int sock, const char *addr, int port);
/* send data through socket*/
int SocketSend(int sock, void *data, int len);
/* receive data from socket*/
int SocketRecv(int sock, void *data, int len);
/* close socket*/
void SocketClose(int sock);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,5 @@
#!/bin/bash
for i in {1..10}
do
dd if=/dev/zero of="file$i" bs=4K count=1
done

View File

@ -0,0 +1 @@
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

View File

@ -0,0 +1,251 @@
/*
* 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: server.c
* @brief: a ftpserver
* @version: 1.0
* @author: bdislab_final
* @date: 2023/10/11
*/
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <errno.h>
#define THREAD_NUM 10000 // thread num
static int isBinary = 0; // transmit binary data
static int port = 9992; // service port
static int dataPort = 9993; // the port for file download
static char order[4]; // receive order
static char param[20]; // receive order param
static char *respMessage; // respose message
static int serverFd; // the server fd for deal with order requests
static int dataServerFd; // the server fd for file download
sem_t mutex; // mutex lock
struct Data{ // 线程间通信传输的数据
char fileName[20]; // file name
int type; // 0:download 1:upload
sem_t isDone; // complete file downlaod
sem_t isReady; // 文件准备好了
} data;
void RecvData(int clientFd,char param[20]){
recv(clientFd,param,20,0);
for(int i = 0;i < 20;++i){
if(param[i] == '\r'){
param[i] = '\0';
return;
}
}
return;
}
void SendMessage(int clientFd, char * respMessage){
int len = 0;
while(respMessage[len] != '\n'){
len++;
}
send(clientFd,respMessage,len+1,0);
}
int CreateServer(int port,int type) {
int serverFd = 0;
struct sockaddr_in serverAddr = {0};
socklen_t socklen = 0;
serverFd = socket(AF_INET, SOCK_STREAM, 0);
if(0 > serverFd)
{
printf("创建socket失败\n");
return 0;
}
if(type == 0){
printf("in ftp server:serverFd=%d\n",serverFd);
}else{
printf("in ftp data server:serverFd=%d\n",serverFd);
}
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(port);
serverAddr.sin_addr.s_addr=htonl(INADDR_ANY);
if(0 > bind(serverFd, (void *)&serverAddr, sizeof(serverAddr)))
{
printf("绑定失败!\n");
return 0;
}
if(0 > listen(serverFd, 1024))
{
printf("监听失败!\n");
return 0;
}
return serverFd;
}
// receive file's data
void* UpLoadServer(void * args){
int clientFd = *(int *) args;
char buf[4096];
int ret = recv(clientFd,buf,4096,0);
printf("ret=%d,errno=%d\n",ret,errno);
FILE * file = fopen(data.fileName,"wb");
fwrite(buf,4096,1,file);
fclose(file);
printf("upload complete for client: clientFd=%d,tid=%ld\n",clientFd,pthread_self());
// notify for file download complete
sem_post(&data.isDone);
close(clientFd);
}
// send file's data
void* DownLoadServer(void * args){
int clientFd = *(int *) args;
char buf[4096];
FILE * file = fopen(data.fileName,"rb");
fread(buf,4096,1,file);
send(clientFd,buf,sizeof(buf),0);
fclose(file);
printf("download complete for client: clientFd=%d,tid=%ld\n",clientFd,pthread_self());
// notify for file download complete
sem_post(&data.isDone);
close(clientFd);
}
// accept a client and new a thread for downlaod/upload
void* DataServer(void * args){
dataServerFd = CreateServer(dataPort,1);
while(1){
// wait for a filename
sem_wait(&data.isReady);
struct sockaddr_in clientAdrr = {0};
int socketLen = sizeof(clientAdrr);
int clientFd = accept(dataServerFd,(struct sockaddr *)&clientAdrr,&socketLen);
pthread_t thread;
if(data.type == 0){ // download
printf("accept a client for file download: clientFd=%d,tid=%ld\n",clientFd,pthread_self());
pthread_create(&thread,NULL,&DownLoadServer,&clientFd);
}else if(data.type == 1){ // upload
printf("accept a client for file upload: clientFd=%d,tid=%ld\n",clientFd,pthread_self());
pthread_create(&thread,NULL,&UpLoadServer,&clientFd);
}
// release lock
sem_post(&mutex);
}
}
// deal with order requests
void* OrderServer(void * args){
int clientFd = *(int *)args;
printf("in OrderServer thread: tid=%ld\n",pthread_self());
// order format: USER anonymous\r\n
// response code format: 213 4096\r\n
while(1){
recv(clientFd,order,4,0);
printf("order=%s,tid=%ld\n",order,pthread_self());
if(strcmp(order,"USER") == 0){
RecvData(clientFd,param);
if(strcmp(param," anonymous") == 0){
respMessage = "331 Please specify the password.\r\n";
SendMessage(clientFd,respMessage);
}
}else if(strcmp(order,"PASS") == 0){
RecvData(clientFd,param);
if(strcmp(param," anonymous") == 0){
respMessage = "230 Login successful.\r\n";
SendMessage(clientFd,respMessage);
printf("login successful in clientFd %d,tid=%ld\n",clientFd,pthread_self());
}
}else if(strcmp(order,"TYPE") == 0){
RecvData(clientFd,param);
if(strcmp(param," I") == 0){
isBinary = 1;
respMessage = "200 Switching to Binary mode.\r\n";
SendMessage(clientFd,respMessage);
}
}else if(strcmp(order,"SIZE") == 0){
RecvData(clientFd,param);
respMessage = "213 4096\r\n";
SendMessage(clientFd,respMessage);
}else if(strcmp(order,"PASV") == 0){
sem_wait(&mutex); // 锁竞争
sem_init(&data.isDone,0,0);
RecvData(clientFd,param);
char buf[50];
sprintf(buf,"227 Entering passive mode (8,140,53,225,%d,%d).\r\n",dataPort/256,dataPort%256);
respMessage = buf;
SendMessage(clientFd,respMessage);
}else if(strcmp(order,"RETR") == 0){
RecvData(clientFd,param);
sprintf(data.fileName,"./data/%s",param+2);
data.type = 0;
// notify the thread of waiting fileName
sem_post(&data.isReady);
char buf[70];
sprintf(buf,"150 Opening Binary mode data connection for %s (4096 bytes).\r\n",param+1);
respMessage = buf;
SendMessage(clientFd,respMessage);
// wait for download complete
printf("wait for download complete,tid=%ld\n",pthread_self());
sem_wait(&data.isDone);
respMessage = "226 Transfer complete.\r\n";
SendMessage(clientFd,respMessage);
}else if(strcmp(order,"STOR") == 0){
RecvData(clientFd,param);
sprintf(data.fileName,"./out/%s",param+1);
data.type = 1;
// notify the thread of waiting fileName
sem_post(&data.isReady);
char buf[70];
sprintf(buf,"150 Opening Binary mode data connection for %s (4096 bytes).\r\n",param+1);
respMessage = buf;
SendMessage(clientFd,respMessage);
// wait for upload complete
printf("wait for upload complete,tid=%ld\n",pthread_self());
sem_wait(&data.isDone);
respMessage = "226 Transfer complete.\r\n";
SendMessage(clientFd,respMessage);
}
else if(strcmp(order,"QUIT") == 0){
printf("close clientFd=%d,tid=%ld\n",clientFd,pthread_self());
close(clientFd);
break;
}
}
return NULL;
}
int main(){
serverFd = CreateServer(port,0);
sem_init(&data.isReady,0,0);
sem_init(&mutex,0,1);
pthread_t thread;
pthread_create(&thread,NULL,&DataServer,NULL);
int clientFds[THREAD_NUM];
int i = 0;
while(1){
struct sockaddr_in clientAdrr = {0};
int socketLen = sizeof(clientAdrr);
clientFds[i] = accept(serverFd,(struct sockaddr *)&clientAdrr,&socketLen);
printf("accept a client:fd=%d\n",clientFds[i]);
respMessage = "220 (myFtpServer 1.0)\r\n";
SendMessage(clientFds[i],respMessage);
printf("send welcome message successfully.\n");
pthread_t thread;
pthread_create(&thread,NULL,&OrderServer,&clientFds[i]);
i++;
}
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -0,0 +1,93 @@
/*
* 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: test_ftpclient.c
* @brief: a ftpClient test sample
* @version: 1.0
* @author: bdislab_final
* @date: 2023/9/16
*/
#include "test_ftpclient_final.h"
#include "ftp_client/ftp_client.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <transform.h>
#include <pthread.h>
int threadIDs[THREAD_NUM];
/*one client upLoad a file of 4K*/
void* UpLoad(void* arg){
int *pThreadID = (int*)arg;
printf("in thread:tid=%ld\n", pthread_self());
FtpInitCmd(*pThreadID);
int ret = FtpLogin(*pThreadID,"8.140.53.225", 9992, "anonymous", "anonymous");
int size = 4096;
char buf[size];
char fileName[20];
sprintf(fileName,"file%d",*pThreadID);
for(int i = 0;i < size;++i){
buf[i] = '0';
}
FtpInitData(*pThreadID); // data socket 每次下载都要重新创建,下载完都要关闭
ret = FtpUpload(*pThreadID,fileName,buf,size);
FtpQuit(*pThreadID);
return NULL;
}
/*one client downLoad a file of 4K*/
void* DownLoad(void* arg){
int *pThreadID = (int*)arg;
printf("in thread:tid=%ld\n", pthread_self());
FtpInitCmd(*pThreadID);
int ret = FtpLogin(*pThreadID,"8.140.53.225", 9992, "anonymous", "anonymous");
int size;
char *buf;
char fileName[20] = "/file1";
size = FtpFileSize(*pThreadID,fileName);
buf = malloc(size);
FtpInitData(*pThreadID); // data socket 每次下载都要重新创建,下载完都要关闭
ret = FtpDownload(*pThreadID,fileName, buf, size);
free(buf);
FtpQuit(*pThreadID);
return NULL;
}
/* test for 10 ftp client */
void TestFtpClient(int argc, char* argv[])
{
int options = atoi(argv[1]);
int n = atoi(argv[2]);
pthread_t threads[THREAD_NUM];
for(int i = 0;i < n;++i){
threadIDs[i] = i;
if(options == 1){ // 全部都是下载
pthread_create(&threads[i],NULL,&DownLoad,&threadIDs[i]);
}else if(options == 2){ // 全部都是上传
pthread_create(&threads[i],NULL,&UpLoad,&threadIDs[i]);
}else if(options == 3){ // 随机下载/上传
int r = rand()%2;
if(r == 0){
printf("===============download===============\n");
pthread_create(&threads[i],NULL,&DownLoad,&threadIDs[i]);
}else{
printf("===============upload===============\n");
pthread_create(&threads[i],NULL,&UpLoad,&threadIDs[i]);
}
}
}
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFtpClient, a ftpClient test sample, PRIV_SHELL_CMD_MAIN_ATTR);

Some files were not shown because too many files have changed in this diff Show More