-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: wifi: simplelink: Add static IP address support #15832
Conversation
@@ -65,6 +65,44 @@ struct sl_connect_state sl_conn; | |||
/* Network Coprocessor state, including role and connection state: */ | |||
static struct nwp_status nwp; | |||
|
|||
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_CONFIG_MY_IPV4_ADDR) | |||
/* Convert IP addr string into an array of integers */ | |||
static int tokenize_ipv4addr(u8_t *ip_array, char const *ip_string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use net_ipaddr_parse()
function here that will do basically the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use net_ipaddr_parse() function here that will do basically the same.
I guess net_addr_pton() might be even better fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's absolutely great to see this feature implemented (and thus, cc3220 to fit much better with Zephyr network configuration model). But I agree with @jukkar's comment that we should reuse existing routines whenever possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please mention in the commit how this was tested?
Which samples, and did wifi_shell work as well with auto init?
If this commit is all that was required, then that's great!
@GAnthony It was tested out-of-tree against the echo sample after modifying the prj.conf file to set the IP address:
and then I had to comment out these lines in the board-specific config file
that would have overridden the NET_CONFIG_SETTINGS. I also ran the wifi sample to verify it still runs correctly. I have added this info to the commit message, thanks. |
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_CONFIG_MY_IPV4_ADDR) | ||
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_ADDR, &addr4) | ||
< 0) { | ||
LOG_ERR("Please verify CONFIG_NET_CONFIG_MY_IPV4_ADDR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but I'd say, consistent Zephyr error style would be "Invalid CONFIG_NET_CONFIG_MY_IPV4_ADDR".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
Thumbs up to that, it may be very helpful to someone who will debug this stuff later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updates.
Change the SimpleLink wifi driver to use static IP address instead of DHCP when it is set by NET_CONFIG_MY_IPV4_ADDR. We also support setting gateway and netmask via NET_CONFIG_MY_IPV4_GW and NET_CONFIG_MY_IPV4_NETMASK. This feature is tested out-of-tree against the echo sample after modifying its prj.conf file to set the static IP address: CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.191" and after commenting out these lines in its board-specific config file for cc3220sf_launchxl: so that the NET_CONFIG_SETTINGS are not overridden. The wifi sample is also verified to run correctly after running the echo sample. Fixes zephyrproject-rtos#14588 Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Qemu_x86 didn't reflect emulated program memory size. It was because chosen zephyr,flash was assigned to flash_simulator which was helping to generate DT_FLASH properties for sim_flash node. This change revert choice of flash0 which solve problem with program memory size. Flash simulator have to use DT_SOC_NV_FLASH_xxx labels for fetch its property since that. fixes zephyrproject-rtos#15832 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Qemu_x86 didn't reflect emulated program memory size. It was because chosen zephyr,flash was assigned to flash_simulator which was helping to generate DT_FLASH properties for sim_flash node. This change revert choice of flash0 which solve problem with program memory size. Flash simulator have to use DT_SOC_NV_FLASH_xxx labels for fetch its property since that. fixes #15832 Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Change the SimpleLink wifi driver to use static IP address instead of
DHCP when it is set by NET_CONFIG_MY_IPV4_ADDR. We also support setting
gateway and netmask via NET_CONFIG_MY_IPV4_GW and
NET_CONFIG_MY_IPV4_NETMASK.
Fixes #14588
Signed-off-by: Vincent Wan vincent.wan@linaro.org