Added IP config
This commit is contained in:
parent
0308e9bb92
commit
639ccb7b3f
|
|
@ -159,4 +159,120 @@ extern uint32_t SystemCoreClock;
|
|||
#include "freertos_evr.h"
|
||||
#endif
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to human
|
||||
* readable ASCII form. See the notes in the implementation of vTaskList() within
|
||||
* FreeRTOS/Source/tasks.c for limitations. configUSE_STATS_FORMATTING_FUNCTIONS
|
||||
* is set to 2 so the formatting functions are included without the stdio.h being
|
||||
* included in tasks.c. That is because this project defines its own sprintf()
|
||||
* functions. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Assert call defined for debug builds. */
|
||||
void vAssertCalled(const char* pcFile,
|
||||
uint32_t ulLine);
|
||||
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) TEST_ABORT()
|
||||
|
||||
/* The function that implements FreeRTOS printf style output, and the macro
|
||||
* that maps the configPRINTF() macros to that function. */
|
||||
#define configPRINTF( X ) printf(X);
|
||||
#define configPRINT( X ) printf(X);
|
||||
/* Non-format version thread-safe print. */
|
||||
#define configPRINT_STRING( X ) printf(X);
|
||||
|
||||
/* Application specific definitions follow. **********************************/
|
||||
|
||||
/* If configINCLUDE_DEMO_DEBUG_STATS is set to one, then a few basic IP trace
|
||||
* macros are defined to gather some UDP stack statistics that can then be viewed
|
||||
* through the CLI interface. */
|
||||
#define configINCLUDE_DEMO_DEBUG_STATS 0
|
||||
|
||||
/* The size of the global output buffer that is available for use when there
|
||||
* are multiple command interpreters running at once (for example, one on a UART
|
||||
* and one on TCP/IP). This is done to prevent an output buffer being defined by
|
||||
* each implementation - which would waste RAM. In this case, there is only one
|
||||
* command interpreter running, and it has its own local output buffer, so the
|
||||
* global buffer is just set to be one byte long as it is not used and should not
|
||||
* take up unnecessary RAM. */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1
|
||||
|
||||
/* Only used when running in the FreeRTOS Windows simulator. Defines the
|
||||
* priority of the task used to simulate Ethernet interrupts. */
|
||||
#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
|
||||
/* This demo creates a virtual network connection by accessing the raw Ethernet
|
||||
* or WiFi data to and from a real network connection. Many computers have more
|
||||
* than one real network port, and configNETWORK_INTERFACE_TO_USE is used to tell
|
||||
* the demo which real port should be used to create the virtual port. The ports
|
||||
* available are displayed on the console when the application is executed. For
|
||||
* example, on my development laptop setting configNETWORK_INTERFACE_TO_USE to 4
|
||||
* results in the wired network being used, while setting
|
||||
* configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being
|
||||
* used. */
|
||||
#define configNETWORK_INTERFACE_TO_USE ( 0L )
|
||||
|
||||
/* The address of an echo server that will be used by the two demo echo client
|
||||
* tasks:
|
||||
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html,
|
||||
* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html. */
|
||||
#define configECHO_SERVER_ADDR0 192
|
||||
#define configECHO_SERVER_ADDR1 168
|
||||
#define configECHO_SERVER_ADDR2 0
|
||||
#define configECHO_SERVER_ADDR3 2
|
||||
#define configTCP_ECHO_CLIENT_PORT 7
|
||||
|
||||
/* Default MAC address configuration. The demo creates a virtual network
|
||||
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
|
||||
* to and from a real network connection on the host PC. See the
|
||||
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
|
||||
* configure the real network connection to use. */
|
||||
#define configMAC_ADDR0 0x00
|
||||
#define configMAC_ADDR1 0x11
|
||||
#define configMAC_ADDR2 0x22
|
||||
#define configMAC_ADDR3 0x33
|
||||
#define configMAC_ADDR4 0x44
|
||||
#define configMAC_ADDR5 0x32
|
||||
|
||||
/* Default IP address configuration. Used in ipconfigUSE_DHCP is set to 0, or
|
||||
* ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configIP_ADDR0 192
|
||||
#define configIP_ADDR1 168
|
||||
#define configIP_ADDR2 0
|
||||
#define configIP_ADDR3 1
|
||||
|
||||
/* Default gateway IP address configuration. Used in ipconfigUSE_DHCP is set to
|
||||
* 0, or ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configGATEWAY_ADDR0 192
|
||||
#define configGATEWAY_ADDR1 168
|
||||
#define configGATEWAY_ADDR2 0
|
||||
#define configGATEWAY_ADDR3 1
|
||||
|
||||
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and
|
||||
* 208.67.220.220. Used in ipconfigUSE_DHCP is set to 0, or ipconfigUSE_DHCP is
|
||||
* set to 1 but a DNS server cannot be contacted.*/
|
||||
#define configDNS_SERVER_ADDR0 208
|
||||
#define configDNS_SERVER_ADDR1 67
|
||||
#define configDNS_SERVER_ADDR2 222
|
||||
#define configDNS_SERVER_ADDR3 222
|
||||
|
||||
/* Default netmask configuration. Used in ipconfigUSE_DHCP is set to 0, or
|
||||
* ipconfigUSE_DHCP is set to 1 but a DNS server cannot be contacted. */
|
||||
#define configNET_MASK0 255
|
||||
#define configNET_MASK1 255
|
||||
#define configNET_MASK2 255
|
||||
#define configNET_MASK3 0
|
||||
|
||||
/* The UDP port to which print messages are sent. */
|
||||
#define configPRINT_PORT ( 15000 )
|
||||
|
||||
#define configPROFILING ( 0 )
|
||||
|
||||
/* Pseudo random number generator used by some demo tasks. */
|
||||
extern uint32_t ulRand();
|
||||
#define configRAND32() ulRand()
|
||||
|
||||
/* The platform that FreeRTOS is running on. */
|
||||
#define configPLATFORM_NAME "GD32F107C-EVAL"
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -241,7 +241,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>FreeRTOS</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
|
@ -569,7 +569,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>::FreeRTOS</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
|
|
|
|||
60
main.c
60
main.c
|
|
@ -4,9 +4,9 @@
|
|||
#include "gd32f10x_gpio.h"
|
||||
#include "stdio.h"
|
||||
/* System application includes. */
|
||||
/*#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_Sockets.h"
|
||||
#include "FreeRTOS_DHCP.h"*/
|
||||
#include "FreeRTOS_DHCP.h"
|
||||
|
||||
#define BUTTON_USER GPIO_PIN_14
|
||||
#define LED2_USER_PORT GPIOC
|
||||
|
|
@ -15,6 +15,57 @@
|
|||
#define LED5_TICK GPIO_PIN_1
|
||||
#define TASK_HELLO_WORLD_DELAY 500
|
||||
#define TASK_TOGGLE_LED_DELAY 125
|
||||
|
||||
|
||||
/* 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
|
||||
* configNETWORK_INTERFACE_TO_USE definition for information on how to configure
|
||||
* the real network connection to use. */
|
||||
const uint8_t ucMACAddress[ 6 ] =
|
||||
{
|
||||
configMAC_ADDR0,
|
||||
configMAC_ADDR1,
|
||||
configMAC_ADDR2,
|
||||
configMAC_ADDR3,
|
||||
configMAC_ADDR4,
|
||||
configMAC_ADDR5
|
||||
};
|
||||
|
||||
/* The default IP and MAC address used by the demo. The address configuration
|
||||
* defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
|
||||
* 1 but a DHCP server could not be contacted. See the online documentation for
|
||||
* more information. In both cases the node can be discovered using
|
||||
* "ping RTOSDemo". */
|
||||
static const uint8_t ucIPAddress[ 4 ] =
|
||||
{
|
||||
configIP_ADDR0,
|
||||
configIP_ADDR1,
|
||||
configIP_ADDR2,
|
||||
configIP_ADDR3
|
||||
};
|
||||
static const uint8_t ucNetMask[ 4 ] =
|
||||
{
|
||||
configNET_MASK0,
|
||||
configNET_MASK1,
|
||||
configNET_MASK2,
|
||||
configNET_MASK3
|
||||
};
|
||||
static const uint8_t ucGatewayAddress[ 4 ] =
|
||||
{
|
||||
configGATEWAY_ADDR0,
|
||||
configGATEWAY_ADDR1,
|
||||
configGATEWAY_ADDR2,
|
||||
configGATEWAY_ADDR3
|
||||
};
|
||||
static const uint8_t ucDNSServerAddress[ 4 ] =
|
||||
{
|
||||
configDNS_SERVER_ADDR0,
|
||||
configDNS_SERVER_ADDR1,
|
||||
configDNS_SERVER_ADDR2,
|
||||
configDNS_SERVER_ADDR3
|
||||
};
|
||||
|
||||
void vTaskHelloWorld( void *pvParameters);
|
||||
void vTaskToggleLed( void *pvParameters);
|
||||
int stdout_putchar (int ch);
|
||||
|
|
@ -97,8 +148,9 @@ void vTaskToggleLed( void *pvParameters)
|
|||
int main(void)
|
||||
{
|
||||
vInitMCU();
|
||||
xTaskCreate(vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL);
|
||||
xTaskCreate(vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL);
|
||||
xTaskCreate( vTaskToggleLed, "ToggleLed", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL);
|
||||
xTaskCreate( vTaskHelloWorld, "HelloWorld", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL);
|
||||
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
|
||||
vTaskStartScheduler();
|
||||
while(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue