Skip to content

Commit

Permalink
built and running - but doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
Known4225 committed Aug 6, 2024
1 parent ae3490f commit 3e1b2cb
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 46 deletions.
2 changes: 1 addition & 1 deletion sdk/FreeRTOS-Plus-TCP
Submodule FreeRTOS-Plus-TCP updated from c81b36 to 978354
148 changes: 136 additions & 12 deletions sdk/freertos_app_cpu0/.cproject

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions sdk/freertos_app_cpu0/.project
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@
<type>2</type>
<location>C:/Users/srich008/Information/gitMistakes/freertos-lwip/sdk/FreeRTOS-Kernel/portable/MemMang</location>
</link>
<link>
<name>Zynq</name>
<type>2</type>
<location>C:/Users/srich008/Information/gitMistakes/freertos-lwip/sdk/FreeRTOS-Plus-TCP/source/portable/NetworkInterface/Zynq</location>
</link>
<link>
<name>shared</name>
<type>2</type>
Expand Down
23 changes: 19 additions & 4 deletions sdk/freertos_app_cpu0/src/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,25 @@ line interface. */
#define configMAC_ADDR5 0x16

/* IP address configuration. */
#define configIP_ADDR0 172
#define configIP_ADDR1 25
#define configIP_ADDR2 218
#define configIP_ADDR3 200
#define configIP_ADDR0 192
#define configIP_ADDR1 168
#define configIP_ADDR2 0
#define configIP_ADDR3 10

/* Default gateway IP address configuration. Used if 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

/* Netmask configuration. */
#define configNET_MASK0 255
Expand Down
43 changes: 19 additions & 24 deletions sdk/freertos_app_cpu0/src/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@
#ifndef FREERTOS_IP_CONFIG_H
#define FREERTOS_IP_CONFIG_H

#define ipconfigZERO_COPY_RX_DRIVER 1
#define ipconfigZERO_COPY_TX_DRIVER 1
/* I put these here -Ryan */
#define ipconfigIPv4_BACKWARD_COMPATIBLE 1
#define ipconfigHAS_PRINTF 1

#define ipconfigZERO_COPY_RX_DRIVER 1
#define ipconfigZERO_COPY_TX_DRIVER 1
#define ipconfigDNS_USE_CALLBACKS 0

/* Zynq driver specific parameters */
#define ipconfigNIC_INCLUDE_GEM ( 1 )
#define ipconfigNIC_N_TX_DESC ( 32 )
#define ipconfigNIC_N_RX_DESC ( 32 )
//#define ipconfigNIC_LINKSPEED100 ( 1 )
#define ipconfigNIC_LINKSPEED_AUTODETECT (1)

/* suppressing the use of _static as it is used for other tools like cbmc */
/* coverity[misra_c_2012_rule_21_1_violation] */
Expand All @@ -41,23 +53,6 @@
#define ipconfigUSE_ARP_REMOVE_ENTRY 1
#define ipconfigUSE_ARP_REVERSED_LOOKUP 1

/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
* 1 then FreeRTOS_debug_printf should be defined to the function used to print
* out the debugging messages. */
#define ipconfigHAS_DEBUG_PRINTF 0
#if ( ipconfigHAS_DEBUG_PRINTF == 1 )
#define FreeRTOS_debug_printf( X ) configPRINTF( X )
#endif

/* Set to 1 to print out non debugging messages, for example the output of the
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
* then FreeRTOS_printf should be set to the function used to print out the
* messages. */
#define ipconfigHAS_PRINTF 0
#if ( ipconfigHAS_PRINTF == 1 )
#define FreeRTOS_printf( X ) configPRINTF( X )
#endif

/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
* on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
Expand Down Expand Up @@ -132,14 +127,14 @@
* set to 1 if a valid configuration cannot be obtained from a DHCP server for any
* reason. The static configuration used is that passed into the stack by the
* FreeRTOS_IPInit() function call. */
#define ipconfigUSE_DHCP 1
#define ipconfigDHCP_REGISTER_HOSTNAME 1
#define ipconfigDHCP_USES_UNICAST 1
#define ipconfigUSE_DHCP 0
#define ipconfigDHCP_REGISTER_HOSTNAME 0
#define ipconfigDHCP_USES_UNICAST 0

/* If ipconfigDHCP_USES_USER_HOOK is set to 1 then the application writer must
* provide an implementation of the DHCP callback function,
* xApplicationDHCPUserHook(). */
#define ipconfigUSE_DHCP_HOOK 1
#define ipconfigUSE_DHCP_HOOK 0

/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at
* increasing time intervals until either a reply is received from a DHCP server
Expand Down Expand Up @@ -184,7 +179,7 @@
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
#define ipconfigINCLUDE_FULL_INET_ADDR 1
#define ipconfigINCLUDE_FULL_INET_ADDR 0

/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
* are available to the IP stack. The total number of network buffers is limited
Expand Down
76 changes: 76 additions & 0 deletions sdk/freertos_app_cpu0/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "queue.h"
#include "task.h"
#include "timers.h"
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
/* Xilinx includes. */
#include "platform.h"
#include "xil_cache.h"
Expand Down Expand Up @@ -89,6 +91,77 @@ extern void vPortInstallFreeRTOSVectorTable(void);
#define QUEUE_LENGTH 10
#define ITEM_SIZE sizeof(uint32_t)

/* needed for FreeRTOS-Plus-TCP */

static UBaseType_t ulNextRand;

UBaseType_t uxRand(void) {
const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
/* Utility function to generate a pseudo random number. */
ulNextRand = (ulMultiplier * ulNextRand) + ulIncrement;
return((int) (ulNextRand) & 0x7fffUL );
}

BaseType_t xApplicationGetRandomNumber(uint32_t *pulNumber) {
*pulNumber = (uint32_t) uxRand();
return pdTRUE;
}

uint32_t ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress, uint16_t usSourcePort, uint32_t ulDestinationAddress, uint16_t usDestinationPort) {
return ( uint32_t ) uxRand();
}

void vApplicationIPNetworkEventHook(eIPCallbackEvent_t eNetworkEvent) {
static BaseType_t xTasksAlreadyCreated = pdFALSE;
/* If the network has just come up...*/
if ((eNetworkEvent == eNetworkUp) && (xTasksAlreadyCreated == pdFALSE)) {
/* Do nothing. Just a stub. */
xTasksAlreadyCreated = pdTRUE;
}
}

/* 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 code. It is used as a place holder.
*/
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
};

int main(void)
{
/* initialise hardware */
Expand Down Expand Up @@ -132,6 +205,9 @@ int main(void)
// BEGIN USER CODE HERE //
/////////////////////////

FreeRTOS_printf(("FreeRTOS_IPInit\n"));
FreeRTOS_IPInit(ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress);

commands_start_msg();

/* command sets */
Expand Down

0 comments on commit 3e1b2cb

Please sign in to comment.