Skip to content

Commit 7a3242d

Browse files
samples: net: zperf: allow networking code to be relocated to RAM
Enable relocation of key networking stack functions to RAM when running the zperf example. This will enable better performance on platforms with fast code RAM. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent c1dfa97 commit 7a3242d

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

samples/net/zperf/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,17 @@ project(zperf)
88
target_sources(app PRIVATE
99
src/main.c
1010
)
11+
12+
if (CONFIG_NET_SAMPLE_CODE_RELOCATE)
13+
# Relocate key networking stack components and L2 layer to RAM
14+
zephyr_code_relocate(LIBRARY subsys__net__ip
15+
LOCATION "${CONFIG_NET_SAMPLE_CODE_RAM_NAME}_TEXT" NOKEEP)
16+
zephyr_code_relocate(LIBRARY subsys__net
17+
LOCATION "${CONFIG_NET_SAMPLE_CODE_RAM_NAME}_TEXT" NOKEEP)
18+
if (CONFIG_NET_L2_ETHERNET)
19+
zephyr_code_relocate(LIBRARY drivers__ethernet
20+
LOCATION "${CONFIG_NET_SAMPLE_CODE_RAM_NAME}_TEXT" NOKEEP)
21+
zephyr_code_relocate(LIBRARY subsys__net__l2__ethernet
22+
LOCATION "${CONFIG_NET_SAMPLE_CODE_RAM_NAME}_TEXT" NOKEEP)
23+
endif()
24+
endif()

samples/net/zperf/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2023 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
source "Kconfig.zephyr"
5+
6+
config NET_SAMPLE_CODE_RELOCATE
7+
bool "Relocate networking code into RAM"
8+
select CODE_DATA_RELOCATION
9+
help
10+
Relocate networking code into RAM when running the zperf
11+
sample. Can improve performance on platforms with fast code
12+
RAM.
13+
14+
if NET_SAMPLE_CODE_RELOCATE
15+
16+
config NET_SAMPLE_CODE_RAM_NAME
17+
string "Networking code RAM location"
18+
default "RAM"
19+
help
20+
Region to relocate networking code to
21+
22+
endif # NET_SAMPLE_CODE_RELOCATE

0 commit comments

Comments
 (0)