From ae004dd01c6acc787c8b0873801d274ed92b9276 Mon Sep 17 00:00:00 2001 From: abazlaev Date: Thu, 6 Apr 2023 18:09:14 +0700 Subject: [PATCH] Added IPTraceMacro.h Added READ-COM3.ps1 Added READ-COM8.ps1 --- .vscode/c_cpp_properties.json | 80 +++++++++++++++++++ DemoTasks/SimpleTCPEchoServer.c | 2 +- Doc/READ-COM3.ps1 | 10 +++ Doc/READ-COM8.ps1 | 10 +++ FreeRTOS/source/include/IPTraceMacro.h | 30 +++++++ .../board_family/NetworkInterface.c | 2 +- Test_project_for_GD32107C-EVAL.uvguix.right | 22 ++--- main.c | 4 +- 8 files changed, 145 insertions(+), 15 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 Doc/READ-COM3.ps1 create mode 100644 Doc/READ-COM8.ps1 create mode 100644 FreeRTOS/source/include/IPTraceMacro.h diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..b806be1 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,80 @@ +{ + "configurations": [ + { + "name": "Target 1", + "includePath": [ + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\portable\\NetworkInterface\\include", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\include", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\portable\\Compiler\\Keil", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\DemoTasks\\include", + "d:\\Users\\right\\Documents\\Keil\\Projects\\GigaDevice_test", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\include", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\PHY", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\DemoTasks", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\portable\\NetworkInterface\\Common", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\portable\\NetworkInterface\\board_family", + "d:\\Users\\right\\Documents\\Keil\\Projects\\Test_project_for_GD32107C-EVAL\\FreeRTOS\\source\\portable\\BufferManagement" + ], + "defines": [ + "__alignof__(x)=", + "__asm(x)=", + "__asm__(x)=", + "__forceinline=", + "__restrict=", + "__volatile__=", + "__inline=", + "__inline__=", + "__declspec(x)=", + "__attribute__(x)=", + "__nonnull__(x)=", + "__unaligned=", + "__promise(x)=", + "__irq=", + "__swi=", + "__weak=", + "__register=", + "__pure=", + "__value_in_regs=", + "__breakpoint(x)=", + "__current_pc()=0U", + "__current_sp()=0U", + "__disable_fiq()=", + "__disable_irq()=", + "__enable_fiq()=", + "__enable_irq()=", + "__force_stores()=", + "__memory_changed()=", + "__schedule_barrier()=", + "__semihost(x,y)=0", + "__vfp_status(x,y)=0", + "__builtin_arm_nop()=", + "__builtin_arm_wfi()=", + "__builtin_arm_wfe()=", + "__builtin_arm_sev()=", + "__builtin_arm_sevl()=", + "__builtin_arm_yield()=", + "__builtin_arm_isb(x)=", + "__builtin_arm_dsb(x)=", + "__builtin_arm_dmb(x)=", + "__builtin_bswap32(x)=0U", + "__builtin_bswap16(x)=0U", + "__builtin_arm_rbit(x)=0U", + "__builtin_clz(x)=0U", + "__builtin_arm_ldrex(x)=0U", + "__builtin_arm_strex(x,y)=0U", + "__builtin_arm_clrex()=", + "__builtin_arm_ssat(x,y)=0U", + "__builtin_arm_usat(x,y)=0U", + "__builtin_arm_ldaex(x)=0U", + "__builtin_arm_stlex(x,y)=0U", + "__GNUC__=4", + "__GNUC_MINOR__=2", + "__GNUC_PATCHLEVEL__=1" + ], + "intelliSenseMode": "${default}" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/DemoTasks/SimpleTCPEchoServer.c b/DemoTasks/SimpleTCPEchoServer.c index 39950f4..acb6ced 100644 --- a/DemoTasks/SimpleTCPEchoServer.c +++ b/DemoTasks/SimpleTCPEchoServer.c @@ -215,7 +215,7 @@ const BaseType_t xBacklog = 20; size_t FreeHeapSize = xPortGetFreeHeapSize(); if(FreeHeapSize < 25032)//45520) { - FreeRTOS_printf(("FreeHeapSize = %d\n", FreeHeapSize)); + FreeRTOS_printf(("[LISTEN_TASK] FreeHeapSize = %d\n", FreeHeapSize)); } #endif /* Spawn a task to handle the connection. */ diff --git a/Doc/READ-COM3.ps1 b/Doc/READ-COM3.ps1 new file mode 100644 index 0000000..4a24518 --- /dev/null +++ b/Doc/READ-COM3.ps1 @@ -0,0 +1,10 @@ +function read-com { +$port= new-Object System.IO.Ports.SerialPort COM3,115200,None,8,one +$port.Open() +do { + $line = $port.ReadLine() + Write-Host $line # Do stuff here + } +while ($port.IsOpen) +} +read-com \ No newline at end of file diff --git a/Doc/READ-COM8.ps1 b/Doc/READ-COM8.ps1 new file mode 100644 index 0000000..bdd4409 --- /dev/null +++ b/Doc/READ-COM8.ps1 @@ -0,0 +1,10 @@ +function read-com { +$port= new-Object System.IO.Ports.SerialPort COM8,115200,None,8,one +$port.Open() +do { + $line = $port.ReadLine() + Write-Host $line # Do stuff here + } +while ($port.IsOpen) +} +read-com \ No newline at end of file diff --git a/FreeRTOS/source/include/IPTraceMacro.h b/FreeRTOS/source/include/IPTraceMacro.h new file mode 100644 index 0000000..d7add27 --- /dev/null +++ b/FreeRTOS/source/include/IPTraceMacro.h @@ -0,0 +1,30 @@ +#ifndef IP_TRACE_MACRO_H +#define IP_TRACE_MACRO_H + +#include + +#define iptraceNETWORK_DOWN() FreeRTOS_debug_printf(("[IPTRACE] Network down\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceSENDING_DNS_REQUEST() FreeRTOS_debug_printf(("[IPTRACE] Sending DNS request\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceSENDING_DHCP_DISCOVER() FreeRTOS_debug_printf(("[IPTRACE] Sending DHCP discover\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceSENDING_DHCP_REQUEST() FreeRTOS_debug_printf(("[IPTRACE] Sending DHCP request\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceETHERNET_RX_EVENT_LOST() FreeRTOS_debug_printf(("[IPTRACE] Ethernet rx event lost\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceFAILED_TO_OBTAIN_NETWORK_BUFFER() FreeRTOS_debug_printf(("[IPTRACE] Failed to obtain network buffer\nFreeHeapSize = %d\n", xPortGetFreeHeapSize())); + + +#define iptraceDHCP_REQUESTS_FAILED_USING_DEFAULT_IP_ADDRESS( ulIPAddress )\ + FreeRTOS_debug_printf(("[IPTRACE] DHCP requests failed, using default IP: 0x%X\nFreeHeapSize = %d\n", ulIPAddress, xPortGetFreeHeapSize())); + +//#define iptraceNETWORK_EVENT_RECEIVED( eEvent )\ + FreeRTOS_debug_printf(("[IPTRACE] Network Event received %d\nFreeHeapSize = %d\n", eEvent, xPortGetFreeHeapSize())); + +#endif \ No newline at end of file diff --git a/FreeRTOS/source/portable/NetworkInterface/board_family/NetworkInterface.c b/FreeRTOS/source/portable/NetworkInterface/board_family/NetworkInterface.c index a087255..c8d1321 100644 --- a/FreeRTOS/source/portable/NetworkInterface/board_family/NetworkInterface.c +++ b/FreeRTOS/source/portable/NetworkInterface/board_family/NetworkInterface.c @@ -620,7 +620,7 @@ BaseType_t xNetworkInterfaceInitialise( void ) static ARM_ETH_LINK_INFO info; if (NULL == receiveHandler) { - xTaskCreate( receiveHandlerTask, "receiveHandlerTask", 1000, NULL, ipconfigIP_TASK_PRIORITY-1, &receiveHandler ); + xTaskCreate( receiveHandlerTask, "receiveHandlerTask", 1000, NULL, tskIDLE_PRIORITY + 1, &receiveHandler ); } if(macIntialise() == ARM_DRIVER_OK && phyIntialise() ==ARM_DRIVER_OK){ diff --git a/Test_project_for_GD32107C-EVAL.uvguix.right b/Test_project_for_GD32107C-EVAL.uvguix.right index 0f7b95a..68a1c47 100644 --- a/Test_project_for_GD32107C-EVAL.uvguix.right +++ b/Test_project_for_GD32107C-EVAL.uvguix.right @@ -93,18 +93,18 @@ 2 3 - -32000 - -32000 + -1 + -1 -1 -1 - 74 - 785 - 2065 - 735 + 76 + 787 + 2067 + 737 @@ -3547,7 +3547,7 @@ File 2834 - 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000000000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000000000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000001074736B49444C455F5052494F5249545996000000000000000B001074736B49444C455F5052494F524954590469646C6514636F6E6669674D41585F5052494F5249544945530869646C655461736B1D697074726163654E4554574F524B5F4556454E545F52454345495645441D6970747261636545544845524E45545F52585F4556454E545F4C4F535426202369662028206970636F6E6669674841535F44454255475F5052494E5446203D3D20312029186970636F6E6669674841535F44454255475F5052494E544614784170706C69636174696F6E44484350486F6F6B156970636F6E6669675553455F444843505F484F4F4B115253542072656365697665642066726F6D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E2280000002000300150000002153746172742F53746F70202644656275672053657373696F6E094374726C2B46350000000000000000000000000100000001000000000000000000000001000000020021802280000000000000150000002153746172742F53746F70202644656275672053657373696F6E094374726C2B4635000000000000000000000000010000000100000000000000000000000100000000002180E0010000000000007500000021456E65726779204D6561737572656D656E742026776974686F75742044656275670000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000002180C8880000000000001700000027264B696C6C20416C6C20427265616B706F696E747320696E2043757272656E7420546172676574000000000000000000000000010000000100000000000000000000000100000003002180C8880000000000001700000027264B696C6C20416C6C20427265616B706F696E747320696E2043757272656E7420546172676574000000000000000000000000010000000100000000000000000000000100000000002180E50100000000000078000000264B696C6C20416C6C20427265616B706F696E747320696E204163746976652050726F6A656374000000000000000000000000010000000100000000000000000000000100000000002180E601000000000000790000002F4B696C6C20416C6C20427265616B706F696E747320696E204D756C74692D50726F6A65637420576F726B73706163650000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000021804C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002180DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002180DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002180E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002180E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000218018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000021800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002180D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002180E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65D5030000 + 00200000010000002800FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000000000000000000000000000000000000000100000001000000018001E100000000000001000000000000000000000000000000000100000001000000018003E1000000000000020000000000000000000000000000000001000000010000000180CD7F0000000000000300000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000018023E100000000040004000000000000000000000000000000000100000001000000018022E100000000040005000000000000000000000000000000000100000001000000018025E10000000000000600000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001802BE10000000000000700000000000000000000000000000000010000000100000001802CE10000000004000800000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000001807A8A0000000000000900000000000000000000000000000000010000000100000001807B8A0000000000000A00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180D3B00000000000000B000000000000000000000000000000000100000001000000018015B10000000004000C0000000000000000000000000000000001000000010000000180F4B00000000004000D000000000000000000000000000000000100000001000000018036B10000000004000E00000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FF88000000000400460000000000000000000000000000000001000000010000000180FE880000000004004500000000000000000000000000000000010000000100000001800B810000000004001300000000000000000000000000000000010000000100000001800C810000000004001400000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180F0880000020000000F000000000000000000000000000000000100000001000000FFFF0100120043555646696E64436F6D626F427574746F6EE803000000000000000000000000000000000000000000000001000000010000009600000002002050000000001074736B49444C455F5052494F5249545996000000000000000B001074736B49444C455F5052494F524954590469646C6514636F6E6669674D41585F5052494F5249544945530869646C655461736B1D697074726163654E4554574F524B5F4556454E545F52454345495645441D6970747261636545544845524E45545F52585F4556454E545F4C4F535426202369662028206970636F6E6669674841535F44454255475F5052494E5446203D3D20312029186970636F6E6669674841535F44454255475F5052494E544614784170706C69636174696F6E44484350486F6F6B156970636F6E6669675553455F444843505F484F4F4B115253542072656365697665642066726F6D0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018024E10000000000001100000000000000000000000000000000010000000100000001800A810000000000001200000000000000000000000000000000010000000100000001800000000001000000FFFFFFFF000000000000000000000000000100000001000000FFFF01001500434D4643546F6F6C4261724D656E75427574746F6E2280000002000300150000002153746172742F53746F70202644656275672053657373696F6E094374726C2B46350000000000000000000000000100000001000000000000000000000001000000020021802280000000000000150000002153746172742F53746F70202644656275672053657373696F6E094374726C2B4635000000000000000000000000010000000100000000000000000000000100000000002180E0010000000000007500000021456E65726779204D6561737572656D656E742026776974686F75742044656275670000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180C488000000000000160000000000000000000000000000000001000000010000000180C988000000000400180000000000000000000000000000000001000000010000000180C788000000000000190000000000000000000000000000000001000000010000002180C8880000000000001700000027264B696C6C20416C6C20427265616B706F696E747320696E2043757272656E7420546172676574000000000000000000000000010000000100000000000000000000000100000003002180C8880000000000001700000027264B696C6C20416C6C20427265616B706F696E747320696E2043757272656E7420546172676574000000000000000000000000010000000100000000000000000000000100000000002180E50100000000000078000000264B696C6C20416C6C20427265616B706F696E747320696E204163746976652050726F6A656374000000000000000000000000010000000100000000000000000000000100000000002180E601000000000000790000002F4B696C6C20416C6C20427265616B706F696E747320696E204D756C74692D50726F6A65637420576F726B73706163650000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF00000000000000000000000000010000000100000021804C010000020001001A0000000F2650726F6A6563742057696E646F77000000000000000000000000010000000100000000000000000000000100000008002180DD880000000000001A0000000750726F6A656374000000000000000000000000010000000100000000000000000000000100000000002180DC8B0000000000003A00000005426F6F6B73000000000000000000000000010000000100000000000000000000000100000000002180E18B0000000000003B0000000946756E6374696F6E73000000000000000000000000010000000100000000000000000000000100000000002180E28B000000000000400000000954656D706C6174657300000000000000000000000001000000010000000000000000000000010000000000218018890000000000003D0000000E536F757263652042726F777365720000000000000000000000000100000001000000000000000000000001000000000021800000000000000400FFFFFFFF00000000000000000001000000000000000100000000000000000000000100000000002180D988000000000000390000000C4275696C64204F7574707574000000000000000000000000010000000100000000000000000000000100000000002180E38B000000000000410000000B46696E64204F75747075740000000000000000000000000100000001000000000000000000000001000000000001800000000001000000FFFFFFFF0000000000000000000000000001000000010000000180FB7F0000000000001B000000000000000000000000000000000100000001000000000000000446696C65D5030000 1423 @@ -3624,7 +3624,7 @@ .\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c - 97 + 91 592 623 1 @@ -3634,7 +3634,7 @@ .\DemoTasks\SimpleTCPEchoServer.c 126 - 306 + 201 222 1 @@ -3660,8 +3660,8 @@ .\main.c - 104 - 352 + 98 + 385 371 1 diff --git a/main.c b/main.c index a720824..08cd701 100644 --- a/main.c +++ b/main.c @@ -367,8 +367,8 @@ int main(void) vInitMCU(); vRFSwitchInit(&rfSwitchConfig, RF_SWITCH_PORT, RF_SWITCH_PIN_A, RF_SWITCH_PORT, RF_SWITCH_PIN_B, RF_SWITCH_PORT, RF_SWITCH_PIN_C, RF_SWITCH_PORT, RF_SWITCH_PIN_EN); prvMiscInitialisation(); - xTaskCreate( vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, ipconfigIP_TASK_PRIORITY-2, &vTaskToggleLed_Handle); - xTaskCreate( vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, ipconfigIP_TASK_PRIORITY-2, &vTaskHelloWorld_Handle); + xTaskCreate( vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, &vTaskToggleLed_Handle); + xTaskCreate( vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, &vTaskHelloWorld_Handle); FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress ); vTaskStartScheduler();