Configuration modifications

This commit is contained in:
Alexei 2023-02-20 01:03:39 +07:00
parent 4d9d6c1138
commit a95e8db5a3
7 changed files with 90 additions and 168 deletions

View File

@ -197,12 +197,11 @@ const BaseType_t xBacklog = 20;
for( ;; )
{
/* Wait for a client to connect. */
/* Wait for a client to connect. */
xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
/* Spawn a task to handle the connection. */
xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY + 1, NULL );
xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY + 1, NULL );
}
}
/*-----------------------------------------------------------*/
@ -217,7 +216,11 @@ TickType_t xTimeOnShutdown;
uint8_t *pucRxBuffer;
xConnectedSocket = ( Socket_t ) pvParameters;
HeapStats_t pxHeapStats;
vPortGetHeapStats( &pxHeapStats );
FreeRTOS_debug_printf(("xAvailableHeapSpaceInBytes1 = %d\n", pxHeapStats.xAvailableHeapSpaceInBytes));
FreeRTOS_debug_printf(("xNumberOfSuccessfulAllocations1 = %d\n", pxHeapStats.xNumberOfSuccessfulAllocations));
FreeRTOS_debug_printf(("xNumberOfSuccessfulFrees1 = %d\n", pxHeapStats.xNumberOfSuccessfulFrees));
/* Attempt to create the buffer used to receive the string to be echoed
back. This could be avoided using a zero copy interface that just returned
the same buffer. */
@ -281,8 +284,13 @@ uint8_t *pucRxBuffer;
/* Finished with the socket, buffer, the task. */
vPortFree( pucRxBuffer );
FreeRTOS_closesocket( xConnectedSocket );
#ifdef DEBUG_TASK_DELETE
vTaskDelete( NULL );
#ifdef DEBUG_TASK_DELETE
vPortGetHeapStats( &pxHeapStats );
FreeRTOS_debug_printf(("xAvailableHeapSpaceInBytes2 = %d\n", pxHeapStats.xAvailableHeapSpaceInBytes));
FreeRTOS_debug_printf(("xNumberOfSuccessfulAllocations2 = %d\n", pxHeapStats.xNumberOfSuccessfulAllocations));
FreeRTOS_debug_printf(("xNumberOfSuccessfulFrees2 = %d\n", pxHeapStats.xNumberOfSuccessfulFrees));
//FreeRTOS_debug_printf(("Heap size after TCP = %d\n", xPortGetFreeHeapSize()));
vTaskDelete( NULL );
#endif
}
/*-----------------------------------------------------------*/

View File

@ -53,6 +53,8 @@
//#define ipconfigUDP_MAX_RX_PACKETS 10
//#define ipconfigSUPPORT_SIGNALS 1
#define ipconfigUSE_TCP_WIN 0
//#define ipconfigNETWORK_MTU 586
//#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 10U
#ifdef DEBUG

View File

@ -82,9 +82,9 @@
//#ifdef RTE_Drivers_PHY_DP83848C /* Driver PHY DP83848C */
//#endif
#ifdef DEBUG
#define BKPT __asm volatile("BKPT #0\n") ;
#endif
//#ifdef DEBUG
//#define BKPT __asm volatile("BKPT #0\n") ;
//#endif
static void receiveHandlerTask( void *pvParameters );
static TaskHandle_t receiveHandler = NULL;

View File

@ -50,7 +50,7 @@ extern uint32_t SystemCoreClock;
/* Constants that describe the hardware and memory usage. */
#define configCPU_CLOCK_HZ (SystemCoreClock)
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configTOTAL_HEAP_SIZE ((size_t)6*8192)
#define configTOTAL_HEAP_SIZE ((size_t)5*8192)
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 0

View File

@ -159,7 +159,7 @@
<Type>0</Type>
<LineNumber>511</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134229006</Address>
<Address>134230234</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
@ -173,119 +173,7 @@
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>1350</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FreeRTOS\source\FreeRTOS_TCP_Transmission.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>474</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>657</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>4</Number>
<Type>0</Type>
<LineNumber>282</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>5</Number>
<Type>0</Type>
<LineNumber>469</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>6</Number>
<Type>0</Type>
<LineNumber>474</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>7</Number>
<Type>0</Type>
<LineNumber>652</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>8</Number>
<Type>0</Type>
<LineNumber>657</LineNumber>
<LineNumber>6</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
@ -365,6 +253,11 @@
<WinNumber>1</WinNumber>
<ItemText>eLeasedAddress</ItemText>
</Ww>
<Ww>
<count>13</count>
<WinNumber>1</WinNumber>
<ItemText>pxSocket</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
@ -391,7 +284,7 @@
</Mm>
</MemoryWindow3>
<ScvdPack>
<Filename>C:\Users\User\AppData\Local\Arm\Packs\ARM\CMSIS-FreeRTOS\10.5.1\CMSIS\RTOS2\FreeRTOS\FreeRTOS.scvd</Filename>
<Filename>E:\Arm\Packs\ARM\CMSIS-FreeRTOS\10.5.1\CMSIS\RTOS2\FreeRTOS\FreeRTOS.scvd</Filename>
<Type>ARM.CMSIS-FreeRTOS.10.5.1</Type>
<SubType>1</SubType>
</ScvdPack>
@ -506,6 +399,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\printf-stdarg.c</PathWithFileName>
<FilenameWithoutPath>printf-stdarg.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@ -516,7 +421,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>6</FileNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -528,7 +433,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>7</FileNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -540,7 +445,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -552,7 +457,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -564,7 +469,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>10</FileNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -576,7 +481,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>11</FileNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -588,7 +493,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>12</FileNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -600,7 +505,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>13</FileNumber>
<FileNumber>14</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -612,7 +517,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>14</FileNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -624,7 +529,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>15</FileNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -636,7 +541,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>16</FileNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -648,7 +553,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>17</FileNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -660,7 +565,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>18</FileNumber>
<FileNumber>19</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -672,7 +577,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>19</FileNumber>
<FileNumber>20</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -684,7 +589,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>20</FileNumber>
<FileNumber>21</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -696,7 +601,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>21</FileNumber>
<FileNumber>22</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -708,7 +613,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>22</FileNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -720,7 +625,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>23</FileNumber>
<FileNumber>24</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -732,7 +637,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>24</FileNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -744,7 +649,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>25</FileNumber>
<FileNumber>26</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -756,7 +661,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>26</FileNumber>
<FileNumber>27</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -768,7 +673,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>27</FileNumber>
<FileNumber>28</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -780,9 +685,9 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>28</FileNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\FreeRTOS\source\portable\NetworkInterface\board_family\NetworkInterface.c</PathWithFileName>
@ -792,7 +697,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>29</FileNumber>
<FileNumber>30</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -822,7 +727,7 @@
<Group>
<GroupName>::Compiler</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
@ -830,7 +735,7 @@
<Group>
<GroupName>::Device</GroupName>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>

View File

@ -341,7 +341,7 @@
<MiscControls>-D DEBUG -Wno-pragma-pack -Wno-macro-redefined</MiscControls>
<Define>DEBUG_TASK_DELETE</Define>
<Undefine></Undefine>
<IncludePath>.\FreeRTOS\source\portable\NetworkInterface\include;.\FreeRTOS\source\include;.\FreeRTOS\source\portable\Compiler\Keil;.\DemoTasks\include</IncludePath>
<IncludePath>.\FreeRTOS\source\portable\NetworkInterface\include;.\FreeRTOS\source\include;.\FreeRTOS\source\portable\Compiler\Keil;.\DemoTasks\include;..\GigaDevice_test</IncludePath>
</VariousControls>
</Cads>
<Aads>
@ -410,6 +410,11 @@
<FileType>1</FileType>
<FilePath>.\PHY\PHY_DP83848C.c</FilePath>
</File>
<File>
<FileName>printf-stdarg.c</FileName>
<FileType>1</FileType>
<FilePath>.\printf-stdarg.c</FilePath>
</File>
</Files>
</Group>
<Group>

30
main.c
View File

@ -77,6 +77,16 @@
//#define mainHOST_NAME "RTOSDemo"
//#define mainDEVICE_NICK_NAME "windows_demo"
#ifdef DEBUG
#define BKPT_DEBUG()\
__BKPT(); \
// NVIC_SystemReset(); \
// while(TRUE){}; \
#else
#define BKPT_DEBUG()
#endif
/* Default MAC address configuration. The demo creates a virtual network
* connection that uses this MAC address by accessing the raw Ethernet data
* to and from a real network connection on the host PC. See the
@ -608,11 +618,7 @@ extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
void vApplicationMallocFailedHook( void )
{
FreeRTOS_debug_printf(("Malloc Failed Hook\n"));
#if defined (DEBUG)
__ASM("BKPT #0\n");
#endif
NVIC_SystemReset();
while(TRUE){}
BKPT_DEBUG();
}
@ -658,11 +664,7 @@ void vApplicationIdleHook( void )
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
{
FreeRTOS_debug_printf(("Stack Overflow Hook\n"));
#if defined (DEBUG)
__ASM("BKPT #0\n");
#endif
NVIC_SystemReset();
while(TRUE){}
BKPT_DEBUG();
}
@ -690,10 +692,10 @@ static volatile uint32_t psr;/* Program status register. */
lr = pulFaultStackAddress[ 5 ];
pc = pulFaultStackAddress[ 6 ];
psr = pulFaultStackAddress[ 7 ];
#ifdef DEBUG
printf("Hard Fault Hook\n");
__asm volatile("BKPT #0\n") ;
#endif
FreeRTOS_debug_printf(("Hard Fault Hook\n"));
BKPT_DEBUG();
NVIC_SystemReset();
/* When the following line is hit, the variables contain the register values. */
for( ;; );