Skip to content

Commit a3c047d

Browse files
Update FreeRTOS+TCP to latest version V4.3.1 (FreeRTOS#1305)
Update FreeRTOS+TCP to latest version V4.3.1
1 parent 93ba585 commit a3c047d

File tree

8 files changed

+61
-31
lines changed

8 files changed

+61
-31
lines changed

.github/workflows/freertos_plus_demos.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,20 @@ jobs:
446446
id: generate-credentials
447447
uses: FreeRTOS/CI-CD-GitHub-Actions/ssl-credential-creator@main
448448

449+
- name: Query CI host IP address
450+
id: get-ip
451+
run: |
452+
# Query the device's IP address
453+
$SERVER_IP = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -notmatch '127.0.0.1' } | Select-Object -First 1 -ExpandProperty IPAddress)
454+
Write-Host "Device IP address: $SERVER_IP"
455+
echo "server_ip=$SERVER_IP" >> $env:GITHUB_ENV
456+
shell: pwsh
457+
449458
- name: Start localhost MQTT broker
450459
id: mqtt-broker
451460
uses: FreeRTOS/CI-CD-GitHub-Actions/localhost-mqtt-broker@main
452461
with:
462+
host_address: ${{ env.server_ip }}
453463
root-ca-cert-path:
454464
${{ steps.generate-credentials.outputs.root-ca-cert-path }}
455465
server-priv-key-path:
@@ -475,7 +485,7 @@ jobs:
475485
# ${{ env.stepName }}
476486
echo -e "::group::${{ env.stepName }}"
477487
echo '#define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
478-
echo '#define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
488+
echo '#define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
479489
echo '#define democonfigMQTT_BROKER_PORT ( 1883 )' >> demo_config.h
480490
echo "::endgroup::"
481491
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
@@ -521,7 +531,7 @@ jobs:
521531
sed 's/.*/"&\\n"\\/' ${{ steps.generate-credentials.outputs.root-ca-cert-path }} >> root_ca_cert.txt
522532
sed '$ s/.$//' root_ca_cert.txt >> demo_config.h
523533
echo '#define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
524-
echo '#define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
534+
echo '#define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
525535
echo '#define democonfigMQTT_BROKER_PORT ( 8883 )' >> demo_config.h
526536
sed -i -z "s/define[[:space:]]*democonfigDISABLE_SNI[[:space:]]*([[:space:]]*[a-zA-Z0-9]\+[[:space:]]*)/define democonfigDISABLE_SNI ( pdTRUE )/g" demo_config.h
527537
exitStatus=$?
@@ -575,7 +585,7 @@ jobs:
575585
sed 's/.*/"&\\n"\\/' ${{ steps.generate-credentials.outputs.device-priv-key-path }} >> device_priv_key.txt
576586
sed '$ s/.$//' device_priv_key.txt >> demo_config.h
577587
echo '#define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
578-
echo '#define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
588+
echo '#define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
579589
echo '#define democonfigMQTT_BROKER_PORT ( 8883 )' >> demo_config.h
580590
sed -i -z "s/define[[:space:]]*democonfigDISABLE_SNI[[:space:]]*([[:space:]]*[a-zA-Z0-9]\+[[:space:]]*)/define democonfigDISABLE_SNI ( pdTRUE )/g" demo_config.h
581591
echo "::endgroup::"
@@ -621,7 +631,7 @@ jobs:
621631
echo '#ifndef DEMO_CONFIG_H_TEST_BUILD' >> demo_config.h
622632
echo ' #define DEMO_CONFIG_H_TEST_BUILD' >> demo_config.h
623633
echo ' #define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
624-
echo ' #define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
634+
echo ' #define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
625635
echo ' #define democonfigMQTT_BROKER_PORT ( 1883 )' >> demo_config.h
626636
echo '#endif /* DEMO_CONFIG_H_TEST_BUILD */' >> demo_config.h
627637
echo "::endgroup::"
@@ -665,7 +675,7 @@ jobs:
665675
# ${{ env.stepName }}
666676
echo -e "::group::${{ env.stepName }}"
667677
echo '#define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
668-
echo '#define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
678+
echo '#define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
669679
echo '#define democonfigMQTT_BROKER_PORT ( 1883 )' >> demo_config.h
670680
echo "::endgroup::"
671681
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
@@ -710,7 +720,7 @@ jobs:
710720
sed 's/.*/"&\\n"\\/' ${{ steps.generate-credentials.outputs.device-priv-key-path }} >> device_priv_key.txt
711721
sed '$ s/.$//' device_priv_key.txt >> demo_config.h
712722
echo '#define democonfigCLIENT_IDENTIFIER "mqtt_demo_test"' >> demo_config.h
713-
echo '#define democonfigMQTT_BROKER_ENDPOINT "127.0.0.1"' >> demo_config.h
723+
echo '#define democonfigMQTT_BROKER_ENDPOINT "${{ env.server_ip }}"' >> demo_config.h
714724
echo '#define democonfigMQTT_BROKER_PORT ( 8883 )' >> demo_config.h
715725
echo "::endgroup::"
716726
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
@@ -1051,10 +1061,19 @@ jobs:
10511061
echo "::endgroup::"
10521062
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
10531063
1064+
- name: Query CI host IP address
1065+
id: get-ip
1066+
run: |
1067+
# Query the device's IP address
1068+
SERVER_IP="$(ip addr show | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}' | cut -d/ -f1 | head -n 1)"
1069+
echo "Device IP address: $SERVER_IP"
1070+
echo "server_ip=\"$SERVER_IP\"" >> $GITHUB_ENV
1071+
10541072
- name: Start localhost Echo server
10551073
id: echo-server
10561074
uses: FreeRTOS/CI-CD-GitHub-Actions/localhost-echo-server@main
10571075
with:
1076+
host_address: ${{ env.server_ip }}
10581077
port_number: 5000
10591078

10601079
- env:
@@ -1067,6 +1086,8 @@ jobs:
10671086
echo -e "::group::${{ env.stepName }}"
10681087
sed -i -z "s/define[[:space:]]*echoECHO_PORT[[:space:]]*([[:space:]]*[0-9]\+[[:space:]]*)/define echoECHO_PORT ( 5000 )/g" TCPEchoClient_SingleTasks.c
10691088
sed -i -z "s/int[[:space:]]*main[[:space:]]*([[:space:]]*void[[:space:]]*)\n{/int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );/g" main.c
1089+
sed -i "s/^#define configECHO_SERVER_ADDR .*/#define configECHO_SERVER_ADDR \"${{ env.server_ip }}\"/" FreeRTOSConfig.h
1090+
git diff
10701091
make -j TRACE_ON_ENTER=0
10711092
echo "::endgroup::"
10721093
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
@@ -1177,10 +1198,20 @@ jobs:
11771198
exit 1
11781199
}
11791200
1201+
- name: Query CI host IP address
1202+
id: get-ip
1203+
run: |
1204+
# Query the device's IP address
1205+
$SERVER_IP = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -notmatch '127.0.0.1' } | Select-Object -First 1 -ExpandProperty IPAddress)
1206+
Write-Host "Device IP address: $SERVER_IP"
1207+
echo "server_ip=$SERVER_IP" >> $env:GITHUB_ENV
1208+
shell: pwsh
1209+
11801210
- name: Start localhost Echo server
11811211
id: echo-server
11821212
uses: FreeRTOS/CI-CD-GitHub-Actions/localhost-echo-server@main
11831213
with:
1214+
host_address: ${{ env.server_ip }}
11841215
port_number: 5000
11851216

11861217
- env:
@@ -1195,7 +1226,7 @@ jobs:
11951226
$newContent = $content -replace '#define\s+echoECHO_PORT.*', '#define echoECHO_PORT ( 5000 )'
11961227
$newContent | Set-Content -Path 'DemoTasks\TCPEchoClient_SingleTasks.c'
11971228
$content = Get-Content -Path 'tcp_echo_config.h' -Raw
1198-
$newContent = $content -replace '#define\s+configECHO_SERVER_ADDR.*', '#define configECHO_SERVER_ADDR "127.0.0.1"'
1229+
$newContent = $content -replace '#define\s+configECHO_SERVER_ADDR.*', '#define configECHO_SERVER_ADDR "${{ env.server_ip }}"'
11991230
$newContent | Set-Content -Path 'tcp_echo_config.h'
12001231
$content = Get-Content -Path 'main.c' -Raw
12011232
$newContent = $content -replace 'int\s+main(.*?)void(.*?)\r?\n\s*{', 'int main( void ){setvbuf( stdout, NULL, _IONBF, 0 );'

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSConfig.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,19 @@ extern void vAssertCalled( const char * const pcFileName,
168168
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html
169169
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html */
170170

171-
#define configECHO_SERVER_ADDR0 127
172-
#define configECHO_SERVER_ADDR1 0
173-
#define configECHO_SERVER_ADDR2 0
174-
#define configECHO_SERVER_ADDR3 1
171+
#define configECHO_SERVER_ADDR "172.31.69.236"
175172

176173
/* Default MAC address configuration. The demo creates a virtual network
177174
* connection that uses this MAC address by accessing the raw Ethernet/WiFi data
178175
* to and from a real network connection on the host PC. See the
179176
* configNETWORK_INTERFACE_TO_USE definition above for information on how to
180177
* configure the real network connection to use. */
181-
#define configMAC_ADDR0 0x00
182-
#define configMAC_ADDR1 0x11
183-
#define configMAC_ADDR2 0x22
184-
#define configMAC_ADDR3 0x33
185-
#define configMAC_ADDR4 0x44
186-
#define configMAC_ADDR5 0x41
178+
#define configMAC_ADDR0 0x00
179+
#define configMAC_ADDR1 0x11
180+
#define configMAC_ADDR2 0x22
181+
#define configMAC_ADDR3 0x33
182+
#define configMAC_ADDR4 0x44
183+
#define configMAC_ADDR5 0x41
187184

188185
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or
189186
* ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/FreeRTOSIPConfig.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
#ifndef FREERTOS_IP_CONFIG_H
3636
#define FREERTOS_IP_CONFIG_H
3737

38+
#ifdef HEAP3
39+
#define xPortGetMinimumEverFreeHeapSize( x ) 0
40+
#define xPortGetFreeHeapSize() 0
41+
#endif
42+
3843
/* Prototype for the function used to print out. In this case it prints to the
3944
* console before the network is connected then a UDP port after the network has
4045
* connected. */
@@ -67,7 +72,7 @@ extern void vLoggingPrintf( const char * pcFormatString,
6772
* FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
6873
* then FreeRTOS_printf should be set to the function used to print out the
6974
* messages. */
70-
#define ipconfigHAS_PRINTF 0
75+
#define ipconfigHAS_PRINTF 1
7176
#if ( ipconfigHAS_PRINTF == 1 )
7277
#define FreeRTOS_printf( X ) vLoggingPrintf X
7378
#endif

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ LDFLAGS += $(shell pkg-config --libs slirp)
6666

6767
CPPFLAGS = $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\"
6868

69+
DEFINES := -DHEAP3
70+
CPPFLAGS += $(DEFINES)
71+
6972
ifndef TRACE_ON_ENTER
7073
TRACE_ON_ENTER = 1
7174
endif

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/TCPEchoClient_SingleTasks.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,11 @@
158158

159159
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
160160
{
161-
xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
162-
configECHO_SERVER_ADDR1,
163-
configECHO_SERVER_ADDR2,
164-
configECHO_SERVER_ADDR3 );
161+
xEchoServerAddress.sin_address.ulIP_IPv4 = FreeRTOS_inet_addr( configECHO_SERVER_ADDR );
165162
}
166163
#else
167164
{
168-
xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
169-
configECHO_SERVER_ADDR1,
170-
configECHO_SERVER_ADDR2,
171-
configECHO_SERVER_ADDR3 );
165+
xEchoServerAddress.sin_addr = FreeRTOS_inet_addr( configECHO_SERVER_ADDR );
172166
}
173167
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
174168

@@ -189,8 +183,8 @@
189183
FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
190184

191185
/* Connect to the echo server. */
192-
printf( "\nConnecting to echo server %d.%d.%d.%d:%d....\n",
193-
configECHO_SERVER_ADDR0, configECHO_SERVER_ADDR1, configECHO_SERVER_ADDR2, configECHO_SERVER_ADDR3, echoECHO_PORT );
186+
printf( "\nConnecting to echo server %s:%d....\n",
187+
configECHO_SERVER_ADDR, echoECHO_PORT );
194188

195189
ret = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) );
196190

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void main_tcp_echo_client_tasks( void )
252252
}
253253
else
254254
{
255-
FreeRTOS_printf( "Application idle hook network down\n" );
255+
FreeRTOS_printf( ( "Application idle hook network down\n" ) );
256256
}
257257
}
258258
/*-----------------------------------------------------------*/
Submodule FreeRTOS-Plus-TCP updated 562 files

manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
path: "FreeRTOS/Source"
1313

1414
- name: "FreeRTOS-Plus-TCP"
15-
version: "V4.1.0"
15+
version: "V4.3.1"
1616
repository:
1717
type: "git"
1818
url: "https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git"

0 commit comments

Comments
 (0)